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