blob: 391b1506cec885368f81b91844d535105eeee6c7 [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,
Prabhanjan Kanduladb202b72013-10-30 17:29:46 +053061 hwc_layer_1_t *layer,
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -070062 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 }
Prabhanjan Kanduladb202b72013-10-30 17:29:46 +053078 ctx->mLayerRotMap[mDpy]->add(layer, mRot);
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -070079 info.format = (mRot)->getDstFormat();
80 updateSource(orient, info, sourceCrop);
81 rotFlags |= ovutils::ROT_PREROTATED;
82 }
83 return true;
84}
85
Saurabh Shah88e4d272013-09-03 13:31:29 -070086bool FBUpdateNonSplit::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080087 int fbZorder) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -050088 if(!ctx->mMDP.hasOverlay) {
Saurabh Shahcf053c62012-12-13 12:32:55 -080089 ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080090 __FUNCTION__);
91 return false;
Naseer Ahmed758bfc52012-11-28 17:02:08 -050092 }
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080093 mModeOn = configure(ctx, list, fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -080094 return mModeOn;
Naseer Ahmed758bfc52012-11-28 17:02:08 -050095}
96
97// Configure
Saurabh Shah88e4d272013-09-03 13:31:29 -070098bool FBUpdateNonSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *list,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080099 int fbZorder) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500100 bool ret = false;
Naseer Ahmed64b81212013-02-14 10:29:47 -0500101 hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500102 if (LIKELY(ctx->mOverlay)) {
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800103 int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex;
104 // ext only layer present..
105 if(extOnlyLayerIndex != -1) {
106 layer = &list->hwLayers[extOnlyLayerIndex];
107 layer->compositionType = HWC_OVERLAY;
108 }
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500109 overlay::Overlay& ov = *(ctx->mOverlay);
110 private_handle_t *hnd = (private_handle_t *)layer->handle;
Ramkumar Radhakrishnan92f3abe2013-06-05 13:52:40 -0700111 ovutils::Whf info(getWidth(hnd), getHeight(hnd),
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800112 ovutils::getMdpFormat(hnd->format), hnd->size);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500113
Saurabh Shahd4e65852013-06-17 11:33:53 -0700114 //Request a pipe
115 ovutils::eMdpPipeType type = ovutils::OV_MDP_PIPE_ANY;
116 if(qdutils::MDPVersion::getInstance().is8x26() && mDpy) {
117 //For 8x26 external always use DMA pipe
118 type = ovutils::OV_MDP_PIPE_DMA;
119 }
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700120 ovutils::eDest dest = ov.nextPipe(type, mDpy, Overlay::MIXER_DEFAULT);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500121 if(dest == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700122 ALOGE("%s: No pipes available to configure fb for dpy %d",
123 __FUNCTION__, mDpy);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500124 return false;
125 }
Saurabh Shahcf053c62012-12-13 12:32:55 -0800126 mDest = dest;
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500127
Ramkumar Radhakrishnan1829d282013-07-23 14:54:36 -0700128 if((mDpy && ctx->deviceOrientation) &&
129 ctx->listStats[mDpy].isDisplayAnimating) {
130 fbZorder = 0;
131 }
132
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800133 ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700134 ovutils::eIsFg isFg = ovutils::IS_FG_OFF;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800135 ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500136
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800137 hwc_rect_t sourceCrop = layer->sourceCrop;
138 hwc_rect_t displayFrame = layer->displayFrame;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700139 int transform = layer->transform;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700140 int rotFlags = ovutils::ROT_FLAGS_NONE;
141
142 ovutils::eTransform orient =
143 static_cast<ovutils::eTransform>(transform);
Arun Kumar K.Rfb5bfa62013-07-25 03:10:51 -0700144 // use ext orientation if any
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -0700145 int extOrient = getExtOrientation(ctx);
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700146
Ramkumar Radhakrishnan59a11072013-04-15 16:14:49 -0700147 // Do not use getNonWormholeRegion() function to calculate the
148 // sourceCrop during animation on external display and
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700149 // Dont do wormhole calculation when extorientation is set on External
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700150 // Dont do wormhole calculation when extDownscale is enabled on External
Ramkumar Radhakrishnan59a11072013-04-15 16:14:49 -0700151 if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) {
152 sourceCrop = layer->displayFrame;
153 displayFrame = sourceCrop;
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700154 } else if((!mDpy ||
Arun Kumar K.Rfb5bfa62013-07-25 03:10:51 -0700155 (mDpy && !extOrient
Amara Venkata Mastan Manoj Kumar376d8a82013-03-13 19:18:47 -0700156 && !ctx->dpyAttr[mDpy].mDownScaleMode))
157 && (extOnlyLayerIndex == -1)) {
Saurabh Shahd4e65852013-06-17 11:33:53 -0700158 if(!qdutils::MDPVersion::getInstance().is8x26()) {
159 getNonWormholeRegion(list, sourceCrop);
160 displayFrame = sourceCrop;
161 }
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800162 }
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -0700163 calcExtDisplayPosition(ctx, hnd, mDpy, sourceCrop, displayFrame,
164 transform, orient);
Ramkumar Radhakrishnan9d52f432013-05-14 14:46:59 -0700165 setMdpFlags(layer, mdpFlags, 0, transform);
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700166 // For External use rotator if there is a rotation value set
Prabhanjan Kanduladb202b72013-10-30 17:29:46 +0530167 ret = preRotateExtDisplay(ctx, layer, info,
168 sourceCrop, mdpFlags, rotFlags);
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -0700169 if(!ret) {
170 ALOGE("%s: preRotate for external Failed!", __FUNCTION__);
171 return false;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700172 }
173 //For the mdp, since either we are pre-rotating or MDP does flips
174 orient = ovutils::OVERLAY_TRANSFORM_0;
175 transform = 0;
176 ovutils::PipeArgs parg(mdpFlags, info, zOrder, isFg,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400177 static_cast<ovutils::eRotFlags>(rotFlags),
178 ovutils::DEFAULT_PLANE_ALPHA,
179 (ovutils::eBlending)
180 getBlending(layer->blending));
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500181 ret = true;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700182 if(configMdp(ctx->mOverlay, parg, orient, sourceCrop, displayFrame,
183 NULL, mDest) < 0) {
Saurabh Shahe2474082013-05-15 16:32:13 -0700184 ALOGE("%s: configMdp failed for dpy %d", __FUNCTION__, mDpy);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500185 ret = false;
186 }
187 }
188 return ret;
189}
190
Saurabh Shah88e4d272013-09-03 13:31:29 -0700191bool FBUpdateNonSplit::draw(hwc_context_t *ctx, private_handle_t *hnd)
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500192{
Saurabh Shahcf053c62012-12-13 12:32:55 -0800193 if(!mModeOn) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500194 return true;
195 }
196 bool ret = true;
197 overlay::Overlay& ov = *(ctx->mOverlay);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800198 ovutils::eDest dest = mDest;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700199 int fd = hnd->fd;
200 uint32_t offset = hnd->offset;
201 if(mRot) {
202 if(!mRot->queueBuffer(fd, offset))
203 return false;
204 fd = mRot->getDstMemId();
205 offset = mRot->getDstOffset();
206 }
207 if (!ov.queueBuffer(fd, offset, dest)) {
Amara Venkata Mastan Manoj Kumardc01a532013-01-30 18:34:56 -0800208 ALOGE("%s: queueBuffer failed for FBUpdate", __FUNCTION__);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500209 ret = false;
210 }
211 return ret;
212}
213
Saurabh Shahcf053c62012-12-13 12:32:55 -0800214//================= High res====================================
Saurabh Shah88e4d272013-09-03 13:31:29 -0700215FBUpdateSplit::FBUpdateSplit(const int& dpy): IFBUpdate(dpy) {}
Saurabh Shahcf053c62012-12-13 12:32:55 -0800216
Saurabh Shah88e4d272013-09-03 13:31:29 -0700217inline void FBUpdateSplit::reset() {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800218 IFBUpdate::reset();
219 mDestLeft = ovutils::OV_INVALID;
220 mDestRight = ovutils::OV_INVALID;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700221 mRot = NULL;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800222}
223
Saurabh Shah88e4d272013-09-03 13:31:29 -0700224bool FBUpdateSplit::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800225 int fbZorder) {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800226 if(!ctx->mMDP.hasOverlay) {
227 ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800228 __FUNCTION__);
229 return false;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800230 }
231 ALOGD_IF(DEBUG_FBUPDATE, "%s, mModeOn = %d", __FUNCTION__, mModeOn);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800232 mModeOn = configure(ctx, list, fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800233 return mModeOn;
234}
235
236// Configure
Saurabh Shah88e4d272013-09-03 13:31:29 -0700237bool FBUpdateSplit::configure(hwc_context_t *ctx,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700238 hwc_display_contents_1 *list, int fbZorder) {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800239 bool ret = false;
Naseer Ahmed64b81212013-02-14 10:29:47 -0500240 hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
Saurabh Shahcf053c62012-12-13 12:32:55 -0800241 if (LIKELY(ctx->mOverlay)) {
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800242 int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex;
243 // ext only layer present..
244 if(extOnlyLayerIndex != -1) {
245 layer = &list->hwLayers[extOnlyLayerIndex];
246 layer->compositionType = HWC_OVERLAY;
247 }
Saurabh Shahcf053c62012-12-13 12:32:55 -0800248 overlay::Overlay& ov = *(ctx->mOverlay);
249 private_handle_t *hnd = (private_handle_t *)layer->handle;
Ramkumar Radhakrishnan92f3abe2013-06-05 13:52:40 -0700250 ovutils::Whf info(getWidth(hnd), getHeight(hnd),
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800251 ovutils::getMdpFormat(hnd->format), hnd->size);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800252
Saurabh Shahc66f54d2013-06-12 15:45:59 -0700253 //Request left pipe
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700254 ovutils::eDest destL = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
255 Overlay::MIXER_LEFT);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800256 if(destL == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700257 ALOGE("%s: No pipes available to configure fb for dpy %d's left"
258 " mixer", __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800259 return false;
260 }
Saurabh Shahc66f54d2013-06-12 15:45:59 -0700261 //Request right pipe
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700262 ovutils::eDest destR = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
263 Overlay::MIXER_RIGHT);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800264 if(destR == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700265 ALOGE("%s: No pipes available to configure fb for dpy %d's right"
266 " mixer", __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800267 return false;
268 }
269
270 mDestLeft = destL;
271 mDestRight = destR;
272
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800273 ovutils::eMdpFlags mdpFlagsL = ovutils::OV_MDP_BLEND_FG_PREMULT;
Sravan Kumar D.V.Nb5ed0292013-03-15 08:51:16 +0530274
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800275 ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800276
Naseer Ahmed522ce662013-03-18 20:14:05 -0400277 //XXX: FB layer plane alpha is currently sent as zero from
278 //surfaceflinger
Saurabh Shahcf053c62012-12-13 12:32:55 -0800279 ovutils::PipeArgs pargL(mdpFlagsL,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800280 info,
281 zOrder,
282 ovutils::IS_FG_OFF,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400283 ovutils::ROT_FLAGS_NONE,
284 ovutils::DEFAULT_PLANE_ALPHA,
285 (ovutils::eBlending)
286 getBlending(layer->blending));
Saurabh Shahcf053c62012-12-13 12:32:55 -0800287 ov.setSource(pargL, destL);
288
289 ovutils::eMdpFlags mdpFlagsR = mdpFlagsL;
290 ovutils::setMdpFlags(mdpFlagsR, ovutils::OV_MDSS_MDP_RIGHT_MIXER);
291 ovutils::PipeArgs pargR(mdpFlagsR,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800292 info,
293 zOrder,
294 ovutils::IS_FG_OFF,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400295 ovutils::ROT_FLAGS_NONE,
296 ovutils::DEFAULT_PLANE_ALPHA,
297 (ovutils::eBlending)
298 getBlending(layer->blending));
Saurabh Shahcf053c62012-12-13 12:32:55 -0800299 ov.setSource(pargR, destR);
300
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800301 hwc_rect_t sourceCrop = layer->sourceCrop;
302 hwc_rect_t displayFrame = layer->displayFrame;
Saurabh Shah67a38c32013-06-10 16:23:15 -0700303
304 const float xres = ctx->dpyAttr[mDpy].xres;
Saurabh Shah07a8ca82013-08-06 18:45:42 -0700305 const int lSplit = getLeftSplit(ctx, mDpy);
Saurabh Shah67a38c32013-06-10 16:23:15 -0700306 const float lSplitRatio = lSplit / xres;
Saurabh Shah67a38c32013-06-10 16:23:15 -0700307 const float lCropWidth =
308 (sourceCrop.right - sourceCrop.left) * lSplitRatio;
309
310 ovutils::Dim dcropL(
311 sourceCrop.left,
312 sourceCrop.top,
313 lCropWidth,
314 sourceCrop.bottom - sourceCrop.top);
315
Saurabh Shahcf053c62012-12-13 12:32:55 -0800316 ovutils::Dim dcropR(
Saurabh Shah67a38c32013-06-10 16:23:15 -0700317 sourceCrop.left + lCropWidth,
318 sourceCrop.top,
319 (sourceCrop.right - sourceCrop.left) - lCropWidth,
320 sourceCrop.bottom - sourceCrop.top);
321
Saurabh Shahcf053c62012-12-13 12:32:55 -0800322 ov.setCrop(dcropL, destL);
323 ov.setCrop(dcropR, destR);
324
325 int transform = layer->transform;
326 ovutils::eTransform orient =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800327 static_cast<ovutils::eTransform>(transform);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800328 ov.setTransform(orient, destL);
329 ov.setTransform(orient, destR);
330
Saurabh Shah67a38c32013-06-10 16:23:15 -0700331 const int lWidth = (lSplit - displayFrame.left);
332 const int rWidth = (displayFrame.right - lSplit);
Saurabh Shahce416f02013-04-10 13:33:09 -0700333 const int height = displayFrame.bottom - displayFrame.top;
334
Saurabh Shah67a38c32013-06-10 16:23:15 -0700335 ovutils::Dim dposL(displayFrame.left,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800336 displayFrame.top,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700337 lWidth,
Saurabh Shahce416f02013-04-10 13:33:09 -0700338 height);
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700339 ov.setPosition(dposL, destL);
Saurabh Shahce416f02013-04-10 13:33:09 -0700340
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700341 ovutils::Dim dposR(0,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800342 displayFrame.top,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700343 rWidth,
Saurabh Shahce416f02013-04-10 13:33:09 -0700344 height);
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700345 ov.setPosition(dposR, destR);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800346
347 ret = true;
348 if (!ov.commit(destL)) {
349 ALOGE("%s: commit fails for left", __FUNCTION__);
350 ret = false;
351 }
352 if (!ov.commit(destR)) {
353 ALOGE("%s: commit fails for right", __FUNCTION__);
354 ret = false;
355 }
356 }
357 return ret;
358}
359
Saurabh Shah88e4d272013-09-03 13:31:29 -0700360bool FBUpdateSplit::draw(hwc_context_t *ctx, private_handle_t *hnd)
Saurabh Shahcf053c62012-12-13 12:32:55 -0800361{
362 if(!mModeOn) {
363 return true;
364 }
365 bool ret = true;
366 overlay::Overlay& ov = *(ctx->mOverlay);
367 ovutils::eDest destL = mDestLeft;
368 ovutils::eDest destR = mDestRight;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800369 if (!ov.queueBuffer(hnd->fd, hnd->offset, destL)) {
370 ALOGE("%s: queue failed for left of dpy = %d",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800371 __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800372 ret = false;
373 }
374 if (!ov.queueBuffer(hnd->fd, hnd->offset, destR)) {
375 ALOGE("%s: queue failed for right of dpy = %d",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800376 __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800377 ret = false;
378 }
379 return ret;
380}
381
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500382//---------------------------------------------------------------------
383}; //namespace qhwc