Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
Dileep Kumar Reddi | bf2678b | 2014-01-29 15:33:32 +0530 | [diff] [blame] | 3 | * Copyright (C) 2012-2014, The Linux Foundation. All rights reserved. |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 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> |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 24 | #include <overlay.h> |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 25 | #include <overlayRotator.h> |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 26 | #include "hwc_fbupdate.h" |
Saurabh Shah | bd2d083 | 2013-04-04 14:33:08 -0700 | [diff] [blame] | 27 | #include "mdp_version.h" |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 28 | #include "external.h" |
Saurabh Shah | bd2d083 | 2013-04-04 14:33:08 -0700 | [diff] [blame] | 29 | |
| 30 | using namespace qdutils; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 31 | using namespace overlay; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 32 | using overlay::Rotator; |
Amara Venkata Mastan Manoj Kumar | 376d8a8 | 2013-03-13 19:18:47 -0700 | [diff] [blame] | 33 | using namespace overlay::utils; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 34 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 35 | namespace qhwc { |
| 36 | |
| 37 | namespace ovutils = overlay::utils; |
| 38 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 39 | IFBUpdate* IFBUpdate::getObject(hwc_context_t *ctx, const int& dpy) { |
Saurabh Shah | 60e8bde | 2014-04-30 14:46:03 -0700 | [diff] [blame] | 40 | if(qdutils::MDPVersion::getInstance().isSrcSplit()) { |
| 41 | return new FBSrcSplit(ctx, dpy); |
| 42 | } else if(isDisplaySplit(ctx, dpy)) { |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 43 | return new FBUpdateSplit(ctx, dpy); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 44 | } |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 45 | return new FBUpdateNonSplit(ctx, dpy); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 46 | } |
| 47 | |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 48 | IFBUpdate::IFBUpdate(hwc_context_t *ctx, const int& dpy) : mDpy(dpy) { |
Saurabh Shah | 8f0ea6f | 2014-05-19 16:48:53 -0700 | [diff] [blame] | 49 | unsigned int size = 0; |
Dileep Kumar Reddi | e351d84 | 2014-03-25 10:39:21 +0530 | [diff] [blame] | 50 | uint32_t xres = ctx->dpyAttr[mDpy].xres; |
| 51 | uint32_t yres = ctx->dpyAttr[mDpy].yres; |
| 52 | if (ctx->dpyAttr[dpy].customFBSize) { |
| 53 | //GPU will render and compose at new resolution |
| 54 | //So need to have FB at new resolution |
| 55 | xres = ctx->dpyAttr[mDpy].xres_new; |
| 56 | yres = ctx->dpyAttr[mDpy].yres_new; |
| 57 | } |
| 58 | getBufferAttributes((int)xres, (int)yres, |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 59 | HAL_PIXEL_FORMAT_RGBA_8888, |
Manoj Kumar AVM | 8a22081 | 2013-10-10 11:46:06 -0700 | [diff] [blame] | 60 | 0, |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 61 | mAlignedFBWidth, |
Manoj Kumar AVM | 8a22081 | 2013-10-10 11:46:06 -0700 | [diff] [blame] | 62 | mAlignedFBHeight, |
| 63 | mTileEnabled, size); |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | void IFBUpdate::reset() { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 67 | mModeOn = false; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 68 | mRot = NULL; |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 69 | } |
| 70 | |
Saurabh Shah | a36be92 | 2013-12-16 18:18:39 -0800 | [diff] [blame] | 71 | bool IFBUpdate::prepareAndValidate(hwc_context_t *ctx, |
| 72 | hwc_display_contents_1 *list, int fbZorder) { |
Jeykumar Sankaran | c2d78d8 | 2014-02-14 14:55:29 -0800 | [diff] [blame] | 73 | hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1]; |
Ramkumar Radhakrishnan | 3686b7e | 2014-03-17 17:30:15 -0700 | [diff] [blame] | 74 | mModeOn = prepare(ctx, list, layer->displayFrame, fbZorder) && |
Saurabh Shah | a36be92 | 2013-12-16 18:18:39 -0800 | [diff] [blame] | 75 | ctx->mOverlay->validateAndSet(mDpy, ctx->dpyAttr[mDpy].fd); |
Ramkumar Radhakrishnan | 3686b7e | 2014-03-17 17:30:15 -0700 | [diff] [blame] | 76 | return mModeOn; |
Saurabh Shah | a36be92 | 2013-12-16 18:18:39 -0800 | [diff] [blame] | 77 | } |
| 78 | |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 79 | //================= Low res==================================== |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 80 | FBUpdateNonSplit::FBUpdateNonSplit(hwc_context_t *ctx, const int& dpy): |
| 81 | IFBUpdate(ctx, dpy) {} |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 82 | |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 83 | void FBUpdateNonSplit::reset() { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 84 | IFBUpdate::reset(); |
| 85 | mDest = ovutils::OV_INVALID; |
| 86 | } |
| 87 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 88 | bool FBUpdateNonSplit::preRotateExtDisplay(hwc_context_t *ctx, |
Prabhanjan Kandula | db202b7 | 2013-10-30 17:29:46 +0530 | [diff] [blame] | 89 | hwc_layer_1_t *layer, |
Ramkumar Radhakrishnan | 66f856c | 2013-08-21 16:09:47 -0700 | [diff] [blame] | 90 | ovutils::Whf &info, |
| 91 | hwc_rect_t& sourceCrop, |
| 92 | ovutils::eMdpFlags& mdpFlags, |
| 93 | int& rotFlags) |
| 94 | { |
| 95 | int extOrient = getExtOrientation(ctx); |
| 96 | ovutils::eTransform orient = static_cast<ovutils::eTransform >(extOrient); |
| 97 | if(mDpy && (extOrient & HWC_TRANSFORM_ROT_90)) { |
| 98 | mRot = ctx->mRotMgr->getNext(); |
| 99 | if(mRot == NULL) return false; |
Saurabh Shah | 39240c9 | 2014-03-31 10:31:42 -0700 | [diff] [blame] | 100 | ctx->mLayerRotMap[mDpy]->add(layer, mRot); |
Ramkumar Radhakrishnan | debfc5a | 2013-12-04 15:15:42 -0800 | [diff] [blame] | 101 | // Composed FB content will have black bars, if the viewFrame of the |
| 102 | // external is different from {0, 0, fbWidth, fbHeight}, so intersect |
| 103 | // viewFrame with sourceCrop to avoid those black bars |
| 104 | sourceCrop = getIntersection(sourceCrop, ctx->mViewFrame[mDpy]); |
Ramkumar Radhakrishnan | 66f856c | 2013-08-21 16:09:47 -0700 | [diff] [blame] | 105 | //Configure rotator for pre-rotation |
| 106 | if(configRotator(mRot, info, sourceCrop, mdpFlags, orient, 0) < 0) { |
| 107 | ALOGE("%s: configRotator Failed!", __FUNCTION__); |
| 108 | mRot = NULL; |
| 109 | return false; |
| 110 | } |
Saurabh Shah | 8ec9b5e | 2014-06-30 14:37:17 -0700 | [diff] [blame] | 111 | updateSource(orient, info, sourceCrop, mRot); |
Ramkumar Radhakrishnan | 66f856c | 2013-08-21 16:09:47 -0700 | [diff] [blame] | 112 | rotFlags |= ovutils::ROT_PREROTATED; |
| 113 | } |
| 114 | return true; |
| 115 | } |
| 116 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 117 | bool FBUpdateNonSplit::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list, |
Jeykumar Sankaran | c2d78d8 | 2014-02-14 14:55:29 -0800 | [diff] [blame] | 118 | hwc_rect_t fbUpdatingRect, int fbZorder) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 119 | if(!ctx->mMDP.hasOverlay) { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 120 | ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays", |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 121 | __FUNCTION__); |
| 122 | return false; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 123 | } |
Jeykumar Sankaran | c2d78d8 | 2014-02-14 14:55:29 -0800 | [diff] [blame] | 124 | mModeOn = configure(ctx, list, fbUpdatingRect, fbZorder); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 125 | return mModeOn; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | // Configure |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 129 | bool FBUpdateNonSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *list, |
Jeykumar Sankaran | c2d78d8 | 2014-02-14 14:55:29 -0800 | [diff] [blame] | 130 | hwc_rect_t fbUpdatingRect, int fbZorder) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 131 | bool ret = false; |
Naseer Ahmed | 64b8121 | 2013-02-14 10:29:47 -0500 | [diff] [blame] | 132 | hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1]; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 133 | if (LIKELY(ctx->mOverlay)) { |
| 134 | overlay::Overlay& ov = *(ctx->mOverlay); |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 135 | |
Manoj Kumar AVM | 8a22081 | 2013-10-10 11:46:06 -0700 | [diff] [blame] | 136 | ovutils::Whf info(mAlignedFBWidth, mAlignedFBHeight, |
| 137 | ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888, |
| 138 | mTileEnabled)); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 139 | |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 140 | Overlay::PipeSpecs pipeSpecs; |
| 141 | pipeSpecs.formatClass = Overlay::FORMAT_RGB; |
| 142 | pipeSpecs.needsScaling = qhwc::needsScaling(layer); |
| 143 | pipeSpecs.dpy = mDpy; |
| 144 | pipeSpecs.mixer = Overlay::MIXER_DEFAULT; |
| 145 | pipeSpecs.fb = true; |
| 146 | |
| 147 | ovutils::eDest dest = ov.getPipe(pipeSpecs); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 148 | if(dest == ovutils::OV_INVALID) { //None available |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 149 | ALOGE("%s: No pipes available to configure fb for dpy %d", |
| 150 | __FUNCTION__, mDpy); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 151 | return false; |
| 152 | } |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 153 | mDest = dest; |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 154 | |
Ramkumar Radhakrishnan | 1829d28 | 2013-07-23 14:54:36 -0700 | [diff] [blame] | 155 | if((mDpy && ctx->deviceOrientation) && |
| 156 | ctx->listStats[mDpy].isDisplayAnimating) { |
| 157 | fbZorder = 0; |
| 158 | } |
| 159 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 160 | ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 161 | ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 162 | |
Saurabh Shah | 62e1d73 | 2013-09-17 10:44:05 -0700 | [diff] [blame] | 163 | hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf); |
Arun Kumar K.R | a297845 | 2013-02-07 01:34:24 -0800 | [diff] [blame] | 164 | hwc_rect_t displayFrame = layer->displayFrame; |
Jeykumar Sankaran | c2d78d8 | 2014-02-14 14:55:29 -0800 | [diff] [blame] | 165 | |
| 166 | // No FB update optimization on (1) Custom FB resolution, |
| 167 | // (2) External Mirror mode, (3) External orientation |
| 168 | if(!ctx->dpyAttr[mDpy].customFBSize && !ctx->mBufferMirrorMode |
| 169 | && !ctx->mExtOrientation) { |
| 170 | sourceCrop = fbUpdatingRect; |
| 171 | displayFrame = fbUpdatingRect; |
| 172 | } |
| 173 | |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 174 | int transform = layer->transform; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 175 | int rotFlags = ovutils::ROT_FLAGS_NONE; |
| 176 | |
| 177 | ovutils::eTransform orient = |
| 178 | static_cast<ovutils::eTransform>(transform); |
Arun Kumar K.R | fb5bfa6 | 2013-07-25 03:10:51 -0700 | [diff] [blame] | 179 | // use ext orientation if any |
Ramkumar Radhakrishnan | 66f856c | 2013-08-21 16:09:47 -0700 | [diff] [blame] | 180 | int extOrient = getExtOrientation(ctx); |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 181 | |
Ramkumar Radhakrishnan | 59a1107 | 2013-04-15 16:14:49 -0700 | [diff] [blame] | 182 | // Do not use getNonWormholeRegion() function to calculate the |
| 183 | // sourceCrop during animation on external display and |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 184 | // Dont do wormhole calculation when extorientation is set on External |
Amara Venkata Mastan Manoj Kumar | 376d8a8 | 2013-03-13 19:18:47 -0700 | [diff] [blame] | 185 | // Dont do wormhole calculation when extDownscale is enabled on External |
Ramkumar Radhakrishnan | 59a1107 | 2013-04-15 16:14:49 -0700 | [diff] [blame] | 186 | if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) { |
| 187 | sourceCrop = layer->displayFrame; |
Ramkumar Radhakrishnan | 3b0d972 | 2014-08-06 13:08:40 -0700 | [diff] [blame] | 188 | } else if((mDpy && !extOrient |
| 189 | && !ctx->dpyAttr[mDpy].mDownScaleMode)) { |
Raj Kamal | 068f457 | 2014-04-14 16:14:06 +0530 | [diff] [blame] | 190 | if(ctx->mOverlay->isUIScalingOnExternalSupported() && |
Dileep Kumar Reddi | bf2678b | 2014-01-29 15:33:32 +0530 | [diff] [blame] | 191 | !ctx->dpyAttr[mDpy].customFBSize) { |
Saurabh Shah | d4e6585 | 2013-06-17 11:33:53 -0700 | [diff] [blame] | 192 | getNonWormholeRegion(list, sourceCrop); |
| 193 | displayFrame = sourceCrop; |
| 194 | } |
Arun Kumar K.R | a297845 | 2013-02-07 01:34:24 -0800 | [diff] [blame] | 195 | } |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 196 | calcExtDisplayPosition(ctx, NULL, mDpy, sourceCrop, displayFrame, |
Ramkumar Radhakrishnan | 66f856c | 2013-08-21 16:09:47 -0700 | [diff] [blame] | 197 | transform, orient); |
Arun Kumar K.R | 8e7a62f | 2013-12-06 18:55:41 -0800 | [diff] [blame] | 198 | //Store the displayFrame, will be used in getDisplayViewFrame |
| 199 | ctx->dpyAttr[mDpy].mDstRect = displayFrame; |
Ramkumar Radhakrishnan | 9d20b39 | 2013-11-15 19:32:47 -0800 | [diff] [blame] | 200 | setMdpFlags(ctx, layer, mdpFlags, 0, transform); |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 201 | // For External use rotator if there is a rotation value set |
Prabhanjan Kandula | db202b7 | 2013-10-30 17:29:46 +0530 | [diff] [blame] | 202 | ret = preRotateExtDisplay(ctx, layer, info, |
| 203 | sourceCrop, mdpFlags, rotFlags); |
Ramkumar Radhakrishnan | 66f856c | 2013-08-21 16:09:47 -0700 | [diff] [blame] | 204 | if(!ret) { |
| 205 | ALOGE("%s: preRotate for external Failed!", __FUNCTION__); |
| 206 | return false; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 207 | } |
| 208 | //For the mdp, since either we are pre-rotating or MDP does flips |
| 209 | orient = ovutils::OVERLAY_TRANSFORM_0; |
| 210 | transform = 0; |
Saurabh Shah | 2c8ad05 | 2014-08-15 13:27:46 -0700 | [diff] [blame] | 211 | ovutils::PipeArgs parg(mdpFlags, info, zOrder, |
Naseer Ahmed | 522ce66 | 2013-03-18 20:14:05 -0400 | [diff] [blame] | 212 | static_cast<ovutils::eRotFlags>(rotFlags), |
| 213 | ovutils::DEFAULT_PLANE_ALPHA, |
| 214 | (ovutils::eBlending) |
| 215 | getBlending(layer->blending)); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 216 | ret = true; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 217 | if(configMdp(ctx->mOverlay, parg, orient, sourceCrop, displayFrame, |
| 218 | NULL, mDest) < 0) { |
Saurabh Shah | e247408 | 2013-05-15 16:32:13 -0700 | [diff] [blame] | 219 | ALOGE("%s: configMdp failed for dpy %d", __FUNCTION__, mDpy); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 220 | ret = false; |
| 221 | } |
| 222 | } |
| 223 | return ret; |
| 224 | } |
| 225 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 226 | bool FBUpdateNonSplit::draw(hwc_context_t *ctx, private_handle_t *hnd) |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 227 | { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 228 | if(!mModeOn) { |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 229 | return true; |
| 230 | } |
| 231 | bool ret = true; |
| 232 | overlay::Overlay& ov = *(ctx->mOverlay); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 233 | ovutils::eDest dest = mDest; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 234 | int fd = hnd->fd; |
Praveena Pachipulusu | d9443c7 | 2014-02-17 10:42:28 +0530 | [diff] [blame] | 235 | uint32_t offset = (uint32_t)hnd->offset; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 236 | if(mRot) { |
| 237 | if(!mRot->queueBuffer(fd, offset)) |
| 238 | return false; |
| 239 | fd = mRot->getDstMemId(); |
| 240 | offset = mRot->getDstOffset(); |
| 241 | } |
| 242 | if (!ov.queueBuffer(fd, offset, dest)) { |
Amara Venkata Mastan Manoj Kumar | dc01a53 | 2013-01-30 18:34:56 -0800 | [diff] [blame] | 243 | ALOGE("%s: queueBuffer failed for FBUpdate", __FUNCTION__); |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 244 | ret = false; |
| 245 | } |
| 246 | return ret; |
| 247 | } |
| 248 | |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 249 | //================= High res==================================== |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 250 | FBUpdateSplit::FBUpdateSplit(hwc_context_t *ctx, const int& dpy): |
| 251 | IFBUpdate(ctx, dpy) {} |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 252 | |
Saurabh Shah | 220a30c | 2013-10-29 16:12:12 -0700 | [diff] [blame] | 253 | void FBUpdateSplit::reset() { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 254 | IFBUpdate::reset(); |
| 255 | mDestLeft = ovutils::OV_INVALID; |
| 256 | mDestRight = ovutils::OV_INVALID; |
Arun Kumar K.R | ffef748 | 2013-04-10 14:17:22 -0700 | [diff] [blame] | 257 | mRot = NULL; |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 258 | } |
| 259 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 260 | bool FBUpdateSplit::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list, |
Jeykumar Sankaran | c2d78d8 | 2014-02-14 14:55:29 -0800 | [diff] [blame] | 261 | hwc_rect_t fbUpdatingRect, int fbZorder) { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 262 | if(!ctx->mMDP.hasOverlay) { |
| 263 | ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays", |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 264 | __FUNCTION__); |
| 265 | return false; |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 266 | } |
Jeykumar Sankaran | c2d78d8 | 2014-02-14 14:55:29 -0800 | [diff] [blame] | 267 | mModeOn = configure(ctx, list, fbUpdatingRect, fbZorder); |
Raj Kamal | 4393eaa | 2014-06-06 13:45:20 +0530 | [diff] [blame] | 268 | ALOGD_IF(DEBUG_FBUPDATE, "%s, mModeOn = %d", __FUNCTION__, mModeOn); |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 269 | return mModeOn; |
| 270 | } |
| 271 | |
| 272 | // Configure |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 273 | bool FBUpdateSplit::configure(hwc_context_t *ctx, |
Jeykumar Sankaran | c2d78d8 | 2014-02-14 14:55:29 -0800 | [diff] [blame] | 274 | hwc_display_contents_1 *list, hwc_rect_t fbUpdatingRect, int fbZorder) { |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 275 | bool ret = false; |
Naseer Ahmed | 64b8121 | 2013-02-14 10:29:47 -0500 | [diff] [blame] | 276 | hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1]; |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 277 | if (LIKELY(ctx->mOverlay)) { |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 278 | ovutils::Whf info(mAlignedFBWidth, mAlignedFBHeight, |
| 279 | ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888, |
| 280 | mTileEnabled)); |
| 281 | |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 282 | overlay::Overlay& ov = *(ctx->mOverlay); |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 283 | ovutils::eMdpFlags mdpFlags = ovutils::OV_MDP_BLEND_FG_PREMULT; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 284 | ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 285 | ovutils::eTransform orient = |
| 286 | static_cast<ovutils::eTransform>(layer->transform); |
| 287 | const int hw_w = ctx->dpyAttr[mDpy].xres; |
| 288 | const int hw_h = ctx->dpyAttr[mDpy].yres; |
| 289 | const int lSplit = getLeftSplit(ctx, mDpy); |
| 290 | mDestLeft = ovutils::OV_INVALID; |
| 291 | mDestRight = ovutils::OV_INVALID; |
Ramkumar Radhakrishnan | e1f433a | 2014-08-06 12:10:33 -0700 | [diff] [blame] | 292 | hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf); |
| 293 | hwc_rect_t displayFrame = layer->displayFrame; |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 294 | |
Ramkumar Radhakrishnan | e1f433a | 2014-08-06 12:10:33 -0700 | [diff] [blame] | 295 | // No FB update optimization on (1) Custom FB resolution, |
| 296 | // (2) External Mirror mode, (3) External orientation |
| 297 | if(!ctx->dpyAttr[mDpy].customFBSize && !ctx->mBufferMirrorMode |
| 298 | && !ctx->mExtOrientation) { |
| 299 | sourceCrop = fbUpdatingRect; |
| 300 | displayFrame = fbUpdatingRect; |
| 301 | } |
| 302 | |
| 303 | int transform = layer->transform; |
| 304 | // use ext orientation if any |
| 305 | int extOrient = getExtOrientation(ctx); |
| 306 | |
| 307 | // Do not use getNonWormholeRegion() function to calculate the |
| 308 | // sourceCrop during animation on external display and |
| 309 | // Dont do wormhole calculation when extorientation is set on External |
| 310 | // Dont do wormhole calculation when extDownscale is enabled on External |
| 311 | if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) { |
| 312 | sourceCrop = layer->displayFrame; |
| 313 | } else if((mDpy && !extOrient |
| 314 | && !ctx->dpyAttr[mDpy].mDownScaleMode)) { |
| 315 | if(!qdutils::MDPVersion::getInstance().is8x26() && |
| 316 | !ctx->dpyAttr[mDpy].customFBSize) { |
| 317 | getNonWormholeRegion(list, sourceCrop); |
| 318 | displayFrame = sourceCrop; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | calcExtDisplayPosition(ctx, NULL, mDpy, sourceCrop, displayFrame, |
| 323 | transform, orient); |
Saurabh Shah | 67a38c3 | 2013-06-10 16:23:15 -0700 | [diff] [blame] | 324 | |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 325 | ret = true; |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 326 | Overlay::PipeSpecs pipeSpecs; |
| 327 | pipeSpecs.formatClass = Overlay::FORMAT_RGB; |
| 328 | pipeSpecs.needsScaling = qhwc::needsScaling(layer); |
| 329 | pipeSpecs.dpy = mDpy; |
| 330 | pipeSpecs.fb = true; |
| 331 | |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 332 | /* Configure left pipe */ |
| 333 | if(displayFrame.left < lSplit) { |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 334 | pipeSpecs.mixer = Overlay::MIXER_LEFT; |
| 335 | ovutils::eDest destL = ov.getPipe(pipeSpecs); |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 336 | if(destL == ovutils::OV_INVALID) { //None available |
| 337 | ALOGE("%s: No pipes available to configure fb for dpy %d's left" |
| 338 | " mixer", __FUNCTION__, mDpy); |
| 339 | return false; |
| 340 | } |
| 341 | |
| 342 | mDestLeft = destL; |
| 343 | |
| 344 | //XXX: FB layer plane alpha is currently sent as zero from |
| 345 | //surfaceflinger |
| 346 | ovutils::PipeArgs pargL(mdpFlags, |
| 347 | info, |
| 348 | zOrder, |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 349 | ovutils::ROT_FLAGS_NONE, |
| 350 | ovutils::DEFAULT_PLANE_ALPHA, |
| 351 | (ovutils::eBlending) |
| 352 | getBlending(layer->blending)); |
| 353 | hwc_rect_t cropL = sourceCrop; |
| 354 | hwc_rect_t dstL = displayFrame; |
| 355 | hwc_rect_t scissorL = {0, 0, lSplit, hw_h }; |
| 356 | qhwc::calculate_crop_rects(cropL, dstL, scissorL, 0); |
| 357 | |
| 358 | if (configMdp(ctx->mOverlay, pargL, orient, cropL, |
| 359 | dstL, NULL, destL)< 0) { |
| 360 | ALOGE("%s: configMdp fails for left FB", __FUNCTION__); |
| 361 | ret = false; |
| 362 | } |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 363 | } |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 364 | |
| 365 | /* Configure right pipe */ |
| 366 | if(displayFrame.right > lSplit) { |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 367 | pipeSpecs.mixer = Overlay::MIXER_RIGHT; |
| 368 | ovutils::eDest destR = ov.getPipe(pipeSpecs); |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 369 | if(destR == ovutils::OV_INVALID) { //None available |
| 370 | ALOGE("%s: No pipes available to configure fb for dpy %d's" |
| 371 | " right mixer", __FUNCTION__, mDpy); |
| 372 | return false; |
| 373 | } |
| 374 | |
| 375 | mDestRight = destR; |
| 376 | ovutils::eMdpFlags mdpFlagsR = mdpFlags; |
| 377 | ovutils::setMdpFlags(mdpFlagsR, ovutils::OV_MDSS_MDP_RIGHT_MIXER); |
| 378 | |
| 379 | //XXX: FB layer plane alpha is currently sent as zero from |
| 380 | //surfaceflinger |
| 381 | ovutils::PipeArgs pargR(mdpFlagsR, |
| 382 | info, |
| 383 | zOrder, |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 384 | ovutils::ROT_FLAGS_NONE, |
| 385 | ovutils::DEFAULT_PLANE_ALPHA, |
| 386 | (ovutils::eBlending) |
| 387 | getBlending(layer->blending)); |
| 388 | |
| 389 | hwc_rect_t cropR = sourceCrop; |
| 390 | hwc_rect_t dstR = displayFrame; |
| 391 | hwc_rect_t scissorR = {lSplit, 0, hw_w, hw_h }; |
| 392 | qhwc::calculate_crop_rects(cropR, dstR, scissorR, 0); |
| 393 | |
| 394 | dstR.left -= lSplit; |
| 395 | dstR.right -= lSplit; |
| 396 | |
| 397 | if (configMdp(ctx->mOverlay, pargR, orient, cropR, |
| 398 | dstR, NULL, destR) < 0) { |
| 399 | ALOGE("%s: configMdp fails for right FB", __FUNCTION__); |
| 400 | ret = false; |
| 401 | } |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 402 | } |
| 403 | } |
| 404 | return ret; |
| 405 | } |
| 406 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 407 | bool FBUpdateSplit::draw(hwc_context_t *ctx, private_handle_t *hnd) |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 408 | { |
| 409 | if(!mModeOn) { |
| 410 | return true; |
| 411 | } |
| 412 | bool ret = true; |
| 413 | overlay::Overlay& ov = *(ctx->mOverlay); |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 414 | if(mDestLeft != ovutils::OV_INVALID) { |
Praveena Pachipulusu | d9443c7 | 2014-02-17 10:42:28 +0530 | [diff] [blame] | 415 | if (!ov.queueBuffer(hnd->fd, (uint32_t)hnd->offset, mDestLeft)) { |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 416 | ALOGE("%s: queue failed for left of dpy = %d", |
| 417 | __FUNCTION__, mDpy); |
| 418 | ret = false; |
| 419 | } |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 420 | } |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 421 | if(mDestRight != ovutils::OV_INVALID) { |
Praveena Pachipulusu | d9443c7 | 2014-02-17 10:42:28 +0530 | [diff] [blame] | 422 | if (!ov.queueBuffer(hnd->fd, (uint32_t)hnd->offset, mDestRight)) { |
Jeykumar Sankaran | c28eb0b | 2014-02-27 14:42:35 -0800 | [diff] [blame] | 423 | ALOGE("%s: queue failed for right of dpy = %d", |
| 424 | __FUNCTION__, mDpy); |
| 425 | ret = false; |
| 426 | } |
Saurabh Shah | cf053c6 | 2012-12-13 12:32:55 -0800 | [diff] [blame] | 427 | } |
| 428 | return ret; |
| 429 | } |
| 430 | |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 431 | //=================FBSrcSplit==================================== |
| 432 | FBSrcSplit::FBSrcSplit(hwc_context_t *ctx, const int& dpy): |
| 433 | FBUpdateSplit(ctx, dpy) {} |
| 434 | |
| 435 | bool FBSrcSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *list, |
| 436 | hwc_rect_t fbUpdatingRect, int fbZorder) { |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 437 | hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1]; |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 438 | overlay::Overlay& ov = *(ctx->mOverlay); |
| 439 | |
| 440 | ovutils::Whf info(mAlignedFBWidth, |
| 441 | mAlignedFBHeight, |
| 442 | ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888, |
| 443 | mTileEnabled)); |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 444 | |
| 445 | ovutils::eMdpFlags mdpFlags = OV_MDP_BLEND_FG_PREMULT; |
| 446 | ovutils::eZorder zOrder = static_cast<ovutils::eZorder>(fbZorder); |
| 447 | |
| 448 | ovutils::PipeArgs parg(mdpFlags, |
| 449 | info, |
| 450 | zOrder, |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 451 | ovutils::ROT_FLAGS_NONE, |
| 452 | ovutils::DEFAULT_PLANE_ALPHA, |
| 453 | (ovutils::eBlending) |
| 454 | getBlending(layer->blending)); |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 455 | |
Ramkumar Radhakrishnan | e1f433a | 2014-08-06 12:10:33 -0700 | [diff] [blame] | 456 | hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf); |
| 457 | hwc_rect_t displayFrame = layer->displayFrame; |
| 458 | |
| 459 | // No FB update optimization on (1) Custom FB resolution, |
| 460 | // (2) External Mirror mode, (3) External orientation |
| 461 | if(!ctx->dpyAttr[mDpy].customFBSize && !ctx->mBufferMirrorMode |
| 462 | && !ctx->mExtOrientation) { |
| 463 | sourceCrop = fbUpdatingRect; |
| 464 | displayFrame = fbUpdatingRect; |
| 465 | } |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 466 | int transform = layer->transform; |
| 467 | ovutils::eTransform orient = |
| 468 | static_cast<ovutils::eTransform>(transform); |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 469 | |
Ramkumar Radhakrishnan | e1f433a | 2014-08-06 12:10:33 -0700 | [diff] [blame] | 470 | // use ext orientation if any |
| 471 | int extOrient = getExtOrientation(ctx); |
| 472 | |
| 473 | // Do not use getNonWormholeRegion() function to calculate the |
| 474 | // sourceCrop during animation on external display and |
| 475 | // Dont do wormhole calculation when extorientation is set on External |
| 476 | // Dont do wormhole calculation when extDownscale is enabled on External |
| 477 | if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) { |
| 478 | sourceCrop = layer->displayFrame; |
| 479 | } else if((mDpy && !extOrient |
| 480 | && !ctx->dpyAttr[mDpy].mDownScaleMode)) { |
| 481 | if(!qdutils::MDPVersion::getInstance().is8x26() && |
| 482 | !ctx->dpyAttr[mDpy].customFBSize) { |
| 483 | getNonWormholeRegion(list, sourceCrop); |
| 484 | displayFrame = sourceCrop; |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | calcExtDisplayPosition(ctx, NULL, mDpy, sourceCrop, displayFrame, |
| 489 | transform, orient); |
| 490 | hwc_rect_t cropL = sourceCrop; |
| 491 | hwc_rect_t cropR = sourceCrop; |
| 492 | hwc_rect_t dstL = displayFrame; |
| 493 | hwc_rect_t dstR = displayFrame; |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 494 | |
| 495 | //Request left pipe (or 1 by default) |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 496 | Overlay::PipeSpecs pipeSpecs; |
| 497 | pipeSpecs.formatClass = Overlay::FORMAT_RGB; |
| 498 | pipeSpecs.needsScaling = qhwc::needsScaling(layer); |
| 499 | pipeSpecs.dpy = mDpy; |
| 500 | pipeSpecs.mixer = Overlay::MIXER_DEFAULT; |
| 501 | pipeSpecs.fb = true; |
| 502 | ovutils::eDest destL = ov.getPipe(pipeSpecs); |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 503 | if(destL == ovutils::OV_INVALID) { |
| 504 | ALOGE("%s: No pipes available to configure fb for dpy %d's left" |
| 505 | " mixer", __FUNCTION__, mDpy); |
| 506 | return false; |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 507 | } |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 508 | |
| 509 | ovutils::eDest destR = ovutils::OV_INVALID; |
| 510 | |
Saurabh Shah | ea7a01d | 2014-05-22 17:45:36 -0700 | [diff] [blame] | 511 | /* Use 2 pipes IF |
Prabhanjan Kandula | 5bae9f5 | 2014-05-15 16:48:18 +0530 | [diff] [blame] | 512 | a) FB's width is > Mixer width or |
Saurabh Shah | ea7a01d | 2014-05-22 17:45:36 -0700 | [diff] [blame] | 513 | b) On primary, driver has indicated with caps to split always. This is |
| 514 | based on an empirically derived value of panel height. |
| 515 | */ |
| 516 | |
| 517 | bool primarySplitAlways = (mDpy == HWC_DISPLAY_PRIMARY) and |
| 518 | qdutils::MDPVersion::getInstance().isSrcSplitAlways(); |
| 519 | |
Ramkumar Radhakrishnan | e1f433a | 2014-08-06 12:10:33 -0700 | [diff] [blame] | 520 | if(((sourceCrop.right - sourceCrop.left) > |
Prabhanjan Kandula | 5bae9f5 | 2014-05-15 16:48:18 +0530 | [diff] [blame] | 521 | (int)qdutils::MDPVersion::getInstance().getMaxMixerWidth()) or |
Saurabh Shah | ea7a01d | 2014-05-22 17:45:36 -0700 | [diff] [blame] | 522 | primarySplitAlways) { |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 523 | destR = ov.getPipe(pipeSpecs); |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 524 | if(destR == ovutils::OV_INVALID) { |
| 525 | ALOGE("%s: No pipes available to configure fb for dpy %d's right" |
| 526 | " mixer", __FUNCTION__, mDpy); |
| 527 | return false; |
| 528 | } |
| 529 | |
| 530 | if(ctx->mOverlay->comparePipePriority(destL, destR) == -1) { |
| 531 | qhwc::swap(destL, destR); |
| 532 | } |
| 533 | |
| 534 | //Split crop equally when using 2 pipes |
Ramkumar Radhakrishnan | e1f433a | 2014-08-06 12:10:33 -0700 | [diff] [blame] | 535 | cropL.right = (sourceCrop.right + sourceCrop.left) / 2; |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 536 | cropR.left = cropL.right; |
Ramkumar Radhakrishnan | e1f433a | 2014-08-06 12:10:33 -0700 | [diff] [blame] | 537 | dstL.right = (displayFrame.right + displayFrame.left) / 2; |
| 538 | dstR.left = dstL.right; |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 539 | } |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 540 | |
| 541 | mDestLeft = destL; |
| 542 | mDestRight = destR; |
| 543 | |
| 544 | if(destL != OV_INVALID) { |
| 545 | if(configMdp(ctx->mOverlay, parg, orient, |
Ramkumar Radhakrishnan | e1f433a | 2014-08-06 12:10:33 -0700 | [diff] [blame] | 546 | cropL, dstL, NULL /*metadata*/, destL) < 0) { |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 547 | ALOGE("%s: commit failed for left mixer config", __FUNCTION__); |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 548 | return false; |
| 549 | } |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 550 | } |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 551 | |
| 552 | //configure right pipe |
| 553 | if(destR != OV_INVALID) { |
| 554 | if(configMdp(ctx->mOverlay, parg, orient, |
Ramkumar Radhakrishnan | e1f433a | 2014-08-06 12:10:33 -0700 | [diff] [blame] | 555 | cropR, dstR, NULL /*metadata*/, destR) < 0) { |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 556 | ALOGE("%s: commit failed for right mixer config", __FUNCTION__); |
Saurabh Shah | dd8237a | 2014-02-28 14:29:09 -0800 | [diff] [blame] | 557 | return false; |
| 558 | } |
| 559 | } |
| 560 | |
| 561 | return true; |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 562 | } |
| 563 | |
Naseer Ahmed | 758bfc5 | 2012-11-28 17:02:08 -0500 | [diff] [blame] | 564 | //--------------------------------------------------------------------- |
| 565 | }; //namespace qhwc |