blob: a578bb001297be7606ea9565b9546422638161b0 [file] [log] [blame]
Naseer Ahmed29a26812012-06-14 00:56:20 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
Arun Kumar K.R361da4f2012-11-28 10:42:59 -08003 * Copyright (C) 2012-2013, The Linux Foundation All rights reserved.
4 *
5 * Not a Contribution, Apache license notifications and license are retained
6 * for attribution purposes only.
Naseer Ahmed29a26812012-06-14 00:56:20 -07007 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
Arun Kumar K.R361da4f2012-11-28 10:42:59 -080020#define HWC_UTILS_DEBUG 0
Naseer Ahmed758bfc52012-11-28 17:02:08 -050021#include <sys/ioctl.h>
Naseer Ahmed66e97882013-03-19 20:42:11 -040022#include <linux/fb.h>
Saurabh Shah86c17292013-02-08 15:24:13 -080023#include <binder/IServiceManager.h>
Naseer Ahmed5b6708a2012-08-02 13:46:08 -070024#include <EGL/egl.h>
Saurabh Shahfc2acbe2012-08-17 19:47:52 -070025#include <cutils/properties.h>
26#include <gralloc_priv.h>
Naseer Ahmed758bfc52012-11-28 17:02:08 -050027#include <overlay.h>
Saurabh Shahacf10202013-02-26 10:15:15 -080028#include <overlayRotator.h>
Naseer Ahmed29a26812012-06-14 00:56:20 -070029#include "hwc_utils.h"
Naseer Ahmed54821fe2012-11-28 18:44:38 -050030#include "hwc_mdpcomp.h"
Saurabh Shahcf053c62012-12-13 12:32:55 -080031#include "hwc_fbupdate.h"
Naseer Ahmeda87da602012-07-01 23:54:19 -070032#include "mdp_version.h"
Arun Kumar K.R361da4f2012-11-28 10:42:59 -080033#include "hwc_copybit.h"
Ramkumar Radhakrishnand224a1a2013-04-05 17:46:55 -070034#include "hwc_dump_layers.h"
Saurabh Shah56f610d2012-08-07 15:27:06 -070035#include "external.h"
Saurabh Shah86c17292013-02-08 15:24:13 -080036#include "hwc_qclient.h"
Saurabh Shah56f610d2012-08-07 15:27:06 -070037#include "QService.h"
Arun Kumar K.R361da4f2012-11-28 10:42:59 -080038#include "comptype.h"
Saurabh Shah86c17292013-02-08 15:24:13 -080039
40using namespace qClient;
41using namespace qService;
42using namespace android;
Saurabh Shahacf10202013-02-26 10:15:15 -080043using namespace overlay;
44using namespace overlay::utils;
45namespace ovutils = overlay::utils;
Saurabh Shah86c17292013-02-08 15:24:13 -080046
Naseer Ahmed29a26812012-06-14 00:56:20 -070047namespace qhwc {
Naseer Ahmed72cf9762012-07-21 12:17:13 -070048
Jeykumar Sankaranc1f86822013-02-20 18:32:01 -080049static int openFramebufferDevice(hwc_context_t *ctx)
Naseer Ahmed72cf9762012-07-21 12:17:13 -070050{
Jeykumar Sankaranc1f86822013-02-20 18:32:01 -080051 struct fb_fix_screeninfo finfo;
52 struct fb_var_screeninfo info;
53
54 int fb_fd = openFb(HWC_DISPLAY_PRIMARY);
55
56 if (ioctl(fb_fd, FBIOGET_VSCREENINFO, &info) == -1)
57 return -errno;
58
59 if (int(info.width) <= 0 || int(info.height) <= 0) {
60 // the driver doesn't return that information
61 // default to 160 dpi
62 info.width = ((info.xres * 25.4f)/160.0f + 0.5f);
63 info.height = ((info.yres * 25.4f)/160.0f + 0.5f);
Naseer Ahmed72cf9762012-07-21 12:17:13 -070064 }
Jeykumar Sankaranc1f86822013-02-20 18:32:01 -080065
66 float xdpi = (info.xres * 25.4f) / info.width;
67 float ydpi = (info.yres * 25.4f) / info.height;
68
69#ifdef MSMFB_METADATA_GET
70 struct msmfb_metadata metadata;
71 memset(&metadata, 0 , sizeof(metadata));
72 metadata.op = metadata_op_frame_rate;
73
74 if (ioctl(fb_fd, MSMFB_METADATA_GET, &metadata) == -1) {
75 ALOGE("Error retrieving panel frame rate");
76 return -errno;
77 }
78
79 float fps = metadata.data.panel_frame_rate;
80#else
81 //XXX: Remove reserved field usage on all baselines
82 //The reserved[3] field is used to store FPS by the driver.
83 float fps = info.reserved[3] & 0xFF;
84#endif
85
86 if (ioctl(fb_fd, FBIOGET_FSCREENINFO, &finfo) == -1)
87 return -errno;
88
89 if (finfo.smem_len <= 0)
90 return -errno;
91
92 ctx->dpyAttr[HWC_DISPLAY_PRIMARY].fd = fb_fd;
93 //xres, yres may not be 32 aligned
94 ctx->dpyAttr[HWC_DISPLAY_PRIMARY].stride = finfo.line_length /(info.xres/8);
95 ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres = info.xres;
96 ctx->dpyAttr[HWC_DISPLAY_PRIMARY].yres = info.yres;
97 ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xdpi = xdpi;
98 ctx->dpyAttr[HWC_DISPLAY_PRIMARY].ydpi = ydpi;
99 ctx->dpyAttr[HWC_DISPLAY_PRIMARY].vsync_period = 1000000000l / fps;
100
101 return 0;
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700102}
103
Naseer Ahmed29a26812012-06-14 00:56:20 -0700104void initContext(hwc_context_t *ctx)
105{
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700106 openFramebufferDevice(ctx);
Naseer Ahmed96c4c952012-07-25 18:27:14 -0700107 ctx->mMDP.version = qdutils::MDPVersion::getInstance().getMDPVersion();
108 ctx->mMDP.hasOverlay = qdutils::MDPVersion::getInstance().hasOverlay();
109 ctx->mMDP.panel = qdutils::MDPVersion::getInstance().getPanelType();
Sushil Chauhan07a2c762013-03-06 15:36:49 -0800110 overlay::Overlay::initOverlay();
111 ctx->mOverlay = overlay::Overlay::getInstance();
112 ctx->mRotMgr = new RotMgr();
113
Saurabh Shahcf053c62012-12-13 12:32:55 -0800114 //Is created and destroyed only once for primary
115 //For external it could get created and destroyed multiple times depending
116 //on what external we connect to.
117 ctx->mFBUpdate[HWC_DISPLAY_PRIMARY] =
118 IFBUpdate::getObject(ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres,
119 HWC_DISPLAY_PRIMARY);
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800120
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800121 // Check if the target supports copybit compostion (dyn/mdp/c2d) to
122 // decide if we need to open the copybit module.
123 int compositionType =
124 qdutils::QCCompositionType::getInstance().getCompositionType();
125
126 if (compositionType & (qdutils::COMPOSITION_TYPE_DYN |
127 qdutils::COMPOSITION_TYPE_MDP |
128 qdutils::COMPOSITION_TYPE_C2D)) {
129 ctx->mCopyBit[HWC_DISPLAY_PRIMARY] = new CopyBit();
130 }
131
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700132 ctx->mExtDisplay = new ExternalDisplay(ctx);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800133
134 ctx->mMDPComp[HWC_DISPLAY_PRIMARY] =
135 MDPComp::getObject(ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres,
136 HWC_DISPLAY_PRIMARY);
137
Ramkumar Radhakrishnand224a1a2013-04-05 17:46:55 -0700138 for (uint32_t i = 0; i < MAX_DISPLAYS; i++) {
139 ctx->mHwcDebug[i] = new HwcDebug(i);
140 }
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500141 MDPComp::init(ctx);
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700142
Naseer Ahmedff4f0252012-10-01 13:03:01 -0400143 pthread_mutex_init(&(ctx->vstate.lock), NULL);
144 pthread_cond_init(&(ctx->vstate.cond), NULL);
145 ctx->vstate.enable = false;
Naseer Ahmed56601cd2013-03-05 11:34:14 -0500146 ctx->vstate.fakevsync = false;
Amara Venkata Mastan Manoj Kumar75526f52012-12-27 18:27:01 -0800147 ctx->mExtDispConfiguring = false;
Saurabh Shah86c17292013-02-08 15:24:13 -0800148
149 //Right now hwc starts the service but anybody could do it, or it could be
150 //independent process as well.
151 QService::init();
152 sp<IQClient> client = new QClient(ctx);
153 interface_cast<IQService>(
154 defaultServiceManager()->getService(
155 String16("display.qservice")))->connect(client);
156
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700157 ALOGI("Initializing Qualcomm Hardware Composer");
Naseer Ahmed96c4c952012-07-25 18:27:14 -0700158 ALOGI("MDP version: %d", ctx->mMDP.version);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700159}
160
161void closeContext(hwc_context_t *ctx)
162{
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500163 if(ctx->mOverlay) {
164 delete ctx->mOverlay;
165 ctx->mOverlay = NULL;
Naseer Ahmed29a26812012-06-14 00:56:20 -0700166 }
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700167
Saurabh Shahacf10202013-02-26 10:15:15 -0800168 if(ctx->mRotMgr) {
169 delete ctx->mRotMgr;
170 ctx->mRotMgr = NULL;
171 }
172
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -0800173 for(int i = 0; i < MAX_DISPLAYS; i++) {
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800174 if(ctx->mCopyBit[i]) {
175 delete ctx->mCopyBit[i];
176 ctx->mCopyBit[i] = NULL;
177 }
178 }
179
Jeykumar Sankaranc1f86822013-02-20 18:32:01 -0800180 if(ctx->dpyAttr[HWC_DISPLAY_PRIMARY].fd) {
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700181 close(ctx->dpyAttr[HWC_DISPLAY_PRIMARY].fd);
182 ctx->dpyAttr[HWC_DISPLAY_PRIMARY].fd = -1;
Naseer Ahmed29a26812012-06-14 00:56:20 -0700183 }
Naseer Ahmed72cf9762012-07-21 12:17:13 -0700184
185 if(ctx->mExtDisplay) {
186 delete ctx->mExtDisplay;
187 ctx->mExtDisplay = NULL;
188 }
Naseer Ahmedff4f0252012-10-01 13:03:01 -0400189
Amara Venkata Mastan Manoj Kumar11a380d2013-01-17 09:30:56 -0800190 for(int i = 0; i < MAX_DISPLAYS; i++) {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800191 if(ctx->mFBUpdate[i]) {
192 delete ctx->mFBUpdate[i];
193 ctx->mFBUpdate[i] = NULL;
194 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800195 if(ctx->mMDPComp[i]) {
196 delete ctx->mMDPComp[i];
197 ctx->mMDPComp[i] = NULL;
Saurabh Shahacf10202013-02-26 10:15:15 -0800198 }
Ramkumar Radhakrishnand224a1a2013-04-05 17:46:55 -0700199 if(ctx->mHwcDebug[i]) {
200 delete ctx->mHwcDebug[i];
201 ctx->mHwcDebug[i] = NULL;
202 }
Saurabh Shahcf053c62012-12-13 12:32:55 -0800203 }
204
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800205
Naseer Ahmedff4f0252012-10-01 13:03:01 -0400206 pthread_mutex_destroy(&(ctx->vstate.lock));
207 pthread_cond_destroy(&(ctx->vstate.cond));
Naseer Ahmed29a26812012-06-14 00:56:20 -0700208}
209
Naseer Ahmed1d183f52012-11-26 12:35:16 -0500210
211void dumpsys_log(android::String8& buf, const char* fmt, ...)
Naseer Ahmed29a26812012-06-14 00:56:20 -0700212{
Naseer Ahmed1d183f52012-11-26 12:35:16 -0500213 va_list varargs;
214 va_start(varargs, fmt);
215 buf.appendFormatV(fmt, varargs);
216 va_end(varargs);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700217}
218
Arun Kumar K.Rfeb2d8a2013-02-01 02:53:13 -0800219/* Calculates the destination position based on the action safe rectangle */
220void getActionSafePosition(hwc_context_t *ctx, int dpy, uint32_t& x,
221 uint32_t& y, uint32_t& w, uint32_t& h) {
222
223 // if external supports underscan, do nothing
224 // it will be taken care in the driver
225 if(ctx->mExtDisplay->isCEUnderscanSupported())
226 return;
227
228 float wRatio = 1.0;
229 float hRatio = 1.0;
230 float xRatio = 1.0;
231 float yRatio = 1.0;
232
233 float fbWidth = ctx->dpyAttr[dpy].xres;
234 float fbHeight = ctx->dpyAttr[dpy].yres;
235
236 float asX = 0;
237 float asY = 0;
238 float asW = fbWidth;
239 float asH= fbHeight;
240 char value[PROPERTY_VALUE_MAX];
241
242 // Apply action safe parameters
243 property_get("hw.actionsafe.width", value, "0");
244 int asWidthRatio = atoi(value);
245 property_get("hw.actionsafe.height", value, "0");
246 int asHeightRatio = atoi(value);
247 // based on the action safe ratio, get the Action safe rectangle
248 asW = fbWidth * (1.0f - asWidthRatio / 100.0f);
249 asH = fbHeight * (1.0f - asHeightRatio / 100.0f);
250 asX = (fbWidth - asW) / 2;
251 asY = (fbHeight - asH) / 2;
252
253 // calculate the position ratio
254 xRatio = (float)x/fbWidth;
255 yRatio = (float)y/fbHeight;
256 wRatio = (float)w/fbWidth;
257 hRatio = (float)h/fbHeight;
258
259 //Calculate the position...
260 x = (xRatio * asW) + asX;
261 y = (yRatio * asH) + asY;
262 w = (wRatio * asW);
263 h = (hRatio * asH);
264
265 return;
266}
267
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800268bool needsScaling(hwc_layer_1_t const* layer) {
Naseer Ahmed018e5452012-12-03 14:46:15 -0500269 int dst_w, dst_h, src_w, src_h;
270
271 hwc_rect_t displayFrame = layer->displayFrame;
272 hwc_rect_t sourceCrop = layer->sourceCrop;
273
274 dst_w = displayFrame.right - displayFrame.left;
275 dst_h = displayFrame.bottom - displayFrame.top;
276
277 src_w = sourceCrop.right - sourceCrop.left;
278 src_h = sourceCrop.bottom - sourceCrop.top;
279
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800280 if(((src_w != dst_w) || (src_h != dst_h)))
281 return true;
282
283 return false;
284}
285
286bool isAlphaScaled(hwc_layer_1_t const* layer) {
Sravan Kumar D.V.N075ef002013-03-20 05:22:26 +0530287 if(needsScaling(layer) && isAlphaPresent(layer)) {
288 return true;
289 }
290 return false;
291}
292
293bool isAlphaPresent(hwc_layer_1_t const* layer) {
294 private_handle_t *hnd = (private_handle_t *)layer->handle;
Naseer Ahmed7a4287c2013-03-26 18:11:41 -0400295 if(hnd) {
296 int format = hnd->format;
297 switch(format) {
Sravan Kumar D.V.N075ef002013-03-20 05:22:26 +0530298 case HAL_PIXEL_FORMAT_RGBA_8888:
299 case HAL_PIXEL_FORMAT_BGRA_8888:
300 // In any more formats with Alpha go here..
Naseer Ahmed018e5452012-12-03 14:46:15 -0500301 return true;
Sravan Kumar D.V.N075ef002013-03-20 05:22:26 +0530302 default : return false;
Naseer Ahmed7a4287c2013-03-26 18:11:41 -0400303 }
Naseer Ahmed018e5452012-12-03 14:46:15 -0500304 }
305 return false;
306}
307
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700308void setListStats(hwc_context_t *ctx,
309 const hwc_display_contents_1_t *list, int dpy) {
310
311 ctx->listStats[dpy].numAppLayers = list->numHwLayers - 1;
312 ctx->listStats[dpy].fbLayerIndex = list->numHwLayers - 1;
Saurabh Shahc4d034f2012-09-27 15:55:15 -0700313 ctx->listStats[dpy].skipCount = 0;
Naseer Ahmed018e5452012-12-03 14:46:15 -0500314 ctx->listStats[dpy].needsAlphaScale = false;
Sravan Kumar D.V.Nb5ed0292013-03-15 08:51:16 +0530315 ctx->listStats[dpy].preMultipliedAlpha = false;
Jeykumar Sankarancf537002013-01-21 21:19:15 -0800316 ctx->listStats[dpy].yuvCount = 0;
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700317
318 for (size_t i = 0; i < list->numHwLayers; i++) {
Naseer Ahmed018e5452012-12-03 14:46:15 -0500319 hwc_layer_1_t const* layer = &list->hwLayers[i];
320 private_handle_t *hnd = (private_handle_t *)layer->handle;
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700321
Jeykumar Sankarancf537002013-01-21 21:19:15 -0800322 //reset stored yuv index
323 ctx->listStats[dpy].yuvIndices[i] = -1;
324
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700325 if(list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) {
326 continue;
327 //We disregard FB being skip for now! so the else if
Saurabh Shah35712cb2012-09-14 10:28:18 -0700328 } else if (isSkipLayer(&list->hwLayers[i])) {
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700329 ctx->listStats[dpy].skipCount++;
Jeykumar Sankaran7535aba2013-02-04 11:03:09 -0800330 } else if (UNLIKELY(isYuvBuffer(hnd))) {
Jeykumar Sankarancf537002013-01-21 21:19:15 -0800331 int& yuvCount = ctx->listStats[dpy].yuvCount;
332 ctx->listStats[dpy].yuvIndices[yuvCount] = i;
333 yuvCount++;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800334
Saurabh Shah85234ec2013-04-12 17:09:00 -0700335 if(layer->transform & HWC_TRANSFORM_ROT_90) {
336 Overlay::setDMAMode(Overlay::DMA_BLOCK_MODE);
337 }
Naseer Ahmed29a26812012-06-14 00:56:20 -0700338 }
Sravan Kumar D.V.Nb5ed0292013-03-15 08:51:16 +0530339 if(layer->blending == HWC_BLENDING_PREMULT)
340 ctx->listStats[dpy].preMultipliedAlpha = true;
Jeykumar Sankaran7535aba2013-02-04 11:03:09 -0800341
342 if(!ctx->listStats[dpy].needsAlphaScale)
343 ctx->listStats[dpy].needsAlphaScale = isAlphaScaled(layer);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700344 }
Naseer Ahmed29a26812012-06-14 00:56:20 -0700345}
346
Naseer Ahmed018e5452012-12-03 14:46:15 -0500347
Saurabh Shah541b59d2012-10-11 11:08:12 -0700348static inline void calc_cut(float& leftCutRatio, float& topCutRatio,
349 float& rightCutRatio, float& bottomCutRatio, int orient) {
Saurabh Shah27c1d652012-08-14 19:30:28 -0700350 if(orient & HAL_TRANSFORM_FLIP_H) {
Saurabh Shah541b59d2012-10-11 11:08:12 -0700351 swap(leftCutRatio, rightCutRatio);
Saurabh Shah27c1d652012-08-14 19:30:28 -0700352 }
353 if(orient & HAL_TRANSFORM_FLIP_V) {
Saurabh Shah541b59d2012-10-11 11:08:12 -0700354 swap(topCutRatio, bottomCutRatio);
Saurabh Shah27c1d652012-08-14 19:30:28 -0700355 }
356 if(orient & HAL_TRANSFORM_ROT_90) {
357 //Anti clock swapping
Saurabh Shah541b59d2012-10-11 11:08:12 -0700358 float tmpCutRatio = leftCutRatio;
359 leftCutRatio = topCutRatio;
360 topCutRatio = rightCutRatio;
361 rightCutRatio = bottomCutRatio;
362 bottomCutRatio = tmpCutRatio;
Saurabh Shah27c1d652012-08-14 19:30:28 -0700363 }
364}
365
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800366bool isSecuring(hwc_context_t* ctx, hwc_layer_1_t const* layer) {
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500367 if((ctx->mMDP.version < qdutils::MDSS_V5) &&
368 (ctx->mMDP.version > qdutils::MDP_V3_0) &&
369 ctx->mSecuring) {
370 return true;
371 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800372 if (isSecureModePolicy(ctx->mMDP.version)) {
373 private_handle_t *hnd = (private_handle_t *)layer->handle;
374 if(ctx->mSecureMode) {
375 if (! isSecureBuffer(hnd)) {
376 ALOGD_IF(HWC_UTILS_DEBUG,"%s:Securing Turning ON ...",
377 __FUNCTION__);
378 return true;
379 }
380 } else {
381 if (isSecureBuffer(hnd)) {
382 ALOGD_IF(HWC_UTILS_DEBUG,"%s:Securing Turning OFF ...",
383 __FUNCTION__);
384 return true;
385 }
386 }
387 }
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500388 return false;
389}
390
Sushil Chauhan2515abf2013-01-08 16:40:05 -0800391bool isSecureModePolicy(int mdpVersion) {
392 if (mdpVersion < qdutils::MDSS_V5)
393 return true;
394 else
395 return false;
396}
Naseer Ahmed54821fe2012-11-28 18:44:38 -0500397
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700398//Crops source buffer against destination and FB boundaries
399void calculate_crop_rects(hwc_rect_t& crop, hwc_rect_t& dst,
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800400 const hwc_rect_t& scissor, int orient) {
401
Saurabh Shah27c1d652012-08-14 19:30:28 -0700402 int& crop_l = crop.left;
403 int& crop_t = crop.top;
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700404 int& crop_r = crop.right;
405 int& crop_b = crop.bottom;
406 int crop_w = crop.right - crop.left;
407 int crop_h = crop.bottom - crop.top;
408
Saurabh Shah27c1d652012-08-14 19:30:28 -0700409 int& dst_l = dst.left;
410 int& dst_t = dst.top;
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700411 int& dst_r = dst.right;
412 int& dst_b = dst.bottom;
Saurabh Shah27c1d652012-08-14 19:30:28 -0700413 int dst_w = abs(dst.right - dst.left);
414 int dst_h = abs(dst.bottom - dst.top);
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700415
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800416 const int& sci_l = scissor.left;
417 const int& sci_t = scissor.top;
418 const int& sci_r = scissor.right;
419 const int& sci_b = scissor.bottom;
420 int sci_w = abs(sci_r - sci_l);
421 int sci_h = abs(sci_b - sci_t);
422
Saurabh Shah541b59d2012-10-11 11:08:12 -0700423 float leftCutRatio = 0.0f, rightCutRatio = 0.0f, topCutRatio = 0.0f,
424 bottomCutRatio = 0.0f;
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700425
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800426 if(dst_l < sci_l) {
427 leftCutRatio = (float)(sci_l - dst_l) / (float)dst_w;
428 dst_l = sci_l;
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700429 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800430
431 if(dst_r > sci_r) {
432 rightCutRatio = (float)(dst_r - sci_r) / (float)dst_w;
433 dst_r = sci_r;
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700434 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800435
436 if(dst_t < sci_t) {
437 topCutRatio = (float)(sci_t - dst_t) / (float)dst_h;
438 dst_t = sci_t;
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700439 }
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800440
441 if(dst_b > sci_b) {
442 bottomCutRatio = (float)(dst_b - sci_b) / (float)dst_h;
443 dst_b = sci_b;
Naseer Ahmed29a26812012-06-14 00:56:20 -0700444 }
Saurabh Shah27c1d652012-08-14 19:30:28 -0700445
Saurabh Shah541b59d2012-10-11 11:08:12 -0700446 calc_cut(leftCutRatio, topCutRatio, rightCutRatio, bottomCutRatio, orient);
447 crop_l += crop_w * leftCutRatio;
448 crop_t += crop_h * topCutRatio;
449 crop_r -= crop_w * rightCutRatio;
450 crop_b -= crop_h * bottomCutRatio;
Naseer Ahmed29a26812012-06-14 00:56:20 -0700451}
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700452
Naseer Ahmed64b81212013-02-14 10:29:47 -0500453void getNonWormholeRegion(hwc_display_contents_1_t* list,
454 hwc_rect_t& nwr)
455{
456 uint32_t last = list->numHwLayers - 1;
457 hwc_rect_t fbDisplayFrame = list->hwLayers[last].displayFrame;
458 //Initiliaze nwr to first frame
459 nwr.left = list->hwLayers[0].displayFrame.left;
460 nwr.top = list->hwLayers[0].displayFrame.top;
461 nwr.right = list->hwLayers[0].displayFrame.right;
462 nwr.bottom = list->hwLayers[0].displayFrame.bottom;
463
464 for (uint32_t i = 1; i < last; i++) {
465 hwc_rect_t displayFrame = list->hwLayers[i].displayFrame;
466 nwr.left = min(nwr.left, displayFrame.left);
467 nwr.top = min(nwr.top, displayFrame.top);
468 nwr.right = max(nwr.right, displayFrame.right);
469 nwr.bottom = max(nwr.bottom, displayFrame.bottom);
470 }
471
472 //Intersect with the framebuffer
473 nwr.left = max(nwr.left, fbDisplayFrame.left);
474 nwr.top = max(nwr.top, fbDisplayFrame.top);
475 nwr.right = min(nwr.right, fbDisplayFrame.right);
476 nwr.bottom = min(nwr.bottom, fbDisplayFrame.bottom);
477
478}
479
Saurabh Shah3e858eb2012-09-17 16:53:21 -0700480bool isExternalActive(hwc_context_t* ctx) {
481 return ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].isActive;
Saurabh Shahfc2acbe2012-08-17 19:47:52 -0700482}
483
Saurabh Shah747af1e2013-02-26 10:25:12 -0800484void closeAcquireFds(hwc_display_contents_1_t* list) {
485 for(uint32_t i = 0; list && i < list->numHwLayers; i++) {
486 //Close the acquireFenceFds
487 //HWC_FRAMEBUFFER are -1 already by SF, rest we close.
488 if(list->hwLayers[i].acquireFenceFd >= 0) {
489 close(list->hwLayers[i].acquireFenceFd);
490 list->hwLayers[i].acquireFenceFd = -1;
491 }
492 }
493}
494
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800495int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
496 int fd) {
Kinjal Bhavsar2dd04a82012-09-18 18:27:59 -0700497 int ret = 0;
Kinjal Bhavsar2dd04a82012-09-18 18:27:59 -0700498 struct mdp_buf_sync data;
Naseer Ahmedb1c76322012-10-17 00:32:50 -0400499 int acquireFd[MAX_NUM_LAYERS];
Kinjal Bhavsar2dd04a82012-09-18 18:27:59 -0700500 int count = 0;
501 int releaseFd = -1;
502 int fbFd = -1;
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800503 memset(&data, 0, sizeof(data));
Naseer Ahmed94baddc2012-12-17 18:51:01 -0500504 bool swapzero = false;
Saurabh Shahc4d034f2012-09-27 15:55:15 -0700505 data.flags = MDP_BUF_SYNC_FLAG_WAIT;
Kinjal Bhavsar2dd04a82012-09-18 18:27:59 -0700506 data.acq_fen_fd = acquireFd;
507 data.rel_fen_fd = &releaseFd;
Naseer Ahmed94baddc2012-12-17 18:51:01 -0500508 char property[PROPERTY_VALUE_MAX];
509 if(property_get("debug.egl.swapinterval", property, "1") > 0) {
510 if(atoi(property) == 0)
511 swapzero = true;
512 }
513
Kinjal Bhavsar2dd04a82012-09-18 18:27:59 -0700514 //Accumulate acquireFenceFds
515 for(uint32_t i = 0; i < list->numHwLayers; i++) {
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800516 if(list->hwLayers[i].compositionType == HWC_OVERLAY &&
517 list->hwLayers[i].acquireFenceFd != -1) {
Naseer Ahmed94baddc2012-12-17 18:51:01 -0500518 if(UNLIKELY(swapzero))
519 acquireFd[count++] = -1;
520 else
521 acquireFd[count++] = list->hwLayers[i].acquireFenceFd;
Kinjal Bhavsar2dd04a82012-09-18 18:27:59 -0700522 }
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800523 if(list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) {
524 if(UNLIKELY(swapzero))
525 acquireFd[count++] = -1;
526 else if(fd != -1) {
527 //set the acquireFD from fd - which is coming from c2d
528 acquireFd[count++] = fd;
529 // Buffer sync IOCTL should be async when using c2d fence is
530 // used
531 data.flags &= ~MDP_BUF_SYNC_FLAG_WAIT;
532 } else if(list->hwLayers[i].acquireFenceFd != -1)
533 acquireFd[count++] = list->hwLayers[i].acquireFenceFd;
534 }
Kinjal Bhavsar2dd04a82012-09-18 18:27:59 -0700535 }
536
Kinjal Bhavsar40a1cc52012-10-10 15:52:03 -0700537 data.acq_fen_fd_cnt = count;
538 fbFd = ctx->dpyAttr[dpy].fd;
Kinjal Bhavsar40a1cc52012-10-10 15:52:03 -0700539 //Waits for acquire fences, returns a release fence
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800540 if(LIKELY(!swapzero)) {
541 uint64_t start = systemTime();
Naseer Ahmed94baddc2012-12-17 18:51:01 -0500542 ret = ioctl(fbFd, MSMFB_BUFFER_SYNC, &data);
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800543 ALOGD_IF(HWC_UTILS_DEBUG, "%s: time taken for MSMFB_BUFFER_SYNC IOCTL = %d",
544 __FUNCTION__, (size_t) ns2ms(systemTime() - start));
545 }
Saurabh Shah747af1e2013-02-26 10:25:12 -0800546
Kinjal Bhavsar40a1cc52012-10-10 15:52:03 -0700547 if(ret < 0) {
548 ALOGE("ioctl MSMFB_BUFFER_SYNC failed, err=%s",
549 strerror(errno));
Kinjal Bhavsar2dd04a82012-09-18 18:27:59 -0700550 }
Saurabh Shah747af1e2013-02-26 10:25:12 -0800551
Kinjal Bhavsar40a1cc52012-10-10 15:52:03 -0700552 for(uint32_t i = 0; i < list->numHwLayers; i++) {
Arun Kumar K.R361da4f2012-11-28 10:42:59 -0800553 if(list->hwLayers[i].compositionType == HWC_OVERLAY ||
554 list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) {
Kinjal Bhavsar40a1cc52012-10-10 15:52:03 -0700555 //Populate releaseFenceFds.
Naseer Ahmed94baddc2012-12-17 18:51:01 -0500556 if(UNLIKELY(swapzero))
557 list->hwLayers[i].releaseFenceFd = -1;
558 else
559 list->hwLayers[i].releaseFenceFd = dup(releaseFd);
Kinjal Bhavsar40a1cc52012-10-10 15:52:03 -0700560 }
561 }
Saurabh Shah747af1e2013-02-26 10:25:12 -0800562
563 if(fd >= 0) {
564 close(fd);
565 fd = -1;
566 }
567
Naseer Ahmed64b81212013-02-14 10:29:47 -0500568 if (ctx->mCopyBit[dpy])
569 ctx->mCopyBit[dpy]->setReleaseFd(releaseFd);
Naseer Ahmed94baddc2012-12-17 18:51:01 -0500570 if(UNLIKELY(swapzero)){
571 list->retireFenceFd = -1;
572 close(releaseFd);
573 } else {
574 list->retireFenceFd = releaseFd;
575 }
Saurabh Shah747af1e2013-02-26 10:25:12 -0800576
Kinjal Bhavsar2dd04a82012-09-18 18:27:59 -0700577 return ret;
578}
579
Saurabh Shahacf10202013-02-26 10:15:15 -0800580void trimLayer(hwc_context_t *ctx, const int& dpy, const int& transform,
581 hwc_rect_t& crop, hwc_rect_t& dst) {
582 int hw_w = ctx->dpyAttr[dpy].xres;
583 int hw_h = ctx->dpyAttr[dpy].yres;
584 if(dst.left < 0 || dst.top < 0 ||
585 dst.right > hw_w || dst.bottom > hw_h) {
586 hwc_rect_t scissor = {0, 0, hw_w, hw_h };
587 qhwc::calculate_crop_rects(crop, dst, scissor, transform);
588 }
589}
590
591void setMdpFlags(hwc_layer_1_t *layer,
592 ovutils::eMdpFlags &mdpFlags,
593 int rotDownscale) {
594 private_handle_t *hnd = (private_handle_t *)layer->handle;
595 MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
596 const int& transform = layer->transform;
597
598 if(layer->blending == HWC_BLENDING_PREMULT) {
599 ovutils::setMdpFlags(mdpFlags,
600 ovutils::OV_MDP_BLEND_FG_PREMULT);
601 }
602
603 if(isYuvBuffer(hnd)) {
604 if(isSecureBuffer(hnd)) {
605 ovutils::setMdpFlags(mdpFlags,
606 ovutils::OV_MDP_SECURE_OVERLAY_SESSION);
607 }
608 if(metadata && (metadata->operation & PP_PARAM_INTERLACED) &&
609 metadata->interlaced) {
610 ovutils::setMdpFlags(mdpFlags,
611 ovutils::OV_MDP_DEINTERLACE);
612 }
613 //Pre-rotation will be used using rotator.
614 if(transform & HWC_TRANSFORM_ROT_90) {
615 ovutils::setMdpFlags(mdpFlags,
616 ovutils::OV_MDP_SOURCE_ROTATED_90);
617 }
618 }
619
620 //No 90 component and no rot-downscale then flips done by MDP
621 //If we use rot then it might as well do flips
622 if(!(layer->transform & HWC_TRANSFORM_ROT_90) && !rotDownscale) {
623 if(layer->transform & HWC_TRANSFORM_FLIP_H) {
624 ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_FLIP_H);
625 }
626
627 if(layer->transform & HWC_TRANSFORM_FLIP_V) {
628 ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_FLIP_V);
629 }
630 }
Saurabh Shah5daeee52013-01-23 16:52:26 +0800631
632 if(metadata &&
633 ((metadata->operation & PP_PARAM_HSIC)
634 || (metadata->operation & PP_PARAM_IGC)
635 || (metadata->operation & PP_PARAM_SHARP2))) {
636 ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_PP_EN);
637 }
Saurabh Shahacf10202013-02-26 10:15:15 -0800638}
639
640static inline int configRotator(Rotator *rot, const Whf& whf,
641 const eMdpFlags& mdpFlags, const eTransform& orient,
642 const int& downscale) {
643 rot->setSource(whf);
644 rot->setFlags(mdpFlags);
645 rot->setTransform(orient);
646 rot->setDownscale(downscale);
647 if(!rot->commit()) return -1;
648 return 0;
649}
650
651static inline int configMdp(Overlay *ov, const PipeArgs& parg,
652 const eTransform& orient, const hwc_rect_t& crop,
Saurabh Shah5daeee52013-01-23 16:52:26 +0800653 const hwc_rect_t& pos, const MetaData_t *metadata,
654 const eDest& dest) {
Saurabh Shahacf10202013-02-26 10:15:15 -0800655 ov->setSource(parg, dest);
656 ov->setTransform(orient, dest);
657
658 int crop_w = crop.right - crop.left;
659 int crop_h = crop.bottom - crop.top;
660 Dim dcrop(crop.left, crop.top, crop_w, crop_h);
661 ov->setCrop(dcrop, dest);
662
663 int posW = pos.right - pos.left;
664 int posH = pos.bottom - pos.top;
665 Dim position(pos.left, pos.top, posW, posH);
666 ov->setPosition(position, dest);
667
Saurabh Shah5daeee52013-01-23 16:52:26 +0800668 if (metadata)
669 ov->setVisualParams(*metadata, dest);
670
Saurabh Shahacf10202013-02-26 10:15:15 -0800671 if (!ov->commit(dest)) {
672 return -1;
673 }
674 return 0;
675}
676
677static inline void updateSource(eTransform& orient, Whf& whf,
678 hwc_rect_t& crop) {
679 Dim srcCrop(crop.left, crop.top,
680 crop.right - crop.left,
681 crop.bottom - crop.top);
Saurabh Shah76fd6552013-03-14 14:45:38 -0700682 orient = static_cast<eTransform>(ovutils::getMdpOrient(orient));
Saurabh Shahacf10202013-02-26 10:15:15 -0800683 preRotateSource(orient, whf, srcCrop);
684 crop.left = srcCrop.x;
685 crop.top = srcCrop.y;
686 crop.right = srcCrop.x + srcCrop.w;
687 crop.bottom = srcCrop.y + srcCrop.h;
688}
689
690int configureLowRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
691 const int& dpy, eMdpFlags& mdpFlags, const eZorder& z,
692 const eIsFg& isFg, const eDest& dest, Rotator **rot) {
693
694 private_handle_t *hnd = (private_handle_t *)layer->handle;
695 if(!hnd) {
696 ALOGE("%s: layer handle is NULL", __FUNCTION__);
697 return -1;
698 }
699
Saurabh Shah5daeee52013-01-23 16:52:26 +0800700 MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
701
Saurabh Shahacf10202013-02-26 10:15:15 -0800702 hwc_rect_t crop = layer->sourceCrop;
703 hwc_rect_t dst = layer->displayFrame;
704 int transform = layer->transform;
705 eTransform orient = static_cast<eTransform>(transform);
706 int downscale = 0;
707 int rotFlags = ovutils::ROT_FLAGS_NONE;
708 Whf whf(hnd->width, hnd->height,
709 getMdpFormat(hnd->format), hnd->size);
710
711 if(isYuvBuffer(hnd) && ctx->mMDP.version >= qdutils::MDP_V4_2 &&
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800712 ctx->mMDP.version < qdutils::MDSS_V5) {
713 downscale = getDownscaleFactor(
714 crop.right - crop.left,
715 crop.bottom - crop.top,
716 dst.right - dst.left,
717 dst.bottom - dst.top);
Saurabh Shahacf10202013-02-26 10:15:15 -0800718 if(downscale) {
719 rotFlags = ROT_DOWNSCALE_ENABLED;
720 }
721 }
722
723 setMdpFlags(layer, mdpFlags, downscale);
724 trimLayer(ctx, dpy, transform, crop, dst);
725
726 if(isYuvBuffer(hnd) && //if 90 component or downscale, use rot
727 ((transform & HWC_TRANSFORM_ROT_90) || downscale)) {
728 *rot = ctx->mRotMgr->getNext();
729 if(*rot == NULL) return -1;
730 //Configure rotator for pre-rotation
731 if(configRotator(*rot, whf, mdpFlags, orient, downscale) < 0)
732 return -1;
733 whf.format = (*rot)->getDstFormat();
734 updateSource(orient, whf, crop);
Saurabh Shahacf10202013-02-26 10:15:15 -0800735 rotFlags |= ovutils::ROT_PREROTATED;
736 }
737
Saurabh Shah76fd6552013-03-14 14:45:38 -0700738 //For the mdp, since either we are pre-rotating or MDP does flips
739 orient = OVERLAY_TRANSFORM_0;
740 transform = 0;
741
Saurabh Shahacf10202013-02-26 10:15:15 -0800742 PipeArgs parg(mdpFlags, whf, z, isFg, static_cast<eRotFlags>(rotFlags));
Saurabh Shah5daeee52013-01-23 16:52:26 +0800743 if(configMdp(ctx->mOverlay, parg, orient, crop, dst, metadata, dest) < 0) {
Saurabh Shahacf10202013-02-26 10:15:15 -0800744 ALOGE("%s: commit failed for low res panel", __FUNCTION__);
745 return -1;
746 }
747 return 0;
748}
749
750int configureHighRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
751 const int& dpy, eMdpFlags& mdpFlagsL, const eZorder& z,
752 const eIsFg& isFg, const eDest& lDest, const eDest& rDest,
753 Rotator **rot) {
754 private_handle_t *hnd = (private_handle_t *)layer->handle;
755 if(!hnd) {
756 ALOGE("%s: layer handle is NULL", __FUNCTION__);
757 return -1;
758 }
759
Saurabh Shah5daeee52013-01-23 16:52:26 +0800760 MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
761
Saurabh Shahacf10202013-02-26 10:15:15 -0800762 int hw_w = ctx->dpyAttr[dpy].xres;
763 int hw_h = ctx->dpyAttr[dpy].yres;
764 hwc_rect_t crop = layer->sourceCrop;
765 hwc_rect_t dst = layer->displayFrame;
766 int transform = layer->transform;
767 eTransform orient = static_cast<eTransform>(transform);
768 const int downscale = 0;
769 int rotFlags = ROT_FLAGS_NONE;
770
771 Whf whf(hnd->width, hnd->height,
772 getMdpFormat(hnd->format), hnd->size);
773
774 setMdpFlags(layer, mdpFlagsL);
775 trimLayer(ctx, dpy, transform, crop, dst);
776
777 if(isYuvBuffer(hnd) && (transform & HWC_TRANSFORM_ROT_90)) {
778 (*rot) = ctx->mRotMgr->getNext();
779 if((*rot) == NULL) return -1;
780 //Configure rotator for pre-rotation
781 if(configRotator(*rot, whf, mdpFlagsL, orient, downscale) < 0)
782 return -1;
783 whf.format = (*rot)->getDstFormat();
784 updateSource(orient, whf, crop);
Saurabh Shahacf10202013-02-26 10:15:15 -0800785 rotFlags |= ROT_PREROTATED;
786 }
787
788 eMdpFlags mdpFlagsR = mdpFlagsL;
789 setMdpFlags(mdpFlagsR, OV_MDSS_MDP_RIGHT_MIXER);
790
791 hwc_rect_t tmp_cropL, tmp_dstL;
792 hwc_rect_t tmp_cropR, tmp_dstR;
793
794 if(lDest != OV_INVALID) {
795 tmp_cropL = crop;
796 tmp_dstL = dst;
797 hwc_rect_t scissor = {0, 0, hw_w/2, hw_h };
798 qhwc::calculate_crop_rects(tmp_cropL, tmp_dstL, scissor, 0);
799 }
800 if(rDest != OV_INVALID) {
801 tmp_cropR = crop;
802 tmp_dstR = dst;
803 hwc_rect_t scissor = {hw_w/2, 0, hw_w, hw_h };
804 qhwc::calculate_crop_rects(tmp_cropR, tmp_dstR, scissor, 0);
805 }
806
807 //When buffer is flipped, contents of mixer config also needs to swapped.
808 //Not needed if the layer is confined to one half of the screen.
809 //If rotator has been used then it has also done the flips, so ignore them.
Saurabh Shah76fd6552013-03-14 14:45:38 -0700810 if((orient & OVERLAY_TRANSFORM_FLIP_V) && lDest != OV_INVALID
Saurabh Shahacf10202013-02-26 10:15:15 -0800811 && rDest != OV_INVALID && rot == NULL) {
812 hwc_rect_t new_cropR;
813 new_cropR.left = tmp_cropL.left;
814 new_cropR.right = new_cropR.left + (tmp_cropR.right - tmp_cropR.left);
815
816 hwc_rect_t new_cropL;
817 new_cropL.left = new_cropR.right;
818 new_cropL.right = tmp_cropR.right;
819
820 tmp_cropL.left = new_cropL.left;
821 tmp_cropL.right = new_cropL.right;
822
823 tmp_cropR.left = new_cropR.left;
824 tmp_cropR.right = new_cropR.right;
825
826 }
827
Saurabh Shah76fd6552013-03-14 14:45:38 -0700828 //For the mdp, since either we are pre-rotating or MDP does flips
829 orient = OVERLAY_TRANSFORM_0;
830 transform = 0;
831
Saurabh Shahacf10202013-02-26 10:15:15 -0800832 //configure left mixer
833 if(lDest != OV_INVALID) {
834 PipeArgs pargL(mdpFlagsL, whf, z, isFg,
835 static_cast<eRotFlags>(rotFlags));
836 if(configMdp(ctx->mOverlay, pargL, orient,
Saurabh Shah5daeee52013-01-23 16:52:26 +0800837 tmp_cropL, tmp_dstL, metadata, lDest) < 0) {
Saurabh Shahacf10202013-02-26 10:15:15 -0800838 ALOGE("%s: commit failed for left mixer config", __FUNCTION__);
839 return -1;
840 }
841 }
842
843 //configure right mixer
844 if(rDest != OV_INVALID) {
845 PipeArgs pargR(mdpFlagsR, whf, z, isFg,
846 static_cast<eRotFlags>(rotFlags));
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700847 tmp_dstR.right = tmp_dstR.right - tmp_dstR.left;
848 tmp_dstR.left = 0;
Saurabh Shahacf10202013-02-26 10:15:15 -0800849 if(configMdp(ctx->mOverlay, pargR, orient,
Saurabh Shah5daeee52013-01-23 16:52:26 +0800850 tmp_cropR, tmp_dstR, metadata, rDest) < 0) {
Saurabh Shahacf10202013-02-26 10:15:15 -0800851 ALOGE("%s: commit failed for right mixer config", __FUNCTION__);
852 return -1;
853 }
854 }
855
856 return 0;
857}
Saurabh Shahacf10202013-02-26 10:15:15 -0800858};//namespace qhwc