blob: 8648ec7adaf9265e5dd3e59f1b1adc74cd3640d8 [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{
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080055 dumpsys_log(buf,"HWC Map for Dpy: %s \n",
56 mDpy ? "\"EXTERNAL\"" : "\"PRIMARY\"");
57 dumpsys_log(buf,"PREV_FRAME: layerCount:%2d mdpCount:%2d \
58 cacheCount:%2d \n", mCachedFrame.layerCount,
59 mCachedFrame.mdpCount, mCachedFrame.cacheCount);
60 dumpsys_log(buf,"CURR_FRAME: layerCount:%2d mdpCount:%2d \
61 fbCount:%2d \n", mCurrentFrame.layerCount,
62 mCurrentFrame.mdpCount, mCurrentFrame.fbCount);
63 dumpsys_log(buf,"needsFBRedraw:%3s pipesUsed:%2d MaxPipesPerMixer: %d \n",
64 (mCurrentFrame.needsRedraw? "YES" : "NO"),
65 mCurrentFrame.mdpCount, sMaxPipesPerMixer);
66 dumpsys_log(buf," --------------------------------------------- \n");
67 dumpsys_log(buf," listIdx | cached? | mdpIndex | comptype | Z \n");
68 dumpsys_log(buf," --------------------------------------------- \n");
69 for(int index = 0; index < mCurrentFrame.layerCount; index++ )
70 dumpsys_log(buf," %7d | %7s | %8d | %9s | %2d \n",
71 index,
72 (mCurrentFrame.isFBComposed[index] ? "YES" : "NO"),
73 mCurrentFrame.layerToMDP[index],
74 (mCurrentFrame.isFBComposed[index] ?
75 (mCurrentFrame.needsRedraw ? "GLES" : "CACHE") : "MDP"),
76 (mCurrentFrame.isFBComposed[index] ? mCurrentFrame.fbZ :
77 mCurrentFrame.mdpToLayer[mCurrentFrame.layerToMDP[index]].pipeInfo->zOrder));
78 dumpsys_log(buf,"\n");
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080079}
80
81bool MDPComp::init(hwc_context_t *ctx) {
82
83 if(!ctx) {
84 ALOGE("%s: Invalid hwc context!!",__FUNCTION__);
85 return false;
86 }
87
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080088 char property[PROPERTY_VALUE_MAX];
89
90 sEnabled = false;
91 if((property_get("persist.hwc.mdpcomp.enable", property, NULL) > 0) &&
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080092 (!strncmp(property, "1", PROPERTY_VALUE_MAX ) ||
93 (!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080094 sEnabled = true;
Xiaoming Zhou944e02e2013-05-01 20:54:03 -040095 if(!setupBasePipe(ctx)) {
96 ALOGE("%s: Failed to setup primary base pipe", __FUNCTION__);
97 return false;
98 }
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080099 }
100
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700101 sEnableMixedMode = true;
102 if((property_get("debug.mdpcomp.mixedmode.disable", property, NULL) > 0) &&
103 (!strncmp(property, "1", PROPERTY_VALUE_MAX ) ||
104 (!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) {
105 sEnableMixedMode = false;
106 }
107
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800108 sDebugLogs = false;
109 if(property_get("debug.mdpcomp.logs", property, NULL) > 0) {
110 if(atoi(property) != 0)
111 sDebugLogs = true;
112 }
113
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800114 sMaxPipesPerMixer = MAX_PIPES_PER_MIXER;
Saurabh Shah85234ec2013-04-12 17:09:00 -0700115 if(property_get("debug.mdpcomp.maxpermixer", property, "-1") > 0) {
116 int val = atoi(property);
117 if(val >= 0)
118 sMaxPipesPerMixer = min(val, MAX_PIPES_PER_MIXER);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800119 }
120
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800121 unsigned long idle_timeout = DEFAULT_IDLE_TIME;
122 if(property_get("debug.mdpcomp.idletime", property, NULL) > 0) {
123 if(atoi(property) != 0)
124 idle_timeout = atoi(property);
125 }
126
127 //create Idle Invalidator
128 idleInvalidator = IdleInvalidator::getInstance();
129
130 if(idleInvalidator == NULL) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800131 ALOGE("%s: failed to instantiate idleInvalidator object", __FUNCTION__);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800132 } else {
133 idleInvalidator->init(timeout_handler, ctx, idle_timeout);
134 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700135 return true;
136}
137
138void MDPComp::timeout_handler(void *udata) {
139 struct hwc_context_t* ctx = (struct hwc_context_t*)(udata);
140
141 if(!ctx) {
142 ALOGE("%s: received empty data in timer callback", __FUNCTION__);
143 return;
144 }
145
Jesse Hall3be78d92012-08-21 15:12:23 -0700146 if(!ctx->proc) {
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700147 ALOGE("%s: HWC proc not registered", __FUNCTION__);
148 return;
149 }
150 sIdleFallBack = true;
151 /* Trigger SF to redraw the current frame */
Jesse Hall3be78d92012-08-21 15:12:23 -0700152 ctx->proc->invalidate(ctx->proc);
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700153}
154
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800155void MDPComp::setMDPCompLayerFlags(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800156 hwc_display_contents_1_t* list) {
157 LayerProp *layerProp = ctx->layerProp[mDpy];
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800158
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800159 for(int index = 0; index < ctx->listStats[mDpy].numAppLayers; index++) {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800160 hwc_layer_1_t* layer = &(list->hwLayers[index]);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800161 if(!mCurrentFrame.isFBComposed[index]) {
162 layerProp[index].mFlags |= HWC_MDPCOMP;
163 layer->compositionType = HWC_OVERLAY;
164 layer->hints |= HWC_HINT_CLEAR_FB;
165 mCachedFrame.hnd[index] = NULL;
166 } else {
167 if(!mCurrentFrame.needsRedraw)
168 layer->compositionType = HWC_OVERLAY;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800169 }
170 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700171}
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500172
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800173/*
174 * Sets up BORDERFILL as default base pipe and detaches RGB0.
175 * Framebuffer is always updated using PLAY ioctl.
176 */
177bool MDPComp::setupBasePipe(hwc_context_t *ctx) {
178 const int dpy = HWC_DISPLAY_PRIMARY;
179 int fb_stride = ctx->dpyAttr[dpy].stride;
180 int fb_width = ctx->dpyAttr[dpy].xres;
181 int fb_height = ctx->dpyAttr[dpy].yres;
182 int fb_fd = ctx->dpyAttr[dpy].fd;
183
184 mdp_overlay ovInfo;
185 msmfb_overlay_data ovData;
186 memset(&ovInfo, 0, sizeof(mdp_overlay));
187 memset(&ovData, 0, sizeof(msmfb_overlay_data));
188
189 ovInfo.src.format = MDP_RGB_BORDERFILL;
190 ovInfo.src.width = fb_width;
191 ovInfo.src.height = fb_height;
192 ovInfo.src_rect.w = fb_width;
193 ovInfo.src_rect.h = fb_height;
194 ovInfo.dst_rect.w = fb_width;
195 ovInfo.dst_rect.h = fb_height;
196 ovInfo.id = MSMFB_NEW_REQUEST;
197
198 if (ioctl(fb_fd, MSMFB_OVERLAY_SET, &ovInfo) < 0) {
199 ALOGE("Failed to call ioctl MSMFB_OVERLAY_SET err=%s",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800200 strerror(errno));
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800201 return false;
202 }
203
204 ovData.id = ovInfo.id;
205 if (ioctl(fb_fd, MSMFB_OVERLAY_PLAY, &ovData) < 0) {
206 ALOGE("Failed to call ioctl MSMFB_OVERLAY_PLAY err=%s",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800207 strerror(errno));
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800208 return false;
209 }
210 return true;
211}
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800212MDPComp::FrameInfo::FrameInfo() {
Saurabh Shahaa236822013-04-24 18:07:26 -0700213 reset(0);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800214}
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800215
Saurabh Shahaa236822013-04-24 18:07:26 -0700216void MDPComp::FrameInfo::reset(const int& numLayers) {
217 for(int i = 0 ; i < MAX_PIPES_PER_MIXER && numLayers; i++ ) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800218 if(mdpToLayer[i].pipeInfo) {
219 delete mdpToLayer[i].pipeInfo;
220 mdpToLayer[i].pipeInfo = NULL;
221 //We dont own the rotator
222 mdpToLayer[i].rot = NULL;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800223 }
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800224 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800225
226 memset(&mdpToLayer, 0, sizeof(mdpToLayer));
227 memset(&layerToMDP, -1, sizeof(layerToMDP));
Saurabh Shahaa236822013-04-24 18:07:26 -0700228 memset(&isFBComposed, 1, sizeof(isFBComposed));
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800229
Saurabh Shahaa236822013-04-24 18:07:26 -0700230 layerCount = numLayers;
231 fbCount = numLayers;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800232 mdpCount = 0;
Saurabh Shah2f3895f2013-05-02 10:13:31 -0700233 needsRedraw = true;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800234 fbZ = 0;
235}
236
Saurabh Shahaa236822013-04-24 18:07:26 -0700237void MDPComp::FrameInfo::map() {
238 // populate layer and MDP maps
239 int mdpIdx = 0;
240 for(int idx = 0; idx < layerCount; idx++) {
241 if(!isFBComposed[idx]) {
242 mdpToLayer[mdpIdx].listIndex = idx;
243 layerToMDP[idx] = mdpIdx++;
244 }
245 }
246}
247
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800248MDPComp::LayerCache::LayerCache() {
249 reset();
250}
251
252void MDPComp::LayerCache::reset() {
Saurabh Shahaa236822013-04-24 18:07:26 -0700253 memset(&hnd, 0, sizeof(hnd));
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800254 mdpCount = 0;
255 cacheCount = 0;
256 layerCount = 0;
Saurabh Shahaa236822013-04-24 18:07:26 -0700257 fbZ = -1;
258}
259
260void MDPComp::LayerCache::cacheAll(hwc_display_contents_1_t* list) {
261 const int numAppLayers = list->numHwLayers - 1;
262 for(int i = 0; i < numAppLayers; i++) {
263 hnd[i] = list->hwLayers[i].handle;
264 }
265}
266
267void MDPComp::LayerCache::updateCounts(const FrameInfo& curFrame) {
268 mdpCount = curFrame.mdpCount;
269 cacheCount = curFrame.fbCount;
270 layerCount = curFrame.layerCount;
271 fbZ = curFrame.fbZ;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800272}
273
Sravan Kumar D.V.Nad5d9292013-04-24 14:23:04 +0530274bool MDPComp::isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer) {
Saurabh Shah4fdde762013-04-30 18:47:33 -0700275 const int dpy = HWC_DISPLAY_PRIMARY;
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800276 private_handle_t *hnd = (private_handle_t *)layer->handle;
277
278 if(!hnd) {
279 ALOGE("%s: layer handle is NULL", __FUNCTION__);
280 return false;
281 }
282
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800283 int hw_w = ctx->dpyAttr[mDpy].xres;
284 int hw_h = ctx->dpyAttr[mDpy].yres;
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800285
Saurabh Shah4fdde762013-04-30 18:47:33 -0700286 hwc_rect_t crop = layer->sourceCrop;
287 hwc_rect_t dst = layer->displayFrame;
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800288
289 if(dst.left < 0 || dst.top < 0 || dst.right > hw_w || dst.bottom > hw_h) {
Saurabh Shah4fdde762013-04-30 18:47:33 -0700290 hwc_rect_t scissor = {0, 0, hw_w, hw_h };
291 qhwc::calculate_crop_rects(crop, dst, scissor, layer->transform);
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800292 }
293
Saurabh Shah4fdde762013-04-30 18:47:33 -0700294 int crop_w = crop.right - crop.left;
295 int crop_h = crop.bottom - crop.top;
296 int dst_w = dst.right - dst.left;
297 int dst_h = dst.bottom - dst.top;
298 float w_dscale = ceilf((float)crop_w / (float)dst_w);
299 float h_dscale = ceilf((float)crop_h / (float)dst_h);
300
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800301 /* Workaround for MDP HW limitation in DSI command mode panels where
302 * FPS will not go beyond 30 if buffers on RGB pipes are of width or height
303 * less than 5 pixels
Sravan Kumar D.V.Nad5d9292013-04-24 14:23:04 +0530304 * There also is a HW limilation in MDP, minimum block size is 2x2
305 * Fallback to GPU if height is less than 2.
306 */
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800307 if((crop_w < 5)||(crop_h < 5))
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800308 return false;
309
Saurabh Shah4fdde762013-04-30 18:47:33 -0700310 const uint32_t downscale =
311 qdutils::MDPVersion::getInstance().getMaxMDPDownscale();
312 if(ctx->mMDP.version >= qdutils::MDSS_V5) {
313 /* Workaround for downscales larger than 4x.
314 * Will be removed once decimator block is enabled for MDSS
315 */
316 if(!qdutils::MDPVersion::getInstance().supportsDecimation()) {
317 if(crop_w > MAX_DISPLAY_DIM || w_dscale > downscale ||
318 h_dscale > downscale)
319 return false;
320 } else {
321 if(w_dscale > 64 || h_dscale > 64)
322 return false;
323 }
324 } else { //A-family
325 if(w_dscale > downscale || h_dscale > downscale)
326 return false;
327 }
328
Jeykumar Sankaranc18dbc22013-02-08 14:29:44 -0800329 return true;
330}
331
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800332ovutils::eDest MDPComp::getMdpPipe(hwc_context_t *ctx, ePipeType type) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800333 overlay::Overlay& ov = *ctx->mOverlay;
334 ovutils::eDest mdp_pipe = ovutils::OV_INVALID;
335
336 switch(type) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800337 case MDPCOMP_OV_DMA:
338 mdp_pipe = ov.nextPipe(ovutils::OV_MDP_PIPE_DMA, mDpy);
339 if(mdp_pipe != ovutils::OV_INVALID) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800340 return mdp_pipe;
341 }
342 case MDPCOMP_OV_ANY:
343 case MDPCOMP_OV_RGB:
344 mdp_pipe = ov.nextPipe(ovutils::OV_MDP_PIPE_RGB, mDpy);
345 if(mdp_pipe != ovutils::OV_INVALID) {
346 return mdp_pipe;
347 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800348
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800349 if(type == MDPCOMP_OV_RGB) {
350 //Requested only for RGB pipe
351 break;
352 }
353 case MDPCOMP_OV_VG:
354 return ov.nextPipe(ovutils::OV_MDP_PIPE_VG, mDpy);
355 default:
356 ALOGE("%s: Invalid pipe type",__FUNCTION__);
357 return ovutils::OV_INVALID;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800358 };
359 return ovutils::OV_INVALID;
360}
361
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800362bool MDPComp::isFrameDoable(hwc_context_t *ctx) {
Saurabh Shahaa236822013-04-24 18:07:26 -0700363 bool ret = true;
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700364 const int numAppLayers = ctx->listStats[mDpy].numAppLayers;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800365
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800366 if(!isEnabled()) {
367 ALOGD_IF(isDebug(),"%s: MDP Comp. not enabled.", __FUNCTION__);
Saurabh Shahaa236822013-04-24 18:07:26 -0700368 ret = false;
Saurabh Shahd4e65852013-06-17 11:33:53 -0700369 } else if(qdutils::MDPVersion::getInstance().is8x26() &&
370 ctx->mVideoTransFlag &&
371 ctx->mExtDisplay->isExternalConnected()) {
372 //1 Padding round to shift pipes across mixers
373 ALOGD_IF(isDebug(),"%s: MDP Comp. video transition padding round",
374 __FUNCTION__);
375 ret = false;
Saurabh Shahaa236822013-04-24 18:07:26 -0700376 } else if(ctx->mExtDispConfiguring) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800377 ALOGD_IF( isDebug(),"%s: External Display connection is pending",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800378 __FUNCTION__);
Saurabh Shahaa236822013-04-24 18:07:26 -0700379 ret = false;
Saurabh Shahaa236822013-04-24 18:07:26 -0700380 } else if(ctx->isPaddingRound) {
Saurabh Shah0ceeb6a2013-04-23 10:46:07 -0700381 ctx->isPaddingRound = false;
382 ALOGD_IF(isDebug(), "%s: padding round",__FUNCTION__);
Saurabh Shahaa236822013-04-24 18:07:26 -0700383 ret = false;
Saurabh Shah0ceeb6a2013-04-23 10:46:07 -0700384 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700385 return ret;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800386}
387
388/* Checks for conditions where all the layers marked for MDP comp cannot be
389 * bypassed. On such conditions we try to bypass atleast YUV layers */
390bool MDPComp::isFullFrameDoable(hwc_context_t *ctx,
391 hwc_display_contents_1_t* list){
392
Saurabh Shahaa236822013-04-24 18:07:26 -0700393 const int numAppLayers = ctx->listStats[mDpy].numAppLayers;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800394
Saurabh Shah2d998a92013-05-14 17:55:58 -0700395 if(sIdleFallBack) {
396 ALOGD_IF(isDebug(), "%s: Idle fallback dpy %d",__FUNCTION__, mDpy);
397 return false;
398 }
399
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800400 if(mDpy > HWC_DISPLAY_PRIMARY){
401 ALOGD_IF(isDebug(), "%s: Cannot support External display(s)",
402 __FUNCTION__);
403 return false;
404 }
405
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800406 if(isSkipPresent(ctx, mDpy)) {
Saurabh Shahaa236822013-04-24 18:07:26 -0700407 ALOGD_IF(isDebug(),"%s: SKIP present: %d",
408 __FUNCTION__,
409 isSkipPresent(ctx, mDpy));
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800410 return false;
411 }
412
Saurabh Shah9f084ad2013-05-02 11:28:09 -0700413 if(ctx->listStats[mDpy].needsAlphaScale
414 && ctx->mMDP.version < qdutils::MDSS_V5) {
415 ALOGD_IF(isDebug(), "%s: frame needs alpha downscaling",__FUNCTION__);
416 return false;
417 }
418
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800419 //MDP composition is not efficient if layer needs rotator.
420 for(int i = 0; i < numAppLayers; ++i) {
421 // As MDP h/w supports flip operation, use MDP comp only for
422 // 180 transforms. Fail for any transform involving 90 (90, 270).
423 hwc_layer_1_t* layer = &list->hwLayers[i];
424 private_handle_t *hnd = (private_handle_t *)layer->handle;
Jeykumar Sankarana37fdbf2013-03-06 18:59:28 -0800425
Saurabh Shah4fdde762013-04-30 18:47:33 -0700426 if((layer->transform & HWC_TRANSFORM_ROT_90) && !isYuvBuffer(hnd)) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800427 ALOGD_IF(isDebug(), "%s: orientation involved",__FUNCTION__);
428 return false;
429 }
430
Saurabh Shah4fdde762013-04-30 18:47:33 -0700431 if(!isValidDimension(ctx,layer)) {
432 ALOGD_IF(isDebug(), "%s: Buffer is of invalid width",
433 __FUNCTION__);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800434 return false;
435 }
436 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700437
438 //If all above hard conditions are met we can do full or partial MDP comp.
439 bool ret = false;
440 if(fullMDPComp(ctx, list)) {
441 ret = true;
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700442 } else if(partialMDPComp(ctx, list)) {
Saurabh Shahaa236822013-04-24 18:07:26 -0700443 ret = true;
444 }
445 return ret;
446}
447
448bool MDPComp::fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
449 //Setup mCurrentFrame
450 mCurrentFrame.mdpCount = mCurrentFrame.layerCount;
451 mCurrentFrame.fbCount = 0;
452 mCurrentFrame.fbZ = -1;
453 memset(&mCurrentFrame.isFBComposed, 0, sizeof(mCurrentFrame.isFBComposed));
454
455 int mdpCount = mCurrentFrame.mdpCount;
456 if(mdpCount > sMaxPipesPerMixer) {
457 ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
458 return false;
459 }
460
461 int numPipesNeeded = pipesNeeded(ctx, list);
462 int availPipes = getAvailablePipes(ctx);
463
464 if(numPipesNeeded > availPipes) {
465 ALOGD_IF(isDebug(), "%s: Insufficient MDP pipes, needed %d, avail %d",
466 __FUNCTION__, numPipesNeeded, availPipes);
467 return false;
468 }
469
470 return true;
471}
472
473bool MDPComp::partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list)
474{
475 int numAppLayers = ctx->listStats[mDpy].numAppLayers;
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700476
477 if(!sEnableMixedMode) {
478 //Mixed mode is disabled. No need to even try caching.
479 return false;
480 }
481
Saurabh Shahaa236822013-04-24 18:07:26 -0700482 //Setup mCurrentFrame
483 mCurrentFrame.reset(numAppLayers);
484 updateLayerCache(ctx, list);
485 updateYUV(ctx, list);
486 batchLayers(); //sets up fbZ also
487
488 int mdpCount = mCurrentFrame.mdpCount;
489 if(mdpCount > (sMaxPipesPerMixer - 1)) { // -1 since FB is used
490 ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
491 return false;
492 }
493
494 int numPipesNeeded = pipesNeeded(ctx, list);
495 int availPipes = getAvailablePipes(ctx);
496
497 if(numPipesNeeded > availPipes) {
498 ALOGD_IF(isDebug(), "%s: Insufficient MDP pipes, needed %d, avail %d",
499 __FUNCTION__, numPipesNeeded, availPipes);
500 return false;
501 }
502
503 return true;
504}
505
506bool MDPComp::isOnlyVideoDoable(hwc_context_t *ctx,
507 hwc_display_contents_1_t* list){
508 int numAppLayers = ctx->listStats[mDpy].numAppLayers;
509 mCurrentFrame.reset(numAppLayers);
510 updateYUV(ctx, list);
Saurabh Shah4fdde762013-04-30 18:47:33 -0700511 int mdpCount = mCurrentFrame.mdpCount;
Saurabh Shahaa236822013-04-24 18:07:26 -0700512 int fbNeeded = int(mCurrentFrame.fbCount != 0);
513
514 if(!isYuvPresent(ctx, mDpy)) {
515 return false;
516 }
517
Saurabh Shah4fdde762013-04-30 18:47:33 -0700518 if(!mdpCount)
519 return false;
520
Saurabh Shahaa236822013-04-24 18:07:26 -0700521 if(mdpCount > (sMaxPipesPerMixer - fbNeeded)) {
522 ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__);
523 return false;
524 }
525
526 int numPipesNeeded = pipesNeeded(ctx, list);
527 int availPipes = getAvailablePipes(ctx);
528 if(numPipesNeeded > availPipes) {
529 ALOGD_IF(isDebug(), "%s: Insufficient MDP pipes, needed %d, avail %d",
530 __FUNCTION__, numPipesNeeded, availPipes);
531 return false;
532 }
533
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800534 return true;
535}
536
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800537/* Checks for conditions where YUV layers cannot be bypassed */
538bool MDPComp::isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer) {
Saurabh Shahe2474082013-05-15 16:32:13 -0700539 bool extAnimBlockFeature = mDpy && ctx->listStats[mDpy].isDisplayAnimating;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800540
Saurabh Shahe2474082013-05-15 16:32:13 -0700541 if(isSkipLayer(layer) && !extAnimBlockFeature) {
542 ALOGD_IF(isDebug(), "%s: Video marked SKIP dpy %d", __FUNCTION__, mDpy);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800543 return false;
544 }
545
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800546 if(isSecuring(ctx, layer)) {
547 ALOGD_IF(isDebug(), "%s: MDP securing is active", __FUNCTION__);
548 return false;
549 }
550
Saurabh Shah4fdde762013-04-30 18:47:33 -0700551 if(!isValidDimension(ctx, layer)) {
552 ALOGD_IF(isDebug(), "%s: Buffer is of invalid width",
553 __FUNCTION__);
554 return false;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800555 }
Saurabh Shah4fdde762013-04-30 18:47:33 -0700556
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800557 return true;
558}
559
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800560void MDPComp::batchLayers() {
561 /* Idea is to keep as many contiguous non-updating(cached) layers in FB and
562 * send rest of them through MDP. NEVER mark an updating layer for caching.
563 * But cached ones can be marked for MDP*/
564
565 int maxBatchStart = -1;
566 int maxBatchCount = 0;
567
568 /* All or Nothing is cached. No batching needed */
Saurabh Shahaa236822013-04-24 18:07:26 -0700569 if(!mCurrentFrame.fbCount) {
570 mCurrentFrame.fbZ = -1;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800571 return;
Saurabh Shahaa236822013-04-24 18:07:26 -0700572 }
573 if(!mCurrentFrame.mdpCount) {
574 mCurrentFrame.fbZ = 0;
575 return;
576 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800577
578 /* Search for max number of contiguous (cached) layers */
579 int i = 0;
580 while (i < mCurrentFrame.layerCount) {
581 int count = 0;
582 while(mCurrentFrame.isFBComposed[i] && i < mCurrentFrame.layerCount) {
583 count++; i++;
584 }
585 if(count > maxBatchCount) {
586 maxBatchCount = count;
587 maxBatchStart = i - count;
Saurabh Shahaa236822013-04-24 18:07:26 -0700588 mCurrentFrame.fbZ = maxBatchStart;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800589 }
590 if(i < mCurrentFrame.layerCount) i++;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800591 }
592
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800593 /* reset rest of the layers for MDP comp */
594 for(int i = 0; i < mCurrentFrame.layerCount; i++) {
595 if(i != maxBatchStart){
596 mCurrentFrame.isFBComposed[i] = false;
597 } else {
598 i += maxBatchCount;
599 }
600 }
601
602 mCurrentFrame.fbCount = maxBatchCount;
Saurabh Shahaa236822013-04-24 18:07:26 -0700603 mCurrentFrame.mdpCount = mCurrentFrame.layerCount -
604 mCurrentFrame.fbCount;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800605
606 ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__,
607 mCurrentFrame.fbCount);
608}
Saurabh Shah85234ec2013-04-12 17:09:00 -0700609
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800610void MDPComp::updateLayerCache(hwc_context_t* ctx,
611 hwc_display_contents_1_t* list) {
612
613 int numAppLayers = ctx->listStats[mDpy].numAppLayers;
614 int numCacheableLayers = 0;
615
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800616 for(int i = 0; i < numAppLayers; i++) {
617 if (mCachedFrame.hnd[i] == list->hwLayers[i].handle) {
618 numCacheableLayers++;
619 mCurrentFrame.isFBComposed[i] = true;
620 } else {
Saurabh Shahaa236822013-04-24 18:07:26 -0700621 mCurrentFrame.isFBComposed[i] = false;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800622 mCachedFrame.hnd[i] = list->hwLayers[i].handle;
623 }
624 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700625
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800626 mCurrentFrame.fbCount = numCacheableLayers;
Saurabh Shahaa236822013-04-24 18:07:26 -0700627 mCurrentFrame.mdpCount = mCurrentFrame.layerCount -
628 mCurrentFrame.fbCount;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800629 ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__, numCacheableLayers);
630}
631
632int MDPComp::getAvailablePipes(hwc_context_t* ctx) {
633 int numDMAPipes = qdutils::MDPVersion::getInstance().getDMAPipes();
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800634 overlay::Overlay& ov = *ctx->mOverlay;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800635
636 int numAvailable = ov.availablePipes(mDpy);
637
638 //Reserve DMA for rotator
Saurabh Shah85234ec2013-04-12 17:09:00 -0700639 if(Overlay::getDMAMode() == Overlay::DMA_BLOCK_MODE)
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800640 numAvailable -= numDMAPipes;
641
642 //Reserve pipe(s)for FB
643 if(mCurrentFrame.fbCount)
644 numAvailable -= pipesForFB();
645
646 return numAvailable;
647}
648
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800649void MDPComp::updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list) {
650
651 int nYuvCount = ctx->listStats[mDpy].yuvCount;
Ramkumar Radhakrishnan59a11072013-04-15 16:14:49 -0700652 if(!nYuvCount && mDpy) {
653 //Reset "No animation on external display" related parameters.
654 ctx->mPrevCropVideo.left = ctx->mPrevCropVideo.top =
655 ctx->mPrevCropVideo.right = ctx->mPrevCropVideo.bottom = 0;
656 ctx->mPrevDestVideo.left = ctx->mPrevDestVideo.top =
657 ctx->mPrevDestVideo.right = ctx->mPrevDestVideo.bottom = 0;
658 ctx->mPrevTransformVideo = 0;
659 return;
660 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800661 for(int index = 0;index < nYuvCount; index++){
662 int nYuvIndex = ctx->listStats[mDpy].yuvIndices[index];
663 hwc_layer_1_t* layer = &list->hwLayers[nYuvIndex];
664
665 if(!isYUVDoable(ctx, layer)) {
666 if(!mCurrentFrame.isFBComposed[nYuvIndex]) {
667 mCurrentFrame.isFBComposed[nYuvIndex] = true;
668 mCurrentFrame.fbCount++;
669 }
670 } else {
671 if(mCurrentFrame.isFBComposed[nYuvIndex]) {
672 mCurrentFrame.isFBComposed[nYuvIndex] = false;
673 mCurrentFrame.fbCount--;
674 }
675 }
676 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700677
678 mCurrentFrame.mdpCount = mCurrentFrame.layerCount -
679 mCurrentFrame.fbCount;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800680 ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__,
681 mCurrentFrame.fbCount);
682}
683
Saurabh Shahaa236822013-04-24 18:07:26 -0700684bool MDPComp::programMDP(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800685 if(!allocLayerPipes(ctx, list)) {
686 ALOGD_IF(isDebug(), "%s: Unable to allocate MDP pipes", __FUNCTION__);
Saurabh Shahaa236822013-04-24 18:07:26 -0700687 return false;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800688 }
689
Saurabh Shahaa236822013-04-24 18:07:26 -0700690 bool fbBatch = false;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800691 for (int index = 0, mdpNextZOrder = 0; index < mCurrentFrame.layerCount;
Saurabh Shahaa236822013-04-24 18:07:26 -0700692 index++) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800693 if(!mCurrentFrame.isFBComposed[index]) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800694 int mdpIndex = mCurrentFrame.layerToMDP[index];
695 hwc_layer_1_t* layer = &list->hwLayers[index];
696
697 MdpPipeInfo* cur_pipe = mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo;
698 cur_pipe->zOrder = mdpNextZOrder++;
699
700 if(configure(ctx, layer, mCurrentFrame.mdpToLayer[mdpIndex]) != 0 ){
701 ALOGD_IF(isDebug(), "%s: Failed to configure overlay for \
702 layer %d",__FUNCTION__, index);
Saurabh Shahaa236822013-04-24 18:07:26 -0700703 return false;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800704 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700705 } else if(fbBatch == false) {
706 mdpNextZOrder++;
707 fbBatch = true;
708 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800709 }
710
Saurabh Shahaa236822013-04-24 18:07:26 -0700711 return true;
712}
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800713
Saurabh Shahaa236822013-04-24 18:07:26 -0700714bool MDPComp::programYUV(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
715 if(!allocLayerPipes(ctx, list)) {
716 ALOGD_IF(isDebug(), "%s: Unable to allocate MDP pipes", __FUNCTION__);
717 return false;
718 }
719 //If we are in this block, it means we have yuv + rgb layers both
720 int mdpIdx = 0;
721 for (int index = 0; index < mCurrentFrame.layerCount; index++) {
722 if(!mCurrentFrame.isFBComposed[index]) {
723 hwc_layer_1_t* layer = &list->hwLayers[index];
724 int mdpIndex = mCurrentFrame.layerToMDP[index];
725 MdpPipeInfo* cur_pipe =
726 mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo;
727 cur_pipe->zOrder = mdpIdx++;
728
729 if(configure(ctx, layer,
730 mCurrentFrame.mdpToLayer[mdpIndex]) != 0 ){
731 ALOGD_IF(isDebug(), "%s: Failed to configure overlay for \
732 layer %d",__FUNCTION__, index);
733 return false;
734 }
735 }
736 }
737 return true;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800738}
739
740int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800741
Saurabh Shahaa236822013-04-24 18:07:26 -0700742 const int numLayers = ctx->listStats[mDpy].numAppLayers;
Ramkumar Radhakrishnanc5893f12013-06-06 19:43:53 -0700743
744 //number of app layers exceeds MAX_NUM_APP_LAYERS fall back to GPU
745 //do not cache the information for next draw cycle.
746 if(numLayers > MAX_NUM_APP_LAYERS) {
747 ALOGD_IF(isDebug(), "%s: Number of App layers exceeded the limit ",
748 __FUNCTION__);
749 return 0;
750 }
751 //reset old data
Saurabh Shahaa236822013-04-24 18:07:26 -0700752 mCurrentFrame.reset(numLayers);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800753
Saurabh Shahaa236822013-04-24 18:07:26 -0700754 //Hard conditions, if not met, cannot do MDP comp
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800755 if(!isFrameDoable(ctx)) {
756 ALOGD_IF( isDebug(),"%s: MDP Comp not possible for this frame",
757 __FUNCTION__);
Saurabh Shahaa236822013-04-24 18:07:26 -0700758 mCurrentFrame.reset(numLayers);
759 mCachedFrame.cacheAll(list);
760 mCachedFrame.updateCounts(mCurrentFrame);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800761 return 0;
762 }
763
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800764 //Check whether layers marked for MDP Composition is actually doable.
Saurabh Shahaa236822013-04-24 18:07:26 -0700765 if(isFullFrameDoable(ctx, list)){
Saurabh Shah2f3895f2013-05-02 10:13:31 -0700766 mCurrentFrame.map();
767 //Acquire and Program MDP pipes
768 if(!programMDP(ctx, list)) {
769 mCurrentFrame.reset(numLayers);
770 mCachedFrame.cacheAll(list);
771 } else { //Success
772 //Any change in composition types needs an FB refresh
773 mCurrentFrame.needsRedraw = false;
774 if(mCurrentFrame.fbCount &&
775 ((mCurrentFrame.mdpCount != mCachedFrame.mdpCount) ||
776 (mCurrentFrame.fbCount != mCachedFrame.cacheCount) ||
777 (mCurrentFrame.fbZ != mCachedFrame.fbZ) ||
778 (!mCurrentFrame.mdpCount) ||
779 (list->flags & HWC_GEOMETRY_CHANGED) ||
780 isSkipPresent(ctx, mDpy) ||
781 (mDpy > HWC_DISPLAY_PRIMARY))) {
782 mCurrentFrame.needsRedraw = true;
Saurabh Shahaa236822013-04-24 18:07:26 -0700783 }
784 }
785 } else if(isOnlyVideoDoable(ctx, list)) {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800786 //All layers marked for MDP comp cannot be bypassed.
787 //Try to compose atleast YUV layers through MDP comp and let
788 //all the RGB layers compose in FB
Saurabh Shahaa236822013-04-24 18:07:26 -0700789 //Destination over
790 mCurrentFrame.fbZ = -1;
791 if(mCurrentFrame.fbCount)
Saurabh Shahe8e76272013-06-12 16:08:06 -0700792 mCurrentFrame.fbZ = mCurrentFrame.mdpCount;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800793
Saurabh Shahaa236822013-04-24 18:07:26 -0700794 mCurrentFrame.map();
795 if(!programYUV(ctx, list)) {
796 mCurrentFrame.reset(numLayers);
797 mCachedFrame.cacheAll(list);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800798 }
Saurabh Shahaa236822013-04-24 18:07:26 -0700799 } else {
800 mCurrentFrame.reset(numLayers);
801 mCachedFrame.cacheAll(list);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800802 }
803
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800804 //UpdateLayerFlags
805 setMDPCompLayerFlags(ctx, list);
Saurabh Shahaa236822013-04-24 18:07:26 -0700806 mCachedFrame.updateCounts(mCurrentFrame);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800807
808 if(isDebug()) {
Saurabh Shahaa236822013-04-24 18:07:26 -0700809 ALOGD("GEOMETRY change: %d", (list->flags & HWC_GEOMETRY_CHANGED));
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800810 android::String8 sDump("");
811 dump(sDump);
812 ALOGE("%s",sDump.string());
813 }
814
815 return mCurrentFrame.fbZ;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800816}
817
818//=============MDPCompLowRes===================================================
819
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700820/*
821 * Configures pipe(s) for MDP composition
822 */
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800823int MDPCompLowRes::configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800824 PipeLayerPair& PipeLayerPair) {
Saurabh Shahacf10202013-02-26 10:15:15 -0800825 MdpPipeInfoLowRes& mdp_info =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800826 *(static_cast<MdpPipeInfoLowRes*>(PipeLayerPair.pipeInfo));
Saurabh Shahacf10202013-02-26 10:15:15 -0800827 eMdpFlags mdpFlags = OV_MDP_BACKEND_COMPOSITION;
828 eZorder zOrder = static_cast<eZorder>(mdp_info.zOrder);
829 eIsFg isFg = IS_FG_OFF;
830 eDest dest = mdp_info.index;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700831
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800832 ALOGD_IF(isDebug(),"%s: configuring: layer: %p z_order: %d dest_pipe: %d",
833 __FUNCTION__, layer, zOrder, dest);
834
835 return configureLowRes(ctx, layer, mDpy, mdpFlags, zOrder, isFg, dest,
836 &PipeLayerPair.rot);
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700837}
838
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800839int MDPCompLowRes::pipesNeeded(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800840 hwc_display_contents_1_t* list) {
841 return mCurrentFrame.mdpCount;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700842}
843
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800844bool MDPCompLowRes::allocLayerPipes(hwc_context_t *ctx,
Saurabh Shahe51f8ca2013-05-06 17:26:16 -0700845 hwc_display_contents_1_t* list) {
846 for(int index = 0; index < mCurrentFrame.layerCount; index++) {
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700847
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800848 if(mCurrentFrame.isFBComposed[index]) continue;
Saurabh Shahe51f8ca2013-05-06 17:26:16 -0700849
Jeykumar Sankarancf537002013-01-21 21:19:15 -0800850 hwc_layer_1_t* layer = &list->hwLayers[index];
851 private_handle_t *hnd = (private_handle_t *)layer->handle;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800852 int mdpIndex = mCurrentFrame.layerToMDP[index];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800853 PipeLayerPair& info = mCurrentFrame.mdpToLayer[mdpIndex];
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800854 info.pipeInfo = new MdpPipeInfoLowRes;
Saurabh Shahacf10202013-02-26 10:15:15 -0800855 info.rot = NULL;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800856 MdpPipeInfoLowRes& pipe_info = *(MdpPipeInfoLowRes*)info.pipeInfo;
Jeykumar Sankarana37fdbf2013-03-06 18:59:28 -0800857 ePipeType type = MDPCOMP_OV_ANY;
858
Saurabh Shahe51f8ca2013-05-06 17:26:16 -0700859 if(isYuvBuffer(hnd)) {
860 type = MDPCOMP_OV_VG;
Saurabh Shah8a117932013-05-23 12:48:13 -0700861 } else if(!qhwc::needsScaling(ctx, layer, mDpy)
Saurabh Shah85234ec2013-04-12 17:09:00 -0700862 && Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE
863 && ctx->mMDP.version >= qdutils::MDSS_V5) {
Jeykumar Sankarana37fdbf2013-03-06 18:59:28 -0800864 type = MDPCOMP_OV_DMA;
865 }
866
867 pipe_info.index = getMdpPipe(ctx, type);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800868 if(pipe_info.index == ovutils::OV_INVALID) {
Saurabh Shahe51f8ca2013-05-06 17:26:16 -0700869 ALOGD_IF(isDebug(), "%s: Unable to get pipe type = %d",
870 __FUNCTION__, (int) type);
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500871 return false;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700872 }
873 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700874 return true;
875}
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700876
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800877bool MDPCompLowRes::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700878
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800879 if(!isEnabled()) {
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500880 ALOGD_IF(isDebug(),"%s: MDP Comp not configured", __FUNCTION__);
881 return true;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800882 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700883
884 if(!ctx || !list) {
885 ALOGE("%s: invalid contxt or list",__FUNCTION__);
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500886 return false;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700887 }
888
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500889 /* reset Invalidator */
Saurabh Shah2d998a92013-05-14 17:55:58 -0700890 if(idleInvalidator && !sIdleFallBack && mCurrentFrame.mdpCount)
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500891 idleInvalidator->markForSleep();
892
893 overlay::Overlay& ov = *ctx->mOverlay;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800894 LayerProp *layerProp = ctx->layerProp[mDpy];
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700895
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800896 int numHwLayers = ctx->listStats[mDpy].numAppLayers;
897 for(int i = 0; i < numHwLayers && mCurrentFrame.mdpCount; i++ )
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700898 {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800899 if(mCurrentFrame.isFBComposed[i]) continue;
900
Naseer Ahmed5b6708a2012-08-02 13:46:08 -0700901 hwc_layer_1_t *layer = &list->hwLayers[i];
Saurabh Shahacf10202013-02-26 10:15:15 -0800902 private_handle_t *hnd = (private_handle_t *)layer->handle;
903 if(!hnd) {
904 ALOGE("%s handle null", __FUNCTION__);
905 return false;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700906 }
907
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800908 int mdpIndex = mCurrentFrame.layerToMDP[i];
909
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800910 MdpPipeInfoLowRes& pipe_info =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800911 *(MdpPipeInfoLowRes*)mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800912 ovutils::eDest dest = pipe_info.index;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800913 if(dest == ovutils::OV_INVALID) {
914 ALOGE("%s: Invalid pipe index (%d)", __FUNCTION__, dest);
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500915 return false;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700916 }
917
Saurabh Shahacf10202013-02-26 10:15:15 -0800918 if(!(layerProp[i].mFlags & HWC_MDPCOMP)) {
919 continue;
920 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700921
Saurabh Shahacf10202013-02-26 10:15:15 -0800922 ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800923 using pipe: %d", __FUNCTION__, layer,
924 hnd, dest );
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700925
Saurabh Shahacf10202013-02-26 10:15:15 -0800926 int fd = hnd->fd;
927 uint32_t offset = hnd->offset;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800928 Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot;
Saurabh Shahacf10202013-02-26 10:15:15 -0800929 if(rot) {
930 if(!rot->queueBuffer(fd, offset))
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500931 return false;
Saurabh Shahacf10202013-02-26 10:15:15 -0800932 fd = rot->getDstMemId();
933 offset = rot->getDstOffset();
934 }
935
936 if (!ov.queueBuffer(fd, offset, dest)) {
937 ALOGE("%s: queueBuffer failed for external", __FUNCTION__);
938 return false;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700939 }
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500940
941 layerProp[i].mFlags &= ~HWC_MDPCOMP;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700942 }
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500943 return true;
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700944}
945
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800946//=============MDPCompHighRes===================================================
947
948int MDPCompHighRes::pipesNeeded(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800949 hwc_display_contents_1_t* list) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800950 int pipesNeeded = 0;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800951 int hw_w = ctx->dpyAttr[mDpy].xres;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800952
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800953 for(int i = 0; i < mCurrentFrame.layerCount; ++i) {
954 if(!mCurrentFrame.isFBComposed[i]) {
955 hwc_layer_1_t* layer = &list->hwLayers[i];
956 hwc_rect_t dst = layer->displayFrame;
957 if(dst.left > hw_w/2) {
958 pipesNeeded++;
959 } else if(dst.right <= hw_w/2) {
960 pipesNeeded++;
961 } else {
962 pipesNeeded += 2;
963 }
964 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800965 }
966 return pipesNeeded;
967}
968
969bool MDPCompHighRes::acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800970 MdpPipeInfoHighRes& pipe_info,
971 ePipeType type) {
972 int hw_w = ctx->dpyAttr[mDpy].xres;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800973
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800974 hwc_rect_t dst = layer->displayFrame;
975 if(dst.left > hw_w/2) {
976 pipe_info.lIndex = ovutils::OV_INVALID;
977 pipe_info.rIndex = getMdpPipe(ctx, type);
978 if(pipe_info.rIndex == ovutils::OV_INVALID)
979 return false;
980 } else if (dst.right <= hw_w/2) {
981 pipe_info.rIndex = ovutils::OV_INVALID;
982 pipe_info.lIndex = getMdpPipe(ctx, type);
983 if(pipe_info.lIndex == ovutils::OV_INVALID)
984 return false;
985 } else {
986 pipe_info.rIndex = getMdpPipe(ctx, type);
987 pipe_info.lIndex = getMdpPipe(ctx, type);
988 if(pipe_info.rIndex == ovutils::OV_INVALID ||
989 pipe_info.lIndex == ovutils::OV_INVALID)
990 return false;
991 }
992 return true;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800993}
994
995bool MDPCompHighRes::allocLayerPipes(hwc_context_t *ctx,
Saurabh Shahe51f8ca2013-05-06 17:26:16 -0700996 hwc_display_contents_1_t* list) {
997 for(int index = 0 ; index < mCurrentFrame.layerCount; index++) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800998
Saurabh Shahe51f8ca2013-05-06 17:26:16 -0700999 if(mCurrentFrame.isFBComposed[index]) continue;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001000
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001001 hwc_layer_1_t* layer = &list->hwLayers[index];
1002 private_handle_t *hnd = (private_handle_t *)layer->handle;
Saurabh Shah0d65dbe2013-06-06 18:33:16 -07001003 int mdpIndex = mCurrentFrame.layerToMDP[index];
1004 PipeLayerPair& info = mCurrentFrame.mdpToLayer[mdpIndex];
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001005 info.pipeInfo = new MdpPipeInfoHighRes;
Saurabh Shah9e3adb22013-03-26 11:16:27 -07001006 info.rot = NULL;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001007 MdpPipeInfoHighRes& pipe_info = *(MdpPipeInfoHighRes*)info.pipeInfo;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001008 ePipeType type = MDPCOMP_OV_ANY;
1009
Saurabh Shahe51f8ca2013-05-06 17:26:16 -07001010 if(isYuvBuffer(hnd)) {
1011 type = MDPCOMP_OV_VG;
Saurabh Shah8a117932013-05-23 12:48:13 -07001012 } else if(!qhwc::needsScaling(ctx, layer, mDpy)
Saurabh Shah85234ec2013-04-12 17:09:00 -07001013 && Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE
Saurabh Shahe51f8ca2013-05-06 17:26:16 -07001014 && ctx->mMDP.version >= qdutils::MDSS_V5) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001015 type = MDPCOMP_OV_DMA;
Saurabh Shahe51f8ca2013-05-06 17:26:16 -07001016 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001017
1018 if(!acquireMDPPipes(ctx, layer, pipe_info, type)) {
Saurabh Shahe51f8ca2013-05-06 17:26:16 -07001019 ALOGD_IF(isDebug(), "%s: Unable to get pipe for type = %d",
1020 __FUNCTION__, (int) type);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001021 return false;
1022 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001023 }
1024 return true;
1025}
1026/*
1027 * Configures pipe(s) for MDP composition
1028 */
1029int MDPCompHighRes::configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001030 PipeLayerPair& PipeLayerPair) {
Saurabh Shahacf10202013-02-26 10:15:15 -08001031 MdpPipeInfoHighRes& mdp_info =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001032 *(static_cast<MdpPipeInfoHighRes*>(PipeLayerPair.pipeInfo));
Saurabh Shahacf10202013-02-26 10:15:15 -08001033 eZorder zOrder = static_cast<eZorder>(mdp_info.zOrder);
1034 eIsFg isFg = IS_FG_OFF;
1035 eMdpFlags mdpFlagsL = OV_MDP_BACKEND_COMPOSITION;
1036 eDest lDest = mdp_info.lIndex;
1037 eDest rDest = mdp_info.rIndex;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001038
1039 ALOGD_IF(isDebug(),"%s: configuring: layer: %p z_order: %d dest_pipeL: %d"
1040 "dest_pipeR: %d",__FUNCTION__, layer, zOrder, lDest, rDest);
1041
1042 return configureHighRes(ctx, layer, mDpy, mdpFlagsL, zOrder, isFg, lDest,
1043 rDest, &PipeLayerPair.rot);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001044}
1045
1046bool MDPCompHighRes::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
1047
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001048 if(!isEnabled()) {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001049 ALOGD_IF(isDebug(),"%s: MDP Comp not configured", __FUNCTION__);
1050 return true;
1051 }
1052
1053 if(!ctx || !list) {
1054 ALOGE("%s: invalid contxt or list",__FUNCTION__);
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001055 return false;
1056 }
1057
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001058 /* reset Invalidator */
Saurabh Shah2d998a92013-05-14 17:55:58 -07001059 if(idleInvalidator && !sIdleFallBack && mCurrentFrame.mdpCount)
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001060 idleInvalidator->markForSleep();
1061
Naseer Ahmed54821fe2012-11-28 18:44:38 -05001062 overlay::Overlay& ov = *ctx->mOverlay;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001063 LayerProp *layerProp = ctx->layerProp[mDpy];
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001064
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001065 int numHwLayers = ctx->listStats[mDpy].numAppLayers;
1066 for(int i = 0; i < numHwLayers && mCurrentFrame.mdpCount; i++ )
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001067 {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001068 if(mCurrentFrame.isFBComposed[i]) continue;
1069
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001070 hwc_layer_1_t *layer = &list->hwLayers[i];
Saurabh Shahacf10202013-02-26 10:15:15 -08001071 private_handle_t *hnd = (private_handle_t *)layer->handle;
1072 if(!hnd) {
1073 ALOGE("%s handle null", __FUNCTION__);
1074 return false;
1075 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001076
1077 if(!(layerProp[i].mFlags & HWC_MDPCOMP)) {
1078 continue;
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001079 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001080
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001081 int mdpIndex = mCurrentFrame.layerToMDP[i];
1082
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001083 MdpPipeInfoHighRes& pipe_info =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001084 *(MdpPipeInfoHighRes*)mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo;
1085 Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot;
Saurabh Shahacf10202013-02-26 10:15:15 -08001086
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001087 ovutils::eDest indexL = pipe_info.lIndex;
1088 ovutils::eDest indexR = pipe_info.rIndex;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001089
Saurabh Shahacf10202013-02-26 10:15:15 -08001090 int fd = hnd->fd;
1091 int offset = hnd->offset;
1092
1093 if(rot) {
1094 rot->queueBuffer(fd, offset);
1095 fd = rot->getDstMemId();
1096 offset = rot->getDstOffset();
1097 }
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001098
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001099 //************* play left mixer **********
1100 if(indexL != ovutils::OV_INVALID) {
1101 ovutils::eDest destL = (ovutils::eDest)indexL;
Saurabh Shahacf10202013-02-26 10:15:15 -08001102 ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001103 using pipe: %d", __FUNCTION__, layer, hnd, indexL );
Saurabh Shahacf10202013-02-26 10:15:15 -08001104 if (!ov.queueBuffer(fd, offset, destL)) {
1105 ALOGE("%s: queueBuffer failed for left mixer", __FUNCTION__);
1106 return false;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001107 }
1108 }
1109
1110 //************* play right mixer **********
1111 if(indexR != ovutils::OV_INVALID) {
1112 ovutils::eDest destR = (ovutils::eDest)indexR;
Saurabh Shahacf10202013-02-26 10:15:15 -08001113 ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \
Jeykumar Sankaran85977e32013-02-25 17:06:08 -08001114 using pipe: %d", __FUNCTION__, layer, hnd, indexR );
Saurabh Shahacf10202013-02-26 10:15:15 -08001115 if (!ov.queueBuffer(fd, offset, destR)) {
1116 ALOGE("%s: queueBuffer failed for right mixer", __FUNCTION__);
1117 return false;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001118 }
1119 }
Saurabh Shahacf10202013-02-26 10:15:15 -08001120
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001121 layerProp[i].mFlags &= ~HWC_MDPCOMP;
1122 }
Saurabh Shahacf10202013-02-26 10:15:15 -08001123
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08001124 return true;
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001125}
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001126}; //namespace
1127