blob: 0e11590938839d784956f64c076ebabdf518f3fe [file] [log] [blame]
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001/*
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08002 * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved.
Naseer Ahmed7c958d42012-07-31 18:57:03 -07003 * 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 Shah4fdde762013-04-30 18:47:33 -070019#include <math.h>
Naseer Ahmed7c958d42012-07-31 18:57:03 -070020#include "hwc_mdpcomp.h"
Naseer Ahmed54821fe2012-11-28 18:44:38 -050021#include <sys/ioctl.h>
Saurabh Shah56f610d2012-08-07 15:27:06 -070022#include "external.h"
Ramkumar Radhakrishnan47573e22012-11-07 11:36:41 -080023#include "qdMetaData.h"
Ramkumar Radhakrishnan288f8c72013-01-15 11:37:54 -080024#include "mdp_version.h"
Saurabh Shahacf10202013-02-26 10:15:15 -080025#include <overlayRotator.h>
26
Saurabh Shah85234ec2013-04-12 17:09:00 -070027using namespace overlay;
Saurabh Shahbd2d0832013-04-04 14:33:08 -070028using namespace qdutils;
Saurabh Shahacf10202013-02-26 10:15:15 -080029using namespace overlay::utils;
30namespace ovutils = overlay::utils;
Naseer Ahmed7c958d42012-07-31 18:57:03 -070031
Naseer Ahmed7c958d42012-07-31 18:57:03 -070032namespace qhwc {
33
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080034//==============MDPComp========================================================
35
Naseer Ahmed7c958d42012-07-31 18:57:03 -070036IdleInvalidator *MDPComp::idleInvalidator = NULL;
37bool MDPComp::sIdleFallBack = false;
38bool MDPComp::sDebugLogs = false;
Naseer Ahmed54821fe2012-11-28 18:44:38 -050039bool MDPComp::sEnabled = false;
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -070040bool MDPComp::sEnableMixedMode = true;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080041int MDPComp::sMaxPipesPerMixer = MAX_PIPES_PER_MIXER;
Naseer Ahmed7c958d42012-07-31 18:57:03 -070042
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080043MDPComp* MDPComp::getObject(const int& width, int dpy) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080044 if(width <= MAX_DISPLAY_DIM) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080045 return new MDPCompLowRes(dpy);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080046 } else {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080047 return new MDPCompHighRes(dpy);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080048 }
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080049}
50
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080051MDPComp::MDPComp(int dpy):mDpy(dpy){};
52
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080053void MDPComp::dump(android::String8& buf)
54{
Prabhanjan Kandula088bd892013-07-02 23:47:13 +053055 Locker::Autolock _l(mMdpCompLock);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080056 dumpsys_log(buf,"HWC Map for Dpy: %s \n",
57 mDpy ? "\"EXTERNAL\"" : "\"PRIMARY\"");
58 dumpsys_log(buf,"PREV_FRAME: layerCount:%2d mdpCount:%2d \
59 cacheCount:%2d \n", mCachedFrame.layerCount,
60 mCachedFrame.mdpCount, mCachedFrame.cacheCount);
61 dumpsys_log(buf,"CURR_FRAME: layerCount:%2d mdpCount:%2d \
62 fbCount:%2d \n", mCurrentFrame.layerCount,
63 mCurrentFrame.mdpCount, mCurrentFrame.fbCount);
64 dumpsys_log(buf,"needsFBRedraw:%3s pipesUsed:%2d MaxPipesPerMixer: %d \n",
65 (mCurrentFrame.needsRedraw? "YES" : "NO"),
66 mCurrentFrame.mdpCount, sMaxPipesPerMixer);
67 dumpsys_log(buf," --------------------------------------------- \n");
68 dumpsys_log(buf," listIdx | cached? | mdpIndex | comptype | Z \n");
69 dumpsys_log(buf," --------------------------------------------- \n");
70 for(int index = 0; index < mCurrentFrame.layerCount; index++ )
71 dumpsys_log(buf," %7d | %7s | %8d | %9s | %2d \n",
72 index,
73 (mCurrentFrame.isFBComposed[index] ? "YES" : "NO"),
74 mCurrentFrame.layerToMDP[index],
75 (mCurrentFrame.isFBComposed[index] ?
76 (mCurrentFrame.needsRedraw ? "GLES" : "CACHE") : "MDP"),
77 (mCurrentFrame.isFBComposed[index] ? mCurrentFrame.fbZ :
78 mCurrentFrame.mdpToLayer[mCurrentFrame.layerToMDP[index]].pipeInfo->zOrder));
79 dumpsys_log(buf,"\n");
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080080}
81
82bool MDPComp::init(hwc_context_t *ctx) {
83
84 if(!ctx) {
85 ALOGE("%s: Invalid hwc context!!",__FUNCTION__);
86 return false;
87 }
88
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080089 char property[PROPERTY_VALUE_MAX];
90
91 sEnabled = false;
92 if((property_get("persist.hwc.mdpcomp.enable", property, NULL) > 0) &&
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080093 (!strncmp(property, "1", PROPERTY_VALUE_MAX ) ||
94 (!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080095 sEnabled = true;
Xiaoming Zhou944e02e2013-05-01 20:54:03 -040096 if(!setupBasePipe(ctx)) {
97 ALOGE("%s: Failed to setup primary base pipe", __FUNCTION__);
98 return false;
99 }
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800100 }
101
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700102 sEnableMixedMode = true;
103 if((property_get("debug.mdpcomp.mixedmode.disable", property, NULL) > 0) &&
104 (!strncmp(property, "1", PROPERTY_VALUE_MAX ) ||
105 (!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) {
106 sEnableMixedMode = false;
107 }
108
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800109 sDebugLogs = false;
110 if(property_get("debug.mdpcomp.logs", property, NULL) > 0) {
111 if(atoi(property) != 0)
112 sDebugLogs = true;
113 }
114
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800115 sMaxPipesPerMixer = MAX_PIPES_PER_MIXER;
Saurabh Shah85234ec2013-04-12 17:09:00 -0700116 if(property_get("debug.mdpcomp.maxpermixer", property, "-1") > 0) {
117 int val = atoi(property);
118 if(val >= 0)
119 sMaxPipesPerMixer = min(val, MAX_PIPES_PER_MIXER);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800120 }
121
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800122 unsigned long idle_timeout = DEFAULT_IDLE_TIME;
123 if(property_get("debug.mdpcomp.idletime", property, NULL) > 0) {
124 if(atoi(property) != 0)
125 idle_timeout = atoi(property);
126 }
127
128 //create Idle Invalidator
129 idleInvalidator = IdleInvalidator::getInstance();
130
131 if(idleInvalidator == NULL) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800132 ALOGE("%s: failed to instantiate idleInvalidator object", __FUNCTION__);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800133 } else {
134 idleInvalidator->init(timeout_handler, ctx, idle_timeout);
135 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700136 return true;
137}
138
139void MDPComp::timeout_handler(void *udata) {
140 struct hwc_context_t* ctx = (struct hwc_context_t*)(udata);
141
142 if(!ctx) {
143 ALOGE("%s: received empty data in timer callback", __FUNCTION__);
144 return;
145 }
146
Jesse Hall3be78d92012-08-21 15:12:23 -0700147 if(!ctx->proc) {
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700148 ALOGE("%s: HWC proc not registered", __FUNCTION__);
149 return;
150 }
151 sIdleFallBack = true;
152 /* Trigger SF to redraw the current frame */
Jesse Hall3be78d92012-08-21 15:12:23 -0700153 ctx->proc->invalidate(ctx->proc);
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700154}
155
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800156void MDPComp::setMDPCompLayerFlags(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800157 hwc_display_contents_1_t* list) {
158 LayerProp *layerProp = ctx->layerProp[mDpy];
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800159
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800160 for(int index = 0; index < ctx->listStats[mDpy].numAppLayers; index++) {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800161 hwc_layer_1_t* layer = &(list->hwLayers[index]);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800162 if(!mCurrentFrame.isFBComposed[index]) {
163 layerProp[index].mFlags |= HWC_MDPCOMP;
164 layer->compositionType = HWC_OVERLAY;
165 layer->hints |= HWC_HINT_CLEAR_FB;
166 mCachedFrame.hnd[index] = NULL;
167 } else {
168 if(!mCurrentFrame.needsRedraw)
169 layer->compositionType = HWC_OVERLAY;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800170 }
171 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700172}
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500173
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800174/*
175 * Sets up BORDERFILL as default base pipe and detaches RGB0.
176 * Framebuffer is always updated using PLAY ioctl.
177 */
178bool MDPComp::setupBasePipe(hwc_context_t *ctx) {
179 const int dpy = HWC_DISPLAY_PRIMARY;
180 int fb_stride = ctx->dpyAttr[dpy].stride;
181 int fb_width = ctx->dpyAttr[dpy].xres;
182 int fb_height = ctx->dpyAttr[dpy].yres;
183 int fb_fd = ctx->dpyAttr[dpy].fd;
184
185 mdp_overlay ovInfo;
186 msmfb_overlay_data ovData;
187 memset(&ovInfo, 0, sizeof(mdp_overlay));
188 memset(&ovData, 0, sizeof(msmfb_overlay_data));
189
190 ovInfo.src.format = MDP_RGB_BORDERFILL;
191 ovInfo.src.width = fb_width;
192 ovInfo.src.height = fb_height;
193 ovInfo.src_rect.w = fb_width;
194 ovInfo.src_rect.h = fb_height;
195 ovInfo.dst_rect.w = fb_width;
196 ovInfo.dst_rect.h = fb_height;
197 ovInfo.id = MSMFB_NEW_REQUEST;
198
199 if (ioctl(fb_fd, MSMFB_OVERLAY_SET, &ovInfo) < 0) {
200 ALOGE("Failed to call ioctl MSMFB_OVERLAY_SET err=%s",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800201 strerror(errno));
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800202 return false;
203 }
204
205 ovData.id = ovInfo.id;
206 if (ioctl(fb_fd, MSMFB_OVERLAY_PLAY, &ovData) < 0) {
207 ALOGE("Failed to call ioctl MSMFB_OVERLAY_PLAY err=%s",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800208 strerror(errno));
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800209 return false;
210 }
211 return true;
212}
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800213MDPComp::FrameInfo::FrameInfo() {
Saurabh Shahaa236822013-04-24 18:07:26 -0700214 reset(0);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800215}
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800216
Saurabh Shahaa236822013-04-24 18:07:26 -0700217void MDPComp::FrameInfo::reset(const int& numLayers) {
218 for(int i = 0 ; i < MAX_PIPES_PER_MIXER && numLayers; i++ ) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800219 if(mdpToLayer[i].pipeInfo) {
220 delete mdpToLayer[i].pipeInfo;
221 mdpToLayer[i].pipeInfo = NULL;
222 //We dont own the rotator
223 mdpToLayer[i].rot = NULL;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800224 }
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800225 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800226
227 memset(&mdpToLayer, 0, sizeof(mdpToLayer));
228 memset(&layerToMDP, -1, sizeof(layerToMDP));
Saurabh Shahaa236822013-04-24 18:07:26 -0700229 memset(&isFBComposed, 1, sizeof(isFBComposed));
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800230
Saurabh Shahaa236822013-04-24 18:07:26 -0700231 layerCount = numLayers;
232 fbCount = numLayers;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800233 mdpCount = 0;
Saurabh Shah2f3895f2013-05-02 10:13:31 -0700234 needsRedraw = true;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800235 fbZ = 0;
236}
237
Saurabh Shahaa236822013-04-24 18:07:26 -0700238void MDPComp::FrameInfo::map() {
239 // populate layer and MDP maps
240 int mdpIdx = 0;
241 for(int idx = 0; idx < layerCount; idx++) {
242 if(!isFBComposed[idx]) {
243 mdpToLayer[mdpIdx].listIndex = idx;
244 layerToMDP[idx] = mdpIdx++;
245 }
246 }
247}
248
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800249MDPComp::LayerCache::LayerCache() {
250 reset();
251}
252
253void MDPComp::LayerCache::reset() {
Saurabh Shahaa236822013-04-24 18:07:26 -0700254 memset(&hnd, 0, sizeof(hnd));
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800255 mdpCount = 0;
256 cacheCount = 0;
257 layerCount = 0;
Saurabh Shahaa236822013-04-24 18:07:26 -0700258 fbZ = -1;
259}
260
261void MDPComp::LayerCache::cacheAll(hwc_display_contents_1_t* list) {
262 const int numAppLayers = list->numHwLayers - 1;
263 for(int i = 0; i < numAppLayers; i++) {
264 hnd[i] = list->hwLayers[i].handle;
265 }
266}
267
268void MDPComp::LayerCache::updateCounts(const FrameInfo& curFrame) {
269 mdpCount = curFrame.mdpCount;
270 cacheCount = curFrame.fbCount;
271 layerCount = curFrame.layerCount;
272 fbZ = curFrame.fbZ;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800273}
274
Sravan Kumar D.V.Nad5d9292013-04-24 14:23:04 +0530275bool MDPComp::isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer) {
Saurabh Shah4fdde762013-04-30 18:47:33 -0700276 const int dpy = HWC_DISPLAY_PRIMARY;
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800277 private_handle_t *hnd = (private_handle_t *)layer->handle;
278
279 if(!hnd) {
280 ALOGE("%s: layer handle is NULL", __FUNCTION__);
281 return false;
282 }
283
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800284 int hw_w = ctx->dpyAttr[mDpy].xres;
285 int hw_h = ctx->dpyAttr[mDpy].yres;
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800286
Saurabh Shah4fdde762013-04-30 18:47:33 -0700287 hwc_rect_t crop = layer->sourceCrop;
288 hwc_rect_t dst = layer->displayFrame;
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800289
290 if(dst.left < 0 || dst.top < 0 || dst.right > hw_w || dst.bottom > hw_h) {
Saurabh Shah4fdde762013-04-30 18:47:33 -0700291 hwc_rect_t scissor = {0, 0, hw_w, hw_h };
292 qhwc::calculate_crop_rects(crop, dst, scissor, layer->transform);
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800293 }
294
Saurabh Shah4fdde762013-04-30 18:47:33 -0700295 int crop_w = crop.right - crop.left;
296 int crop_h = crop.bottom - crop.top;
297 int dst_w = dst.right - dst.left;
298 int dst_h = dst.bottom - dst.top;
299 float w_dscale = ceilf((float)crop_w / (float)dst_w);
300 float h_dscale = ceilf((float)crop_h / (float)dst_h);
301
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800302 /* Workaround for MDP HW limitation in DSI command mode panels where
303 * FPS will not go beyond 30 if buffers on RGB pipes are of width or height
304 * less than 5 pixels
Sravan Kumar D.V.Nad5d9292013-04-24 14:23:04 +0530305 * There also is a HW limilation in MDP, minimum block size is 2x2
306 * Fallback to GPU if height is less than 2.
307 */
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800308 if((crop_w < 5)||(crop_h < 5))
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800309 return false;
310
Saurabh Shah4fdde762013-04-30 18:47:33 -0700311 const uint32_t downscale =
312 qdutils::MDPVersion::getInstance().getMaxMDPDownscale();
313 if(ctx->mMDP.version >= qdutils::MDSS_V5) {
314 /* Workaround for downscales larger than 4x.
315 * Will be removed once decimator block is enabled for MDSS
316 */
317 if(!qdutils::MDPVersion::getInstance().supportsDecimation()) {
318 if(crop_w > MAX_DISPLAY_DIM || w_dscale > downscale ||
319 h_dscale > downscale)
320 return false;
321 } else {
322 if(w_dscale > 64 || h_dscale > 64)
323 return false;
324 }
325 } else { //A-family
326 if(w_dscale > downscale || h_dscale > downscale)
327 return false;
328 }
329
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800330 return true;
331}
332
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800333ovutils::eDest MDPComp::getMdpPipe(hwc_context_t *ctx, ePipeType type) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800334 overlay::Overlay& ov = *ctx->mOverlay;
335 ovutils::eDest mdp_pipe = ovutils::OV_INVALID;
336
337 switch(type) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800338 case MDPCOMP_OV_DMA:
339 mdp_pipe = ov.nextPipe(ovutils::OV_MDP_PIPE_DMA, mDpy);
340 if(mdp_pipe != ovutils::OV_INVALID) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800341 return mdp_pipe;
342 }
343 case MDPCOMP_OV_ANY:
344 case MDPCOMP_OV_RGB:
345 mdp_pipe = ov.nextPipe(ovutils::OV_MDP_PIPE_RGB, mDpy);
346 if(mdp_pipe != ovutils::OV_INVALID) {
347 return mdp_pipe;
348 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800349
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800350 if(type == MDPCOMP_OV_RGB) {
351 //Requested only for RGB pipe
352 break;
353 }
354 case MDPCOMP_OV_VG:
355 return ov.nextPipe(ovutils::OV_MDP_PIPE_VG, mDpy);
356 default:
357 ALOGE("%s: Invalid pipe type",__FUNCTION__);
358 return ovutils::OV_INVALID;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800359 };
360 return ovutils::OV_INVALID;
361}
362
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800363bool MDPComp::isFrameDoable(hwc_context_t *ctx) {
Saurabh Shahaa236822013-04-24 18:07:26 -0700364 bool ret = true;
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700365 const int numAppLayers = ctx->listStats[mDpy].numAppLayers;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800366
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800367 if(!isEnabled()) {
368 ALOGD_IF(isDebug(),"%s: MDP Comp. not enabled.", __FUNCTION__);
Saurabh Shahaa236822013-04-24 18:07:26 -0700369 ret = false;
Saurabh Shahd4e65852013-06-17 11:33:53 -0700370 } else if(qdutils::MDPVersion::getInstance().is8x26() &&
371 ctx->mVideoTransFlag &&
372 ctx->mExtDisplay->isExternalConnected()) {
373 //1 Padding round to shift pipes across mixers
374 ALOGD_IF(isDebug(),"%s: MDP Comp. video transition padding round",
375 __FUNCTION__);
376 ret = false;
Saurabh Shahaa236822013-04-24 18:07:26 -0700377 } else if(ctx->mExtDispConfiguring) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800378 ALOGD_IF( isDebug(),"%s: External Display connection is pending",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800379 __FUNCTION__);
Saurabh Shahaa236822013-04-24 18:07:26 -0700380 ret = false;
Saurabh Shahaa236822013-04-24 18:07:26 -0700381 } else if(ctx->isPaddingRound) {
Saurabh Shah0ceeb6a2013-04-23 10:46:07 -0700382 ctx->isPaddingRound = false;
383 ALOGD_IF(isDebug(), "%s: padding round",__FUNCTION__);
Saurabh Shahaa236822013-04-24 18:07:26 -0700384 ret = false;
Saurabh Shah0ceeb6a2013-04-23 10:46:07 -0700385 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700386 return ret;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800387}
388
389/* Checks for conditions where all the layers marked for MDP comp cannot be
390 * bypassed. On such conditions we try to bypass atleast YUV layers */
391bool MDPComp::isFullFrameDoable(hwc_context_t *ctx,
392 hwc_display_contents_1_t* list){
393
Saurabh Shahaa236822013-04-24 18:07:26 -0700394 const int numAppLayers = ctx->listStats[mDpy].numAppLayers;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800395
Saurabh Shah2d998a92013-05-14 17:55:58 -0700396 if(sIdleFallBack) {
397 ALOGD_IF(isDebug(), "%s: Idle fallback dpy %d",__FUNCTION__, mDpy);
398 return false;
399 }
400
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800401 if(mDpy > HWC_DISPLAY_PRIMARY){
402 ALOGD_IF(isDebug(), "%s: Cannot support External display(s)",
403 __FUNCTION__);
404 return false;
405 }
406
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800407 if(isSkipPresent(ctx, mDpy)) {
Saurabh Shahaa236822013-04-24 18:07:26 -0700408 ALOGD_IF(isDebug(),"%s: SKIP present: %d",
409 __FUNCTION__,
410 isSkipPresent(ctx, mDpy));
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800411 return false;
412 }
413
Saurabh Shah9f084ad2013-05-02 11:28:09 -0700414 if(ctx->listStats[mDpy].needsAlphaScale
415 && ctx->mMDP.version < qdutils::MDSS_V5) {
416 ALOGD_IF(isDebug(), "%s: frame needs alpha downscaling",__FUNCTION__);
417 return false;
418 }
419
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800420 //MDP composition is not efficient if layer needs rotator.
421 for(int i = 0; i < numAppLayers; ++i) {
422 // As MDP h/w supports flip operation, use MDP comp only for
423 // 180 transforms. Fail for any transform involving 90 (90, 270).
424 hwc_layer_1_t* layer = &list->hwLayers[i];
425 private_handle_t *hnd = (private_handle_t *)layer->handle;
Jeykumar Sankarana37fdbf2013-03-06 18:59:28 -0800426
Saurabh Shah4fdde762013-04-30 18:47:33 -0700427 if((layer->transform & HWC_TRANSFORM_ROT_90) && !isYuvBuffer(hnd)) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800428 ALOGD_IF(isDebug(), "%s: orientation involved",__FUNCTION__);
429 return false;
430 }
431
Saurabh Shah4fdde762013-04-30 18:47:33 -0700432 if(!isValidDimension(ctx,layer)) {
433 ALOGD_IF(isDebug(), "%s: Buffer is of invalid width",
434 __FUNCTION__);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800435 return false;
436 }
Prabhanjan Kandula9fb032a2013-06-18 17:37:22 +0530437
438 //For 8x26 with panel width>1k, if RGB layer needs HFLIP fail mdp comp
439 // may not need it if Gfx pre-rotation can handle all flips & rotations
440 if(qdutils::MDPVersion::getInstance().is8x26() &&
441 (ctx->dpyAttr[mDpy].xres > 1024) &&
442 (layer->transform & HWC_TRANSFORM_FLIP_H) &&
443 (!isYuvBuffer(hnd)))
444 return false;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800445 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700446
447 //If all above hard conditions are met we can do full or partial MDP comp.
448 bool ret = false;
449 if(fullMDPComp(ctx, list)) {
450 ret = true;
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700451 } else if(partialMDPComp(ctx, list)) {
Saurabh Shahaa236822013-04-24 18:07:26 -0700452 ret = true;
453 }
454 return ret;
455}
456
457bool MDPComp::fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
458 //Setup mCurrentFrame
459 mCurrentFrame.mdpCount = mCurrentFrame.layerCount;
460 mCurrentFrame.fbCount = 0;
461 mCurrentFrame.fbZ = -1;
462 memset(&mCurrentFrame.isFBComposed, 0, sizeof(mCurrentFrame.isFBComposed));
463
464 int mdpCount = mCurrentFrame.mdpCount;
465 if(mdpCount > sMaxPipesPerMixer) {
466 ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
467 return false;
468 }
469
470 int numPipesNeeded = pipesNeeded(ctx, list);
471 int availPipes = getAvailablePipes(ctx);
472
473 if(numPipesNeeded > availPipes) {
474 ALOGD_IF(isDebug(), "%s: Insufficient MDP pipes, needed %d, avail %d",
475 __FUNCTION__, numPipesNeeded, availPipes);
476 return false;
477 }
478
479 return true;
480}
481
482bool MDPComp::partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list)
483{
484 int numAppLayers = ctx->listStats[mDpy].numAppLayers;
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700485
486 if(!sEnableMixedMode) {
487 //Mixed mode is disabled. No need to even try caching.
488 return false;
489 }
490
Saurabh Shahaa236822013-04-24 18:07:26 -0700491 //Setup mCurrentFrame
492 mCurrentFrame.reset(numAppLayers);
493 updateLayerCache(ctx, list);
494 updateYUV(ctx, list);
495 batchLayers(); //sets up fbZ also
496
497 int mdpCount = mCurrentFrame.mdpCount;
498 if(mdpCount > (sMaxPipesPerMixer - 1)) { // -1 since FB is used
499 ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
500 return false;
501 }
502
503 int numPipesNeeded = pipesNeeded(ctx, list);
504 int availPipes = getAvailablePipes(ctx);
505
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
512 return true;
513}
514
515bool MDPComp::isOnlyVideoDoable(hwc_context_t *ctx,
516 hwc_display_contents_1_t* list){
517 int numAppLayers = ctx->listStats[mDpy].numAppLayers;
518 mCurrentFrame.reset(numAppLayers);
519 updateYUV(ctx, list);
Saurabh Shah4fdde762013-04-30 18:47:33 -0700520 int mdpCount = mCurrentFrame.mdpCount;
Saurabh Shahaa236822013-04-24 18:07:26 -0700521 int fbNeeded = int(mCurrentFrame.fbCount != 0);
522
523 if(!isYuvPresent(ctx, mDpy)) {
524 return false;
525 }
526
Saurabh Shah4fdde762013-04-30 18:47:33 -0700527 if(!mdpCount)
528 return false;
529
Saurabh Shahaa236822013-04-24 18:07:26 -0700530 if(mdpCount > (sMaxPipesPerMixer - fbNeeded)) {
531 ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
532 return false;
533 }
534
535 int numPipesNeeded = pipesNeeded(ctx, list);
536 int availPipes = getAvailablePipes(ctx);
537 if(numPipesNeeded > availPipes) {
538 ALOGD_IF(isDebug(), "%s: Insufficient MDP pipes, needed %d, avail %d",
539 __FUNCTION__, numPipesNeeded, availPipes);
540 return false;
541 }
542
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800543 return true;
544}
545
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800546/* Checks for conditions where YUV layers cannot be bypassed */
547bool MDPComp::isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer) {
Saurabh Shahe2474082013-05-15 16:32:13 -0700548 bool extAnimBlockFeature = mDpy && ctx->listStats[mDpy].isDisplayAnimating;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800549
Saurabh Shahe2474082013-05-15 16:32:13 -0700550 if(isSkipLayer(layer) && !extAnimBlockFeature) {
551 ALOGD_IF(isDebug(), "%s: Video marked SKIP dpy %d", __FUNCTION__, mDpy);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800552 return false;
553 }
554
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800555 if(isSecuring(ctx, layer)) {
556 ALOGD_IF(isDebug(), "%s: MDP securing is active", __FUNCTION__);
557 return false;
558 }
559
Saurabh Shah4fdde762013-04-30 18:47:33 -0700560 if(!isValidDimension(ctx, layer)) {
561 ALOGD_IF(isDebug(), "%s: Buffer is of invalid width",
562 __FUNCTION__);
563 return false;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800564 }
Saurabh Shah4fdde762013-04-30 18:47:33 -0700565
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800566 return true;
567}
568
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800569void MDPComp::batchLayers() {
570 /* Idea is to keep as many contiguous non-updating(cached) layers in FB and
571 * send rest of them through MDP. NEVER mark an updating layer for caching.
572 * But cached ones can be marked for MDP*/
573
574 int maxBatchStart = -1;
575 int maxBatchCount = 0;
576
577 /* All or Nothing is cached. No batching needed */
Saurabh Shahaa236822013-04-24 18:07:26 -0700578 if(!mCurrentFrame.fbCount) {
579 mCurrentFrame.fbZ = -1;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800580 return;
Saurabh Shahaa236822013-04-24 18:07:26 -0700581 }
582 if(!mCurrentFrame.mdpCount) {
583 mCurrentFrame.fbZ = 0;
584 return;
585 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800586
587 /* Search for max number of contiguous (cached) layers */
588 int i = 0;
589 while (i < mCurrentFrame.layerCount) {
590 int count = 0;
591 while(mCurrentFrame.isFBComposed[i] && i < mCurrentFrame.layerCount) {
592 count++; i++;
593 }
594 if(count > maxBatchCount) {
595 maxBatchCount = count;
596 maxBatchStart = i - count;
Saurabh Shahaa236822013-04-24 18:07:26 -0700597 mCurrentFrame.fbZ = maxBatchStart;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800598 }
599 if(i < mCurrentFrame.layerCount) i++;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800600 }
601
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800602 /* reset rest of the layers for MDP comp */
603 for(int i = 0; i < mCurrentFrame.layerCount; i++) {
604 if(i != maxBatchStart){
605 mCurrentFrame.isFBComposed[i] = false;
606 } else {
607 i += maxBatchCount;
608 }
609 }
610
611 mCurrentFrame.fbCount = maxBatchCount;
Saurabh Shahaa236822013-04-24 18:07:26 -0700612 mCurrentFrame.mdpCount = mCurrentFrame.layerCount -
613 mCurrentFrame.fbCount;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800614
615 ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__,
616 mCurrentFrame.fbCount);
617}
Saurabh Shah85234ec2013-04-12 17:09:00 -0700618
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800619void MDPComp::updateLayerCache(hwc_context_t* ctx,
620 hwc_display_contents_1_t* list) {
621
622 int numAppLayers = ctx->listStats[mDpy].numAppLayers;
623 int numCacheableLayers = 0;
624
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800625 for(int i = 0; i < numAppLayers; i++) {
626 if (mCachedFrame.hnd[i] == list->hwLayers[i].handle) {
627 numCacheableLayers++;
628 mCurrentFrame.isFBComposed[i] = true;
629 } else {
Saurabh Shahaa236822013-04-24 18:07:26 -0700630 mCurrentFrame.isFBComposed[i] = false;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800631 mCachedFrame.hnd[i] = list->hwLayers[i].handle;
632 }
633 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700634
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800635 mCurrentFrame.fbCount = numCacheableLayers;
Saurabh Shahaa236822013-04-24 18:07:26 -0700636 mCurrentFrame.mdpCount = mCurrentFrame.layerCount -
637 mCurrentFrame.fbCount;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800638 ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__, numCacheableLayers);
639}
640
641int MDPComp::getAvailablePipes(hwc_context_t* ctx) {
642 int numDMAPipes = qdutils::MDPVersion::getInstance().getDMAPipes();
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800643 overlay::Overlay& ov = *ctx->mOverlay;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800644
645 int numAvailable = ov.availablePipes(mDpy);
646
647 //Reserve DMA for rotator
Saurabh Shah85234ec2013-04-12 17:09:00 -0700648 if(Overlay::getDMAMode() == Overlay::DMA_BLOCK_MODE)
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800649 numAvailable -= numDMAPipes;
650
651 //Reserve pipe(s)for FB
652 if(mCurrentFrame.fbCount)
653 numAvailable -= pipesForFB();
654
655 return numAvailable;
656}
657
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800658void MDPComp::updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list) {
659
660 int nYuvCount = ctx->listStats[mDpy].yuvCount;
Ramkumar Radhakrishnan59a11072013-04-15 16:14:49 -0700661 if(!nYuvCount && mDpy) {
662 //Reset "No animation on external display" related parameters.
663 ctx->mPrevCropVideo.left = ctx->mPrevCropVideo.top =
664 ctx->mPrevCropVideo.right = ctx->mPrevCropVideo.bottom = 0;
665 ctx->mPrevDestVideo.left = ctx->mPrevDestVideo.top =
666 ctx->mPrevDestVideo.right = ctx->mPrevDestVideo.bottom = 0;
667 ctx->mPrevTransformVideo = 0;
668 return;
669 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800670 for(int index = 0;index < nYuvCount; index++){
671 int nYuvIndex = ctx->listStats[mDpy].yuvIndices[index];
672 hwc_layer_1_t* layer = &list->hwLayers[nYuvIndex];
673
674 if(!isYUVDoable(ctx, layer)) {
675 if(!mCurrentFrame.isFBComposed[nYuvIndex]) {
676 mCurrentFrame.isFBComposed[nYuvIndex] = true;
677 mCurrentFrame.fbCount++;
678 }
679 } else {
680 if(mCurrentFrame.isFBComposed[nYuvIndex]) {
681 mCurrentFrame.isFBComposed[nYuvIndex] = false;
682 mCurrentFrame.fbCount--;
683 }
684 }
685 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700686
687 mCurrentFrame.mdpCount = mCurrentFrame.layerCount -
688 mCurrentFrame.fbCount;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800689 ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__,
690 mCurrentFrame.fbCount);
691}
692
Saurabh Shahaa236822013-04-24 18:07:26 -0700693bool MDPComp::programMDP(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800694 if(!allocLayerPipes(ctx, list)) {
695 ALOGD_IF(isDebug(), "%s: Unable to allocate MDP pipes", __FUNCTION__);
Saurabh Shahaa236822013-04-24 18:07:26 -0700696 return false;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800697 }
698
Saurabh Shahaa236822013-04-24 18:07:26 -0700699 bool fbBatch = false;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800700 for (int index = 0, mdpNextZOrder = 0; index < mCurrentFrame.layerCount;
Saurabh Shahaa236822013-04-24 18:07:26 -0700701 index++) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800702 if(!mCurrentFrame.isFBComposed[index]) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800703 int mdpIndex = mCurrentFrame.layerToMDP[index];
704 hwc_layer_1_t* layer = &list->hwLayers[index];
705
706 MdpPipeInfo* cur_pipe = mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo;
707 cur_pipe->zOrder = mdpNextZOrder++;
708
709 if(configure(ctx, layer, mCurrentFrame.mdpToLayer[mdpIndex]) != 0 ){
710 ALOGD_IF(isDebug(), "%s: Failed to configure overlay for \
711 layer %d",__FUNCTION__, index);
Saurabh Shahaa236822013-04-24 18:07:26 -0700712 return false;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800713 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700714 } else if(fbBatch == false) {
715 mdpNextZOrder++;
716 fbBatch = true;
717 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800718 }
719
Saurabh Shahaa236822013-04-24 18:07:26 -0700720 return true;
721}
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800722
Saurabh Shahaa236822013-04-24 18:07:26 -0700723bool MDPComp::programYUV(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
724 if(!allocLayerPipes(ctx, list)) {
725 ALOGD_IF(isDebug(), "%s: Unable to allocate MDP pipes", __FUNCTION__);
726 return false;
727 }
728 //If we are in this block, it means we have yuv + rgb layers both
729 int mdpIdx = 0;
730 for (int index = 0; index < mCurrentFrame.layerCount; index++) {
731 if(!mCurrentFrame.isFBComposed[index]) {
732 hwc_layer_1_t* layer = &list->hwLayers[index];
733 int mdpIndex = mCurrentFrame.layerToMDP[index];
734 MdpPipeInfo* cur_pipe =
735 mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo;
736 cur_pipe->zOrder = mdpIdx++;
737
738 if(configure(ctx, layer,
739 mCurrentFrame.mdpToLayer[mdpIndex]) != 0 ){
740 ALOGD_IF(isDebug(), "%s: Failed to configure overlay for \
741 layer %d",__FUNCTION__, index);
742 return false;
743 }
744 }
745 }
746 return true;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800747}
748
749int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800750
Saurabh Shahaa236822013-04-24 18:07:26 -0700751 const int numLayers = ctx->listStats[mDpy].numAppLayers;
Ramkumar Radhakrishnanc5893f12013-06-06 19:43:53 -0700752
753 //number of app layers exceeds MAX_NUM_APP_LAYERS fall back to GPU
754 //do not cache the information for next draw cycle.
755 if(numLayers > MAX_NUM_APP_LAYERS) {
756 ALOGD_IF(isDebug(), "%s: Number of App layers exceeded the limit ",
757 __FUNCTION__);
758 return 0;
759 }
Prabhanjan Kandula088bd892013-07-02 23:47:13 +0530760
761 Locker::Autolock _l(mMdpCompLock);
762
Ramkumar Radhakrishnanc5893f12013-06-06 19:43:53 -0700763 //reset old data
Saurabh Shahaa236822013-04-24 18:07:26 -0700764 mCurrentFrame.reset(numLayers);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800765
Saurabh Shahaa236822013-04-24 18:07:26 -0700766 //Hard conditions, if not met, cannot do MDP comp
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800767 if(!isFrameDoable(ctx)) {
768 ALOGD_IF( isDebug(),"%s: MDP Comp not possible for this frame",
769 __FUNCTION__);
Saurabh Shahaa236822013-04-24 18:07:26 -0700770 mCurrentFrame.reset(numLayers);
771 mCachedFrame.cacheAll(list);
772 mCachedFrame.updateCounts(mCurrentFrame);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800773 return 0;
774 }
775
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800776 //Check whether layers marked for MDP Composition is actually doable.
Saurabh Shahaa236822013-04-24 18:07:26 -0700777 if(isFullFrameDoable(ctx, list)){
Saurabh Shah2f3895f2013-05-02 10:13:31 -0700778 mCurrentFrame.map();
779 //Acquire and Program MDP pipes
780 if(!programMDP(ctx, list)) {
781 mCurrentFrame.reset(numLayers);
782 mCachedFrame.cacheAll(list);
783 } else { //Success
784 //Any change in composition types needs an FB refresh
785 mCurrentFrame.needsRedraw = false;
786 if(mCurrentFrame.fbCount &&
787 ((mCurrentFrame.mdpCount != mCachedFrame.mdpCount) ||
788 (mCurrentFrame.fbCount != mCachedFrame.cacheCount) ||
789 (mCurrentFrame.fbZ != mCachedFrame.fbZ) ||
790 (!mCurrentFrame.mdpCount) ||
791 (list->flags & HWC_GEOMETRY_CHANGED) ||
792 isSkipPresent(ctx, mDpy) ||
793 (mDpy > HWC_DISPLAY_PRIMARY))) {
794 mCurrentFrame.needsRedraw = true;
Saurabh Shahaa236822013-04-24 18:07:26 -0700795 }
796 }
797 } else if(isOnlyVideoDoable(ctx, list)) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800798 //All layers marked for MDP comp cannot be bypassed.
799 //Try to compose atleast YUV layers through MDP comp and let
800 //all the RGB layers compose in FB
Saurabh Shahaa236822013-04-24 18:07:26 -0700801 //Destination over
802 mCurrentFrame.fbZ = -1;
803 if(mCurrentFrame.fbCount)
Saurabh Shahe8e76272013-06-12 16:08:06 -0700804 mCurrentFrame.fbZ = mCurrentFrame.mdpCount;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800805
Saurabh Shahaa236822013-04-24 18:07:26 -0700806 mCurrentFrame.map();
807 if(!programYUV(ctx, list)) {
808 mCurrentFrame.reset(numLayers);
809 mCachedFrame.cacheAll(list);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800810 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700811 } else {
812 mCurrentFrame.reset(numLayers);
813 mCachedFrame.cacheAll(list);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800814 }
815
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800816 //UpdateLayerFlags
817 setMDPCompLayerFlags(ctx, list);
Saurabh Shahaa236822013-04-24 18:07:26 -0700818 mCachedFrame.updateCounts(mCurrentFrame);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800819
820 if(isDebug()) {
Saurabh Shahaa236822013-04-24 18:07:26 -0700821 ALOGD("GEOMETRY change: %d", (list->flags & HWC_GEOMETRY_CHANGED));
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800822 android::String8 sDump("");
823 dump(sDump);
824 ALOGE("%s",sDump.string());
825 }
826
827 return mCurrentFrame.fbZ;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800828}
829
830//=============MDPCompLowRes===================================================
831
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700832/*
833 * Configures pipe(s) for MDP composition
834 */
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800835int MDPCompLowRes::configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800836 PipeLayerPair& PipeLayerPair) {
Saurabh Shahacf10202013-02-26 10:15:15 -0800837 MdpPipeInfoLowRes& mdp_info =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800838 *(static_cast<MdpPipeInfoLowRes*>(PipeLayerPair.pipeInfo));
Saurabh Shahacf10202013-02-26 10:15:15 -0800839 eMdpFlags mdpFlags = OV_MDP_BACKEND_COMPOSITION;
840 eZorder zOrder = static_cast<eZorder>(mdp_info.zOrder);
841 eIsFg isFg = IS_FG_OFF;
842 eDest dest = mdp_info.index;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700843
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800844 ALOGD_IF(isDebug(),"%s: configuring: layer: %p z_order: %d dest_pipe: %d",
845 __FUNCTION__, layer, zOrder, dest);
846
847 return configureLowRes(ctx, layer, mDpy, mdpFlags, zOrder, isFg, dest,
848 &PipeLayerPair.rot);
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700849}
850
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800851int MDPCompLowRes::pipesNeeded(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800852 hwc_display_contents_1_t* list) {
853 return mCurrentFrame.mdpCount;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700854}
855
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800856bool MDPCompLowRes::allocLayerPipes(hwc_context_t *ctx,
Saurabh Shahe51f8ca2013-05-06 17:26:16 -0700857 hwc_display_contents_1_t* list) {
858 for(int index = 0; index < mCurrentFrame.layerCount; index++) {
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700859
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800860 if(mCurrentFrame.isFBComposed[index]) continue;
Saurabh Shahe51f8ca2013-05-06 17:26:16 -0700861
Jeykumar Sankarancf537002013-01-21 21:19:15 -0800862 hwc_layer_1_t* layer = &list->hwLayers[index];
863 private_handle_t *hnd = (private_handle_t *)layer->handle;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800864 int mdpIndex = mCurrentFrame.layerToMDP[index];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800865 PipeLayerPair& info = mCurrentFrame.mdpToLayer[mdpIndex];
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800866 info.pipeInfo = new MdpPipeInfoLowRes;
Saurabh Shahacf10202013-02-26 10:15:15 -0800867 info.rot = NULL;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800868 MdpPipeInfoLowRes& pipe_info = *(MdpPipeInfoLowRes*)info.pipeInfo;
Jeykumar Sankarana37fdbf2013-03-06 18:59:28 -0800869 ePipeType type = MDPCOMP_OV_ANY;
870
Saurabh Shahe51f8ca2013-05-06 17:26:16 -0700871 if(isYuvBuffer(hnd)) {
872 type = MDPCOMP_OV_VG;
Saurabh Shah8a117932013-05-23 12:48:13 -0700873 } else if(!qhwc::needsScaling(ctx, layer, mDpy)
Saurabh Shah85234ec2013-04-12 17:09:00 -0700874 && Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE
875 && ctx->mMDP.version >= qdutils::MDSS_V5) {
Jeykumar Sankarana37fdbf2013-03-06 18:59:28 -0800876 type = MDPCOMP_OV_DMA;
877 }
878
879 pipe_info.index = getMdpPipe(ctx, type);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800880 if(pipe_info.index == ovutils::OV_INVALID) {
Saurabh Shahe51f8ca2013-05-06 17:26:16 -0700881 ALOGD_IF(isDebug(), "%s: Unable to get pipe type = %d",
882 __FUNCTION__, (int) type);
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500883 return false;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700884 }
885 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700886 return true;
887}
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700888
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800889bool MDPCompLowRes::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700890
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800891 if(!isEnabled()) {
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500892 ALOGD_IF(isDebug(),"%s: MDP Comp not configured", __FUNCTION__);
893 return true;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800894 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700895
896 if(!ctx || !list) {
897 ALOGE("%s: invalid contxt or list",__FUNCTION__);
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500898 return false;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700899 }
900
Prabhanjan Kandula088bd892013-07-02 23:47:13 +0530901 Locker::Autolock _l(mMdpCompLock);
902
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500903 /* reset Invalidator */
Saurabh Shah2d998a92013-05-14 17:55:58 -0700904 if(idleInvalidator && !sIdleFallBack && mCurrentFrame.mdpCount)
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500905 idleInvalidator->markForSleep();
906
907 overlay::Overlay& ov = *ctx->mOverlay;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800908 LayerProp *layerProp = ctx->layerProp[mDpy];
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700909
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800910 int numHwLayers = ctx->listStats[mDpy].numAppLayers;
911 for(int i = 0; i < numHwLayers && mCurrentFrame.mdpCount; i++ )
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700912 {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800913 if(mCurrentFrame.isFBComposed[i]) continue;
914
Naseer Ahmed5b6708a2012-08-02 13:46:08 -0700915 hwc_layer_1_t *layer = &list->hwLayers[i];
Saurabh Shahacf10202013-02-26 10:15:15 -0800916 private_handle_t *hnd = (private_handle_t *)layer->handle;
917 if(!hnd) {
918 ALOGE("%s handle null", __FUNCTION__);
919 return false;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700920 }
921
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800922 int mdpIndex = mCurrentFrame.layerToMDP[i];
923
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800924 MdpPipeInfoLowRes& pipe_info =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800925 *(MdpPipeInfoLowRes*)mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800926 ovutils::eDest dest = pipe_info.index;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800927 if(dest == ovutils::OV_INVALID) {
928 ALOGE("%s: Invalid pipe index (%d)", __FUNCTION__, dest);
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500929 return false;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700930 }
931
Saurabh Shahacf10202013-02-26 10:15:15 -0800932 if(!(layerProp[i].mFlags & HWC_MDPCOMP)) {
933 continue;
934 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700935
Saurabh Shahacf10202013-02-26 10:15:15 -0800936 ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800937 using pipe: %d", __FUNCTION__, layer,
938 hnd, dest );
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700939
Saurabh Shahacf10202013-02-26 10:15:15 -0800940 int fd = hnd->fd;
941 uint32_t offset = hnd->offset;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800942 Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot;
Saurabh Shahacf10202013-02-26 10:15:15 -0800943 if(rot) {
944 if(!rot->queueBuffer(fd, offset))
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500945 return false;
Saurabh Shahacf10202013-02-26 10:15:15 -0800946 fd = rot->getDstMemId();
947 offset = rot->getDstOffset();
948 }
949
950 if (!ov.queueBuffer(fd, offset, dest)) {
951 ALOGE("%s: queueBuffer failed for external", __FUNCTION__);
952 return false;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700953 }
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500954
955 layerProp[i].mFlags &= ~HWC_MDPCOMP;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700956 }
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500957 return true;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700958}
959
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800960//=============MDPCompHighRes===================================================
961
962int MDPCompHighRes::pipesNeeded(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800963 hwc_display_contents_1_t* list) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800964 int pipesNeeded = 0;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800965 int hw_w = ctx->dpyAttr[mDpy].xres;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800966
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800967 for(int i = 0; i < mCurrentFrame.layerCount; ++i) {
968 if(!mCurrentFrame.isFBComposed[i]) {
969 hwc_layer_1_t* layer = &list->hwLayers[i];
970 hwc_rect_t dst = layer->displayFrame;
971 if(dst.left > hw_w/2) {
972 pipesNeeded++;
973 } else if(dst.right <= hw_w/2) {
974 pipesNeeded++;
975 } else {
976 pipesNeeded += 2;
977 }
978 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800979 }
980 return pipesNeeded;
981}
982
983bool MDPCompHighRes::acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800984 MdpPipeInfoHighRes& pipe_info,
985 ePipeType type) {
986 int hw_w = ctx->dpyAttr[mDpy].xres;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800987
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800988 hwc_rect_t dst = layer->displayFrame;
989 if(dst.left > hw_w/2) {
990 pipe_info.lIndex = ovutils::OV_INVALID;
991 pipe_info.rIndex = getMdpPipe(ctx, type);
992 if(pipe_info.rIndex == ovutils::OV_INVALID)
993 return false;
994 } else if (dst.right <= hw_w/2) {
995 pipe_info.rIndex = ovutils::OV_INVALID;
996 pipe_info.lIndex = getMdpPipe(ctx, type);
997 if(pipe_info.lIndex == ovutils::OV_INVALID)
998 return false;
999 } else {
1000 pipe_info.rIndex = getMdpPipe(ctx, type);
1001 pipe_info.lIndex = getMdpPipe(ctx, type);
1002 if(pipe_info.rIndex == ovutils::OV_INVALID ||
1003 pipe_info.lIndex == ovutils::OV_INVALID)
1004 return false;
1005 }
1006 return true;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001007}
1008
1009bool MDPCompHighRes::allocLayerPipes(hwc_context_t *ctx,
Saurabh Shahe51f8ca2013-05-06 17:26:16 -07001010 hwc_display_contents_1_t* list) {
1011 for(int index = 0 ; index < mCurrentFrame.layerCount; index++) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001012
Saurabh Shahe51f8ca2013-05-06 17:26:16 -07001013 if(mCurrentFrame.isFBComposed[index]) continue;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001014
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001015 hwc_layer_1_t* layer = &list->hwLayers[index];
1016 private_handle_t *hnd = (private_handle_t *)layer->handle;
Saurabh Shah0d65dbe2013-06-06 18:33:16 -07001017 int mdpIndex = mCurrentFrame.layerToMDP[index];
1018 PipeLayerPair& info = mCurrentFrame.mdpToLayer[mdpIndex];
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001019 info.pipeInfo = new MdpPipeInfoHighRes;
Saurabh Shah9e3adb22013-03-26 11:16:27 -07001020 info.rot = NULL;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001021 MdpPipeInfoHighRes& pipe_info = *(MdpPipeInfoHighRes*)info.pipeInfo;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001022 ePipeType type = MDPCOMP_OV_ANY;
1023
Saurabh Shahe51f8ca2013-05-06 17:26:16 -07001024 if(isYuvBuffer(hnd)) {
1025 type = MDPCOMP_OV_VG;
Saurabh Shah8a117932013-05-23 12:48:13 -07001026 } else if(!qhwc::needsScaling(ctx, layer, mDpy)
Saurabh Shah85234ec2013-04-12 17:09:00 -07001027 && Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE
Saurabh Shahe51f8ca2013-05-06 17:26:16 -07001028 && ctx->mMDP.version >= qdutils::MDSS_V5) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001029 type = MDPCOMP_OV_DMA;
Saurabh Shahe51f8ca2013-05-06 17:26:16 -07001030 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001031
1032 if(!acquireMDPPipes(ctx, layer, pipe_info, type)) {
Saurabh Shahe51f8ca2013-05-06 17:26:16 -07001033 ALOGD_IF(isDebug(), "%s: Unable to get pipe for type = %d",
1034 __FUNCTION__, (int) type);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001035 return false;
1036 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001037 }
1038 return true;
1039}
1040/*
1041 * Configures pipe(s) for MDP composition
1042 */
1043int MDPCompHighRes::configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001044 PipeLayerPair& PipeLayerPair) {
Saurabh Shahacf10202013-02-26 10:15:15 -08001045 MdpPipeInfoHighRes& mdp_info =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001046 *(static_cast<MdpPipeInfoHighRes*>(PipeLayerPair.pipeInfo));
Saurabh Shahacf10202013-02-26 10:15:15 -08001047 eZorder zOrder = static_cast<eZorder>(mdp_info.zOrder);
1048 eIsFg isFg = IS_FG_OFF;
1049 eMdpFlags mdpFlagsL = OV_MDP_BACKEND_COMPOSITION;
1050 eDest lDest = mdp_info.lIndex;
1051 eDest rDest = mdp_info.rIndex;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001052
1053 ALOGD_IF(isDebug(),"%s: configuring: layer: %p z_order: %d dest_pipeL: %d"
1054 "dest_pipeR: %d",__FUNCTION__, layer, zOrder, lDest, rDest);
1055
1056 return configureHighRes(ctx, layer, mDpy, mdpFlagsL, zOrder, isFg, lDest,
1057 rDest, &PipeLayerPair.rot);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001058}
1059
1060bool MDPCompHighRes::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
1061
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001062 if(!isEnabled()) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001063 ALOGD_IF(isDebug(),"%s: MDP Comp not configured", __FUNCTION__);
1064 return true;
1065 }
1066
1067 if(!ctx || !list) {
1068 ALOGE("%s: invalid contxt or list",__FUNCTION__);
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001069 return false;
1070 }
1071
Prabhanjan Kandula088bd892013-07-02 23:47:13 +05301072 Locker::Autolock _l(mMdpCompLock);
1073
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001074 /* reset Invalidator */
Saurabh Shah2d998a92013-05-14 17:55:58 -07001075 if(idleInvalidator && !sIdleFallBack && mCurrentFrame.mdpCount)
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001076 idleInvalidator->markForSleep();
1077
Naseer Ahmed54821fe2012-11-28 18:44:38 -05001078 overlay::Overlay& ov = *ctx->mOverlay;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001079 LayerProp *layerProp = ctx->layerProp[mDpy];
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001080
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001081 int numHwLayers = ctx->listStats[mDpy].numAppLayers;
1082 for(int i = 0; i < numHwLayers && mCurrentFrame.mdpCount; i++ )
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001083 {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001084 if(mCurrentFrame.isFBComposed[i]) continue;
1085
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001086 hwc_layer_1_t *layer = &list->hwLayers[i];
Saurabh Shahacf10202013-02-26 10:15:15 -08001087 private_handle_t *hnd = (private_handle_t *)layer->handle;
1088 if(!hnd) {
1089 ALOGE("%s handle null", __FUNCTION__);
1090 return false;
1091 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001092
1093 if(!(layerProp[i].mFlags & HWC_MDPCOMP)) {
1094 continue;
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001095 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001096
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001097 int mdpIndex = mCurrentFrame.layerToMDP[i];
1098
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001099 MdpPipeInfoHighRes& pipe_info =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001100 *(MdpPipeInfoHighRes*)mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo;
1101 Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot;
Saurabh Shahacf10202013-02-26 10:15:15 -08001102
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001103 ovutils::eDest indexL = pipe_info.lIndex;
1104 ovutils::eDest indexR = pipe_info.rIndex;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001105
Saurabh Shahacf10202013-02-26 10:15:15 -08001106 int fd = hnd->fd;
1107 int offset = hnd->offset;
1108
1109 if(rot) {
1110 rot->queueBuffer(fd, offset);
1111 fd = rot->getDstMemId();
1112 offset = rot->getDstOffset();
1113 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001114
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001115 //************* play left mixer **********
1116 if(indexL != ovutils::OV_INVALID) {
1117 ovutils::eDest destL = (ovutils::eDest)indexL;
Saurabh Shahacf10202013-02-26 10:15:15 -08001118 ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001119 using pipe: %d", __FUNCTION__, layer, hnd, indexL );
Saurabh Shahacf10202013-02-26 10:15:15 -08001120 if (!ov.queueBuffer(fd, offset, destL)) {
1121 ALOGE("%s: queueBuffer failed for left mixer", __FUNCTION__);
1122 return false;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001123 }
1124 }
1125
1126 //************* play right mixer **********
1127 if(indexR != ovutils::OV_INVALID) {
1128 ovutils::eDest destR = (ovutils::eDest)indexR;
Saurabh Shahacf10202013-02-26 10:15:15 -08001129 ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001130 using pipe: %d", __FUNCTION__, layer, hnd, indexR );
Saurabh Shahacf10202013-02-26 10:15:15 -08001131 if (!ov.queueBuffer(fd, offset, destR)) {
1132 ALOGE("%s: queueBuffer failed for right mixer", __FUNCTION__);
1133 return false;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001134 }
1135 }
Saurabh Shahacf10202013-02-26 10:15:15 -08001136
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001137 layerProp[i].mFlags &= ~HWC_MDPCOMP;
1138 }
Saurabh Shahacf10202013-02-26 10:15:15 -08001139
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001140 return true;
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001141}
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001142}; //namespace
1143