blob: 53b3d18d73b9fa6489fb185434ce5f8e3c626ce8 [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 Shah88e4d272013-09-03 13:31:29 -070040IFBUpdate* IFBUpdate::getObject(hwc_context_t *ctx, const int& dpy) {
41 if(isDisplaySplit(ctx, dpy)) {
42 return new FBUpdateSplit(dpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -080043 }
Saurabh Shah88e4d272013-09-03 13:31:29 -070044 return new FBUpdateNonSplit(dpy);
Naseer Ahmed758bfc52012-11-28 17:02:08 -050045}
46
Saurabh Shahcf053c62012-12-13 12:32:55 -080047inline void IFBUpdate::reset() {
48 mModeOn = false;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -070049 mRot = NULL;
Saurabh Shahcf053c62012-12-13 12:32:55 -080050}
51
52//================= Low res====================================
Saurabh Shah88e4d272013-09-03 13:31:29 -070053FBUpdateNonSplit::FBUpdateNonSplit(const int& dpy): IFBUpdate(dpy) {}
Saurabh Shahcf053c62012-12-13 12:32:55 -080054
Saurabh Shah88e4d272013-09-03 13:31:29 -070055inline void FBUpdateNonSplit::reset() {
Saurabh Shahcf053c62012-12-13 12:32:55 -080056 IFBUpdate::reset();
57 mDest = ovutils::OV_INVALID;
58}
59
Saurabh Shah88e4d272013-09-03 13:31:29 -070060bool FBUpdateNonSplit::preRotateExtDisplay(hwc_context_t *ctx,
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -070061 ovutils::Whf &info,
62 hwc_rect_t& sourceCrop,
63 ovutils::eMdpFlags& mdpFlags,
64 int& rotFlags)
65{
66 int extOrient = getExtOrientation(ctx);
67 ovutils::eTransform orient = static_cast<ovutils::eTransform >(extOrient);
68 if(mDpy && (extOrient & HWC_TRANSFORM_ROT_90)) {
69 mRot = ctx->mRotMgr->getNext();
70 if(mRot == NULL) return false;
71 //Configure rotator for pre-rotation
72 if(configRotator(mRot, info, sourceCrop, mdpFlags, orient, 0) < 0) {
73 ALOGE("%s: configRotator Failed!", __FUNCTION__);
74 mRot = NULL;
75 return false;
76 }
77 info.format = (mRot)->getDstFormat();
78 updateSource(orient, info, sourceCrop);
79 rotFlags |= ovutils::ROT_PREROTATED;
80 }
81 return true;
82}
83
Saurabh Shah88e4d272013-09-03 13:31:29 -070084bool FBUpdateNonSplit::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080085 int fbZorder) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -050086 if(!ctx->mMDP.hasOverlay) {
Saurabh Shahcf053c62012-12-13 12:32:55 -080087 ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080088 __FUNCTION__);
89 return false;
Naseer Ahmed758bfc52012-11-28 17:02:08 -050090 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080091 mModeOn = configure(ctx, list, fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -080092 return mModeOn;
Naseer Ahmed758bfc52012-11-28 17:02:08 -050093}
94
95// Configure
Saurabh Shah88e4d272013-09-03 13:31:29 -070096bool FBUpdateNonSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *list,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080097 int fbZorder) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -050098 bool ret = false;
Naseer Ahmed64b81212013-02-14 10:29:47 -050099 hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500100 if (LIKELY(ctx->mOverlay)) {
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800101 int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex;
102 // ext only layer present..
103 if(extOnlyLayerIndex != -1) {
104 layer = &list->hwLayers[extOnlyLayerIndex];
105 layer->compositionType = HWC_OVERLAY;
106 }
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500107 overlay::Overlay& ov = *(ctx->mOverlay);
108 private_handle_t *hnd = (private_handle_t *)layer->handle;
Saurabh Shahacf10202013-02-26 10:15:15 -0800109 ovutils::Whf info(hnd->width, hnd->height,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800110 ovutils::getMdpFormat(hnd->format), hnd->size);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500111
Saurabh Shahd4e65852013-06-17 11:33:53 -0700112 //Request a pipe
113 ovutils::eMdpPipeType type = ovutils::OV_MDP_PIPE_ANY;
114 if(qdutils::MDPVersion::getInstance().is8x26() && mDpy) {
115 //For 8x26 external always use DMA pipe
116 type = ovutils::OV_MDP_PIPE_DMA;
117 }
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700118 ovutils::eDest dest = ov.nextPipe(type, mDpy, Overlay::MIXER_DEFAULT);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500119 if(dest == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700120 ALOGE("%s: No pipes available to configure fb for dpy %d",
121 __FUNCTION__, mDpy);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500122 return false;
123 }
Saurabh Shahcf053c62012-12-13 12:32:55 -0800124 mDest = dest;
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500125
Ramkumar Radhakrishnan1829d282013-07-23 14:54:36 -0700126 if((mDpy && ctx->deviceOrientation) &&
127 ctx->listStats[mDpy].isDisplayAnimating) {
128 fbZorder = 0;
129 }
130
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800131 ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700132 ovutils::eIsFg isFg = ovutils::IS_FG_OFF;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800133 ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500134
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800135 hwc_rect_t sourceCrop = layer->sourceCrop;
136 hwc_rect_t displayFrame = layer->displayFrame;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700137 int transform = layer->transform;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700138 int rotFlags = ovutils::ROT_FLAGS_NONE;
139
140 ovutils::eTransform orient =
141 static_cast<ovutils::eTransform>(transform);
Arun Kumar K.Rfb5bfa62013-07-25 03:10:51 -0700142 // use ext orientation if any
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -0700143 int extOrient = getExtOrientation(ctx);
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700144
Ramkumar Radhakrishnan59a11072013-04-15 16:14:49 -0700145 // Do not use getNonWormholeRegion() function to calculate the
146 // sourceCrop during animation on external display and
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700147 // Dont do wormhole calculation when extorientation is set on External
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700148 // Dont do wormhole calculation when extDownscale is enabled on External
Ramkumar Radhakrishnan59a11072013-04-15 16:14:49 -0700149 if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) {
150 sourceCrop = layer->displayFrame;
151 displayFrame = sourceCrop;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700152 } else if((!mDpy ||
Arun Kumar K.Rfb5bfa62013-07-25 03:10:51 -0700153 (mDpy && !extOrient
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700154 && !ctx->dpyAttr[mDpy].mDownScaleMode))
155 && (extOnlyLayerIndex == -1)) {
Saurabh Shahd4e65852013-06-17 11:33:53 -0700156 if(!qdutils::MDPVersion::getInstance().is8x26()) {
157 getNonWormholeRegion(list, sourceCrop);
158 displayFrame = sourceCrop;
159 }
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800160 }
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -0700161 calcExtDisplayPosition(ctx, hnd, mDpy, sourceCrop, displayFrame,
162 transform, orient);
Ramkumar Radhakrishnan9d52f432013-05-14 14:46:59 -0700163 setMdpFlags(layer, mdpFlags, 0, transform);
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700164 // For External use rotator if there is a rotation value set
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -0700165 ret = preRotateExtDisplay(ctx, info, sourceCrop, mdpFlags, rotFlags);
166 if(!ret) {
167 ALOGE("%s: preRotate for external Failed!", __FUNCTION__);
168 return false;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700169 }
170 //For the mdp, since either we are pre-rotating or MDP does flips
171 orient = ovutils::OVERLAY_TRANSFORM_0;
172 transform = 0;
173 ovutils::PipeArgs parg(mdpFlags, info, zOrder, isFg,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400174 static_cast<ovutils::eRotFlags>(rotFlags),
175 ovutils::DEFAULT_PLANE_ALPHA,
176 (ovutils::eBlending)
177 getBlending(layer->blending));
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500178 ret = true;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700179 if(configMdp(ctx->mOverlay, parg, orient, sourceCrop, displayFrame,
180 NULL, mDest) < 0) {
Saurabh Shahe2474082013-05-15 16:32:13 -0700181 ALOGE("%s: configMdp failed for dpy %d", __FUNCTION__, mDpy);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500182 ret = false;
183 }
184 }
185 return ret;
186}
187
Saurabh Shah88e4d272013-09-03 13:31:29 -0700188bool FBUpdateNonSplit::draw(hwc_context_t *ctx, private_handle_t *hnd)
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500189{
Saurabh Shahcf053c62012-12-13 12:32:55 -0800190 if(!mModeOn) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500191 return true;
192 }
193 bool ret = true;
194 overlay::Overlay& ov = *(ctx->mOverlay);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800195 ovutils::eDest dest = mDest;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700196 int fd = hnd->fd;
197 uint32_t offset = hnd->offset;
198 if(mRot) {
199 if(!mRot->queueBuffer(fd, offset))
200 return false;
201 fd = mRot->getDstMemId();
202 offset = mRot->getDstOffset();
203 }
204 if (!ov.queueBuffer(fd, offset, dest)) {
Amara Venkata Mastan Manoj Kumardc01a532013-01-30 18:34:56 -0800205 ALOGE("%s: queueBuffer failed for FBUpdate", __FUNCTION__);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500206 ret = false;
207 }
208 return ret;
209}
210
Saurabh Shahcf053c62012-12-13 12:32:55 -0800211//================= High res====================================
Saurabh Shah88e4d272013-09-03 13:31:29 -0700212FBUpdateSplit::FBUpdateSplit(const int& dpy): IFBUpdate(dpy) {}
Saurabh Shahcf053c62012-12-13 12:32:55 -0800213
Saurabh Shah88e4d272013-09-03 13:31:29 -0700214inline void FBUpdateSplit::reset() {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800215 IFBUpdate::reset();
216 mDestLeft = ovutils::OV_INVALID;
217 mDestRight = ovutils::OV_INVALID;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700218 mRot = NULL;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800219}
220
Saurabh Shah88e4d272013-09-03 13:31:29 -0700221bool FBUpdateSplit::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800222 int fbZorder) {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800223 if(!ctx->mMDP.hasOverlay) {
224 ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800225 __FUNCTION__);
226 return false;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800227 }
228 ALOGD_IF(DEBUG_FBUPDATE, "%s, mModeOn = %d", __FUNCTION__, mModeOn);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800229 mModeOn = configure(ctx, list, fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800230 return mModeOn;
231}
232
233// Configure
Saurabh Shah88e4d272013-09-03 13:31:29 -0700234bool FBUpdateSplit::configure(hwc_context_t *ctx,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700235 hwc_display_contents_1 *list, int fbZorder) {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800236 bool ret = false;
Naseer Ahmed64b81212013-02-14 10:29:47 -0500237 hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
Saurabh Shahcf053c62012-12-13 12:32:55 -0800238 if (LIKELY(ctx->mOverlay)) {
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800239 int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex;
240 // ext only layer present..
241 if(extOnlyLayerIndex != -1) {
242 layer = &list->hwLayers[extOnlyLayerIndex];
243 layer->compositionType = HWC_OVERLAY;
244 }
Saurabh Shahcf053c62012-12-13 12:32:55 -0800245 overlay::Overlay& ov = *(ctx->mOverlay);
246 private_handle_t *hnd = (private_handle_t *)layer->handle;
Saurabh Shahacf10202013-02-26 10:15:15 -0800247 ovutils::Whf info(hnd->width, hnd->height,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800248 ovutils::getMdpFormat(hnd->format), hnd->size);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800249
Saurabh Shahc66f54d2013-06-12 15:45:59 -0700250 //Request left pipe
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700251 ovutils::eDest destL = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
252 Overlay::MIXER_LEFT);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800253 if(destL == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700254 ALOGE("%s: No pipes available to configure fb for dpy %d's left"
255 " mixer", __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800256 return false;
257 }
Saurabh Shahc66f54d2013-06-12 15:45:59 -0700258 //Request right pipe
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700259 ovutils::eDest destR = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
260 Overlay::MIXER_RIGHT);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800261 if(destR == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700262 ALOGE("%s: No pipes available to configure fb for dpy %d's right"
263 " mixer", __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800264 return false;
265 }
266
267 mDestLeft = destL;
268 mDestRight = destR;
269
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800270 ovutils::eMdpFlags mdpFlagsL = ovutils::OV_MDP_BLEND_FG_PREMULT;
Sravan Kumar D.V.Nb5ed0292013-03-15 08:51:16 +0530271
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800272 ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800273
Naseer Ahmed522ce662013-03-18 20:14:05 -0400274 //XXX: FB layer plane alpha is currently sent as zero from
275 //surfaceflinger
Saurabh Shahcf053c62012-12-13 12:32:55 -0800276 ovutils::PipeArgs pargL(mdpFlagsL,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800277 info,
278 zOrder,
279 ovutils::IS_FG_OFF,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400280 ovutils::ROT_FLAGS_NONE,
281 ovutils::DEFAULT_PLANE_ALPHA,
282 (ovutils::eBlending)
283 getBlending(layer->blending));
Saurabh Shahcf053c62012-12-13 12:32:55 -0800284 ov.setSource(pargL, destL);
285
286 ovutils::eMdpFlags mdpFlagsR = mdpFlagsL;
287 ovutils::setMdpFlags(mdpFlagsR, ovutils::OV_MDSS_MDP_RIGHT_MIXER);
288 ovutils::PipeArgs pargR(mdpFlagsR,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800289 info,
290 zOrder,
291 ovutils::IS_FG_OFF,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400292 ovutils::ROT_FLAGS_NONE,
293 ovutils::DEFAULT_PLANE_ALPHA,
294 (ovutils::eBlending)
295 getBlending(layer->blending));
Saurabh Shahcf053c62012-12-13 12:32:55 -0800296 ov.setSource(pargR, destR);
297
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800298 hwc_rect_t sourceCrop = layer->sourceCrop;
299 hwc_rect_t displayFrame = layer->displayFrame;
Saurabh Shah67a38c32013-06-10 16:23:15 -0700300
301 const float xres = ctx->dpyAttr[mDpy].xres;
Saurabh Shah07a8ca82013-08-06 18:45:42 -0700302 const int lSplit = getLeftSplit(ctx, mDpy);
Saurabh Shah67a38c32013-06-10 16:23:15 -0700303 const float lSplitRatio = lSplit / xres;
Saurabh Shah67a38c32013-06-10 16:23:15 -0700304 const float lCropWidth =
305 (sourceCrop.right - sourceCrop.left) * lSplitRatio;
306
307 ovutils::Dim dcropL(
308 sourceCrop.left,
309 sourceCrop.top,
310 lCropWidth,
311 sourceCrop.bottom - sourceCrop.top);
312
Saurabh Shahcf053c62012-12-13 12:32:55 -0800313 ovutils::Dim dcropR(
Saurabh Shah67a38c32013-06-10 16:23:15 -0700314 sourceCrop.left + lCropWidth,
315 sourceCrop.top,
316 (sourceCrop.right - sourceCrop.left) - lCropWidth,
317 sourceCrop.bottom - sourceCrop.top);
318
Saurabh Shahcf053c62012-12-13 12:32:55 -0800319 ov.setCrop(dcropL, destL);
320 ov.setCrop(dcropR, destR);
321
322 int transform = layer->transform;
323 ovutils::eTransform orient =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800324 static_cast<ovutils::eTransform>(transform);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800325 ov.setTransform(orient, destL);
326 ov.setTransform(orient, destR);
327
Saurabh Shah67a38c32013-06-10 16:23:15 -0700328 const int lWidth = (lSplit - displayFrame.left);
329 const int rWidth = (displayFrame.right - lSplit);
Saurabh Shahce416f02013-04-10 13:33:09 -0700330 const int height = displayFrame.bottom - displayFrame.top;
331
Saurabh Shah67a38c32013-06-10 16:23:15 -0700332 ovutils::Dim dposL(displayFrame.left,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800333 displayFrame.top,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700334 lWidth,
Saurabh Shahce416f02013-04-10 13:33:09 -0700335 height);
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700336 ov.setPosition(dposL, destL);
Saurabh Shahce416f02013-04-10 13:33:09 -0700337
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700338 ovutils::Dim dposR(0,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800339 displayFrame.top,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700340 rWidth,
Saurabh Shahce416f02013-04-10 13:33:09 -0700341 height);
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700342 ov.setPosition(dposR, destR);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800343
344 ret = true;
345 if (!ov.commit(destL)) {
346 ALOGE("%s: commit fails for left", __FUNCTION__);
347 ret = false;
348 }
349 if (!ov.commit(destR)) {
350 ALOGE("%s: commit fails for right", __FUNCTION__);
351 ret = false;
352 }
353 }
354 return ret;
355}
356
Saurabh Shah88e4d272013-09-03 13:31:29 -0700357bool FBUpdateSplit::draw(hwc_context_t *ctx, private_handle_t *hnd)
Saurabh Shahcf053c62012-12-13 12:32:55 -0800358{
359 if(!mModeOn) {
360 return true;
361 }
362 bool ret = true;
363 overlay::Overlay& ov = *(ctx->mOverlay);
364 ovutils::eDest destL = mDestLeft;
365 ovutils::eDest destR = mDestRight;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800366 if (!ov.queueBuffer(hnd->fd, hnd->offset, destL)) {
367 ALOGE("%s: queue failed for left of dpy = %d",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800368 __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800369 ret = false;
370 }
371 if (!ov.queueBuffer(hnd->fd, hnd->offset, destR)) {
372 ALOGE("%s: queue failed for right of dpy = %d",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800373 __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800374 ret = false;
375 }
376 return ret;
377}
378
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500379//---------------------------------------------------------------------
380}; //namespace qhwc