blob: dde4815c9b53c4f67c78f8e89979900f918dc9ce [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
Saurabh Shah62e1d732013-09-17 10:44:05 -0700137 hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf);
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800138 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__);
Saurabh Shahda5b3ce2013-11-26 10:48:06 -0800171 ctx->mOverlay->clear(mDpy);
172 ctx->mLayerRotMap[mDpy]->clear();
Ramkumar Radhakrishnan66f856c2013-08-21 16:09:47 -0700173 return false;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700174 }
175 //For the mdp, since either we are pre-rotating or MDP does flips
176 orient = ovutils::OVERLAY_TRANSFORM_0;
177 transform = 0;
178 ovutils::PipeArgs parg(mdpFlags, info, zOrder, isFg,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400179 static_cast<ovutils::eRotFlags>(rotFlags),
180 ovutils::DEFAULT_PLANE_ALPHA,
181 (ovutils::eBlending)
182 getBlending(layer->blending));
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500183 ret = true;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700184 if(configMdp(ctx->mOverlay, parg, orient, sourceCrop, displayFrame,
185 NULL, mDest) < 0) {
Saurabh Shahe2474082013-05-15 16:32:13 -0700186 ALOGE("%s: configMdp failed for dpy %d", __FUNCTION__, mDpy);
Saurabh Shahda5b3ce2013-11-26 10:48:06 -0800187 ctx->mLayerRotMap[mDpy]->clear();
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500188 ret = false;
189 }
190 }
191 return ret;
192}
193
Saurabh Shah88e4d272013-09-03 13:31:29 -0700194bool FBUpdateNonSplit::draw(hwc_context_t *ctx, private_handle_t *hnd)
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500195{
Saurabh Shahcf053c62012-12-13 12:32:55 -0800196 if(!mModeOn) {
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500197 return true;
198 }
199 bool ret = true;
200 overlay::Overlay& ov = *(ctx->mOverlay);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800201 ovutils::eDest dest = mDest;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700202 int fd = hnd->fd;
203 uint32_t offset = hnd->offset;
204 if(mRot) {
205 if(!mRot->queueBuffer(fd, offset))
206 return false;
207 fd = mRot->getDstMemId();
208 offset = mRot->getDstOffset();
209 }
210 if (!ov.queueBuffer(fd, offset, dest)) {
Amara Venkata Mastan Manoj Kumardc01a532013-01-30 18:34:56 -0800211 ALOGE("%s: queueBuffer failed for FBUpdate", __FUNCTION__);
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500212 ret = false;
213 }
214 return ret;
215}
216
Saurabh Shahcf053c62012-12-13 12:32:55 -0800217//================= High res====================================
Saurabh Shah88e4d272013-09-03 13:31:29 -0700218FBUpdateSplit::FBUpdateSplit(const int& dpy): IFBUpdate(dpy) {}
Saurabh Shahcf053c62012-12-13 12:32:55 -0800219
Saurabh Shah88e4d272013-09-03 13:31:29 -0700220inline void FBUpdateSplit::reset() {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800221 IFBUpdate::reset();
222 mDestLeft = ovutils::OV_INVALID;
223 mDestRight = ovutils::OV_INVALID;
Arun Kumar K.Rffef7482013-04-10 14:17:22 -0700224 mRot = NULL;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800225}
226
Saurabh Shah88e4d272013-09-03 13:31:29 -0700227bool FBUpdateSplit::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800228 int fbZorder) {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800229 if(!ctx->mMDP.hasOverlay) {
230 ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800231 __FUNCTION__);
232 return false;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800233 }
234 ALOGD_IF(DEBUG_FBUPDATE, "%s, mModeOn = %d", __FUNCTION__, mModeOn);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800235 mModeOn = configure(ctx, list, fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800236 return mModeOn;
237}
238
239// Configure
Saurabh Shah88e4d272013-09-03 13:31:29 -0700240bool FBUpdateSplit::configure(hwc_context_t *ctx,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700241 hwc_display_contents_1 *list, int fbZorder) {
Saurabh Shahcf053c62012-12-13 12:32:55 -0800242 bool ret = false;
Naseer Ahmed64b81212013-02-14 10:29:47 -0500243 hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
Saurabh Shahcf053c62012-12-13 12:32:55 -0800244 if (LIKELY(ctx->mOverlay)) {
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800245 int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex;
246 // ext only layer present..
247 if(extOnlyLayerIndex != -1) {
248 layer = &list->hwLayers[extOnlyLayerIndex];
249 layer->compositionType = HWC_OVERLAY;
250 }
Saurabh Shahcf053c62012-12-13 12:32:55 -0800251 overlay::Overlay& ov = *(ctx->mOverlay);
252 private_handle_t *hnd = (private_handle_t *)layer->handle;
Ramkumar Radhakrishnan92f3abe2013-06-05 13:52:40 -0700253 ovutils::Whf info(getWidth(hnd), getHeight(hnd),
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800254 ovutils::getMdpFormat(hnd->format), hnd->size);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800255
Saurabh Shahc66f54d2013-06-12 15:45:59 -0700256 //Request left pipe
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700257 ovutils::eDest destL = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
258 Overlay::MIXER_LEFT);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800259 if(destL == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700260 ALOGE("%s: No pipes available to configure fb for dpy %d's left"
261 " mixer", __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800262 return false;
263 }
Saurabh Shahc66f54d2013-06-12 15:45:59 -0700264 //Request right pipe
Saurabh Shahaf5f5972013-07-30 13:56:35 -0700265 ovutils::eDest destR = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
266 Overlay::MIXER_RIGHT);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800267 if(destR == ovutils::OV_INVALID) { //None available
Saurabh Shahaa236822013-04-24 18:07:26 -0700268 ALOGE("%s: No pipes available to configure fb for dpy %d's right"
269 " mixer", __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800270 return false;
271 }
272
273 mDestLeft = destL;
274 mDestRight = destR;
275
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800276 ovutils::eMdpFlags mdpFlagsL = ovutils::OV_MDP_BLEND_FG_PREMULT;
Sravan Kumar D.V.Nb5ed0292013-03-15 08:51:16 +0530277
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800278 ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800279
Naseer Ahmed522ce662013-03-18 20:14:05 -0400280 //XXX: FB layer plane alpha is currently sent as zero from
281 //surfaceflinger
Saurabh Shahcf053c62012-12-13 12:32:55 -0800282 ovutils::PipeArgs pargL(mdpFlagsL,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800283 info,
284 zOrder,
285 ovutils::IS_FG_OFF,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400286 ovutils::ROT_FLAGS_NONE,
287 ovutils::DEFAULT_PLANE_ALPHA,
288 (ovutils::eBlending)
289 getBlending(layer->blending));
Saurabh Shahcf053c62012-12-13 12:32:55 -0800290 ov.setSource(pargL, destL);
291
292 ovutils::eMdpFlags mdpFlagsR = mdpFlagsL;
293 ovutils::setMdpFlags(mdpFlagsR, ovutils::OV_MDSS_MDP_RIGHT_MIXER);
294 ovutils::PipeArgs pargR(mdpFlagsR,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800295 info,
296 zOrder,
297 ovutils::IS_FG_OFF,
Naseer Ahmed522ce662013-03-18 20:14:05 -0400298 ovutils::ROT_FLAGS_NONE,
299 ovutils::DEFAULT_PLANE_ALPHA,
300 (ovutils::eBlending)
301 getBlending(layer->blending));
Saurabh Shahcf053c62012-12-13 12:32:55 -0800302 ov.setSource(pargR, destR);
303
Saurabh Shah62e1d732013-09-17 10:44:05 -0700304 hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf);
Arun Kumar K.Ra2978452013-02-07 01:34:24 -0800305 hwc_rect_t displayFrame = layer->displayFrame;
Saurabh Shah67a38c32013-06-10 16:23:15 -0700306
307 const float xres = ctx->dpyAttr[mDpy].xres;
Saurabh Shah07a8ca82013-08-06 18:45:42 -0700308 const int lSplit = getLeftSplit(ctx, mDpy);
Saurabh Shah67a38c32013-06-10 16:23:15 -0700309 const float lSplitRatio = lSplit / xres;
Saurabh Shah67a38c32013-06-10 16:23:15 -0700310 const float lCropWidth =
311 (sourceCrop.right - sourceCrop.left) * lSplitRatio;
312
313 ovutils::Dim dcropL(
314 sourceCrop.left,
315 sourceCrop.top,
316 lCropWidth,
317 sourceCrop.bottom - sourceCrop.top);
318
Saurabh Shahcf053c62012-12-13 12:32:55 -0800319 ovutils::Dim dcropR(
Saurabh Shah67a38c32013-06-10 16:23:15 -0700320 sourceCrop.left + lCropWidth,
321 sourceCrop.top,
322 (sourceCrop.right - sourceCrop.left) - lCropWidth,
323 sourceCrop.bottom - sourceCrop.top);
324
Saurabh Shahcf053c62012-12-13 12:32:55 -0800325 ov.setCrop(dcropL, destL);
326 ov.setCrop(dcropR, destR);
327
328 int transform = layer->transform;
329 ovutils::eTransform orient =
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800330 static_cast<ovutils::eTransform>(transform);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800331 ov.setTransform(orient, destL);
332 ov.setTransform(orient, destR);
333
Saurabh Shah67a38c32013-06-10 16:23:15 -0700334 const int lWidth = (lSplit - displayFrame.left);
335 const int rWidth = (displayFrame.right - lSplit);
Saurabh Shahce416f02013-04-10 13:33:09 -0700336 const int height = displayFrame.bottom - displayFrame.top;
337
Saurabh Shah67a38c32013-06-10 16:23:15 -0700338 ovutils::Dim dposL(displayFrame.left,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800339 displayFrame.top,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700340 lWidth,
Saurabh Shahce416f02013-04-10 13:33:09 -0700341 height);
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700342 ov.setPosition(dposL, destL);
Saurabh Shahce416f02013-04-10 13:33:09 -0700343
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700344 ovutils::Dim dposR(0,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800345 displayFrame.top,
Saurabh Shah67a38c32013-06-10 16:23:15 -0700346 rWidth,
Saurabh Shahce416f02013-04-10 13:33:09 -0700347 height);
Arun Kumar K.R0e8efb82013-03-18 17:31:50 -0700348 ov.setPosition(dposR, destR);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800349
350 ret = true;
351 if (!ov.commit(destL)) {
352 ALOGE("%s: commit fails for left", __FUNCTION__);
353 ret = false;
354 }
355 if (!ov.commit(destR)) {
356 ALOGE("%s: commit fails for right", __FUNCTION__);
357 ret = false;
358 }
Saurabh Shahda5b3ce2013-11-26 10:48:06 -0800359 if(ret == false) {
360 ctx->mLayerRotMap[mDpy]->clear();
361 }
Saurabh Shahcf053c62012-12-13 12:32:55 -0800362 }
363 return ret;
364}
365
Saurabh Shah88e4d272013-09-03 13:31:29 -0700366bool FBUpdateSplit::draw(hwc_context_t *ctx, private_handle_t *hnd)
Saurabh Shahcf053c62012-12-13 12:32:55 -0800367{
368 if(!mModeOn) {
369 return true;
370 }
371 bool ret = true;
372 overlay::Overlay& ov = *(ctx->mOverlay);
373 ovutils::eDest destL = mDestLeft;
374 ovutils::eDest destR = mDestRight;
Saurabh Shahcf053c62012-12-13 12:32:55 -0800375 if (!ov.queueBuffer(hnd->fd, hnd->offset, destL)) {
376 ALOGE("%s: queue failed for left of dpy = %d",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800377 __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800378 ret = false;
379 }
380 if (!ov.queueBuffer(hnd->fd, hnd->offset, destR)) {
381 ALOGE("%s: queue failed for right of dpy = %d",
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800382 __FUNCTION__, mDpy);
Saurabh Shahcf053c62012-12-13 12:32:55 -0800383 ret = false;
384 }
385 return ret;
386}
387
Naseer Ahmed758bfc52012-11-28 17:02:08 -0500388//---------------------------------------------------------------------
389}; //namespace qhwc