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