Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 1 | /* |
| 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 Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 21 | #define DEBUG_FBUPDATE 0 |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 22 | #include <cutils/properties.h> |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 23 | #include <gralloc_priv.h> |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 24 | #include <overlayRotator.h> |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 25 | #include "hwc_fbupdate.h" |
Saurabh Shah | bd2d083 | 2013-04-04 14:33:08 -0700 | [diff] [blame] | 26 | #include "mdp_version.h" |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 27 | #include "external.h" |
Saurabh Shah | bd2d083 | 2013-04-04 14:33:08 -0700 | [diff] [blame] | 28 | |
| 29 | using namespace qdutils; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 30 | |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 31 | using overlay::Rotator; |
| 32 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 33 | namespace qhwc { |
| 34 | |
| 35 | namespace ovutils = overlay::utils; |
| 36 | |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 37 | IFBUpdate* IFBUpdate::getObject(const int& width, const int& dpy) { |
| 38 | if(width > MAX_DISPLAY_DIM) { |
| 39 | return new FBUpdateHighRes(dpy); |
| 40 | } |
| 41 | return new FBUpdateLowRes(dpy); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 42 | } |
| 43 | |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 44 | inline void IFBUpdate::reset() { |
| 45 | mModeOn = false; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 46 | mRot = NULL; |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | //================= Low res==================================== |
| 50 | FBUpdateLowRes::FBUpdateLowRes(const int& dpy): IFBUpdate(dpy) {} |
| 51 | |
| 52 | inline void FBUpdateLowRes::reset() { |
| 53 | IFBUpdate::reset(); |
| 54 | mDest = ovutils::OV_INVALID; |
| 55 | } |
| 56 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 57 | bool FBUpdateLowRes::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list, |
| 58 | int fbZorder) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 59 | if(!ctx->mMDP.hasOverlay) { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 60 | ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays", |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 61 | __FUNCTION__); |
| 62 | return false; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 63 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 64 | mModeOn = configure(ctx, list, fbZorder); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 65 | return mModeOn; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | // Configure |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 69 | bool FBUpdateLowRes::configure(hwc_context_t *ctx, hwc_display_contents_1 *list, |
| 70 | int fbZorder) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 71 | bool ret = false; |
Naseer Ahmed | 64b8121 | 2013-02-14 10:29:47 -0500 | [diff] [blame] | 72 | hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1]; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 73 | if (LIKELY(ctx->mOverlay)) { |
Arun Kumar K.R | a297845 | 2013-02-07 01:34:24 -0800 | [diff] [blame] | 74 | int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex; |
| 75 | // ext only layer present.. |
| 76 | if(extOnlyLayerIndex != -1) { |
| 77 | layer = &list->hwLayers[extOnlyLayerIndex]; |
| 78 | layer->compositionType = HWC_OVERLAY; |
| 79 | } |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 80 | overlay::Overlay& ov = *(ctx->mOverlay); |
| 81 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 82 | ovutils::Whf info(hnd->width, hnd->height, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 83 | ovutils::getMdpFormat(hnd->format), hnd->size); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 84 | |
| 85 | //Request an RGB pipe |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 86 | ovutils::eDest dest = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 87 | if(dest == ovutils::OV_INVALID) { //None available |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 88 | ALOGE("%s: No pipes available to configure fb for dpy %d", |
| 89 | __FUNCTION__, mDpy); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 90 | return false; |
| 91 | } |
| 92 | |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 93 | mDest = dest; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 94 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 95 | ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 96 | ovutils::eIsFg isFg = ovutils::IS_FG_OFF; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 97 | ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 98 | |
Arun Kumar K.R | a297845 | 2013-02-07 01:34:24 -0800 | [diff] [blame] | 99 | hwc_rect_t sourceCrop = layer->sourceCrop; |
| 100 | hwc_rect_t displayFrame = layer->displayFrame; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 101 | int transform = layer->transform; |
| 102 | int fbWidth = ctx->dpyAttr[mDpy].xres; |
| 103 | int fbHeight = ctx->dpyAttr[mDpy].yres; |
| 104 | int rotFlags = ovutils::ROT_FLAGS_NONE; |
| 105 | |
| 106 | ovutils::eTransform orient = |
| 107 | static_cast<ovutils::eTransform>(transform); |
| 108 | if(mDpy && ctx->mExtOrientation) { |
| 109 | // If there is a external orientation set, use that |
| 110 | transform = ctx->mExtOrientation; |
| 111 | orient = static_cast<ovutils::eTransform >(ctx->mExtOrientation); |
| 112 | } |
| 113 | |
Ramkumar Radhakrishnan | 59a1107 | 2013-04-15 16:14:49 -0700 | [diff] [blame] | 114 | // Do not use getNonWormholeRegion() function to calculate the |
| 115 | // sourceCrop during animation on external display and |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 116 | // Dont do wormhole calculation when extorientation is set on External |
Ramkumar Radhakrishnan | 59a1107 | 2013-04-15 16:14:49 -0700 | [diff] [blame] | 117 | if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) { |
| 118 | sourceCrop = layer->displayFrame; |
| 119 | displayFrame = sourceCrop; |
| 120 | } else if((!mDpy || (mDpy && !ctx->mExtOrientation)) |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 121 | && extOnlyLayerIndex == -1) { |
Arun Kumar K.R | a297845 | 2013-02-07 01:34:24 -0800 | [diff] [blame] | 122 | getNonWormholeRegion(list, sourceCrop); |
| 123 | displayFrame = sourceCrop; |
| 124 | } |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 125 | ovutils::Dim dpos(displayFrame.left, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 126 | displayFrame.top, |
| 127 | displayFrame.right - displayFrame.left, |
| 128 | displayFrame.bottom - displayFrame.top); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 129 | |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 130 | if(mDpy) { |
Arun Kumar K.R | 82f1d28 | 2013-05-17 15:37:31 -0700 | [diff] [blame] | 131 | // Get Aspect Ratio for external |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 132 | getAspectRatioPosition(ctx, mDpy, ctx->mExtOrientation, dpos.x, |
| 133 | dpos.y, dpos.w, dpos.h); |
Arun Kumar K.R | 82f1d28 | 2013-05-17 15:37:31 -0700 | [diff] [blame] | 134 | // Calculate the actionsafe dimensions for External(dpy = 1 or 2) |
| 135 | getActionSafePosition(ctx, mDpy, dpos.x, dpos.y, dpos.w, dpos.h); |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 136 | // Convert dim to hwc_rect_t |
| 137 | displayFrame.left = dpos.x; |
| 138 | displayFrame.top = dpos.y; |
| 139 | displayFrame.right = dpos.w + displayFrame.left; |
| 140 | displayFrame.bottom = dpos.h + displayFrame.top; |
| 141 | } |
Ramkumar Radhakrishnan | 9d52f43 | 2013-05-14 14:46:59 -0700 | [diff] [blame] | 142 | setMdpFlags(layer, mdpFlags, 0, transform); |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 143 | // For External use rotator if there is a rotation value set |
| 144 | if(mDpy && (ctx->mExtOrientation & HWC_TRANSFORM_ROT_90)) { |
| 145 | mRot = ctx->mRotMgr->getNext(); |
| 146 | if(mRot == NULL) return -1; |
| 147 | //Configure rotator for pre-rotation |
| 148 | if(configRotator(mRot, info, sourceCrop, mdpFlags, orient, 0) < 0) { |
| 149 | ALOGE("%s: configRotator Failed!", __FUNCTION__); |
| 150 | mRot = NULL; |
| 151 | return -1; |
| 152 | } |
| 153 | info.format = (mRot)->getDstFormat(); |
| 154 | updateSource(orient, info, sourceCrop); |
| 155 | rotFlags |= ovutils::ROT_PREROTATED; |
| 156 | } |
| 157 | //For the mdp, since either we are pre-rotating or MDP does flips |
| 158 | orient = ovutils::OVERLAY_TRANSFORM_0; |
| 159 | transform = 0; |
| 160 | ovutils::PipeArgs parg(mdpFlags, info, zOrder, isFg, |
| 161 | static_cast<ovutils::eRotFlags>(rotFlags)); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 162 | ret = true; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 163 | if(configMdp(ctx->mOverlay, parg, orient, sourceCrop, displayFrame, |
| 164 | NULL, mDest) < 0) { |
Saurabh Shah | e247408 | 2013-05-15 16:32:13 -0700 | [diff] [blame] | 165 | ALOGE("%s: configMdp failed for dpy %d", __FUNCTION__, mDpy); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 166 | ret = false; |
| 167 | } |
| 168 | } |
| 169 | return ret; |
| 170 | } |
| 171 | |
Naseer Ahmed | 64b8121 | 2013-02-14 10:29:47 -0500 | [diff] [blame] | 172 | bool FBUpdateLowRes::draw(hwc_context_t *ctx, private_handle_t *hnd) |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 173 | { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 174 | if(!mModeOn) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 175 | return true; |
| 176 | } |
| 177 | bool ret = true; |
| 178 | overlay::Overlay& ov = *(ctx->mOverlay); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 179 | ovutils::eDest dest = mDest; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 180 | int fd = hnd->fd; |
| 181 | uint32_t offset = hnd->offset; |
| 182 | if(mRot) { |
| 183 | if(!mRot->queueBuffer(fd, offset)) |
| 184 | return false; |
| 185 | fd = mRot->getDstMemId(); |
| 186 | offset = mRot->getDstOffset(); |
| 187 | } |
| 188 | if (!ov.queueBuffer(fd, offset, dest)) { |
Amara Venkata Mastan Manoj Kumar | dc01a53 | 2013-01-30 18:34:56 -0800 | [diff] [blame] | 189 | ALOGE("%s: queueBuffer failed for FBUpdate", __FUNCTION__); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 190 | ret = false; |
| 191 | } |
| 192 | return ret; |
| 193 | } |
| 194 | |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 195 | //================= High res==================================== |
| 196 | FBUpdateHighRes::FBUpdateHighRes(const int& dpy): IFBUpdate(dpy) {} |
| 197 | |
| 198 | inline void FBUpdateHighRes::reset() { |
| 199 | IFBUpdate::reset(); |
| 200 | mDestLeft = ovutils::OV_INVALID; |
| 201 | mDestRight = ovutils::OV_INVALID; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 202 | mRot = NULL; |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 203 | } |
| 204 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 205 | bool FBUpdateHighRes::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list, |
| 206 | int fbZorder) { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 207 | if(!ctx->mMDP.hasOverlay) { |
| 208 | ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays", |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 209 | __FUNCTION__); |
| 210 | return false; |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 211 | } |
| 212 | ALOGD_IF(DEBUG_FBUPDATE, "%s, mModeOn = %d", __FUNCTION__, mModeOn); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 213 | mModeOn = configure(ctx, list, fbZorder); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 214 | return mModeOn; |
| 215 | } |
| 216 | |
| 217 | // Configure |
Naseer Ahmed | 64b8121 | 2013-02-14 10:29:47 -0500 | [diff] [blame] | 218 | bool FBUpdateHighRes::configure(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 219 | hwc_display_contents_1 *list, int fbZorder) { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 220 | bool ret = false; |
Naseer Ahmed | 64b8121 | 2013-02-14 10:29:47 -0500 | [diff] [blame] | 221 | hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1]; |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 222 | if (LIKELY(ctx->mOverlay)) { |
Arun Kumar K.R | a297845 | 2013-02-07 01:34:24 -0800 | [diff] [blame] | 223 | int extOnlyLayerIndex = ctx->listStats[mDpy].extOnlyLayerIndex; |
| 224 | // ext only layer present.. |
| 225 | if(extOnlyLayerIndex != -1) { |
| 226 | layer = &list->hwLayers[extOnlyLayerIndex]; |
| 227 | layer->compositionType = HWC_OVERLAY; |
| 228 | } |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 229 | overlay::Overlay& ov = *(ctx->mOverlay); |
| 230 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 231 | ovutils::Whf info(hnd->width, hnd->height, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 232 | ovutils::getMdpFormat(hnd->format), hnd->size); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 233 | |
| 234 | //Request left RGB pipe |
| 235 | ovutils::eDest destL = ov.nextPipe(ovutils::OV_MDP_PIPE_RGB, mDpy); |
| 236 | if(destL == ovutils::OV_INVALID) { //None available |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 237 | ALOGE("%s: No pipes available to configure fb for dpy %d's left" |
| 238 | " mixer", __FUNCTION__, mDpy); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 239 | return false; |
| 240 | } |
| 241 | //Request right RGB pipe |
| 242 | ovutils::eDest destR = ov.nextPipe(ovutils::OV_MDP_PIPE_RGB, mDpy); |
| 243 | if(destR == ovutils::OV_INVALID) { //None available |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 244 | ALOGE("%s: No pipes available to configure fb for dpy %d's right" |
| 245 | " mixer", __FUNCTION__, mDpy); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 246 | return false; |
| 247 | } |
| 248 | |
| 249 | mDestLeft = destL; |
| 250 | mDestRight = destR; |
| 251 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 252 | ovutils::eMdpFlags mdpFlagsL = ovutils::OV_MDP_BLEND_FG_PREMULT; |
Sravan Kumar D.V.N | b5ed029 | 2013-03-15 08:51:16 +0530 | [diff] [blame] | 253 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 254 | ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 255 | |
| 256 | ovutils::PipeArgs pargL(mdpFlagsL, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 257 | info, |
| 258 | zOrder, |
| 259 | ovutils::IS_FG_OFF, |
| 260 | ovutils::ROT_FLAGS_NONE); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 261 | ov.setSource(pargL, destL); |
| 262 | |
| 263 | ovutils::eMdpFlags mdpFlagsR = mdpFlagsL; |
| 264 | ovutils::setMdpFlags(mdpFlagsR, ovutils::OV_MDSS_MDP_RIGHT_MIXER); |
| 265 | ovutils::PipeArgs pargR(mdpFlagsR, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 266 | info, |
| 267 | zOrder, |
| 268 | ovutils::IS_FG_OFF, |
| 269 | ovutils::ROT_FLAGS_NONE); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 270 | ov.setSource(pargR, destR); |
| 271 | |
Arun Kumar K.R | a297845 | 2013-02-07 01:34:24 -0800 | [diff] [blame] | 272 | hwc_rect_t sourceCrop = layer->sourceCrop; |
| 273 | hwc_rect_t displayFrame = layer->displayFrame; |
Ramkumar Radhakrishnan | 59a1107 | 2013-04-15 16:14:49 -0700 | [diff] [blame] | 274 | // Do not use getNonWormholeRegion() function to calculate the |
| 275 | // sourceCrop during animation on external display. |
| 276 | if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) { |
| 277 | sourceCrop = layer->displayFrame; |
| 278 | displayFrame = sourceCrop; |
| 279 | } else if(extOnlyLayerIndex == -1) { |
Arun Kumar K.R | a297845 | 2013-02-07 01:34:24 -0800 | [diff] [blame] | 280 | getNonWormholeRegion(list, sourceCrop); |
| 281 | displayFrame = sourceCrop; |
| 282 | } |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 283 | ovutils::Dim dcropL(sourceCrop.left, sourceCrop.top, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 284 | (sourceCrop.right - sourceCrop.left) / 2, |
| 285 | sourceCrop.bottom - sourceCrop.top); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 286 | ovutils::Dim dcropR( |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 287 | sourceCrop.left + (sourceCrop.right - sourceCrop.left) / 2, |
| 288 | sourceCrop.top, |
| 289 | (sourceCrop.right - sourceCrop.left) / 2, |
| 290 | sourceCrop.bottom - sourceCrop.top); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 291 | ov.setCrop(dcropL, destL); |
| 292 | ov.setCrop(dcropR, destR); |
| 293 | |
| 294 | int transform = layer->transform; |
| 295 | ovutils::eTransform orient = |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 296 | static_cast<ovutils::eTransform>(transform); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 297 | ov.setTransform(orient, destL); |
| 298 | ov.setTransform(orient, destR); |
| 299 | |
Saurabh Shah | ce416f0 | 2013-04-10 13:33:09 -0700 | [diff] [blame] | 300 | const int halfWidth = (displayFrame.right - displayFrame.left) / 2; |
| 301 | const int height = displayFrame.bottom - displayFrame.top; |
| 302 | |
Saurabh Shah | ca31759 | 2013-05-02 14:53:58 -0700 | [diff] [blame] | 303 | const int halfDpy = ctx->dpyAttr[mDpy].xres / 2; |
| 304 | ovutils::Dim dposL(halfDpy - halfWidth, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 305 | displayFrame.top, |
Saurabh Shah | ce416f0 | 2013-04-10 13:33:09 -0700 | [diff] [blame] | 306 | halfWidth, |
| 307 | height); |
Arun Kumar K.R | 0e8efb8 | 2013-03-18 17:31:50 -0700 | [diff] [blame] | 308 | ov.setPosition(dposL, destL); |
Saurabh Shah | ce416f0 | 2013-04-10 13:33:09 -0700 | [diff] [blame] | 309 | |
Arun Kumar K.R | 0e8efb8 | 2013-03-18 17:31:50 -0700 | [diff] [blame] | 310 | ovutils::Dim dposR(0, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 311 | displayFrame.top, |
Saurabh Shah | ce416f0 | 2013-04-10 13:33:09 -0700 | [diff] [blame] | 312 | halfWidth, |
| 313 | height); |
Arun Kumar K.R | 0e8efb8 | 2013-03-18 17:31:50 -0700 | [diff] [blame] | 314 | ov.setPosition(dposR, destR); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 315 | |
| 316 | ret = true; |
| 317 | if (!ov.commit(destL)) { |
| 318 | ALOGE("%s: commit fails for left", __FUNCTION__); |
| 319 | ret = false; |
| 320 | } |
| 321 | if (!ov.commit(destR)) { |
| 322 | ALOGE("%s: commit fails for right", __FUNCTION__); |
| 323 | ret = false; |
| 324 | } |
| 325 | } |
| 326 | return ret; |
| 327 | } |
| 328 | |
Naseer Ahmed | 64b8121 | 2013-02-14 10:29:47 -0500 | [diff] [blame] | 329 | bool FBUpdateHighRes::draw(hwc_context_t *ctx, private_handle_t *hnd) |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 330 | { |
| 331 | if(!mModeOn) { |
| 332 | return true; |
| 333 | } |
| 334 | bool ret = true; |
| 335 | overlay::Overlay& ov = *(ctx->mOverlay); |
| 336 | ovutils::eDest destL = mDestLeft; |
| 337 | ovutils::eDest destR = mDestRight; |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 338 | if (!ov.queueBuffer(hnd->fd, hnd->offset, destL)) { |
| 339 | ALOGE("%s: queue failed for left of dpy = %d", |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 340 | __FUNCTION__, mDpy); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 341 | ret = false; |
| 342 | } |
| 343 | if (!ov.queueBuffer(hnd->fd, hnd->offset, destR)) { |
| 344 | ALOGE("%s: queue failed for right of dpy = %d", |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 345 | __FUNCTION__, mDpy); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 346 | ret = false; |
| 347 | } |
| 348 | return ret; |
| 349 | } |
| 350 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 351 | //--------------------------------------------------------------------- |
| 352 | }; //namespace qhwc |