blob: ab3561fa85856d76d016f8fd3c2e9173fff13079 [file] [log] [blame]
Naseer Ahmed758bfc52012-11-28 17:02:08 -05001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 * Copyright (C) 2012, The Linux Foundation. All rights reserved.
4 *
5 * Not a Contribution, Apache license notifications and license are
6 * retained for attribution purposes only.
7 *
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 */
20
Saurabh Shahcf053c62012-12-13 12:32:55 -080021#define DEBUG_FBUPDATE 0
Arun Kumar K.Rffef7482013-04-10 14:17:22 -070022#include <cutils/properties.h>
Naseer Ahmed758bfc52012-11-28 17:02:08 -050023#include <gralloc_priv.h>
Saurabh Shahaf5f5972013-07-30 13:56:35 -070024#include <overlay.h>
Arun Kumar K.Rffef7482013-04-10 14:17:22 -070025#include <overlayRotator.h>
Naseer Ahmed758bfc52012-11-28 17:02:08 -050026#include "hwc_fbupdate.h"
Saurabh Shahbd2d0832013-04-04 14:33:08 -070027#include "mdp_version.h"
Arun Kumar K.Rffef7482013-04-10 14:17:22 -070028#include "external.h"
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -070029#include "virtual.h"
Saurabh Shahbd2d0832013-04-04 14:33:08 -070030
31using namespace qdutils;
Saurabh Shahaf5f5972013-07-30 13:56:35 -070032using namespace overlay;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -070033using overlay::Rotator;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -070034using namespace overlay::utils;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -070035
Naseer Ahmed758bfc52012-11-28 17:02:08 -050036namespace qhwc {
37
38namespace ovutils = overlay::utils;
39
Saurabh Shah67a38c32013-06-10 16:23:15 -070040IFBUpdate* IFBUpdate::getObject(const int& width, const int& rightSplit,
41 const int& dpy) {
42 if(width > MAX_DISPLAY_DIM || rightSplit) {
Saurabh Shahcf053c62012-12-13 12:32:55 -080043 return new FBUpdateHighRes(dpy);
44 }
45 return new FBUpdateLowRes(dpy);
Naseer Ahmed758bfc52012-11-28 17:02:08 -050046}
47
Saurabh Shahcf053c62012-12-13 12:32:55 -080048inline void IFBUpdate::reset() {
49 mModeOn = false;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -070050 mRot = NULL;
Saurabh Shahcf053c62012-12-13 12:32:55 -080051}
52
53//================= Low res====================================
54FBUpdateLowRes::FBUpdateLowRes(const int& dpy): IFBUpdate(dpy) {}
55
56inline void FBUpdateLowRes::reset() {
57 IFBUpdate::reset();
58 mDest = ovutils::OV_INVALID;
59}
60
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080061bool FBUpdateLowRes::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
62 int fbZorder) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -050063 if(!ctx->mMDP.hasOverlay) {
Saurabh Shahcf053c62012-12-13 12:32:55 -080064 ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080065 __FUNCTION__);
66 return false;
Naseer Ahmed758bfc52012-11-28 17:02:08 -050067 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080068 mModeOn = configure(ctx, list, fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -080069 return mModeOn;
Naseer Ahmed758bfc52012-11-28 17:02:08 -050070}
71
72// Configure
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080073bool FBUpdateLowRes::configure(hwc_context_t *ctx, hwc_display_contents_1 *list,
74 int fbZorder) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -050075 bool ret = false;
Naseer Ahmed64b81212013-02-14 10:29:47 -050076 hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
Naseer Ahmed758bfc52012-11-28 17:02:08 -050077 if (LIKELY(ctx->mOverlay)) {
Arun Kumar K.Ra2978452013-02-07 01:34:24 -080078 int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex;
79 // ext only layer present..
80 if(extOnlyLayerIndex != -1) {
81 layer = &list->hwLayers[extOnlyLayerIndex];
82 layer->compositionType = HWC_OVERLAY;
83 }
Naseer Ahmed758bfc52012-11-28 17:02:08 -050084 overlay::Overlay& ov = *(ctx->mOverlay);
85 private_handle_t *hnd = (private_handle_t *)layer->handle;
Saurabh Shahacf10202013-02-26 10:15:15 -080086 ovutils::Whf info(hnd->width, hnd->height,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080087 ovutils::getMdpFormat(hnd->format), hnd->size);
Naseer Ahmed758bfc52012-11-28 17:02:08 -050088
Saurabh Shahd4e65852013-06-17 11:33:53 -070089 //Request a pipe
90 ovutils::eMdpPipeType type = ovutils::OV_MDP_PIPE_ANY;
91 if(qdutils::MDPVersion::getInstance().is8x26() && mDpy) {
92 //For 8x26 external always use DMA pipe
93 type = ovutils::OV_MDP_PIPE_DMA;
94 }
Saurabh Shahaf5f5972013-07-30 13:56:35 -070095 ovutils::eDest dest = ov.nextPipe(type, mDpy, Overlay::MIXER_DEFAULT);
Naseer Ahmed758bfc52012-11-28 17:02:08 -050096 if(dest == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -070097 ALOGE("%s: No pipes available to configure fb for dpy %d",
98 __FUNCTION__, mDpy);
Naseer Ahmed758bfc52012-11-28 17:02:08 -050099 return false;
100 }
Saurabh Shahcf053c62012-12-13 12:32:55 -0800101 mDest = dest;
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500102
Ramkumar Radhakrishnan1829d282013-07-23 14:54:36 -0700103 if((mDpy && ctx->deviceOrientation) &&
104 ctx->listStats[mDpy].isDisplayAnimating) {
105 fbZorder = 0;
106 }
107
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800108 ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700109 ovutils::eIsFg isFg = ovutils::IS_FG_OFF;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800110 ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500111
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800112 hwc_rect_t sourceCrop = layer->sourceCrop;
113 hwc_rect_t displayFrame = layer->displayFrame;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700114 int transform = layer->transform;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700115 int rotFlags = ovutils::ROT_FLAGS_NONE;
116
117 ovutils::eTransform orient =
118 static_cast<ovutils::eTransform>(transform);
Arun Kumar K.Rfb5bfa62013-07-25 03:10:51 -0700119 // use ext orientation if any
120 int extOrient = ctx->mExtOrientation;
121 if(ctx->mBufferMirrorMode)
122 extOrient = getMirrorModeOrientation(ctx);
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700123
Ramkumar Radhakrishnan59a11072013-04-15 16:14:49 -0700124 // Do not use getNonWormholeRegion() function to calculate the
125 // sourceCrop during animation on external display and
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700126 // Dont do wormhole calculation when extorientation is set on External
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700127 // Dont do wormhole calculation when extDownscale is enabled on External
Ramkumar Radhakrishnan59a11072013-04-15 16:14:49 -0700128 if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) {
129 sourceCrop = layer->displayFrame;
130 displayFrame = sourceCrop;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700131 } else if((!mDpy ||
Arun Kumar K.Rfb5bfa62013-07-25 03:10:51 -0700132 (mDpy && !extOrient
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700133 && !ctx->dpyAttr[mDpy].mDownScaleMode))
134 && (extOnlyLayerIndex == -1)) {
Saurabh Shahd4e65852013-06-17 11:33:53 -0700135 if(!qdutils::MDPVersion::getInstance().is8x26()) {
136 getNonWormholeRegion(list, sourceCrop);
137 displayFrame = sourceCrop;
138 }
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800139 }
Saurabh Shahd4e65852013-06-17 11:33:53 -0700140 if(mDpy && !qdutils::MDPVersion::getInstance().is8x26()) {
Arun Kumar K.Rfb5bfa62013-07-25 03:10:51 -0700141 if(extOrient || ctx->dpyAttr[mDpy].mDownScaleMode) {
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700142 calcExtDisplayPosition(ctx, mDpy, sourceCrop, displayFrame);
Arun Kumar K.R5898c652013-07-17 14:20:32 -0700143 // If there is a external orientation set, use that
Arun Kumar K.Rfb5bfa62013-07-25 03:10:51 -0700144 if(extOrient) {
145 transform = extOrient;
146 orient = static_cast<ovutils::eTransform >(extOrient);
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700147 }
Arun Kumar K.R5898c652013-07-17 14:20:32 -0700148 }
Arun Kumar K.R82f1d282013-05-17 15:37:31 -0700149 // Calculate the actionsafe dimensions for External(dpy = 1 or 2)
Arun Kumar K.R5898c652013-07-17 14:20:32 -0700150 getActionSafePosition(ctx, mDpy, displayFrame);
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700151 }
Ramkumar Radhakrishnan9d52f432013-05-14 14:46:59 -0700152 setMdpFlags(layer, mdpFlags, 0, transform);
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700153 // For External use rotator if there is a rotation value set
Arun Kumar K.Rfb5bfa62013-07-25 03:10:51 -0700154 if(mDpy && (extOrient & HWC_TRANSFORM_ROT_90)) {
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700155 mRot = ctx->mRotMgr->getNext();
156 if(mRot == NULL) return -1;
157 //Configure rotator for pre-rotation
158 if(configRotator(mRot, info, sourceCrop, mdpFlags, orient, 0) < 0) {
159 ALOGE("%s: configRotator Failed!", __FUNCTION__);
160 mRot = NULL;
161 return -1;
162 }
163 info.format = (mRot)->getDstFormat();
164 updateSource(orient, info, sourceCrop);
165 rotFlags |= ovutils::ROT_PREROTATED;
166 }
167 //For the mdp, since either we are pre-rotating or MDP does flips
168 orient = ovutils::OVERLAY_TRANSFORM_0;
169 transform = 0;
170 ovutils::PipeArgs parg(mdpFlags, info, zOrder, isFg,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400171 static_cast<ovutils::eRotFlags>(rotFlags),
172 ovutils::DEFAULT_PLANE_ALPHA,
173 (ovutils::eBlending)
174 getBlending(layer->blending));
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500175 ret = true;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700176 if(configMdp(ctx->mOverlay, parg, orient, sourceCrop, displayFrame,
177 NULL, mDest) < 0) {
Saurabh Shahe2474082013-05-15 16:32:13 -0700178 ALOGE("%s: configMdp failed for dpy %d", __FUNCTION__, mDpy);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500179 ret = false;
180 }
181 }
182 return ret;
183}
184
Naseer Ahmed64b81212013-02-14 10:29:47 -0500185bool FBUpdateLowRes::draw(hwc_context_t *ctx, private_handle_t *hnd)
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500186{
Saurabh Shahcf053c62012-12-13 12:32:55 -0800187 if(!mModeOn) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500188 return true;
189 }
190 bool ret = true;
191 overlay::Overlay& ov = *(ctx->mOverlay);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800192 ovutils::eDest dest = mDest;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700193 int fd = hnd->fd;
194 uint32_t offset = hnd->offset;
195 if(mRot) {
196 if(!mRot->queueBuffer(fd, offset))
197 return false;
198 fd = mRot->getDstMemId();
199 offset = mRot->getDstOffset();
200 }
201 if (!ov.queueBuffer(fd, offset, dest)) {
Amara Venkata Mastan Manoj Kumardc01a532013-01-30 18:34:56 -0800202 ALOGE("%s: queueBuffer failed for FBUpdate", __FUNCTION__);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500203 ret = false;
204 }
205 return ret;
206}
207
Saurabh Shahcf053c62012-12-13 12:32:55 -0800208//================= High res====================================
209FBUpdateHighRes::FBUpdateHighRes(const int& dpy): IFBUpdate(dpy) {}
210
211inline void FBUpdateHighRes::reset() {
212 IFBUpdate::reset();
213 mDestLeft = ovutils::OV_INVALID;
214 mDestRight = ovutils::OV_INVALID;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700215 mRot = NULL;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800216}
217
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800218bool FBUpdateHighRes::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
219 int fbZorder) {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800220 if(!ctx->mMDP.hasOverlay) {
221 ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800222 __FUNCTION__);
223 return false;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800224 }
225 ALOGD_IF(DEBUG_FBUPDATE, "%s, mModeOn = %d", __FUNCTION__, mModeOn);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800226 mModeOn = configure(ctx, list, fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800227 return mModeOn;
228}
229
230// Configure
Naseer Ahmed64b81212013-02-14 10:29:47 -0500231bool FBUpdateHighRes::configure(hwc_context_t *ctx,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700232 hwc_display_contents_1 *list, int fbZorder) {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800233 bool ret = false;
Naseer Ahmed64b81212013-02-14 10:29:47 -0500234 hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
Saurabh Shahcf053c62012-12-13 12:32:55 -0800235 if (LIKELY(ctx->mOverlay)) {
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800236 int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex;
237 // ext only layer present..
238 if(extOnlyLayerIndex != -1) {
239 layer = &list->hwLayers[extOnlyLayerIndex];
240 layer->compositionType = HWC_OVERLAY;
241 }
Saurabh Shahcf053c62012-12-13 12:32:55 -0800242 overlay::Overlay& ov = *(ctx->mOverlay);
243 private_handle_t *hnd = (private_handle_t *)layer->handle;
Saurabh Shahacf10202013-02-26 10:15:15 -0800244 ovutils::Whf info(hnd->width, hnd->height,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800245 ovutils::getMdpFormat(hnd->format), hnd->size);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800246
Saurabh Shahc66f54d2013-06-12 15:45:59 -0700247 //Request left pipe
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700248 ovutils::eDest destL = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
249 Overlay::MIXER_LEFT);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800250 if(destL == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700251 ALOGE("%s: No pipes available to configure fb for dpy %d's left"
252 " mixer", __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800253 return false;
254 }
Saurabh Shahc66f54d2013-06-12 15:45:59 -0700255 //Request right pipe
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700256 ovutils::eDest destR = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
257 Overlay::MIXER_RIGHT);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800258 if(destR == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700259 ALOGE("%s: No pipes available to configure fb for dpy %d's right"
260 " mixer", __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800261 return false;
262 }
263
264 mDestLeft = destL;
265 mDestRight = destR;
266
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800267 ovutils::eMdpFlags mdpFlagsL = ovutils::OV_MDP_BLEND_FG_PREMULT;
Sravan Kumar D.V.Nb5ed0292013-03-15 08:51:16 +0530268
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800269 ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800270
Naseer Ahmed522ce662013-03-18 20:14:05 -0400271 //XXX: FB layer plane alpha is currently sent as zero from
272 //surfaceflinger
Saurabh Shahcf053c62012-12-13 12:32:55 -0800273 ovutils::PipeArgs pargL(mdpFlagsL,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800274 info,
275 zOrder,
276 ovutils::IS_FG_OFF,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400277 ovutils::ROT_FLAGS_NONE,
278 ovutils::DEFAULT_PLANE_ALPHA,
279 (ovutils::eBlending)
280 getBlending(layer->blending));
Saurabh Shahcf053c62012-12-13 12:32:55 -0800281 ov.setSource(pargL, destL);
282
283 ovutils::eMdpFlags mdpFlagsR = mdpFlagsL;
284 ovutils::setMdpFlags(mdpFlagsR, ovutils::OV_MDSS_MDP_RIGHT_MIXER);
285 ovutils::PipeArgs pargR(mdpFlagsR,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800286 info,
287 zOrder,
288 ovutils::IS_FG_OFF,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400289 ovutils::ROT_FLAGS_NONE,
290 ovutils::DEFAULT_PLANE_ALPHA,
291 (ovutils::eBlending)
292 getBlending(layer->blending));
Saurabh Shahcf053c62012-12-13 12:32:55 -0800293 ov.setSource(pargR, destR);
294
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800295 hwc_rect_t sourceCrop = layer->sourceCrop;
296 hwc_rect_t displayFrame = layer->displayFrame;
Saurabh Shah67a38c32013-06-10 16:23:15 -0700297
298 const float xres = ctx->dpyAttr[mDpy].xres;
Saurabh Shah07a8ca82013-08-06 18:45:42 -0700299 const int lSplit = getLeftSplit(ctx, mDpy);
Saurabh Shah67a38c32013-06-10 16:23:15 -0700300 const float lSplitRatio = lSplit / xres;
Saurabh Shah67a38c32013-06-10 16:23:15 -0700301 const float lCropWidth =
302 (sourceCrop.right - sourceCrop.left) * lSplitRatio;
303
304 ovutils::Dim dcropL(
305 sourceCrop.left,
306 sourceCrop.top,
307 lCropWidth,
308 sourceCrop.bottom - sourceCrop.top);
309
Saurabh Shahcf053c62012-12-13 12:32:55 -0800310 ovutils::Dim dcropR(
Saurabh Shah67a38c32013-06-10 16:23:15 -0700311 sourceCrop.left + lCropWidth,
312 sourceCrop.top,
313 (sourceCrop.right - sourceCrop.left) - lCropWidth,
314 sourceCrop.bottom - sourceCrop.top);
315
Saurabh Shahcf053c62012-12-13 12:32:55 -0800316 ov.setCrop(dcropL, destL);
317 ov.setCrop(dcropR, destR);
318
319 int transform = layer->transform;
320 ovutils::eTransform orient =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800321 static_cast<ovutils::eTransform>(transform);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800322 ov.setTransform(orient, destL);
323 ov.setTransform(orient, destR);
324
Saurabh Shah67a38c32013-06-10 16:23:15 -0700325 const int lWidth = (lSplit - displayFrame.left);
326 const int rWidth = (displayFrame.right - lSplit);
Saurabh Shahce416f02013-04-10 13:33:09 -0700327 const int height = displayFrame.bottom - displayFrame.top;
328
Saurabh Shah67a38c32013-06-10 16:23:15 -0700329 ovutils::Dim dposL(displayFrame.left,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800330 displayFrame.top,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700331 lWidth,
Saurabh Shahce416f02013-04-10 13:33:09 -0700332 height);
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700333 ov.setPosition(dposL, destL);
Saurabh Shahce416f02013-04-10 13:33:09 -0700334
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700335 ovutils::Dim dposR(0,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800336 displayFrame.top,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700337 rWidth,
Saurabh Shahce416f02013-04-10 13:33:09 -0700338 height);
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700339 ov.setPosition(dposR, destR);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800340
341 ret = true;
342 if (!ov.commit(destL)) {
343 ALOGE("%s: commit fails for left", __FUNCTION__);
344 ret = false;
345 }
346 if (!ov.commit(destR)) {
347 ALOGE("%s: commit fails for right", __FUNCTION__);
348 ret = false;
349 }
350 }
351 return ret;
352}
353
Naseer Ahmed64b81212013-02-14 10:29:47 -0500354bool FBUpdateHighRes::draw(hwc_context_t *ctx, private_handle_t *hnd)
Saurabh Shahcf053c62012-12-13 12:32:55 -0800355{
356 if(!mModeOn) {
357 return true;
358 }
359 bool ret = true;
360 overlay::Overlay& ov = *(ctx->mOverlay);
361 ovutils::eDest destL = mDestLeft;
362 ovutils::eDest destR = mDestRight;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800363 if (!ov.queueBuffer(hnd->fd, hnd->offset, destL)) {
364 ALOGE("%s: queue failed for left of dpy = %d",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800365 __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800366 ret = false;
367 }
368 if (!ov.queueBuffer(hnd->fd, hnd->offset, destR)) {
369 ALOGE("%s: queue failed for right of dpy = %d",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800370 __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800371 ret = false;
372 }
373 return ret;
374}
375
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500376//---------------------------------------------------------------------
377}; //namespace qhwc