Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1 | /* |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 2 | * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved. |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 3 | * Not a Contribution, Apache license notifications and license are retained |
| 4 | * for attribution purposes only. |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | */ |
| 18 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 19 | #include <math.h> |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 20 | #include "hwc_mdpcomp.h" |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 21 | #include <sys/ioctl.h> |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 22 | #include "external.h" |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 23 | #include "qdMetaData.h" |
Ramkumar Radhakrishnan | 288f8c7 | 2013-01-15 11:37:54 -0800 | [diff] [blame] | 24 | #include "mdp_version.h" |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 25 | #include <overlayRotator.h> |
| 26 | |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 27 | using namespace overlay; |
Saurabh Shah | bd2d083 | 2013-04-04 14:33:08 -0700 | [diff] [blame] | 28 | using namespace qdutils; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 29 | using namespace overlay::utils; |
| 30 | namespace ovutils = overlay::utils; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 31 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 32 | namespace qhwc { |
| 33 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 34 | //==============MDPComp======================================================== |
| 35 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 36 | IdleInvalidator *MDPComp::idleInvalidator = NULL; |
| 37 | bool MDPComp::sIdleFallBack = false; |
| 38 | bool MDPComp::sDebugLogs = false; |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 39 | bool MDPComp::sEnabled = false; |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 40 | bool MDPComp::sEnableMixedMode = true; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 41 | int MDPComp::sMaxPipesPerMixer = MAX_PIPES_PER_MIXER; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 42 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 43 | MDPComp* MDPComp::getObject(const int& width, int dpy) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 44 | if(width <= MAX_DISPLAY_DIM) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 45 | return new MDPCompLowRes(dpy); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 46 | } else { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 47 | return new MDPCompHighRes(dpy); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 48 | } |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 49 | } |
| 50 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 51 | MDPComp::MDPComp(int dpy):mDpy(dpy){}; |
| 52 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 53 | void MDPComp::dump(android::String8& buf) |
| 54 | { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 55 | dumpsys_log(buf,"HWC Map for Dpy: %s \n", |
| 56 | mDpy ? "\"EXTERNAL\"" : "\"PRIMARY\""); |
| 57 | dumpsys_log(buf,"PREV_FRAME: layerCount:%2d mdpCount:%2d \ |
| 58 | cacheCount:%2d \n", mCachedFrame.layerCount, |
| 59 | mCachedFrame.mdpCount, mCachedFrame.cacheCount); |
| 60 | dumpsys_log(buf,"CURR_FRAME: layerCount:%2d mdpCount:%2d \ |
| 61 | fbCount:%2d \n", mCurrentFrame.layerCount, |
| 62 | mCurrentFrame.mdpCount, mCurrentFrame.fbCount); |
| 63 | dumpsys_log(buf,"needsFBRedraw:%3s pipesUsed:%2d MaxPipesPerMixer: %d \n", |
| 64 | (mCurrentFrame.needsRedraw? "YES" : "NO"), |
| 65 | mCurrentFrame.mdpCount, sMaxPipesPerMixer); |
| 66 | dumpsys_log(buf," --------------------------------------------- \n"); |
| 67 | dumpsys_log(buf," listIdx | cached? | mdpIndex | comptype | Z \n"); |
| 68 | dumpsys_log(buf," --------------------------------------------- \n"); |
| 69 | for(int index = 0; index < mCurrentFrame.layerCount; index++ ) |
| 70 | dumpsys_log(buf," %7d | %7s | %8d | %9s | %2d \n", |
| 71 | index, |
| 72 | (mCurrentFrame.isFBComposed[index] ? "YES" : "NO"), |
| 73 | mCurrentFrame.layerToMDP[index], |
| 74 | (mCurrentFrame.isFBComposed[index] ? |
| 75 | (mCurrentFrame.needsRedraw ? "GLES" : "CACHE") : "MDP"), |
| 76 | (mCurrentFrame.isFBComposed[index] ? mCurrentFrame.fbZ : |
| 77 | mCurrentFrame.mdpToLayer[mCurrentFrame.layerToMDP[index]].pipeInfo->zOrder)); |
| 78 | dumpsys_log(buf,"\n"); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | bool MDPComp::init(hwc_context_t *ctx) { |
| 82 | |
| 83 | if(!ctx) { |
| 84 | ALOGE("%s: Invalid hwc context!!",__FUNCTION__); |
| 85 | return false; |
| 86 | } |
| 87 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 88 | char property[PROPERTY_VALUE_MAX]; |
| 89 | |
| 90 | sEnabled = false; |
| 91 | if((property_get("persist.hwc.mdpcomp.enable", property, NULL) > 0) && |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 92 | (!strncmp(property, "1", PROPERTY_VALUE_MAX ) || |
| 93 | (!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) { |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 94 | sEnabled = true; |
Xiaoming Zhou | 944e02e | 2013-05-01 20:54:03 -0400 | [diff] [blame] | 95 | if(!setupBasePipe(ctx)) { |
| 96 | ALOGE("%s: Failed to setup primary base pipe", __FUNCTION__); |
| 97 | return false; |
| 98 | } |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 99 | } |
| 100 | |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 101 | sEnableMixedMode = true; |
| 102 | if((property_get("debug.mdpcomp.mixedmode.disable", property, NULL) > 0) && |
| 103 | (!strncmp(property, "1", PROPERTY_VALUE_MAX ) || |
| 104 | (!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) { |
| 105 | sEnableMixedMode = false; |
| 106 | } |
| 107 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 108 | sDebugLogs = false; |
| 109 | if(property_get("debug.mdpcomp.logs", property, NULL) > 0) { |
| 110 | if(atoi(property) != 0) |
| 111 | sDebugLogs = true; |
| 112 | } |
| 113 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 114 | sMaxPipesPerMixer = MAX_PIPES_PER_MIXER; |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 115 | if(property_get("debug.mdpcomp.maxpermixer", property, "-1") > 0) { |
| 116 | int val = atoi(property); |
| 117 | if(val >= 0) |
| 118 | sMaxPipesPerMixer = min(val, MAX_PIPES_PER_MIXER); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 119 | } |
| 120 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 121 | unsigned long idle_timeout = DEFAULT_IDLE_TIME; |
| 122 | if(property_get("debug.mdpcomp.idletime", property, NULL) > 0) { |
| 123 | if(atoi(property) != 0) |
| 124 | idle_timeout = atoi(property); |
| 125 | } |
| 126 | |
| 127 | //create Idle Invalidator |
| 128 | idleInvalidator = IdleInvalidator::getInstance(); |
| 129 | |
| 130 | if(idleInvalidator == NULL) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 131 | ALOGE("%s: failed to instantiate idleInvalidator object", __FUNCTION__); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 132 | } else { |
| 133 | idleInvalidator->init(timeout_handler, ctx, idle_timeout); |
| 134 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 135 | return true; |
| 136 | } |
| 137 | |
| 138 | void MDPComp::timeout_handler(void *udata) { |
| 139 | struct hwc_context_t* ctx = (struct hwc_context_t*)(udata); |
| 140 | |
| 141 | if(!ctx) { |
| 142 | ALOGE("%s: received empty data in timer callback", __FUNCTION__); |
| 143 | return; |
| 144 | } |
| 145 | |
Jesse Hall | 3be78d9 | 2012-08-21 15:12:23 -0700 | [diff] [blame] | 146 | if(!ctx->proc) { |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 147 | ALOGE("%s: HWC proc not registered", __FUNCTION__); |
| 148 | return; |
| 149 | } |
| 150 | sIdleFallBack = true; |
| 151 | /* Trigger SF to redraw the current frame */ |
Jesse Hall | 3be78d9 | 2012-08-21 15:12:23 -0700 | [diff] [blame] | 152 | ctx->proc->invalidate(ctx->proc); |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 153 | } |
| 154 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 155 | void MDPComp::setMDPCompLayerFlags(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 156 | hwc_display_contents_1_t* list) { |
| 157 | LayerProp *layerProp = ctx->layerProp[mDpy]; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 158 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 159 | for(int index = 0; index < ctx->listStats[mDpy].numAppLayers; index++) { |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 160 | hwc_layer_1_t* layer = &(list->hwLayers[index]); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 161 | if(!mCurrentFrame.isFBComposed[index]) { |
| 162 | layerProp[index].mFlags |= HWC_MDPCOMP; |
| 163 | layer->compositionType = HWC_OVERLAY; |
| 164 | layer->hints |= HWC_HINT_CLEAR_FB; |
| 165 | mCachedFrame.hnd[index] = NULL; |
| 166 | } else { |
| 167 | if(!mCurrentFrame.needsRedraw) |
| 168 | layer->compositionType = HWC_OVERLAY; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 169 | } |
| 170 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 171 | } |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 172 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 173 | /* |
| 174 | * Sets up BORDERFILL as default base pipe and detaches RGB0. |
| 175 | * Framebuffer is always updated using PLAY ioctl. |
| 176 | */ |
| 177 | bool MDPComp::setupBasePipe(hwc_context_t *ctx) { |
| 178 | const int dpy = HWC_DISPLAY_PRIMARY; |
| 179 | int fb_stride = ctx->dpyAttr[dpy].stride; |
| 180 | int fb_width = ctx->dpyAttr[dpy].xres; |
| 181 | int fb_height = ctx->dpyAttr[dpy].yres; |
| 182 | int fb_fd = ctx->dpyAttr[dpy].fd; |
| 183 | |
| 184 | mdp_overlay ovInfo; |
| 185 | msmfb_overlay_data ovData; |
| 186 | memset(&ovInfo, 0, sizeof(mdp_overlay)); |
| 187 | memset(&ovData, 0, sizeof(msmfb_overlay_data)); |
| 188 | |
| 189 | ovInfo.src.format = MDP_RGB_BORDERFILL; |
| 190 | ovInfo.src.width = fb_width; |
| 191 | ovInfo.src.height = fb_height; |
| 192 | ovInfo.src_rect.w = fb_width; |
| 193 | ovInfo.src_rect.h = fb_height; |
| 194 | ovInfo.dst_rect.w = fb_width; |
| 195 | ovInfo.dst_rect.h = fb_height; |
| 196 | ovInfo.id = MSMFB_NEW_REQUEST; |
| 197 | |
| 198 | if (ioctl(fb_fd, MSMFB_OVERLAY_SET, &ovInfo) < 0) { |
| 199 | ALOGE("Failed to call ioctl MSMFB_OVERLAY_SET err=%s", |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 200 | strerror(errno)); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 201 | return false; |
| 202 | } |
| 203 | |
| 204 | ovData.id = ovInfo.id; |
| 205 | if (ioctl(fb_fd, MSMFB_OVERLAY_PLAY, &ovData) < 0) { |
| 206 | ALOGE("Failed to call ioctl MSMFB_OVERLAY_PLAY err=%s", |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 207 | strerror(errno)); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 208 | return false; |
| 209 | } |
| 210 | return true; |
| 211 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 212 | MDPComp::FrameInfo::FrameInfo() { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 213 | reset(0); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 214 | } |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 215 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 216 | void MDPComp::FrameInfo::reset(const int& numLayers) { |
| 217 | for(int i = 0 ; i < MAX_PIPES_PER_MIXER && numLayers; i++ ) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 218 | if(mdpToLayer[i].pipeInfo) { |
| 219 | delete mdpToLayer[i].pipeInfo; |
| 220 | mdpToLayer[i].pipeInfo = NULL; |
| 221 | //We dont own the rotator |
| 222 | mdpToLayer[i].rot = NULL; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 223 | } |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 224 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 225 | |
| 226 | memset(&mdpToLayer, 0, sizeof(mdpToLayer)); |
| 227 | memset(&layerToMDP, -1, sizeof(layerToMDP)); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 228 | memset(&isFBComposed, 1, sizeof(isFBComposed)); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 229 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 230 | layerCount = numLayers; |
| 231 | fbCount = numLayers; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 232 | mdpCount = 0; |
Saurabh Shah | 2f3895f | 2013-05-02 10:13:31 -0700 | [diff] [blame] | 233 | needsRedraw = true; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 234 | fbZ = 0; |
| 235 | } |
| 236 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 237 | void MDPComp::FrameInfo::map() { |
| 238 | // populate layer and MDP maps |
| 239 | int mdpIdx = 0; |
| 240 | for(int idx = 0; idx < layerCount; idx++) { |
| 241 | if(!isFBComposed[idx]) { |
| 242 | mdpToLayer[mdpIdx].listIndex = idx; |
| 243 | layerToMDP[idx] = mdpIdx++; |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 248 | MDPComp::LayerCache::LayerCache() { |
| 249 | reset(); |
| 250 | } |
| 251 | |
| 252 | void MDPComp::LayerCache::reset() { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 253 | memset(&hnd, 0, sizeof(hnd)); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 254 | mdpCount = 0; |
| 255 | cacheCount = 0; |
| 256 | layerCount = 0; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 257 | fbZ = -1; |
| 258 | } |
| 259 | |
| 260 | void MDPComp::LayerCache::cacheAll(hwc_display_contents_1_t* list) { |
| 261 | const int numAppLayers = list->numHwLayers - 1; |
| 262 | for(int i = 0; i < numAppLayers; i++) { |
| 263 | hnd[i] = list->hwLayers[i].handle; |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | void MDPComp::LayerCache::updateCounts(const FrameInfo& curFrame) { |
| 268 | mdpCount = curFrame.mdpCount; |
| 269 | cacheCount = curFrame.fbCount; |
| 270 | layerCount = curFrame.layerCount; |
| 271 | fbZ = curFrame.fbZ; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 272 | } |
| 273 | |
Sravan Kumar D.V.N | ad5d929 | 2013-04-24 14:23:04 +0530 | [diff] [blame] | 274 | bool MDPComp::isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer) { |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 275 | const int dpy = HWC_DISPLAY_PRIMARY; |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 276 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 277 | |
| 278 | if(!hnd) { |
| 279 | ALOGE("%s: layer handle is NULL", __FUNCTION__); |
| 280 | return false; |
| 281 | } |
| 282 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 283 | int hw_w = ctx->dpyAttr[mDpy].xres; |
| 284 | int hw_h = ctx->dpyAttr[mDpy].yres; |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 285 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 286 | hwc_rect_t crop = layer->sourceCrop; |
| 287 | hwc_rect_t dst = layer->displayFrame; |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 288 | |
| 289 | if(dst.left < 0 || dst.top < 0 || dst.right > hw_w || dst.bottom > hw_h) { |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 290 | hwc_rect_t scissor = {0, 0, hw_w, hw_h }; |
| 291 | qhwc::calculate_crop_rects(crop, dst, scissor, layer->transform); |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 292 | } |
| 293 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 294 | int crop_w = crop.right - crop.left; |
| 295 | int crop_h = crop.bottom - crop.top; |
| 296 | int dst_w = dst.right - dst.left; |
| 297 | int dst_h = dst.bottom - dst.top; |
| 298 | float w_dscale = ceilf((float)crop_w / (float)dst_w); |
| 299 | float h_dscale = ceilf((float)crop_h / (float)dst_h); |
| 300 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 301 | /* Workaround for MDP HW limitation in DSI command mode panels where |
| 302 | * FPS will not go beyond 30 if buffers on RGB pipes are of width or height |
| 303 | * less than 5 pixels |
Sravan Kumar D.V.N | ad5d929 | 2013-04-24 14:23:04 +0530 | [diff] [blame] | 304 | * There also is a HW limilation in MDP, minimum block size is 2x2 |
| 305 | * Fallback to GPU if height is less than 2. |
| 306 | */ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 307 | if((crop_w < 5)||(crop_h < 5)) |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 308 | return false; |
| 309 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 310 | const uint32_t downscale = |
| 311 | qdutils::MDPVersion::getInstance().getMaxMDPDownscale(); |
| 312 | if(ctx->mMDP.version >= qdutils::MDSS_V5) { |
| 313 | /* Workaround for downscales larger than 4x. |
| 314 | * Will be removed once decimator block is enabled for MDSS |
| 315 | */ |
| 316 | if(!qdutils::MDPVersion::getInstance().supportsDecimation()) { |
| 317 | if(crop_w > MAX_DISPLAY_DIM || w_dscale > downscale || |
| 318 | h_dscale > downscale) |
| 319 | return false; |
| 320 | } else { |
| 321 | if(w_dscale > 64 || h_dscale > 64) |
| 322 | return false; |
| 323 | } |
| 324 | } else { //A-family |
| 325 | if(w_dscale > downscale || h_dscale > downscale) |
| 326 | return false; |
| 327 | } |
| 328 | |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 329 | return true; |
| 330 | } |
| 331 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 332 | ovutils::eDest MDPComp::getMdpPipe(hwc_context_t *ctx, ePipeType type) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 333 | overlay::Overlay& ov = *ctx->mOverlay; |
| 334 | ovutils::eDest mdp_pipe = ovutils::OV_INVALID; |
| 335 | |
| 336 | switch(type) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 337 | case MDPCOMP_OV_DMA: |
| 338 | mdp_pipe = ov.nextPipe(ovutils::OV_MDP_PIPE_DMA, mDpy); |
| 339 | if(mdp_pipe != ovutils::OV_INVALID) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 340 | return mdp_pipe; |
| 341 | } |
| 342 | case MDPCOMP_OV_ANY: |
| 343 | case MDPCOMP_OV_RGB: |
| 344 | mdp_pipe = ov.nextPipe(ovutils::OV_MDP_PIPE_RGB, mDpy); |
| 345 | if(mdp_pipe != ovutils::OV_INVALID) { |
| 346 | return mdp_pipe; |
| 347 | } |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 348 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 349 | if(type == MDPCOMP_OV_RGB) { |
| 350 | //Requested only for RGB pipe |
| 351 | break; |
| 352 | } |
| 353 | case MDPCOMP_OV_VG: |
| 354 | return ov.nextPipe(ovutils::OV_MDP_PIPE_VG, mDpy); |
| 355 | default: |
| 356 | ALOGE("%s: Invalid pipe type",__FUNCTION__); |
| 357 | return ovutils::OV_INVALID; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 358 | }; |
| 359 | return ovutils::OV_INVALID; |
| 360 | } |
| 361 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 362 | bool MDPComp::isFrameDoable(hwc_context_t *ctx) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 363 | bool ret = true; |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 364 | const int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 365 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 366 | if(!isEnabled()) { |
| 367 | ALOGD_IF(isDebug(),"%s: MDP Comp. not enabled.", __FUNCTION__); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 368 | ret = false; |
Saurabh Shah | d4e6585 | 2013-06-17 11:33:53 -0700 | [diff] [blame] | 369 | } else if(qdutils::MDPVersion::getInstance().is8x26() && |
| 370 | ctx->mVideoTransFlag && |
| 371 | ctx->mExtDisplay->isExternalConnected()) { |
| 372 | //1 Padding round to shift pipes across mixers |
| 373 | ALOGD_IF(isDebug(),"%s: MDP Comp. video transition padding round", |
| 374 | __FUNCTION__); |
| 375 | ret = false; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 376 | } else if(ctx->mExtDispConfiguring) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 377 | ALOGD_IF( isDebug(),"%s: External Display connection is pending", |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 378 | __FUNCTION__); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 379 | ret = false; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 380 | } else if(ctx->isPaddingRound) { |
Saurabh Shah | 0ceeb6a | 2013-04-23 10:46:07 -0700 | [diff] [blame] | 381 | ctx->isPaddingRound = false; |
| 382 | ALOGD_IF(isDebug(), "%s: padding round",__FUNCTION__); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 383 | ret = false; |
Saurabh Shah | 0ceeb6a | 2013-04-23 10:46:07 -0700 | [diff] [blame] | 384 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 385 | return ret; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 386 | } |
| 387 | |
| 388 | /* Checks for conditions where all the layers marked for MDP comp cannot be |
| 389 | * bypassed. On such conditions we try to bypass atleast YUV layers */ |
| 390 | bool MDPComp::isFullFrameDoable(hwc_context_t *ctx, |
| 391 | hwc_display_contents_1_t* list){ |
| 392 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 393 | const int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 394 | |
Saurabh Shah | 2d998a9 | 2013-05-14 17:55:58 -0700 | [diff] [blame] | 395 | if(sIdleFallBack) { |
| 396 | ALOGD_IF(isDebug(), "%s: Idle fallback dpy %d",__FUNCTION__, mDpy); |
| 397 | return false; |
| 398 | } |
| 399 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 400 | if(mDpy > HWC_DISPLAY_PRIMARY){ |
| 401 | ALOGD_IF(isDebug(), "%s: Cannot support External display(s)", |
| 402 | __FUNCTION__); |
| 403 | return false; |
| 404 | } |
| 405 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 406 | if(isSkipPresent(ctx, mDpy)) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 407 | ALOGD_IF(isDebug(),"%s: SKIP present: %d", |
| 408 | __FUNCTION__, |
| 409 | isSkipPresent(ctx, mDpy)); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 410 | return false; |
| 411 | } |
| 412 | |
Saurabh Shah | 9f084ad | 2013-05-02 11:28:09 -0700 | [diff] [blame] | 413 | if(ctx->listStats[mDpy].needsAlphaScale |
| 414 | && ctx->mMDP.version < qdutils::MDSS_V5) { |
| 415 | ALOGD_IF(isDebug(), "%s: frame needs alpha downscaling",__FUNCTION__); |
| 416 | return false; |
| 417 | } |
| 418 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 419 | //MDP composition is not efficient if layer needs rotator. |
| 420 | for(int i = 0; i < numAppLayers; ++i) { |
| 421 | // As MDP h/w supports flip operation, use MDP comp only for |
| 422 | // 180 transforms. Fail for any transform involving 90 (90, 270). |
| 423 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
| 424 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
Jeykumar Sankaran | a37fdbf | 2013-03-06 18:59:28 -0800 | [diff] [blame] | 425 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 426 | if((layer->transform & HWC_TRANSFORM_ROT_90) && !isYuvBuffer(hnd)) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 427 | ALOGD_IF(isDebug(), "%s: orientation involved",__FUNCTION__); |
| 428 | return false; |
| 429 | } |
| 430 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 431 | if(!isValidDimension(ctx,layer)) { |
| 432 | ALOGD_IF(isDebug(), "%s: Buffer is of invalid width", |
| 433 | __FUNCTION__); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 434 | return false; |
| 435 | } |
Prabhanjan Kandula | 9fb032a | 2013-06-18 17:37:22 +0530 | [diff] [blame] | 436 | |
| 437 | //For 8x26 with panel width>1k, if RGB layer needs HFLIP fail mdp comp |
| 438 | // may not need it if Gfx pre-rotation can handle all flips & rotations |
| 439 | if(qdutils::MDPVersion::getInstance().is8x26() && |
| 440 | (ctx->dpyAttr[mDpy].xres > 1024) && |
| 441 | (layer->transform & HWC_TRANSFORM_FLIP_H) && |
| 442 | (!isYuvBuffer(hnd))) |
| 443 | return false; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 444 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 445 | |
| 446 | //If all above hard conditions are met we can do full or partial MDP comp. |
| 447 | bool ret = false; |
| 448 | if(fullMDPComp(ctx, list)) { |
| 449 | ret = true; |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 450 | } else if(partialMDPComp(ctx, list)) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 451 | ret = true; |
| 452 | } |
| 453 | return ret; |
| 454 | } |
| 455 | |
| 456 | bool MDPComp::fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
| 457 | //Setup mCurrentFrame |
| 458 | mCurrentFrame.mdpCount = mCurrentFrame.layerCount; |
| 459 | mCurrentFrame.fbCount = 0; |
| 460 | mCurrentFrame.fbZ = -1; |
| 461 | memset(&mCurrentFrame.isFBComposed, 0, sizeof(mCurrentFrame.isFBComposed)); |
| 462 | |
| 463 | int mdpCount = mCurrentFrame.mdpCount; |
| 464 | if(mdpCount > sMaxPipesPerMixer) { |
| 465 | ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__); |
| 466 | return false; |
| 467 | } |
| 468 | |
| 469 | int numPipesNeeded = pipesNeeded(ctx, list); |
| 470 | int availPipes = getAvailablePipes(ctx); |
| 471 | |
| 472 | if(numPipesNeeded > availPipes) { |
| 473 | ALOGD_IF(isDebug(), "%s: Insufficient MDP pipes, needed %d, avail %d", |
| 474 | __FUNCTION__, numPipesNeeded, availPipes); |
| 475 | return false; |
| 476 | } |
| 477 | |
| 478 | return true; |
| 479 | } |
| 480 | |
| 481 | bool MDPComp::partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list) |
| 482 | { |
| 483 | int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 484 | |
| 485 | if(!sEnableMixedMode) { |
| 486 | //Mixed mode is disabled. No need to even try caching. |
| 487 | return false; |
| 488 | } |
| 489 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 490 | //Setup mCurrentFrame |
| 491 | mCurrentFrame.reset(numAppLayers); |
| 492 | updateLayerCache(ctx, list); |
| 493 | updateYUV(ctx, list); |
| 494 | batchLayers(); //sets up fbZ also |
| 495 | |
| 496 | int mdpCount = mCurrentFrame.mdpCount; |
| 497 | if(mdpCount > (sMaxPipesPerMixer - 1)) { // -1 since FB is used |
| 498 | ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__); |
| 499 | return false; |
| 500 | } |
| 501 | |
| 502 | int numPipesNeeded = pipesNeeded(ctx, list); |
| 503 | int availPipes = getAvailablePipes(ctx); |
| 504 | |
| 505 | if(numPipesNeeded > availPipes) { |
| 506 | ALOGD_IF(isDebug(), "%s: Insufficient MDP pipes, needed %d, avail %d", |
| 507 | __FUNCTION__, numPipesNeeded, availPipes); |
| 508 | return false; |
| 509 | } |
| 510 | |
| 511 | return true; |
| 512 | } |
| 513 | |
| 514 | bool MDPComp::isOnlyVideoDoable(hwc_context_t *ctx, |
| 515 | hwc_display_contents_1_t* list){ |
| 516 | int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
| 517 | mCurrentFrame.reset(numAppLayers); |
| 518 | updateYUV(ctx, list); |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 519 | int mdpCount = mCurrentFrame.mdpCount; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 520 | int fbNeeded = int(mCurrentFrame.fbCount != 0); |
| 521 | |
| 522 | if(!isYuvPresent(ctx, mDpy)) { |
| 523 | return false; |
| 524 | } |
| 525 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 526 | if(!mdpCount) |
| 527 | return false; |
| 528 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 529 | if(mdpCount > (sMaxPipesPerMixer - fbNeeded)) { |
| 530 | ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__); |
| 531 | return false; |
| 532 | } |
| 533 | |
| 534 | int numPipesNeeded = pipesNeeded(ctx, list); |
| 535 | int availPipes = getAvailablePipes(ctx); |
| 536 | if(numPipesNeeded > availPipes) { |
| 537 | ALOGD_IF(isDebug(), "%s: Insufficient MDP pipes, needed %d, avail %d", |
| 538 | __FUNCTION__, numPipesNeeded, availPipes); |
| 539 | return false; |
| 540 | } |
| 541 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 542 | return true; |
| 543 | } |
| 544 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 545 | /* Checks for conditions where YUV layers cannot be bypassed */ |
| 546 | bool MDPComp::isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer) { |
Saurabh Shah | e247408 | 2013-05-15 16:32:13 -0700 | [diff] [blame] | 547 | bool extAnimBlockFeature = mDpy && ctx->listStats[mDpy].isDisplayAnimating; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 548 | |
Saurabh Shah | e247408 | 2013-05-15 16:32:13 -0700 | [diff] [blame] | 549 | if(isSkipLayer(layer) && !extAnimBlockFeature) { |
| 550 | ALOGD_IF(isDebug(), "%s: Video marked SKIP dpy %d", __FUNCTION__, mDpy); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 551 | return false; |
| 552 | } |
| 553 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 554 | if(isSecuring(ctx, layer)) { |
| 555 | ALOGD_IF(isDebug(), "%s: MDP securing is active", __FUNCTION__); |
| 556 | return false; |
| 557 | } |
| 558 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 559 | if(!isValidDimension(ctx, layer)) { |
| 560 | ALOGD_IF(isDebug(), "%s: Buffer is of invalid width", |
| 561 | __FUNCTION__); |
| 562 | return false; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 563 | } |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 564 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 565 | return true; |
| 566 | } |
| 567 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 568 | void MDPComp::batchLayers() { |
| 569 | /* Idea is to keep as many contiguous non-updating(cached) layers in FB and |
| 570 | * send rest of them through MDP. NEVER mark an updating layer for caching. |
| 571 | * But cached ones can be marked for MDP*/ |
| 572 | |
| 573 | int maxBatchStart = -1; |
| 574 | int maxBatchCount = 0; |
| 575 | |
| 576 | /* All or Nothing is cached. No batching needed */ |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 577 | if(!mCurrentFrame.fbCount) { |
| 578 | mCurrentFrame.fbZ = -1; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 579 | return; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 580 | } |
| 581 | if(!mCurrentFrame.mdpCount) { |
| 582 | mCurrentFrame.fbZ = 0; |
| 583 | return; |
| 584 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 585 | |
| 586 | /* Search for max number of contiguous (cached) layers */ |
| 587 | int i = 0; |
| 588 | while (i < mCurrentFrame.layerCount) { |
| 589 | int count = 0; |
| 590 | while(mCurrentFrame.isFBComposed[i] && i < mCurrentFrame.layerCount) { |
| 591 | count++; i++; |
| 592 | } |
| 593 | if(count > maxBatchCount) { |
| 594 | maxBatchCount = count; |
| 595 | maxBatchStart = i - count; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 596 | mCurrentFrame.fbZ = maxBatchStart; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 597 | } |
| 598 | if(i < mCurrentFrame.layerCount) i++; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 599 | } |
| 600 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 601 | /* reset rest of the layers for MDP comp */ |
| 602 | for(int i = 0; i < mCurrentFrame.layerCount; i++) { |
| 603 | if(i != maxBatchStart){ |
| 604 | mCurrentFrame.isFBComposed[i] = false; |
| 605 | } else { |
| 606 | i += maxBatchCount; |
| 607 | } |
| 608 | } |
| 609 | |
| 610 | mCurrentFrame.fbCount = maxBatchCount; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 611 | mCurrentFrame.mdpCount = mCurrentFrame.layerCount - |
| 612 | mCurrentFrame.fbCount; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 613 | |
| 614 | ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__, |
| 615 | mCurrentFrame.fbCount); |
| 616 | } |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 617 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 618 | void MDPComp::updateLayerCache(hwc_context_t* ctx, |
| 619 | hwc_display_contents_1_t* list) { |
| 620 | |
| 621 | int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
| 622 | int numCacheableLayers = 0; |
| 623 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 624 | for(int i = 0; i < numAppLayers; i++) { |
| 625 | if (mCachedFrame.hnd[i] == list->hwLayers[i].handle) { |
| 626 | numCacheableLayers++; |
| 627 | mCurrentFrame.isFBComposed[i] = true; |
| 628 | } else { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 629 | mCurrentFrame.isFBComposed[i] = false; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 630 | mCachedFrame.hnd[i] = list->hwLayers[i].handle; |
| 631 | } |
| 632 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 633 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 634 | mCurrentFrame.fbCount = numCacheableLayers; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 635 | mCurrentFrame.mdpCount = mCurrentFrame.layerCount - |
| 636 | mCurrentFrame.fbCount; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 637 | ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__, numCacheableLayers); |
| 638 | } |
| 639 | |
| 640 | int MDPComp::getAvailablePipes(hwc_context_t* ctx) { |
| 641 | int numDMAPipes = qdutils::MDPVersion::getInstance().getDMAPipes(); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 642 | overlay::Overlay& ov = *ctx->mOverlay; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 643 | |
| 644 | int numAvailable = ov.availablePipes(mDpy); |
| 645 | |
| 646 | //Reserve DMA for rotator |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 647 | if(Overlay::getDMAMode() == Overlay::DMA_BLOCK_MODE) |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 648 | numAvailable -= numDMAPipes; |
| 649 | |
| 650 | //Reserve pipe(s)for FB |
| 651 | if(mCurrentFrame.fbCount) |
| 652 | numAvailable -= pipesForFB(); |
| 653 | |
| 654 | return numAvailable; |
| 655 | } |
| 656 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 657 | void MDPComp::updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list) { |
| 658 | |
| 659 | int nYuvCount = ctx->listStats[mDpy].yuvCount; |
Ramkumar Radhakrishnan | 59a1107 | 2013-04-15 16:14:49 -0700 | [diff] [blame] | 660 | if(!nYuvCount && mDpy) { |
| 661 | //Reset "No animation on external display" related parameters. |
| 662 | ctx->mPrevCropVideo.left = ctx->mPrevCropVideo.top = |
| 663 | ctx->mPrevCropVideo.right = ctx->mPrevCropVideo.bottom = 0; |
| 664 | ctx->mPrevDestVideo.left = ctx->mPrevDestVideo.top = |
| 665 | ctx->mPrevDestVideo.right = ctx->mPrevDestVideo.bottom = 0; |
| 666 | ctx->mPrevTransformVideo = 0; |
| 667 | return; |
| 668 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 669 | for(int index = 0;index < nYuvCount; index++){ |
| 670 | int nYuvIndex = ctx->listStats[mDpy].yuvIndices[index]; |
| 671 | hwc_layer_1_t* layer = &list->hwLayers[nYuvIndex]; |
| 672 | |
| 673 | if(!isYUVDoable(ctx, layer)) { |
| 674 | if(!mCurrentFrame.isFBComposed[nYuvIndex]) { |
| 675 | mCurrentFrame.isFBComposed[nYuvIndex] = true; |
| 676 | mCurrentFrame.fbCount++; |
| 677 | } |
| 678 | } else { |
| 679 | if(mCurrentFrame.isFBComposed[nYuvIndex]) { |
| 680 | mCurrentFrame.isFBComposed[nYuvIndex] = false; |
| 681 | mCurrentFrame.fbCount--; |
| 682 | } |
| 683 | } |
| 684 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 685 | |
| 686 | mCurrentFrame.mdpCount = mCurrentFrame.layerCount - |
| 687 | mCurrentFrame.fbCount; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 688 | ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__, |
| 689 | mCurrentFrame.fbCount); |
| 690 | } |
| 691 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 692 | bool MDPComp::programMDP(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 693 | if(!allocLayerPipes(ctx, list)) { |
| 694 | ALOGD_IF(isDebug(), "%s: Unable to allocate MDP pipes", __FUNCTION__); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 695 | return false; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 696 | } |
| 697 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 698 | bool fbBatch = false; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 699 | for (int index = 0, mdpNextZOrder = 0; index < mCurrentFrame.layerCount; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 700 | index++) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 701 | if(!mCurrentFrame.isFBComposed[index]) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 702 | int mdpIndex = mCurrentFrame.layerToMDP[index]; |
| 703 | hwc_layer_1_t* layer = &list->hwLayers[index]; |
| 704 | |
| 705 | MdpPipeInfo* cur_pipe = mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo; |
| 706 | cur_pipe->zOrder = mdpNextZOrder++; |
| 707 | |
| 708 | if(configure(ctx, layer, mCurrentFrame.mdpToLayer[mdpIndex]) != 0 ){ |
| 709 | ALOGD_IF(isDebug(), "%s: Failed to configure overlay for \ |
| 710 | layer %d",__FUNCTION__, index); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 711 | return false; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 712 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 713 | } else if(fbBatch == false) { |
| 714 | mdpNextZOrder++; |
| 715 | fbBatch = true; |
| 716 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 717 | } |
| 718 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 719 | return true; |
| 720 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 721 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 722 | bool MDPComp::programYUV(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
| 723 | if(!allocLayerPipes(ctx, list)) { |
| 724 | ALOGD_IF(isDebug(), "%s: Unable to allocate MDP pipes", __FUNCTION__); |
| 725 | return false; |
| 726 | } |
| 727 | //If we are in this block, it means we have yuv + rgb layers both |
| 728 | int mdpIdx = 0; |
| 729 | for (int index = 0; index < mCurrentFrame.layerCount; index++) { |
| 730 | if(!mCurrentFrame.isFBComposed[index]) { |
| 731 | hwc_layer_1_t* layer = &list->hwLayers[index]; |
| 732 | int mdpIndex = mCurrentFrame.layerToMDP[index]; |
| 733 | MdpPipeInfo* cur_pipe = |
| 734 | mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo; |
| 735 | cur_pipe->zOrder = mdpIdx++; |
| 736 | |
| 737 | if(configure(ctx, layer, |
| 738 | mCurrentFrame.mdpToLayer[mdpIndex]) != 0 ){ |
| 739 | ALOGD_IF(isDebug(), "%s: Failed to configure overlay for \ |
| 740 | layer %d",__FUNCTION__, index); |
| 741 | return false; |
| 742 | } |
| 743 | } |
| 744 | } |
| 745 | return true; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 746 | } |
| 747 | |
| 748 | int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 749 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 750 | const int numLayers = ctx->listStats[mDpy].numAppLayers; |
Ramkumar Radhakrishnan | c5893f1 | 2013-06-06 19:43:53 -0700 | [diff] [blame] | 751 | |
| 752 | //number of app layers exceeds MAX_NUM_APP_LAYERS fall back to GPU |
| 753 | //do not cache the information for next draw cycle. |
| 754 | if(numLayers > MAX_NUM_APP_LAYERS) { |
| 755 | ALOGD_IF(isDebug(), "%s: Number of App layers exceeded the limit ", |
| 756 | __FUNCTION__); |
| 757 | return 0; |
| 758 | } |
| 759 | //reset old data |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 760 | mCurrentFrame.reset(numLayers); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 761 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 762 | //Hard conditions, if not met, cannot do MDP comp |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 763 | if(!isFrameDoable(ctx)) { |
| 764 | ALOGD_IF( isDebug(),"%s: MDP Comp not possible for this frame", |
| 765 | __FUNCTION__); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 766 | mCurrentFrame.reset(numLayers); |
| 767 | mCachedFrame.cacheAll(list); |
| 768 | mCachedFrame.updateCounts(mCurrentFrame); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 769 | return 0; |
| 770 | } |
| 771 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 772 | //Check whether layers marked for MDP Composition is actually doable. |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 773 | if(isFullFrameDoable(ctx, list)){ |
Saurabh Shah | 2f3895f | 2013-05-02 10:13:31 -0700 | [diff] [blame] | 774 | mCurrentFrame.map(); |
| 775 | //Acquire and Program MDP pipes |
| 776 | if(!programMDP(ctx, list)) { |
| 777 | mCurrentFrame.reset(numLayers); |
| 778 | mCachedFrame.cacheAll(list); |
| 779 | } else { //Success |
| 780 | //Any change in composition types needs an FB refresh |
| 781 | mCurrentFrame.needsRedraw = false; |
| 782 | if(mCurrentFrame.fbCount && |
| 783 | ((mCurrentFrame.mdpCount != mCachedFrame.mdpCount) || |
| 784 | (mCurrentFrame.fbCount != mCachedFrame.cacheCount) || |
| 785 | (mCurrentFrame.fbZ != mCachedFrame.fbZ) || |
| 786 | (!mCurrentFrame.mdpCount) || |
| 787 | (list->flags & HWC_GEOMETRY_CHANGED) || |
| 788 | isSkipPresent(ctx, mDpy) || |
| 789 | (mDpy > HWC_DISPLAY_PRIMARY))) { |
| 790 | mCurrentFrame.needsRedraw = true; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 791 | } |
| 792 | } |
| 793 | } else if(isOnlyVideoDoable(ctx, list)) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 794 | //All layers marked for MDP comp cannot be bypassed. |
| 795 | //Try to compose atleast YUV layers through MDP comp and let |
| 796 | //all the RGB layers compose in FB |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 797 | //Destination over |
| 798 | mCurrentFrame.fbZ = -1; |
| 799 | if(mCurrentFrame.fbCount) |
Saurabh Shah | e8e7627 | 2013-06-12 16:08:06 -0700 | [diff] [blame] | 800 | mCurrentFrame.fbZ = mCurrentFrame.mdpCount; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 801 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 802 | mCurrentFrame.map(); |
| 803 | if(!programYUV(ctx, list)) { |
| 804 | mCurrentFrame.reset(numLayers); |
| 805 | mCachedFrame.cacheAll(list); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 806 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 807 | } else { |
| 808 | mCurrentFrame.reset(numLayers); |
| 809 | mCachedFrame.cacheAll(list); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 810 | } |
| 811 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 812 | //UpdateLayerFlags |
| 813 | setMDPCompLayerFlags(ctx, list); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 814 | mCachedFrame.updateCounts(mCurrentFrame); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 815 | |
| 816 | if(isDebug()) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 817 | ALOGD("GEOMETRY change: %d", (list->flags & HWC_GEOMETRY_CHANGED)); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 818 | android::String8 sDump(""); |
| 819 | dump(sDump); |
| 820 | ALOGE("%s",sDump.string()); |
| 821 | } |
| 822 | |
| 823 | return mCurrentFrame.fbZ; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 824 | } |
| 825 | |
| 826 | //=============MDPCompLowRes=================================================== |
| 827 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 828 | /* |
| 829 | * Configures pipe(s) for MDP composition |
| 830 | */ |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 831 | int MDPCompLowRes::configure(hwc_context_t *ctx, hwc_layer_1_t *layer, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 832 | PipeLayerPair& PipeLayerPair) { |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 833 | MdpPipeInfoLowRes& mdp_info = |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 834 | *(static_cast<MdpPipeInfoLowRes*>(PipeLayerPair.pipeInfo)); |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 835 | eMdpFlags mdpFlags = OV_MDP_BACKEND_COMPOSITION; |
| 836 | eZorder zOrder = static_cast<eZorder>(mdp_info.zOrder); |
| 837 | eIsFg isFg = IS_FG_OFF; |
| 838 | eDest dest = mdp_info.index; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 839 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 840 | ALOGD_IF(isDebug(),"%s: configuring: layer: %p z_order: %d dest_pipe: %d", |
| 841 | __FUNCTION__, layer, zOrder, dest); |
| 842 | |
| 843 | return configureLowRes(ctx, layer, mDpy, mdpFlags, zOrder, isFg, dest, |
| 844 | &PipeLayerPair.rot); |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 845 | } |
| 846 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 847 | int MDPCompLowRes::pipesNeeded(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 848 | hwc_display_contents_1_t* list) { |
| 849 | return mCurrentFrame.mdpCount; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 850 | } |
| 851 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 852 | bool MDPCompLowRes::allocLayerPipes(hwc_context_t *ctx, |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 853 | hwc_display_contents_1_t* list) { |
| 854 | for(int index = 0; index < mCurrentFrame.layerCount; index++) { |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 855 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 856 | if(mCurrentFrame.isFBComposed[index]) continue; |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 857 | |
Jeykumar Sankaran | cf53700 | 2013-01-21 21:19:15 -0800 | [diff] [blame] | 858 | hwc_layer_1_t* layer = &list->hwLayers[index]; |
| 859 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 860 | int mdpIndex = mCurrentFrame.layerToMDP[index]; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 861 | PipeLayerPair& info = mCurrentFrame.mdpToLayer[mdpIndex]; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 862 | info.pipeInfo = new MdpPipeInfoLowRes; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 863 | info.rot = NULL; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 864 | MdpPipeInfoLowRes& pipe_info = *(MdpPipeInfoLowRes*)info.pipeInfo; |
Jeykumar Sankaran | a37fdbf | 2013-03-06 18:59:28 -0800 | [diff] [blame] | 865 | ePipeType type = MDPCOMP_OV_ANY; |
| 866 | |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 867 | if(isYuvBuffer(hnd)) { |
| 868 | type = MDPCOMP_OV_VG; |
Saurabh Shah | 8a11793 | 2013-05-23 12:48:13 -0700 | [diff] [blame] | 869 | } else if(!qhwc::needsScaling(ctx, layer, mDpy) |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 870 | && Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE |
| 871 | && ctx->mMDP.version >= qdutils::MDSS_V5) { |
Jeykumar Sankaran | a37fdbf | 2013-03-06 18:59:28 -0800 | [diff] [blame] | 872 | type = MDPCOMP_OV_DMA; |
| 873 | } |
| 874 | |
| 875 | pipe_info.index = getMdpPipe(ctx, type); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 876 | if(pipe_info.index == ovutils::OV_INVALID) { |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 877 | ALOGD_IF(isDebug(), "%s: Unable to get pipe type = %d", |
| 878 | __FUNCTION__, (int) type); |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 879 | return false; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 880 | } |
| 881 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 882 | return true; |
| 883 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 884 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 885 | bool MDPCompLowRes::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 886 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 887 | if(!isEnabled()) { |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 888 | ALOGD_IF(isDebug(),"%s: MDP Comp not configured", __FUNCTION__); |
| 889 | return true; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 890 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 891 | |
| 892 | if(!ctx || !list) { |
| 893 | ALOGE("%s: invalid contxt or list",__FUNCTION__); |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 894 | return false; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 895 | } |
| 896 | |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 897 | /* reset Invalidator */ |
Saurabh Shah | 2d998a9 | 2013-05-14 17:55:58 -0700 | [diff] [blame] | 898 | if(idleInvalidator && !sIdleFallBack && mCurrentFrame.mdpCount) |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 899 | idleInvalidator->markForSleep(); |
| 900 | |
| 901 | overlay::Overlay& ov = *ctx->mOverlay; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 902 | LayerProp *layerProp = ctx->layerProp[mDpy]; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 903 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 904 | int numHwLayers = ctx->listStats[mDpy].numAppLayers; |
| 905 | for(int i = 0; i < numHwLayers && mCurrentFrame.mdpCount; i++ ) |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 906 | { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 907 | if(mCurrentFrame.isFBComposed[i]) continue; |
| 908 | |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 909 | hwc_layer_1_t *layer = &list->hwLayers[i]; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 910 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 911 | if(!hnd) { |
| 912 | ALOGE("%s handle null", __FUNCTION__); |
| 913 | return false; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 914 | } |
| 915 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 916 | int mdpIndex = mCurrentFrame.layerToMDP[i]; |
| 917 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 918 | MdpPipeInfoLowRes& pipe_info = |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 919 | *(MdpPipeInfoLowRes*)mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 920 | ovutils::eDest dest = pipe_info.index; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 921 | if(dest == ovutils::OV_INVALID) { |
| 922 | ALOGE("%s: Invalid pipe index (%d)", __FUNCTION__, dest); |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 923 | return false; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 924 | } |
| 925 | |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 926 | if(!(layerProp[i].mFlags & HWC_MDPCOMP)) { |
| 927 | continue; |
| 928 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 929 | |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 930 | ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 931 | using pipe: %d", __FUNCTION__, layer, |
| 932 | hnd, dest ); |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 933 | |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 934 | int fd = hnd->fd; |
| 935 | uint32_t offset = hnd->offset; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 936 | Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 937 | if(rot) { |
| 938 | if(!rot->queueBuffer(fd, offset)) |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 939 | return false; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 940 | fd = rot->getDstMemId(); |
| 941 | offset = rot->getDstOffset(); |
| 942 | } |
| 943 | |
| 944 | if (!ov.queueBuffer(fd, offset, dest)) { |
| 945 | ALOGE("%s: queueBuffer failed for external", __FUNCTION__); |
| 946 | return false; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 947 | } |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 948 | |
| 949 | layerProp[i].mFlags &= ~HWC_MDPCOMP; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 950 | } |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 951 | return true; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 952 | } |
| 953 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 954 | //=============MDPCompHighRes=================================================== |
| 955 | |
| 956 | int MDPCompHighRes::pipesNeeded(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 957 | hwc_display_contents_1_t* list) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 958 | int pipesNeeded = 0; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 959 | int hw_w = ctx->dpyAttr[mDpy].xres; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 960 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 961 | for(int i = 0; i < mCurrentFrame.layerCount; ++i) { |
| 962 | if(!mCurrentFrame.isFBComposed[i]) { |
| 963 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
| 964 | hwc_rect_t dst = layer->displayFrame; |
| 965 | if(dst.left > hw_w/2) { |
| 966 | pipesNeeded++; |
| 967 | } else if(dst.right <= hw_w/2) { |
| 968 | pipesNeeded++; |
| 969 | } else { |
| 970 | pipesNeeded += 2; |
| 971 | } |
| 972 | } |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 973 | } |
| 974 | return pipesNeeded; |
| 975 | } |
| 976 | |
| 977 | bool MDPCompHighRes::acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 978 | MdpPipeInfoHighRes& pipe_info, |
| 979 | ePipeType type) { |
| 980 | int hw_w = ctx->dpyAttr[mDpy].xres; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 981 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 982 | hwc_rect_t dst = layer->displayFrame; |
| 983 | if(dst.left > hw_w/2) { |
| 984 | pipe_info.lIndex = ovutils::OV_INVALID; |
| 985 | pipe_info.rIndex = getMdpPipe(ctx, type); |
| 986 | if(pipe_info.rIndex == ovutils::OV_INVALID) |
| 987 | return false; |
| 988 | } else if (dst.right <= hw_w/2) { |
| 989 | pipe_info.rIndex = ovutils::OV_INVALID; |
| 990 | pipe_info.lIndex = getMdpPipe(ctx, type); |
| 991 | if(pipe_info.lIndex == ovutils::OV_INVALID) |
| 992 | return false; |
| 993 | } else { |
| 994 | pipe_info.rIndex = getMdpPipe(ctx, type); |
| 995 | pipe_info.lIndex = getMdpPipe(ctx, type); |
| 996 | if(pipe_info.rIndex == ovutils::OV_INVALID || |
| 997 | pipe_info.lIndex == ovutils::OV_INVALID) |
| 998 | return false; |
| 999 | } |
| 1000 | return true; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1001 | } |
| 1002 | |
| 1003 | bool MDPCompHighRes::allocLayerPipes(hwc_context_t *ctx, |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1004 | hwc_display_contents_1_t* list) { |
| 1005 | for(int index = 0 ; index < mCurrentFrame.layerCount; index++) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1006 | |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1007 | if(mCurrentFrame.isFBComposed[index]) continue; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1008 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1009 | hwc_layer_1_t* layer = &list->hwLayers[index]; |
| 1010 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
Saurabh Shah | 0d65dbe | 2013-06-06 18:33:16 -0700 | [diff] [blame] | 1011 | int mdpIndex = mCurrentFrame.layerToMDP[index]; |
| 1012 | PipeLayerPair& info = mCurrentFrame.mdpToLayer[mdpIndex]; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1013 | info.pipeInfo = new MdpPipeInfoHighRes; |
Saurabh Shah | 9e3adb2 | 2013-03-26 11:16:27 -0700 | [diff] [blame] | 1014 | info.rot = NULL; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1015 | MdpPipeInfoHighRes& pipe_info = *(MdpPipeInfoHighRes*)info.pipeInfo; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1016 | ePipeType type = MDPCOMP_OV_ANY; |
| 1017 | |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1018 | if(isYuvBuffer(hnd)) { |
| 1019 | type = MDPCOMP_OV_VG; |
Saurabh Shah | 8a11793 | 2013-05-23 12:48:13 -0700 | [diff] [blame] | 1020 | } else if(!qhwc::needsScaling(ctx, layer, mDpy) |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 1021 | && Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1022 | && ctx->mMDP.version >= qdutils::MDSS_V5) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1023 | type = MDPCOMP_OV_DMA; |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1024 | } |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1025 | |
| 1026 | if(!acquireMDPPipes(ctx, layer, pipe_info, type)) { |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1027 | ALOGD_IF(isDebug(), "%s: Unable to get pipe for type = %d", |
| 1028 | __FUNCTION__, (int) type); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1029 | return false; |
| 1030 | } |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1031 | } |
| 1032 | return true; |
| 1033 | } |
| 1034 | /* |
| 1035 | * Configures pipe(s) for MDP composition |
| 1036 | */ |
| 1037 | int MDPCompHighRes::configure(hwc_context_t *ctx, hwc_layer_1_t *layer, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1038 | PipeLayerPair& PipeLayerPair) { |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1039 | MdpPipeInfoHighRes& mdp_info = |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1040 | *(static_cast<MdpPipeInfoHighRes*>(PipeLayerPair.pipeInfo)); |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1041 | eZorder zOrder = static_cast<eZorder>(mdp_info.zOrder); |
| 1042 | eIsFg isFg = IS_FG_OFF; |
| 1043 | eMdpFlags mdpFlagsL = OV_MDP_BACKEND_COMPOSITION; |
| 1044 | eDest lDest = mdp_info.lIndex; |
| 1045 | eDest rDest = mdp_info.rIndex; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1046 | |
| 1047 | ALOGD_IF(isDebug(),"%s: configuring: layer: %p z_order: %d dest_pipeL: %d" |
| 1048 | "dest_pipeR: %d",__FUNCTION__, layer, zOrder, lDest, rDest); |
| 1049 | |
| 1050 | return configureHighRes(ctx, layer, mDpy, mdpFlagsL, zOrder, isFg, lDest, |
| 1051 | rDest, &PipeLayerPair.rot); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1052 | } |
| 1053 | |
| 1054 | bool MDPCompHighRes::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
| 1055 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1056 | if(!isEnabled()) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1057 | ALOGD_IF(isDebug(),"%s: MDP Comp not configured", __FUNCTION__); |
| 1058 | return true; |
| 1059 | } |
| 1060 | |
| 1061 | if(!ctx || !list) { |
| 1062 | ALOGE("%s: invalid contxt or list",__FUNCTION__); |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1063 | return false; |
| 1064 | } |
| 1065 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1066 | /* reset Invalidator */ |
Saurabh Shah | 2d998a9 | 2013-05-14 17:55:58 -0700 | [diff] [blame] | 1067 | if(idleInvalidator && !sIdleFallBack && mCurrentFrame.mdpCount) |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1068 | idleInvalidator->markForSleep(); |
| 1069 | |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 1070 | overlay::Overlay& ov = *ctx->mOverlay; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1071 | LayerProp *layerProp = ctx->layerProp[mDpy]; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1072 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1073 | int numHwLayers = ctx->listStats[mDpy].numAppLayers; |
| 1074 | for(int i = 0; i < numHwLayers && mCurrentFrame.mdpCount; i++ ) |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1075 | { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1076 | if(mCurrentFrame.isFBComposed[i]) continue; |
| 1077 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1078 | hwc_layer_1_t *layer = &list->hwLayers[i]; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1079 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 1080 | if(!hnd) { |
| 1081 | ALOGE("%s handle null", __FUNCTION__); |
| 1082 | return false; |
| 1083 | } |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1084 | |
| 1085 | if(!(layerProp[i].mFlags & HWC_MDPCOMP)) { |
| 1086 | continue; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1087 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1088 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1089 | int mdpIndex = mCurrentFrame.layerToMDP[i]; |
| 1090 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1091 | MdpPipeInfoHighRes& pipe_info = |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1092 | *(MdpPipeInfoHighRes*)mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo; |
| 1093 | Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1094 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1095 | ovutils::eDest indexL = pipe_info.lIndex; |
| 1096 | ovutils::eDest indexR = pipe_info.rIndex; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1097 | |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1098 | int fd = hnd->fd; |
| 1099 | int offset = hnd->offset; |
| 1100 | |
| 1101 | if(rot) { |
| 1102 | rot->queueBuffer(fd, offset); |
| 1103 | fd = rot->getDstMemId(); |
| 1104 | offset = rot->getDstOffset(); |
| 1105 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1106 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1107 | //************* play left mixer ********** |
| 1108 | if(indexL != ovutils::OV_INVALID) { |
| 1109 | ovutils::eDest destL = (ovutils::eDest)indexL; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1110 | ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1111 | using pipe: %d", __FUNCTION__, layer, hnd, indexL ); |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1112 | if (!ov.queueBuffer(fd, offset, destL)) { |
| 1113 | ALOGE("%s: queueBuffer failed for left mixer", __FUNCTION__); |
| 1114 | return false; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1115 | } |
| 1116 | } |
| 1117 | |
| 1118 | //************* play right mixer ********** |
| 1119 | if(indexR != ovutils::OV_INVALID) { |
| 1120 | ovutils::eDest destR = (ovutils::eDest)indexR; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1121 | ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1122 | using pipe: %d", __FUNCTION__, layer, hnd, indexR ); |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1123 | if (!ov.queueBuffer(fd, offset, destR)) { |
| 1124 | ALOGE("%s: queueBuffer failed for right mixer", __FUNCTION__); |
| 1125 | return false; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1126 | } |
| 1127 | } |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1128 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1129 | layerProp[i].mFlags &= ~HWC_MDPCOMP; |
| 1130 | } |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1131 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1132 | return true; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1133 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1134 | }; //namespace |
| 1135 | |