blob: 2337b2a9c0d25858fe6b5a1656e3b855b6c4c06a [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
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -070061bool FBUpdateLowRes::preRotateExtDisplay(hwc_context_t *ctx,
62 ovutils::Whf &info,
63 hwc_rect_t& sourceCrop,
64 ovutils::eMdpFlags& mdpFlags,
65 int& rotFlags)
66{
67 int extOrient = getExtOrientation(ctx);
68 ovutils::eTransform orient = static_cast<ovutils::eTransform >(extOrient);
69 if(mDpy && (extOrient & HWC_TRANSFORM_ROT_90)) {
70 mRot = ctx->mRotMgr->getNext();
71 if(mRot == NULL) return false;
72 //Configure rotator for pre-rotation
73 if(configRotator(mRot, info, sourceCrop, mdpFlags, orient, 0) < 0) {
74 ALOGE("%s: configRotator Failed!", __FUNCTION__);
75 mRot = NULL;
76 return false;
77 }
78 info.format = (mRot)->getDstFormat();
79 updateSource(orient, info, sourceCrop);
80 rotFlags |= ovutils::ROT_PREROTATED;
81 }
82 return true;
83}
84
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080085bool FBUpdateLowRes::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
86 int fbZorder) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -050087 if(!ctx->mMDP.hasOverlay) {
Saurabh Shahcf053c62012-12-13 12:32:55 -080088 ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080089 __FUNCTION__);
90 return false;
Naseer Ahmed758bfc52012-11-28 17:02:08 -050091 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080092 mModeOn = configure(ctx, list, fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -080093 return mModeOn;
Naseer Ahmed758bfc52012-11-28 17:02:08 -050094}
95
96// Configure
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080097bool FBUpdateLowRes::configure(hwc_context_t *ctx, hwc_display_contents_1 *list,
98 int fbZorder) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -050099 bool ret = false;
Naseer Ahmed64b81212013-02-14 10:29:47 -0500100 hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500101 if (LIKELY(ctx->mOverlay)) {
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800102 int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex;
103 // ext only layer present..
104 if(extOnlyLayerIndex != -1) {
105 layer = &list->hwLayers[extOnlyLayerIndex];
106 layer->compositionType = HWC_OVERLAY;
107 }
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500108 overlay::Overlay& ov = *(ctx->mOverlay);
109 private_handle_t *hnd = (private_handle_t *)layer->handle;
Saurabh Shahacf10202013-02-26 10:15:15 -0800110 ovutils::Whf info(hnd->width, hnd->height,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800111 ovutils::getMdpFormat(hnd->format), hnd->size);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500112
Saurabh Shahd4e65852013-06-17 11:33:53 -0700113 //Request a pipe
114 ovutils::eMdpPipeType type = ovutils::OV_MDP_PIPE_ANY;
115 if(qdutils::MDPVersion::getInstance().is8x26() && mDpy) {
116 //For 8x26 external always use DMA pipe
117 type = ovutils::OV_MDP_PIPE_DMA;
118 }
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700119 ovutils::eDest dest = ov.nextPipe(type, mDpy, Overlay::MIXER_DEFAULT);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500120 if(dest == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700121 ALOGE("%s: No pipes available to configure fb for dpy %d",
122 __FUNCTION__, mDpy);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500123 return false;
124 }
Saurabh Shahcf053c62012-12-13 12:32:55 -0800125 mDest = dest;
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500126
Ramkumar Radhakrishnan1829d282013-07-23 14:54:36 -0700127 if((mDpy && ctx->deviceOrientation) &&
128 ctx->listStats[mDpy].isDisplayAnimating) {
129 fbZorder = 0;
130 }
131
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800132 ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700133 ovutils::eIsFg isFg = ovutils::IS_FG_OFF;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800134 ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500135
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800136 hwc_rect_t sourceCrop = layer->sourceCrop;
137 hwc_rect_t displayFrame = layer->displayFrame;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700138 int transform = layer->transform;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700139 int rotFlags = ovutils::ROT_FLAGS_NONE;
140
141 ovutils::eTransform orient =
142 static_cast<ovutils::eTransform>(transform);
Arun Kumar K.Rfb5bfa62013-07-25 03:10:51 -0700143 // use ext orientation if any
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -0700144 int extOrient = getExtOrientation(ctx);
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700145
Ramkumar Radhakrishnan59a11072013-04-15 16:14:49 -0700146 // Do not use getNonWormholeRegion() function to calculate the
147 // sourceCrop during animation on external display and
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700148 // Dont do wormhole calculation when extorientation is set on External
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700149 // Dont do wormhole calculation when extDownscale is enabled on External
Ramkumar Radhakrishnan59a11072013-04-15 16:14:49 -0700150 if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) {
151 sourceCrop = layer->displayFrame;
152 displayFrame = sourceCrop;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700153 } else if((!mDpy ||
Arun Kumar K.Rfb5bfa62013-07-25 03:10:51 -0700154 (mDpy && !extOrient
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700155 && !ctx->dpyAttr[mDpy].mDownScaleMode))
156 && (extOnlyLayerIndex == -1)) {
Saurabh Shahd4e65852013-06-17 11:33:53 -0700157 if(!qdutils::MDPVersion::getInstance().is8x26()) {
158 getNonWormholeRegion(list, sourceCrop);
159 displayFrame = sourceCrop;
160 }
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800161 }
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -0700162 calcExtDisplayPosition(ctx, hnd, mDpy, sourceCrop, displayFrame,
163 transform, orient);
Ramkumar Radhakrishnan9d52f432013-05-14 14:46:59 -0700164 setMdpFlags(layer, mdpFlags, 0, transform);
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700165 // For External use rotator if there is a rotation value set
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -0700166 ret = preRotateExtDisplay(ctx, info, sourceCrop, mdpFlags, rotFlags);
167 if(!ret) {
168 ALOGE("%s: preRotate for external Failed!", __FUNCTION__);
169 return false;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700170 }
171 //For the mdp, since either we are pre-rotating or MDP does flips
172 orient = ovutils::OVERLAY_TRANSFORM_0;
173 transform = 0;
174 ovutils::PipeArgs parg(mdpFlags, info, zOrder, isFg,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400175 static_cast<ovutils::eRotFlags>(rotFlags),
176 ovutils::DEFAULT_PLANE_ALPHA,
177 (ovutils::eBlending)
178 getBlending(layer->blending));
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500179 ret = true;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700180 if(configMdp(ctx->mOverlay, parg, orient, sourceCrop, displayFrame,
181 NULL, mDest) < 0) {
Saurabh Shahe2474082013-05-15 16:32:13 -0700182 ALOGE("%s: configMdp failed for dpy %d", __FUNCTION__, mDpy);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500183 ret = false;
184 }
185 }
186 return ret;
187}
188
Naseer Ahmed64b81212013-02-14 10:29:47 -0500189bool FBUpdateLowRes::draw(hwc_context_t *ctx, private_handle_t *hnd)
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500190{
Saurabh Shahcf053c62012-12-13 12:32:55 -0800191 if(!mModeOn) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500192 return true;
193 }
194 bool ret = true;
195 overlay::Overlay& ov = *(ctx->mOverlay);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800196 ovutils::eDest dest = mDest;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700197 int fd = hnd->fd;
198 uint32_t offset = hnd->offset;
199 if(mRot) {
200 if(!mRot->queueBuffer(fd, offset))
201 return false;
202 fd = mRot->getDstMemId();
203 offset = mRot->getDstOffset();
204 }
205 if (!ov.queueBuffer(fd, offset, dest)) {
Amara Venkata Mastan Manoj Kumardc01a532013-01-30 18:34:56 -0800206 ALOGE("%s: queueBuffer failed for FBUpdate", __FUNCTION__);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500207 ret = false;
208 }
209 return ret;
210}
211
Saurabh Shahcf053c62012-12-13 12:32:55 -0800212//================= High res====================================
213FBUpdateHighRes::FBUpdateHighRes(const int& dpy): IFBUpdate(dpy) {}
214
215inline void FBUpdateHighRes::reset() {
216 IFBUpdate::reset();
217 mDestLeft = ovutils::OV_INVALID;
218 mDestRight = ovutils::OV_INVALID;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700219 mRot = NULL;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800220}
221
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800222bool FBUpdateHighRes::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
223 int fbZorder) {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800224 if(!ctx->mMDP.hasOverlay) {
225 ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800226 __FUNCTION__);
227 return false;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800228 }
229 ALOGD_IF(DEBUG_FBUPDATE, "%s, mModeOn = %d", __FUNCTION__, mModeOn);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800230 mModeOn = configure(ctx, list, fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800231 return mModeOn;
232}
233
234// Configure
Naseer Ahmed64b81212013-02-14 10:29:47 -0500235bool FBUpdateHighRes::configure(hwc_context_t *ctx,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700236 hwc_display_contents_1 *list, int fbZorder) {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800237 bool ret = false;
Naseer Ahmed64b81212013-02-14 10:29:47 -0500238 hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
Saurabh Shahcf053c62012-12-13 12:32:55 -0800239 if (LIKELY(ctx->mOverlay)) {
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800240 int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex;
241 // ext only layer present..
242 if(extOnlyLayerIndex != -1) {
243 layer = &list->hwLayers[extOnlyLayerIndex];
244 layer->compositionType = HWC_OVERLAY;
245 }
Saurabh Shahcf053c62012-12-13 12:32:55 -0800246 overlay::Overlay& ov = *(ctx->mOverlay);
247 private_handle_t *hnd = (private_handle_t *)layer->handle;
Saurabh Shahacf10202013-02-26 10:15:15 -0800248 ovutils::Whf info(hnd->width, hnd->height,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800249 ovutils::getMdpFormat(hnd->format), hnd->size);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800250
Saurabh Shahc66f54d2013-06-12 15:45:59 -0700251 //Request left pipe
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700252 ovutils::eDest destL = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
253 Overlay::MIXER_LEFT);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800254 if(destL == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700255 ALOGE("%s: No pipes available to configure fb for dpy %d's left"
256 " mixer", __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800257 return false;
258 }
Saurabh Shahc66f54d2013-06-12 15:45:59 -0700259 //Request right pipe
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700260 ovutils::eDest destR = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
261 Overlay::MIXER_RIGHT);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800262 if(destR == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700263 ALOGE("%s: No pipes available to configure fb for dpy %d's right"
264 " mixer", __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800265 return false;
266 }
267
268 mDestLeft = destL;
269 mDestRight = destR;
270
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800271 ovutils::eMdpFlags mdpFlagsL = ovutils::OV_MDP_BLEND_FG_PREMULT;
Sravan Kumar D.V.Nb5ed0292013-03-15 08:51:16 +0530272
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800273 ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800274
Naseer Ahmed522ce662013-03-18 20:14:05 -0400275 //XXX: FB layer plane alpha is currently sent as zero from
276 //surfaceflinger
Saurabh Shahcf053c62012-12-13 12:32:55 -0800277 ovutils::PipeArgs pargL(mdpFlagsL,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800278 info,
279 zOrder,
280 ovutils::IS_FG_OFF,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400281 ovutils::ROT_FLAGS_NONE,
282 ovutils::DEFAULT_PLANE_ALPHA,
283 (ovutils::eBlending)
284 getBlending(layer->blending));
Saurabh Shahcf053c62012-12-13 12:32:55 -0800285 ov.setSource(pargL, destL);
286
287 ovutils::eMdpFlags mdpFlagsR = mdpFlagsL;
288 ovutils::setMdpFlags(mdpFlagsR, ovutils::OV_MDSS_MDP_RIGHT_MIXER);
289 ovutils::PipeArgs pargR(mdpFlagsR,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800290 info,
291 zOrder,
292 ovutils::IS_FG_OFF,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400293 ovutils::ROT_FLAGS_NONE,
294 ovutils::DEFAULT_PLANE_ALPHA,
295 (ovutils::eBlending)
296 getBlending(layer->blending));
Saurabh Shahcf053c62012-12-13 12:32:55 -0800297 ov.setSource(pargR, destR);
298
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800299 hwc_rect_t sourceCrop = layer->sourceCrop;
300 hwc_rect_t displayFrame = layer->displayFrame;
Saurabh Shah67a38c32013-06-10 16:23:15 -0700301
302 const float xres = ctx->dpyAttr[mDpy].xres;
Saurabh Shah07a8ca82013-08-06 18:45:42 -0700303 const int lSplit = getLeftSplit(ctx, mDpy);
Saurabh Shah67a38c32013-06-10 16:23:15 -0700304 const float lSplitRatio = lSplit / xres;
Saurabh Shah67a38c32013-06-10 16:23:15 -0700305 const float lCropWidth =
306 (sourceCrop.right - sourceCrop.left) * lSplitRatio;
307
308 ovutils::Dim dcropL(
309 sourceCrop.left,
310 sourceCrop.top,
311 lCropWidth,
312 sourceCrop.bottom - sourceCrop.top);
313
Saurabh Shahcf053c62012-12-13 12:32:55 -0800314 ovutils::Dim dcropR(
Saurabh Shah67a38c32013-06-10 16:23:15 -0700315 sourceCrop.left + lCropWidth,
316 sourceCrop.top,
317 (sourceCrop.right - sourceCrop.left) - lCropWidth,
318 sourceCrop.bottom - sourceCrop.top);
319
Saurabh Shahcf053c62012-12-13 12:32:55 -0800320 ov.setCrop(dcropL, destL);
321 ov.setCrop(dcropR, destR);
322
323 int transform = layer->transform;
324 ovutils::eTransform orient =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800325 static_cast<ovutils::eTransform>(transform);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800326 ov.setTransform(orient, destL);
327 ov.setTransform(orient, destR);
328
Saurabh Shah67a38c32013-06-10 16:23:15 -0700329 const int lWidth = (lSplit - displayFrame.left);
330 const int rWidth = (displayFrame.right - lSplit);
Saurabh Shahce416f02013-04-10 13:33:09 -0700331 const int height = displayFrame.bottom - displayFrame.top;
332
Saurabh Shah67a38c32013-06-10 16:23:15 -0700333 ovutils::Dim dposL(displayFrame.left,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800334 displayFrame.top,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700335 lWidth,
Saurabh Shahce416f02013-04-10 13:33:09 -0700336 height);
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700337 ov.setPosition(dposL, destL);
Saurabh Shahce416f02013-04-10 13:33:09 -0700338
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700339 ovutils::Dim dposR(0,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800340 displayFrame.top,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700341 rWidth,
Saurabh Shahce416f02013-04-10 13:33:09 -0700342 height);
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700343 ov.setPosition(dposR, destR);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800344
345 ret = true;
346 if (!ov.commit(destL)) {
347 ALOGE("%s: commit fails for left", __FUNCTION__);
348 ret = false;
349 }
350 if (!ov.commit(destR)) {
351 ALOGE("%s: commit fails for right", __FUNCTION__);
352 ret = false;
353 }
354 }
355 return ret;
356}
357
Naseer Ahmed64b81212013-02-14 10:29:47 -0500358bool FBUpdateHighRes::draw(hwc_context_t *ctx, private_handle_t *hnd)
Saurabh Shahcf053c62012-12-13 12:32:55 -0800359{
360 if(!mModeOn) {
361 return true;
362 }
363 bool ret = true;
364 overlay::Overlay& ov = *(ctx->mOverlay);
365 ovutils::eDest destL = mDestLeft;
366 ovutils::eDest destR = mDestRight;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800367 if (!ov.queueBuffer(hnd->fd, hnd->offset, destL)) {
368 ALOGE("%s: queue failed for left of dpy = %d",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800369 __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800370 ret = false;
371 }
372 if (!ov.queueBuffer(hnd->fd, hnd->offset, destR)) {
373 ALOGE("%s: queue failed for right of dpy = %d",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800374 __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800375 ret = false;
376 }
377 return ret;
378}
379
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500380//---------------------------------------------------------------------
381}; //namespace qhwc