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