Saurabh Shah | 86c1729 | 2013-02-08 15:24:13 -0800 | [diff] [blame] | 1 | /* |
Arun Kumar K.R | c62935a | 2013-12-03 16:47:47 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013-14, The Linux Foundation. All rights reserved. |
Saurabh Shah | 86c1729 | 2013-02-08 15:24:13 -0800 | [diff] [blame] | 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are |
| 6 | * met: |
| 7 | * * Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * * Redistributions in binary form must reproduce the above |
| 10 | * copyright notice, this list of conditions and the following |
| 11 | * disclaimer in the documentation and/or other materials provided |
| 12 | * with the distribution. |
| 13 | * * Neither the name of The Linux Foundation nor the names of its |
| 14 | * contributors may be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 23 | * SUBSTITUTE GOODS OR CLIENTS; LOSS OF USE, DATA, OR PROFITS; OR |
| 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | #include <hwc_qclient.h> |
| 31 | #include <IQService.h> |
| 32 | #include <hwc_utils.h> |
Zohaib Alam | 1bb6561 | 2013-09-28 03:38:20 -0400 | [diff] [blame] | 33 | #include <mdp_version.h> |
Naseer Ahmed | 35a268c | 2014-06-24 19:07:13 -0400 | [diff] [blame] | 34 | #include <hwc_mdpcomp.h> |
Tatenda Chipeperekwa | 06af9cb | 2014-08-26 14:51:05 -0700 | [diff] [blame] | 35 | #include <hwc_virtual.h> |
Saurabh Shah | 24eec8a | 2014-08-22 15:07:25 -0700 | [diff] [blame] | 36 | #include <overlay.h> |
Raj Kamal | 0d53fc6 | 2014-11-25 17:36:36 +0530 | [diff] [blame] | 37 | #include <display_config.h> |
Naseer Ahmed | 6bbd0a1 | 2015-01-23 11:57:10 -0500 | [diff] [blame] | 38 | #include <hdmi.h> |
| 39 | #include <video/msm_hdmi_modes.h> |
Saurabh Shah | 86c1729 | 2013-02-08 15:24:13 -0800 | [diff] [blame] | 40 | |
| 41 | #define QCLIENT_DEBUG 0 |
| 42 | |
| 43 | using namespace android; |
| 44 | using namespace qService; |
Arun Kumar K.R | c62935a | 2013-12-03 16:47:47 -0800 | [diff] [blame] | 45 | using namespace qhwc; |
Saurabh Shah | 24eec8a | 2014-08-22 15:07:25 -0700 | [diff] [blame] | 46 | using namespace overlay; |
Saurabh Shah | cd01835 | 2014-11-11 13:54:19 -0800 | [diff] [blame] | 47 | using namespace qdutils; |
Saurabh Shah | 86c1729 | 2013-02-08 15:24:13 -0800 | [diff] [blame] | 48 | |
| 49 | namespace qClient { |
| 50 | |
| 51 | // ---------------------------------------------------------------------------- |
Saurabh Shah | 7128e50 | 2013-02-20 13:24:48 -0800 | [diff] [blame] | 52 | QClient::QClient(hwc_context_t *ctx) : mHwcContext(ctx), |
| 53 | mMPDeathNotifier(new MPDeathNotifier(ctx)) |
Saurabh Shah | 86c1729 | 2013-02-08 15:24:13 -0800 | [diff] [blame] | 54 | { |
| 55 | ALOGD_IF(QCLIENT_DEBUG, "QClient Constructor invoked"); |
| 56 | } |
| 57 | |
| 58 | QClient::~QClient() |
| 59 | { |
| 60 | ALOGD_IF(QCLIENT_DEBUG,"QClient Destructor invoked"); |
| 61 | } |
| 62 | |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 63 | static void securing(hwc_context_t *ctx, uint32_t startEnd) { |
Saurabh Shah | c212577 | 2013-03-15 16:49:50 -0700 | [diff] [blame] | 64 | //The only way to make this class in this process subscribe to media |
| 65 | //player's death. |
| 66 | IMediaDeathNotifier::getMediaPlayerService(); |
| 67 | |
Raj Kamal | 58b31a0 | 2014-12-16 15:53:53 +0530 | [diff] [blame] | 68 | ctx->mDrawLock.lock(); |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 69 | ctx->mSecuring = startEnd; |
Saurabh Shah | 86c1729 | 2013-02-08 15:24:13 -0800 | [diff] [blame] | 70 | //We're done securing |
| 71 | if(startEnd == IQService::END) |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 72 | ctx->mSecureMode = true; |
Raj Kamal | 58b31a0 | 2014-12-16 15:53:53 +0530 | [diff] [blame] | 73 | ctx->mDrawLock.unlock(); |
| 74 | |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 75 | if(ctx->proc) |
| 76 | ctx->proc->invalidate(ctx->proc); |
Saurabh Shah | 86c1729 | 2013-02-08 15:24:13 -0800 | [diff] [blame] | 77 | } |
| 78 | |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 79 | static void unsecuring(hwc_context_t *ctx, uint32_t startEnd) { |
Raj Kamal | 58b31a0 | 2014-12-16 15:53:53 +0530 | [diff] [blame] | 80 | ctx->mDrawLock.lock(); |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 81 | ctx->mSecuring = startEnd; |
Saurabh Shah | 86c1729 | 2013-02-08 15:24:13 -0800 | [diff] [blame] | 82 | //We're done unsecuring |
| 83 | if(startEnd == IQService::END) |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 84 | ctx->mSecureMode = false; |
Raj Kamal | 58b31a0 | 2014-12-16 15:53:53 +0530 | [diff] [blame] | 85 | ctx->mDrawLock.unlock(); |
| 86 | |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 87 | if(ctx->proc) |
| 88 | ctx->proc->invalidate(ctx->proc); |
Saurabh Shah | 86c1729 | 2013-02-08 15:24:13 -0800 | [diff] [blame] | 89 | } |
| 90 | |
Saurabh Shah | 7128e50 | 2013-02-20 13:24:48 -0800 | [diff] [blame] | 91 | void QClient::MPDeathNotifier::died() { |
Raj Kamal | 58b31a0 | 2014-12-16 15:53:53 +0530 | [diff] [blame] | 92 | mHwcContext->mDrawLock.lock(); |
Saurabh Shah | 7128e50 | 2013-02-20 13:24:48 -0800 | [diff] [blame] | 93 | ALOGD_IF(QCLIENT_DEBUG, "Media Player died"); |
| 94 | mHwcContext->mSecuring = false; |
| 95 | mHwcContext->mSecureMode = false; |
Raj Kamal | 58b31a0 | 2014-12-16 15:53:53 +0530 | [diff] [blame] | 96 | mHwcContext->mDrawLock.unlock(); |
Saurabh Shah | 7128e50 | 2013-02-20 13:24:48 -0800 | [diff] [blame] | 97 | if(mHwcContext->proc) |
| 98 | mHwcContext->proc->invalidate(mHwcContext->proc); |
| 99 | } |
| 100 | |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 101 | static android::status_t screenRefresh(hwc_context_t *ctx) { |
Jeykumar Sankaran | 9f59a76 | 2013-02-28 10:45:56 -0800 | [diff] [blame] | 102 | status_t result = NO_INIT; |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 103 | if(ctx->proc) { |
| 104 | ctx->proc->invalidate(ctx->proc); |
Jeykumar Sankaran | 9f59a76 | 2013-02-28 10:45:56 -0800 | [diff] [blame] | 105 | result = NO_ERROR; |
| 106 | } |
Jeykumar Sankaran | 9f59a76 | 2013-02-28 10:45:56 -0800 | [diff] [blame] | 107 | return result; |
| 108 | } |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 109 | |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 110 | static void setExtOrientation(hwc_context_t *ctx, uint32_t orientation) { |
| 111 | ctx->mExtOrientation = orientation; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 112 | } |
| 113 | |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 114 | static void isExternalConnected(hwc_context_t* ctx, Parcel* outParcel) { |
| 115 | int connected; |
| 116 | connected = ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected ? 1 : 0; |
| 117 | outParcel->writeInt32(connected); |
| 118 | } |
| 119 | |
| 120 | static void getDisplayAttributes(hwc_context_t* ctx, const Parcel* inParcel, |
| 121 | Parcel* outParcel) { |
| 122 | int dpy = inParcel->readInt32(); |
| 123 | outParcel->writeInt32(ctx->dpyAttr[dpy].vsync_period); |
Dileep Kumar Reddi | e351d84 | 2014-03-25 10:39:21 +0530 | [diff] [blame] | 124 | if (ctx->dpyAttr[dpy].customFBSize) { |
| 125 | outParcel->writeInt32(ctx->dpyAttr[dpy].xres_new); |
| 126 | outParcel->writeInt32(ctx->dpyAttr[dpy].yres_new); |
| 127 | } else { |
| 128 | outParcel->writeInt32(ctx->dpyAttr[dpy].xres); |
| 129 | outParcel->writeInt32(ctx->dpyAttr[dpy].yres); |
| 130 | } |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 131 | outParcel->writeFloat(ctx->dpyAttr[dpy].xdpi); |
| 132 | outParcel->writeFloat(ctx->dpyAttr[dpy].ydpi); |
| 133 | //XXX: Need to check what to return for HDMI |
| 134 | outParcel->writeInt32(ctx->mMDP.panel); |
| 135 | } |
Arun Kumar K.R | 2aa44c6 | 2014-01-21 23:08:28 -0800 | [diff] [blame] | 136 | static void setHSIC(const Parcel* inParcel) { |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 137 | int dpy = inParcel->readInt32(); |
Arun Kumar K.R | 2aa44c6 | 2014-01-21 23:08:28 -0800 | [diff] [blame] | 138 | ALOGD_IF(0, "In %s: dpy = %d", __FUNCTION__, dpy); |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 139 | HSICData_t hsic_data; |
| 140 | hsic_data.hue = inParcel->readInt32(); |
| 141 | hsic_data.saturation = inParcel->readFloat(); |
| 142 | hsic_data.intensity = inParcel->readInt32(); |
| 143 | hsic_data.contrast = inParcel->readFloat(); |
| 144 | //XXX: Actually set the HSIC data through ABL lib |
| 145 | } |
| 146 | |
| 147 | |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 148 | static void setBufferMirrorMode(hwc_context_t *ctx, uint32_t enable) { |
| 149 | ctx->mBufferMirrorMode = enable; |
Arun Kumar K.R | fb5bfa6 | 2013-07-25 03:10:51 -0700 | [diff] [blame] | 150 | } |
| 151 | |
Arun Kumar K.R | 8e7a62f | 2013-12-06 18:55:41 -0800 | [diff] [blame] | 152 | static status_t getDisplayVisibleRegion(hwc_context_t* ctx, int dpy, |
| 153 | Parcel* outParcel) { |
| 154 | // Get the info only if the dpy is valid |
| 155 | if(dpy >= HWC_DISPLAY_PRIMARY && dpy <= HWC_DISPLAY_VIRTUAL) { |
| 156 | Locker::Autolock _sl(ctx->mDrawLock); |
| 157 | if(dpy && (ctx->mExtOrientation || ctx->mBufferMirrorMode)) { |
| 158 | // Return the destRect on external, if external orienation |
| 159 | // is enabled |
| 160 | outParcel->writeInt32(ctx->dpyAttr[dpy].mDstRect.left); |
| 161 | outParcel->writeInt32(ctx->dpyAttr[dpy].mDstRect.top); |
| 162 | outParcel->writeInt32(ctx->dpyAttr[dpy].mDstRect.right); |
| 163 | outParcel->writeInt32(ctx->dpyAttr[dpy].mDstRect.bottom); |
| 164 | } else { |
| 165 | outParcel->writeInt32(ctx->mViewFrame[dpy].left); |
| 166 | outParcel->writeInt32(ctx->mViewFrame[dpy].top); |
| 167 | outParcel->writeInt32(ctx->mViewFrame[dpy].right); |
| 168 | outParcel->writeInt32(ctx->mViewFrame[dpy].bottom); |
| 169 | } |
| 170 | return NO_ERROR; |
| 171 | } else { |
| 172 | ALOGE("In %s: invalid dpy index %d", __FUNCTION__, dpy); |
| 173 | return BAD_VALUE; |
| 174 | } |
| 175 | } |
| 176 | |
Arun Kumar K.R | 33888f5 | 2014-10-09 15:56:33 -0700 | [diff] [blame] | 177 | // USed for setting the secondary(hdmi/wfd) status |
| 178 | static void setSecondaryDisplayStatus(hwc_context_t *ctx, |
| 179 | const Parcel* inParcel) { |
| 180 | uint32_t dpy = inParcel->readInt32(); |
| 181 | uint32_t status = inParcel->readInt32(); |
| 182 | ALOGD_IF(QCLIENT_DEBUG, "%s: dpy = %d status = %s", __FUNCTION__, |
| 183 | dpy, getExternalDisplayState(status)); |
| 184 | |
| 185 | if(dpy > HWC_DISPLAY_PRIMARY && dpy <= HWC_DISPLAY_VIRTUAL) { |
Raj Kamal | 0d53fc6 | 2014-11-25 17:36:36 +0530 | [diff] [blame] | 186 | if(dpy == HWC_DISPLAY_VIRTUAL && status == qdutils::EXTERNAL_OFFLINE) { |
Arun Kumar K.R | 33888f5 | 2014-10-09 15:56:33 -0700 | [diff] [blame] | 187 | ctx->mWfdSyncLock.lock(); |
| 188 | ctx->mWfdSyncLock.signal(); |
| 189 | ctx->mWfdSyncLock.unlock(); |
Raj Kamal | 0d53fc6 | 2014-11-25 17:36:36 +0530 | [diff] [blame] | 190 | } else if(status == qdutils::EXTERNAL_PAUSE) { |
Arun Kumar K.R | 33888f5 | 2014-10-09 15:56:33 -0700 | [diff] [blame] | 191 | handle_pause(ctx, dpy); |
Raj Kamal | 0d53fc6 | 2014-11-25 17:36:36 +0530 | [diff] [blame] | 192 | } else if(status == qdutils::EXTERNAL_RESUME) { |
Arun Kumar K.R | 33888f5 | 2014-10-09 15:56:33 -0700 | [diff] [blame] | 193 | handle_resume(ctx, dpy); |
| 194 | } |
Arun Kumar K.R | c62935a | 2013-12-03 16:47:47 -0800 | [diff] [blame] | 195 | } else { |
Ramakant Singh | 8595cca | 2014-11-06 16:17:08 +0530 | [diff] [blame] | 196 | ALOGE("%s: Invalid dpy %d", __FUNCTION__, dpy); |
Arun Kumar K.R | 33888f5 | 2014-10-09 15:56:33 -0700 | [diff] [blame] | 197 | return; |
Raj kamal | 59fea56 | 2014-04-01 16:52:19 +0530 | [diff] [blame] | 198 | } |
| 199 | } |
| 200 | |
Ramkumar Radhakrishnan | 0a021a8 | 2014-05-19 19:53:56 -0700 | [diff] [blame] | 201 | |
| 202 | static status_t setViewFrame(hwc_context_t* ctx, const Parcel* inParcel) { |
| 203 | int dpy = inParcel->readInt32(); |
| 204 | if(dpy >= HWC_DISPLAY_PRIMARY && dpy <= HWC_DISPLAY_VIRTUAL) { |
| 205 | Locker::Autolock _sl(ctx->mDrawLock); |
| 206 | ctx->mViewFrame[dpy].left = inParcel->readInt32(); |
| 207 | ctx->mViewFrame[dpy].top = inParcel->readInt32(); |
| 208 | ctx->mViewFrame[dpy].right = inParcel->readInt32(); |
| 209 | ctx->mViewFrame[dpy].bottom = inParcel->readInt32(); |
| 210 | ALOGD_IF(QCLIENT_DEBUG, "%s: mViewFrame[%d] = [%d %d %d %d]", |
| 211 | __FUNCTION__, dpy, |
| 212 | ctx->mViewFrame[dpy].left, ctx->mViewFrame[dpy].top, |
| 213 | ctx->mViewFrame[dpy].right, ctx->mViewFrame[dpy].bottom); |
| 214 | return NO_ERROR; |
| 215 | } else { |
| 216 | ALOGE("In %s: invalid dpy index %d", __FUNCTION__, dpy); |
| 217 | return BAD_VALUE; |
| 218 | } |
| 219 | } |
| 220 | |
Naseer Ahmed | 35a268c | 2014-06-24 19:07:13 -0400 | [diff] [blame] | 221 | static void toggleDynamicDebug(hwc_context_t* ctx, const Parcel* inParcel) { |
| 222 | int debug_type = inParcel->readInt32(); |
| 223 | bool enable = !!inParcel->readInt32(); |
| 224 | ALOGD("%s: debug_type: %d enable:%d", |
| 225 | __FUNCTION__, debug_type, enable); |
| 226 | Locker::Autolock _sl(ctx->mDrawLock); |
| 227 | switch (debug_type) { |
| 228 | //break is ignored for DEBUG_ALL to toggle all of them at once |
| 229 | case IQService::DEBUG_ALL: |
| 230 | case IQService::DEBUG_MDPCOMP: |
| 231 | qhwc::MDPComp::dynamicDebug(enable); |
| 232 | if (debug_type != IQService::DEBUG_ALL) |
| 233 | break; |
| 234 | case IQService::DEBUG_VSYNC: |
| 235 | ctx->vstate.debug = enable; |
| 236 | if (debug_type != IQService::DEBUG_ALL) |
| 237 | break; |
Tatenda Chipeperekwa | 06af9cb | 2014-08-26 14:51:05 -0700 | [diff] [blame] | 238 | case IQService::DEBUG_VD: |
Manoj Kumar AVM | 9591a5e | 2014-08-21 22:50:21 -0700 | [diff] [blame] | 239 | HWCVirtualVDS::dynamicDebug(enable); |
Tatenda Chipeperekwa | 06af9cb | 2014-08-26 14:51:05 -0700 | [diff] [blame] | 240 | if (debug_type != IQService::DEBUG_ALL) |
| 241 | break; |
Saurabh Shah | 24eec8a | 2014-08-22 15:07:25 -0700 | [diff] [blame] | 242 | case IQService::DEBUG_PIPE_LIFECYCLE: |
| 243 | Overlay::debugPipeLifecycle(enable); |
| 244 | if (debug_type != IQService::DEBUG_ALL) |
| 245 | break; |
Naseer Ahmed | 35a268c | 2014-06-24 19:07:13 -0400 | [diff] [blame] | 246 | } |
| 247 | } |
| 248 | |
Saurabh Shah | 59562ff | 2014-09-30 16:13:12 -0700 | [diff] [blame] | 249 | static void setIdleTimeout(hwc_context_t* ctx, const Parcel* inParcel) { |
| 250 | uint32_t timeout = (uint32_t)inParcel->readInt32(); |
| 251 | ALOGD("%s :%u ms", __FUNCTION__, timeout); |
| 252 | Locker::Autolock _sl(ctx->mDrawLock); |
| 253 | MDPComp::setIdleTimeout(timeout); |
| 254 | } |
| 255 | |
Jeykumar Sankaran | be93e27 | 2014-06-19 18:15:57 -0700 | [diff] [blame] | 256 | static void setMaxPipesPerMixer(hwc_context_t* ctx, const Parcel* inParcel) { |
| 257 | uint32_t value = (uint32_t)inParcel->readInt32(); |
| 258 | ALOGD("%s : setting MaxPipesPerMixer: %d ", __FUNCTION__, value); |
| 259 | Locker::Autolock _sl(ctx->mDrawLock); |
| 260 | MDPComp::setMaxPipesPerMixer(value); |
| 261 | } |
| 262 | |
Saurabh Shah | cd01835 | 2014-11-11 13:54:19 -0800 | [diff] [blame] | 263 | static void toggleBWC(hwc_context_t* ctx, const Parcel* inParcel) { |
| 264 | uint32_t enable = (uint32_t)inParcel->readInt32(); |
| 265 | if(MDPVersion::getInstance().supportsBWC()) { |
| 266 | Locker::Autolock _sl(ctx->mDrawLock); |
| 267 | ctx->mBWCEnabled = (bool) enable; |
| 268 | ALOGI("%s: Set BWC to %d", __FUNCTION__, enable); |
| 269 | } else { |
| 270 | ALOGI("%s: Target doesn't support BWC", __FUNCTION__); |
| 271 | } |
| 272 | } |
| 273 | |
Raj Kamal | 0d53fc6 | 2014-11-25 17:36:36 +0530 | [diff] [blame] | 274 | static void configureDynRefreshRate(hwc_context_t* ctx, |
| 275 | const Parcel* inParcel) { |
| 276 | uint32_t op = (uint32_t)inParcel->readInt32(); |
| 277 | uint32_t refresh_rate = (uint32_t)inParcel->readInt32(); |
| 278 | MDPVersion& mdpHw = MDPVersion::getInstance(); |
| 279 | uint32_t dpy = HWC_DISPLAY_PRIMARY; |
| 280 | |
| 281 | if(mdpHw.isDynFpsSupported()) { |
| 282 | Locker::Autolock _sl(ctx->mDrawLock); |
| 283 | |
| 284 | switch (op) { |
| 285 | case DISABLE_METADATA_DYN_REFRESH_RATE: |
| 286 | ctx->mUseMetaDataRefreshRate = false; |
| 287 | setRefreshRate(ctx, dpy, ctx->dpyAttr[dpy].refreshRate); |
| 288 | break; |
| 289 | case ENABLE_METADATA_DYN_REFRESH_RATE: |
| 290 | ctx->mUseMetaDataRefreshRate = true; |
| 291 | setRefreshRate(ctx, dpy, ctx->dpyAttr[dpy].refreshRate); |
| 292 | break; |
| 293 | case SET_BINDER_DYN_REFRESH_RATE: |
| 294 | if(ctx->mUseMetaDataRefreshRate) |
| 295 | ALOGW("%s: Ignoring binder request to change refresh-rate", |
| 296 | __FUNCTION__); |
| 297 | else { |
| 298 | uint32_t rate = roundOff(refresh_rate); |
| 299 | if((rate >= mdpHw.getMinFpsSupported() && |
| 300 | rate <= mdpHw.getMaxFpsSupported())) { |
| 301 | setRefreshRate(ctx, dpy, rate); |
| 302 | } else { |
| 303 | ALOGE("%s: Requested refresh-rate should be between \ |
| 304 | (%d) and (%d). Given (%d)", __FUNCTION__, |
| 305 | mdpHw.getMinFpsSupported(), |
| 306 | mdpHw.getMaxFpsSupported(), rate); |
| 307 | } |
| 308 | } |
| 309 | break; |
| 310 | default: |
| 311 | ALOGE("%s: Invalid op %d",__FUNCTION__,op); |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | |
Jeykumar Sankaran | 53b05f2 | 2014-08-05 11:27:03 -0700 | [diff] [blame] | 316 | static status_t setPartialUpdatePref(hwc_context_t *ctx, uint32_t enable) { |
| 317 | ALOGD("%s: enable: %d", __FUNCTION__, enable); |
| 318 | if(qhwc::MDPComp::setPartialUpdatePref(ctx, (bool)enable) < 0) |
| 319 | return NO_INIT; |
| 320 | return NO_ERROR; |
| 321 | } |
| 322 | |
Naseer Ahmed | 78951b2 | 2014-12-10 18:19:21 -0500 | [diff] [blame] | 323 | static void toggleScreenUpdate(hwc_context_t* ctx, uint32_t on) { |
| 324 | ALOGD("%s: toggle update: %d", __FUNCTION__, on); |
Naseer Ahmed | 78951b2 | 2014-12-10 18:19:21 -0500 | [diff] [blame] | 325 | if (on == 0) { |
Raj Kamal | 58b31a0 | 2014-12-16 15:53:53 +0530 | [diff] [blame] | 326 | ctx->mDrawLock.lock(); |
Naseer Ahmed | 78951b2 | 2014-12-10 18:19:21 -0500 | [diff] [blame] | 327 | ctx->dpyAttr[HWC_DISPLAY_PRIMARY].isPause = true; |
| 328 | ctx->mOverlay->configBegin(); |
| 329 | ctx->mOverlay->configDone(); |
| 330 | ctx->mRotMgr->clear(); |
| 331 | if(!Overlay::displayCommit(ctx->dpyAttr[0].fd)) { |
| 332 | ALOGE("%s: Display commit failed", __FUNCTION__); |
| 333 | } |
Raj Kamal | 58b31a0 | 2014-12-16 15:53:53 +0530 | [diff] [blame] | 334 | ctx->mDrawLock.unlock(); |
Naseer Ahmed | 78951b2 | 2014-12-10 18:19:21 -0500 | [diff] [blame] | 335 | } else { |
Raj Kamal | 58b31a0 | 2014-12-16 15:53:53 +0530 | [diff] [blame] | 336 | ctx->mDrawLock.lock(); |
Naseer Ahmed | 78951b2 | 2014-12-10 18:19:21 -0500 | [diff] [blame] | 337 | ctx->dpyAttr[HWC_DISPLAY_PRIMARY].isPause = false; |
Raj Kamal | 58b31a0 | 2014-12-16 15:53:53 +0530 | [diff] [blame] | 338 | ctx->mDrawLock.unlock(); |
Naseer Ahmed | 78951b2 | 2014-12-10 18:19:21 -0500 | [diff] [blame] | 339 | ctx->proc->invalidate(ctx->proc); |
| 340 | } |
| 341 | } |
| 342 | |
Naseer Ahmed | 6bbd0a1 | 2015-01-23 11:57:10 -0500 | [diff] [blame] | 343 | static void setS3DMode(hwc_context_t* ctx, int mode) { |
| 344 | if (ctx->mHDMIDisplay) { |
| 345 | if(ctx->mHDMIDisplay->isS3DModeSupported(mode)) { |
| 346 | ALOGD("%s: Force S3D mode to %d", __FUNCTION__, mode); |
| 347 | Locker::Autolock _sl(ctx->mDrawLock); |
| 348 | ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].s3dModeForced = true; |
| 349 | setup3DMode(ctx, HWC_DISPLAY_EXTERNAL, mode); |
| 350 | } else { |
| 351 | ALOGD("%s: mode %d is not supported", __FUNCTION__, mode); |
| 352 | } |
| 353 | } else { |
| 354 | ALOGE("%s: No HDMI Display detected", __FUNCTION__); |
| 355 | } |
| 356 | } |
| 357 | |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 358 | status_t QClient::notifyCallback(uint32_t command, const Parcel* inParcel, |
| 359 | Parcel* outParcel) { |
Arun Kumar K.R | 8e7a62f | 2013-12-06 18:55:41 -0800 | [diff] [blame] | 360 | status_t ret = NO_ERROR; |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 361 | |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 362 | switch(command) { |
| 363 | case IQService::SECURING: |
| 364 | securing(mHwcContext, inParcel->readInt32()); |
| 365 | break; |
| 366 | case IQService::UNSECURING: |
| 367 | unsecuring(mHwcContext, inParcel->readInt32()); |
| 368 | break; |
| 369 | case IQService::SCREEN_REFRESH: |
| 370 | return screenRefresh(mHwcContext); |
| 371 | break; |
| 372 | case IQService::EXTERNAL_ORIENTATION: |
| 373 | setExtOrientation(mHwcContext, inParcel->readInt32()); |
| 374 | break; |
| 375 | case IQService::BUFFER_MIRRORMODE: |
| 376 | setBufferMirrorMode(mHwcContext, inParcel->readInt32()); |
| 377 | break; |
Arun Kumar K.R | 8e7a62f | 2013-12-06 18:55:41 -0800 | [diff] [blame] | 378 | case IQService::GET_DISPLAY_VISIBLE_REGION: |
| 379 | ret = getDisplayVisibleRegion(mHwcContext, inParcel->readInt32(), |
| 380 | outParcel); |
| 381 | break; |
Naseer Ahmed | 78c952e | 2013-11-25 18:12:23 -0500 | [diff] [blame] | 382 | case IQService::CHECK_EXTERNAL_STATUS: |
| 383 | isExternalConnected(mHwcContext, outParcel); |
| 384 | break; |
| 385 | case IQService::GET_DISPLAY_ATTRIBUTES: |
| 386 | getDisplayAttributes(mHwcContext, inParcel, outParcel); |
| 387 | break; |
| 388 | case IQService::SET_HSIC_DATA: |
Arun Kumar K.R | 2aa44c6 | 2014-01-21 23:08:28 -0800 | [diff] [blame] | 389 | setHSIC(inParcel); |
Raj kamal | 59fea56 | 2014-04-01 16:52:19 +0530 | [diff] [blame] | 390 | break; |
Arun Kumar K.R | 33888f5 | 2014-10-09 15:56:33 -0700 | [diff] [blame] | 391 | case IQService::SET_SECONDARY_DISPLAY_STATUS: |
| 392 | setSecondaryDisplayStatus(mHwcContext, inParcel); |
Raj kamal | 59fea56 | 2014-04-01 16:52:19 +0530 | [diff] [blame] | 393 | break; |
Ramkumar Radhakrishnan | 0a021a8 | 2014-05-19 19:53:56 -0700 | [diff] [blame] | 394 | case IQService::SET_VIEW_FRAME: |
| 395 | setViewFrame(mHwcContext, inParcel); |
| 396 | break; |
Naseer Ahmed | 35a268c | 2014-06-24 19:07:13 -0400 | [diff] [blame] | 397 | case IQService::DYNAMIC_DEBUG: |
| 398 | toggleDynamicDebug(mHwcContext, inParcel); |
| 399 | break; |
Saurabh Shah | 59562ff | 2014-09-30 16:13:12 -0700 | [diff] [blame] | 400 | case IQService::SET_IDLE_TIMEOUT: |
| 401 | setIdleTimeout(mHwcContext, inParcel); |
| 402 | break; |
Jeykumar Sankaran | be93e27 | 2014-06-19 18:15:57 -0700 | [diff] [blame] | 403 | case IQService::SET_MAX_PIPES_PER_MIXER: |
| 404 | setMaxPipesPerMixer(mHwcContext, inParcel); |
Jeykumar Sankaran | 85ddc0c | 2014-12-17 14:39:26 -0800 | [diff] [blame] | 405 | break; |
Jeykumar Sankaran | 53b05f2 | 2014-08-05 11:27:03 -0700 | [diff] [blame] | 406 | case IQService::SET_PARTIAL_UPDATE: |
| 407 | ret = setPartialUpdatePref(mHwcContext, inParcel->readInt32()); |
Jeykumar Sankaran | be93e27 | 2014-06-19 18:15:57 -0700 | [diff] [blame] | 408 | break; |
Saurabh Shah | cd01835 | 2014-11-11 13:54:19 -0800 | [diff] [blame] | 409 | case IQService::TOGGLE_BWC: |
| 410 | toggleBWC(mHwcContext, inParcel); |
| 411 | break; |
Raj Kamal | 0d53fc6 | 2014-11-25 17:36:36 +0530 | [diff] [blame] | 412 | case IQService::CONFIGURE_DYN_REFRESH_RATE: |
| 413 | configureDynRefreshRate(mHwcContext, inParcel); |
| 414 | break; |
Naseer Ahmed | 78951b2 | 2014-12-10 18:19:21 -0500 | [diff] [blame] | 415 | case IQService::TOGGLE_SCREEN_UPDATE: |
| 416 | toggleScreenUpdate(mHwcContext, inParcel->readInt32()); |
| 417 | break; |
Naseer Ahmed | 6bbd0a1 | 2015-01-23 11:57:10 -0500 | [diff] [blame] | 418 | case IQService::SET_S3D_MODE: |
| 419 | setS3DMode(mHwcContext, inParcel->readInt32()); |
| 420 | break; |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 421 | default: |
Arun Kumar K.R | 8e7a62f | 2013-12-06 18:55:41 -0800 | [diff] [blame] | 422 | ret = NO_ERROR; |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 423 | } |
Arun Kumar K.R | 8e7a62f | 2013-12-06 18:55:41 -0800 | [diff] [blame] | 424 | return ret; |
Naseer Ahmed | 4957c52 | 2013-11-12 18:07:15 -0500 | [diff] [blame] | 425 | } |
| 426 | |
Saurabh Shah | 86c1729 | 2013-02-08 15:24:13 -0800 | [diff] [blame] | 427 | } |