Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1 | /* |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 2 | * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved. |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 3 | * Not a Contribution, Apache license notifications and license are retained |
| 4 | * for attribution purposes only. |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | */ |
| 18 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 19 | #include <math.h> |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 20 | #include "hwc_mdpcomp.h" |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 21 | #include <sys/ioctl.h> |
Saurabh Shah | 56f610d | 2012-08-07 15:27:06 -0700 | [diff] [blame] | 22 | #include "external.h" |
Jeykumar Sankaran | 27dee26 | 2013-08-01 17:09:54 -0700 | [diff] [blame] | 23 | #include "virtual.h" |
Ramkumar Radhakrishnan | 47573e2 | 2012-11-07 11:36:41 -0800 | [diff] [blame] | 24 | #include "qdMetaData.h" |
Ramkumar Radhakrishnan | 288f8c7 | 2013-01-15 11:37:54 -0800 | [diff] [blame] | 25 | #include "mdp_version.h" |
Saurabh Shah | 2a4eb1b | 2013-07-22 16:33:23 -0700 | [diff] [blame] | 26 | #include "hwc_fbupdate.h" |
Saurabh Shah | a9da08f | 2013-07-03 13:27:53 -0700 | [diff] [blame] | 27 | #include "hwc_ad.h" |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 28 | #include <overlayRotator.h> |
| 29 | |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 30 | using namespace overlay; |
Saurabh Shah | bd2d083 | 2013-04-04 14:33:08 -0700 | [diff] [blame] | 31 | using namespace qdutils; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 32 | using namespace overlay::utils; |
| 33 | namespace ovutils = overlay::utils; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 34 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 35 | namespace qhwc { |
| 36 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 37 | //==============MDPComp======================================================== |
| 38 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 39 | IdleInvalidator *MDPComp::idleInvalidator = NULL; |
| 40 | bool MDPComp::sIdleFallBack = false; |
| 41 | bool MDPComp::sDebugLogs = false; |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 42 | bool MDPComp::sEnabled = false; |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 43 | bool MDPComp::sEnableMixedMode = true; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 44 | bool MDPComp::sEnablePartialFrameUpdate = false; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 45 | int MDPComp::sMaxPipesPerMixer = MAX_PIPES_PER_MIXER; |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 46 | float MDPComp::sMaxBw = 2.3f; |
| 47 | uint32_t MDPComp::sCompBytesClaimed = 0; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 48 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 49 | MDPComp* MDPComp::getObject(hwc_context_t *ctx, const int& dpy) { |
| 50 | if(isDisplaySplit(ctx, dpy)) { |
| 51 | return new MDPCompSplit(dpy); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 52 | } |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 53 | return new MDPCompNonSplit(dpy); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 54 | } |
| 55 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 56 | MDPComp::MDPComp(int dpy):mDpy(dpy){}; |
| 57 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 58 | void MDPComp::dump(android::String8& buf) |
| 59 | { |
Jeykumar Sankaran | 3c6bb04 | 2013-08-15 14:01:04 -0700 | [diff] [blame] | 60 | if(mCurrentFrame.layerCount > MAX_NUM_APP_LAYERS) |
| 61 | return; |
| 62 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 63 | dumpsys_log(buf,"HWC Map for Dpy: %s \n", |
Jeykumar Sankaran | 27dee26 | 2013-08-01 17:09:54 -0700 | [diff] [blame] | 64 | (mDpy == 0) ? "\"PRIMARY\"" : |
| 65 | (mDpy == 1) ? "\"EXTERNAL\"" : "\"VIRTUAL\""); |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 66 | dumpsys_log(buf,"CURR_FRAME: layerCount:%2d mdpCount:%2d " |
| 67 | "fbCount:%2d \n", mCurrentFrame.layerCount, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 68 | mCurrentFrame.mdpCount, mCurrentFrame.fbCount); |
| 69 | dumpsys_log(buf,"needsFBRedraw:%3s pipesUsed:%2d MaxPipesPerMixer: %d \n", |
| 70 | (mCurrentFrame.needsRedraw? "YES" : "NO"), |
| 71 | mCurrentFrame.mdpCount, sMaxPipesPerMixer); |
| 72 | dumpsys_log(buf," --------------------------------------------- \n"); |
| 73 | dumpsys_log(buf," listIdx | cached? | mdpIndex | comptype | Z \n"); |
| 74 | dumpsys_log(buf," --------------------------------------------- \n"); |
| 75 | for(int index = 0; index < mCurrentFrame.layerCount; index++ ) |
| 76 | dumpsys_log(buf," %7d | %7s | %8d | %9s | %2d \n", |
| 77 | index, |
| 78 | (mCurrentFrame.isFBComposed[index] ? "YES" : "NO"), |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 79 | mCurrentFrame.layerToMDP[index], |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 80 | (mCurrentFrame.isFBComposed[index] ? |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 81 | (mCurrentFrame.drop[index] ? "DROP" : |
| 82 | (mCurrentFrame.needsRedraw ? "GLES" : "CACHE")) : "MDP"), |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 83 | (mCurrentFrame.isFBComposed[index] ? mCurrentFrame.fbZ : |
| 84 | mCurrentFrame.mdpToLayer[mCurrentFrame.layerToMDP[index]].pipeInfo->zOrder)); |
| 85 | dumpsys_log(buf,"\n"); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | bool MDPComp::init(hwc_context_t *ctx) { |
| 89 | |
| 90 | if(!ctx) { |
| 91 | ALOGE("%s: Invalid hwc context!!",__FUNCTION__); |
| 92 | return false; |
| 93 | } |
| 94 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 95 | char property[PROPERTY_VALUE_MAX]; |
| 96 | |
| 97 | sEnabled = false; |
| 98 | if((property_get("persist.hwc.mdpcomp.enable", property, NULL) > 0) && |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 99 | (!strncmp(property, "1", PROPERTY_VALUE_MAX ) || |
| 100 | (!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) { |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 101 | sEnabled = true; |
| 102 | } |
| 103 | |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 104 | sEnableMixedMode = true; |
| 105 | if((property_get("debug.mdpcomp.mixedmode.disable", property, NULL) > 0) && |
| 106 | (!strncmp(property, "1", PROPERTY_VALUE_MAX ) || |
| 107 | (!strncasecmp(property,"true", PROPERTY_VALUE_MAX )))) { |
| 108 | sEnableMixedMode = false; |
| 109 | } |
| 110 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 111 | if(property_get("debug.mdpcomp.logs", property, NULL) > 0) { |
| 112 | if(atoi(property) != 0) |
| 113 | sDebugLogs = true; |
| 114 | } |
| 115 | |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 116 | if(property_get("persist.hwc.partialupdate.enable", property, NULL) > 0) { |
| 117 | if((atoi(property) != 0) && ctx->mMDP.panel == MIPI_CMD_PANEL && |
| 118 | qdutils::MDPVersion::getInstance().is8x74v2()) |
| 119 | sEnablePartialFrameUpdate = true; |
| 120 | } |
| 121 | ALOGE_IF(isDebug(), "%s: Partial Update applicable?: %d",__FUNCTION__, |
| 122 | sEnablePartialFrameUpdate); |
| 123 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 124 | sMaxPipesPerMixer = MAX_PIPES_PER_MIXER; |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 125 | if(property_get("debug.mdpcomp.maxpermixer", property, "-1") > 0) { |
| 126 | int val = atoi(property); |
| 127 | if(val >= 0) |
| 128 | sMaxPipesPerMixer = min(val, MAX_PIPES_PER_MIXER); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 129 | } |
| 130 | |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 131 | if(property_get("debug.mdpcomp.bw", property, "0") > 0) { |
| 132 | float val = atof(property); |
| 133 | if(val > 0.0f) { |
| 134 | sMaxBw = val; |
| 135 | } |
| 136 | } |
| 137 | |
Naseer Ahmed | f40f2c8 | 2013-08-14 16:42:40 -0400 | [diff] [blame] | 138 | if(ctx->mMDP.panel != MIPI_CMD_PANEL) { |
| 139 | // Idle invalidation is not necessary on command mode panels |
| 140 | long idle_timeout = DEFAULT_IDLE_TIME; |
| 141 | if(property_get("debug.mdpcomp.idletime", property, NULL) > 0) { |
| 142 | if(atoi(property) != 0) |
| 143 | idle_timeout = atoi(property); |
| 144 | } |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 145 | |
Naseer Ahmed | f40f2c8 | 2013-08-14 16:42:40 -0400 | [diff] [blame] | 146 | //create Idle Invalidator only when not disabled through property |
| 147 | if(idle_timeout != -1) |
| 148 | idleInvalidator = IdleInvalidator::getInstance(); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 149 | |
Naseer Ahmed | f40f2c8 | 2013-08-14 16:42:40 -0400 | [diff] [blame] | 150 | if(idleInvalidator == NULL) { |
| 151 | ALOGE("%s: failed to instantiate idleInvalidator object", |
| 152 | __FUNCTION__); |
| 153 | } else { |
| 154 | idleInvalidator->init(timeout_handler, ctx, idle_timeout); |
| 155 | } |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 156 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 157 | return true; |
| 158 | } |
| 159 | |
Saurabh Shah | 2a4eb1b | 2013-07-22 16:33:23 -0700 | [diff] [blame] | 160 | void MDPComp::reset(const int& numLayers, hwc_display_contents_1_t* list) { |
| 161 | mCurrentFrame.reset(numLayers); |
| 162 | mCachedFrame.cacheAll(list); |
| 163 | mCachedFrame.updateCounts(mCurrentFrame); |
| 164 | } |
| 165 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 166 | void MDPComp::timeout_handler(void *udata) { |
| 167 | struct hwc_context_t* ctx = (struct hwc_context_t*)(udata); |
| 168 | |
| 169 | if(!ctx) { |
| 170 | ALOGE("%s: received empty data in timer callback", __FUNCTION__); |
| 171 | return; |
| 172 | } |
| 173 | |
Jesse Hall | 3be78d9 | 2012-08-21 15:12:23 -0700 | [diff] [blame] | 174 | if(!ctx->proc) { |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 175 | ALOGE("%s: HWC proc not registered", __FUNCTION__); |
| 176 | return; |
| 177 | } |
| 178 | sIdleFallBack = true; |
| 179 | /* Trigger SF to redraw the current frame */ |
Jesse Hall | 3be78d9 | 2012-08-21 15:12:23 -0700 | [diff] [blame] | 180 | ctx->proc->invalidate(ctx->proc); |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 181 | } |
| 182 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 183 | void MDPComp::setMDPCompLayerFlags(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 184 | hwc_display_contents_1_t* list) { |
| 185 | LayerProp *layerProp = ctx->layerProp[mDpy]; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 186 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 187 | for(int index = 0; index < ctx->listStats[mDpy].numAppLayers; index++) { |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 188 | hwc_layer_1_t* layer = &(list->hwLayers[index]); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 189 | if(!mCurrentFrame.isFBComposed[index]) { |
| 190 | layerProp[index].mFlags |= HWC_MDPCOMP; |
| 191 | layer->compositionType = HWC_OVERLAY; |
| 192 | layer->hints |= HWC_HINT_CLEAR_FB; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 193 | } else { |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 194 | /* Drop the layer when its already present in FB OR when it lies |
| 195 | * outside frame's ROI */ |
| 196 | if(!mCurrentFrame.needsRedraw || mCurrentFrame.drop[index]) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 197 | layer->compositionType = HWC_OVERLAY; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 198 | } |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 199 | } |
| 200 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 201 | } |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 202 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 203 | MDPComp::FrameInfo::FrameInfo() { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 204 | reset(0); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 205 | } |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 206 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 207 | void MDPComp::FrameInfo::reset(const int& numLayers) { |
| 208 | for(int i = 0 ; i < MAX_PIPES_PER_MIXER && numLayers; i++ ) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 209 | if(mdpToLayer[i].pipeInfo) { |
| 210 | delete mdpToLayer[i].pipeInfo; |
| 211 | mdpToLayer[i].pipeInfo = NULL; |
| 212 | //We dont own the rotator |
| 213 | mdpToLayer[i].rot = NULL; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 214 | } |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 215 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 216 | |
| 217 | memset(&mdpToLayer, 0, sizeof(mdpToLayer)); |
| 218 | memset(&layerToMDP, -1, sizeof(layerToMDP)); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 219 | memset(&isFBComposed, 1, sizeof(isFBComposed)); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 220 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 221 | layerCount = numLayers; |
| 222 | fbCount = numLayers; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 223 | mdpCount = 0; |
Saurabh Shah | 2f3895f | 2013-05-02 10:13:31 -0700 | [diff] [blame] | 224 | needsRedraw = true; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 225 | fbZ = 0; |
| 226 | } |
| 227 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 228 | void MDPComp::FrameInfo::map() { |
| 229 | // populate layer and MDP maps |
| 230 | int mdpIdx = 0; |
| 231 | for(int idx = 0; idx < layerCount; idx++) { |
| 232 | if(!isFBComposed[idx]) { |
| 233 | mdpToLayer[mdpIdx].listIndex = idx; |
| 234 | layerToMDP[idx] = mdpIdx++; |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 239 | MDPComp::LayerCache::LayerCache() { |
| 240 | reset(); |
| 241 | } |
| 242 | |
| 243 | void MDPComp::LayerCache::reset() { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 244 | memset(&hnd, 0, sizeof(hnd)); |
Prabhanjan Kandula | 2243aa6 | 2013-10-24 12:58:55 +0530 | [diff] [blame] | 245 | memset(&isFBComposed, true, sizeof(isFBComposed)); |
| 246 | memset(&drop, false, sizeof(drop)); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 247 | layerCount = 0; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | void MDPComp::LayerCache::cacheAll(hwc_display_contents_1_t* list) { |
| 251 | const int numAppLayers = list->numHwLayers - 1; |
| 252 | for(int i = 0; i < numAppLayers; i++) { |
| 253 | hnd[i] = list->hwLayers[i].handle; |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | void MDPComp::LayerCache::updateCounts(const FrameInfo& curFrame) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 258 | layerCount = curFrame.layerCount; |
Prabhanjan Kandula | 2243aa6 | 2013-10-24 12:58:55 +0530 | [diff] [blame] | 259 | memcpy(&isFBComposed, &curFrame.isFBComposed, sizeof(isFBComposed)); |
| 260 | memcpy(&drop, &curFrame.drop, sizeof(drop)); |
| 261 | } |
| 262 | |
| 263 | bool MDPComp::LayerCache::isSameFrame(const FrameInfo& curFrame) { |
| 264 | if(layerCount != curFrame.layerCount) |
| 265 | return false; |
| 266 | for(int i = 0; i < curFrame.layerCount; i++) { |
| 267 | if((curFrame.isFBComposed[i] != isFBComposed[i]) || |
| 268 | (curFrame.drop[i] != drop[i])) { |
| 269 | return false; |
| 270 | } |
| 271 | } |
| 272 | return true; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 273 | } |
| 274 | |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 275 | bool MDPComp::isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer) { |
| 276 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 277 | if((not isYuvBuffer(hnd) and has90Transform(layer)) or |
| 278 | (not isValidDimension(ctx,layer)) |
| 279 | //More conditions here, SKIP, sRGB+Blend etc |
| 280 | ) { |
| 281 | return false; |
| 282 | } |
| 283 | return true; |
| 284 | } |
| 285 | |
Sravan Kumar D.V.N | ad5d929 | 2013-04-24 14:23:04 +0530 | [diff] [blame] | 286 | bool MDPComp::isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer) { |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 287 | const int dpy = HWC_DISPLAY_PRIMARY; |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 288 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 289 | |
| 290 | if(!hnd) { |
| 291 | ALOGE("%s: layer handle is NULL", __FUNCTION__); |
| 292 | return false; |
| 293 | } |
| 294 | |
Naseer Ahmed | e850a80 | 2013-09-06 13:12:52 -0400 | [diff] [blame] | 295 | //XXX: Investigate doing this with pixel phase on MDSS |
Naseer Ahmed | e77f808 | 2013-10-10 13:42:48 -0400 | [diff] [blame] | 296 | if(!isSecureBuffer(hnd) && isNonIntegralSourceCrop(layer->sourceCropf)) |
Naseer Ahmed | e850a80 | 2013-09-06 13:12:52 -0400 | [diff] [blame] | 297 | return false; |
| 298 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 299 | int hw_w = ctx->dpyAttr[mDpy].xres; |
| 300 | int hw_h = ctx->dpyAttr[mDpy].yres; |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 301 | |
Saurabh Shah | 62e1d73 | 2013-09-17 10:44:05 -0700 | [diff] [blame] | 302 | hwc_rect_t crop = integerizeSourceCrop(layer->sourceCropf); |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 303 | hwc_rect_t dst = layer->displayFrame; |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 304 | |
| 305 | if(dst.left < 0 || dst.top < 0 || dst.right > hw_w || dst.bottom > hw_h) { |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 306 | hwc_rect_t scissor = {0, 0, hw_w, hw_h }; |
| 307 | qhwc::calculate_crop_rects(crop, dst, scissor, layer->transform); |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 308 | } |
| 309 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 310 | int crop_w = crop.right - crop.left; |
| 311 | int crop_h = crop.bottom - crop.top; |
| 312 | int dst_w = dst.right - dst.left; |
| 313 | int dst_h = dst.bottom - dst.top; |
| 314 | float w_dscale = ceilf((float)crop_w / (float)dst_w); |
| 315 | float h_dscale = ceilf((float)crop_h / (float)dst_h); |
| 316 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 317 | /* Workaround for MDP HW limitation in DSI command mode panels where |
| 318 | * FPS will not go beyond 30 if buffers on RGB pipes are of width or height |
| 319 | * less than 5 pixels |
Sravan Kumar D.V.N | ad5d929 | 2013-04-24 14:23:04 +0530 | [diff] [blame] | 320 | * There also is a HW limilation in MDP, minimum block size is 2x2 |
| 321 | * Fallback to GPU if height is less than 2. |
| 322 | */ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 323 | if((crop_w < 5)||(crop_h < 5)) |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 324 | return false; |
| 325 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 326 | const uint32_t downscale = |
| 327 | qdutils::MDPVersion::getInstance().getMaxMDPDownscale(); |
| 328 | if(ctx->mMDP.version >= qdutils::MDSS_V5) { |
| 329 | /* Workaround for downscales larger than 4x. |
| 330 | * Will be removed once decimator block is enabled for MDSS |
| 331 | */ |
| 332 | if(!qdutils::MDPVersion::getInstance().supportsDecimation()) { |
| 333 | if(crop_w > MAX_DISPLAY_DIM || w_dscale > downscale || |
| 334 | h_dscale > downscale) |
| 335 | return false; |
| 336 | } else { |
| 337 | if(w_dscale > 64 || h_dscale > 64) |
| 338 | return false; |
| 339 | } |
| 340 | } else { //A-family |
| 341 | if(w_dscale > downscale || h_dscale > downscale) |
| 342 | return false; |
| 343 | } |
| 344 | |
Jeykumar Sankaran | c18dbc2 | 2013-02-08 14:29:44 -0800 | [diff] [blame] | 345 | return true; |
| 346 | } |
| 347 | |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 348 | ovutils::eDest MDPComp::getMdpPipe(hwc_context_t *ctx, ePipeType type, |
| 349 | int mixer) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 350 | overlay::Overlay& ov = *ctx->mOverlay; |
| 351 | ovutils::eDest mdp_pipe = ovutils::OV_INVALID; |
| 352 | |
| 353 | switch(type) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 354 | case MDPCOMP_OV_DMA: |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 355 | mdp_pipe = ov.nextPipe(ovutils::OV_MDP_PIPE_DMA, mDpy, mixer); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 356 | if(mdp_pipe != ovutils::OV_INVALID) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 357 | return mdp_pipe; |
| 358 | } |
| 359 | case MDPCOMP_OV_ANY: |
| 360 | case MDPCOMP_OV_RGB: |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 361 | mdp_pipe = ov.nextPipe(ovutils::OV_MDP_PIPE_RGB, mDpy, mixer); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 362 | if(mdp_pipe != ovutils::OV_INVALID) { |
| 363 | return mdp_pipe; |
| 364 | } |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 365 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 366 | if(type == MDPCOMP_OV_RGB) { |
| 367 | //Requested only for RGB pipe |
| 368 | break; |
| 369 | } |
| 370 | case MDPCOMP_OV_VG: |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 371 | return ov.nextPipe(ovutils::OV_MDP_PIPE_VG, mDpy, mixer); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 372 | default: |
| 373 | ALOGE("%s: Invalid pipe type",__FUNCTION__); |
| 374 | return ovutils::OV_INVALID; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 375 | }; |
| 376 | return ovutils::OV_INVALID; |
| 377 | } |
| 378 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 379 | bool MDPComp::isFrameDoable(hwc_context_t *ctx) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 380 | bool ret = true; |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 381 | const int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 382 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 383 | if(!isEnabled()) { |
| 384 | ALOGD_IF(isDebug(),"%s: MDP Comp. not enabled.", __FUNCTION__); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 385 | ret = false; |
Saurabh Shah | d4e6585 | 2013-06-17 11:33:53 -0700 | [diff] [blame] | 386 | } else if(qdutils::MDPVersion::getInstance().is8x26() && |
Jeykumar Sankaran | 27dee26 | 2013-08-01 17:09:54 -0700 | [diff] [blame] | 387 | ctx->mVideoTransFlag && ctx->mVirtualDisplay->isConnected()) { |
Saurabh Shah | d4e6585 | 2013-06-17 11:33:53 -0700 | [diff] [blame] | 388 | //1 Padding round to shift pipes across mixers |
| 389 | ALOGD_IF(isDebug(),"%s: MDP Comp. video transition padding round", |
| 390 | __FUNCTION__); |
| 391 | ret = false; |
Jeykumar Sankaran | 27dee26 | 2013-08-01 17:09:54 -0700 | [diff] [blame] | 392 | } else if(ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].isConfiguring || |
| 393 | ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].isConfiguring) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 394 | ALOGD_IF( isDebug(),"%s: External Display connection is pending", |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 395 | __FUNCTION__); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 396 | ret = false; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 397 | } else if(ctx->isPaddingRound) { |
Saurabh Shah | 0ceeb6a | 2013-04-23 10:46:07 -0700 | [diff] [blame] | 398 | ctx->isPaddingRound = false; |
| 399 | ALOGD_IF(isDebug(), "%s: padding round",__FUNCTION__); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 400 | ret = false; |
Saurabh Shah | 0ceeb6a | 2013-04-23 10:46:07 -0700 | [diff] [blame] | 401 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 402 | return ret; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 403 | } |
| 404 | |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 405 | bool MDPComp::validateAndApplyROI(hwc_context_t *ctx, |
| 406 | hwc_display_contents_1_t* list, hwc_rect_t roi) { |
| 407 | int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
| 408 | |
| 409 | if(!isValidRect(roi)) |
| 410 | return false; |
| 411 | |
| 412 | for(int i = 0; i < numAppLayers; i++){ |
| 413 | const hwc_layer_1_t* layer = &list->hwLayers[i]; |
| 414 | |
| 415 | hwc_rect_t dstRect = layer->displayFrame; |
Arun Kumar K.R | 91090c7 | 2013-10-28 19:40:18 -0700 | [diff] [blame] | 416 | hwc_rect_t srcRect = integerizeSourceCrop(layer->sourceCropf); |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 417 | int transform = layer->transform; |
| 418 | trimLayer(ctx, mDpy, transform, srcRect, dstRect); |
| 419 | |
| 420 | hwc_rect_t res = getIntersection(roi, dstRect); |
| 421 | |
| 422 | int res_w = res.right - res.left; |
| 423 | int res_h = res.bottom - res.top; |
| 424 | int dst_w = dstRect.right - dstRect.left; |
| 425 | int dst_h = dstRect.bottom - dstRect.top; |
| 426 | |
| 427 | if(!isValidRect(res)) { |
| 428 | mCurrentFrame.drop[i] = true; |
| 429 | mCurrentFrame.dropCount++; |
| 430 | }else { |
| 431 | /* Reset frame ROI when any layer which needs scaling also needs ROI |
| 432 | * cropping */ |
| 433 | if((res_w != dst_w || res_h != dst_h) && |
| 434 | needsScaling (ctx, layer, mDpy)) { |
| 435 | ALOGE("%s: Resetting ROI due to scaling", __FUNCTION__); |
| 436 | memset(&mCurrentFrame.drop, 0, sizeof(mCurrentFrame.drop)); |
| 437 | mCurrentFrame.dropCount = 0; |
| 438 | return false; |
| 439 | } |
| 440 | } |
| 441 | } |
| 442 | return true; |
| 443 | } |
| 444 | |
| 445 | void MDPComp::generateROI(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
| 446 | int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
| 447 | |
| 448 | if(!sEnablePartialFrameUpdate) { |
| 449 | return; |
| 450 | } |
| 451 | |
| 452 | if(mDpy || isDisplaySplit(ctx, mDpy)){ |
| 453 | ALOGE_IF(isDebug(), "%s: ROI not supported for" |
| 454 | "the (1) external / virtual display's (2) dual DSI displays", |
| 455 | __FUNCTION__); |
| 456 | return; |
| 457 | } |
| 458 | |
| 459 | if(list->flags & HWC_GEOMETRY_CHANGED) |
| 460 | return; |
| 461 | |
| 462 | struct hwc_rect roi = (struct hwc_rect){0, 0, 0, 0}; |
| 463 | for(int index = 0; index < numAppLayers; index++ ) { |
| 464 | if ((mCachedFrame.hnd[index] != list->hwLayers[index].handle) || |
| 465 | isYuvBuffer((private_handle_t *)list->hwLayers[index].handle)) { |
| 466 | hwc_rect_t dstRect = list->hwLayers[index].displayFrame; |
Arun Kumar K.R | 91090c7 | 2013-10-28 19:40:18 -0700 | [diff] [blame] | 467 | hwc_rect_t srcRect = integerizeSourceCrop( |
| 468 | list->hwLayers[index].sourceCropf); |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 469 | int transform = list->hwLayers[index].transform; |
| 470 | |
| 471 | /* Intersect against display boundaries */ |
| 472 | trimLayer(ctx, mDpy, transform, srcRect, dstRect); |
| 473 | roi = getUnion(roi, dstRect); |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | if(!validateAndApplyROI(ctx, list, roi)){ |
| 478 | roi = (struct hwc_rect) {0, 0, |
| 479 | (int)ctx->dpyAttr[mDpy].xres, (int)ctx->dpyAttr[mDpy].yres}; |
| 480 | } |
| 481 | |
| 482 | ctx->listStats[mDpy].roi.x = roi.left; |
| 483 | ctx->listStats[mDpy].roi.y = roi.top; |
| 484 | ctx->listStats[mDpy].roi.w = roi.right - roi.left; |
| 485 | ctx->listStats[mDpy].roi.h = roi.bottom - roi.top; |
| 486 | |
| 487 | ALOGD_IF(isDebug(),"%s: generated ROI: [%d, %d, %d, %d]", __FUNCTION__, |
| 488 | roi.left, roi.top, roi.right, roi.bottom); |
| 489 | } |
| 490 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 491 | /* Checks for conditions where all the layers marked for MDP comp cannot be |
| 492 | * bypassed. On such conditions we try to bypass atleast YUV layers */ |
| 493 | bool MDPComp::isFullFrameDoable(hwc_context_t *ctx, |
| 494 | hwc_display_contents_1_t* list){ |
| 495 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 496 | const int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 497 | |
Ramkumar Radhakrishnan | ba71338 | 2013-08-30 18:41:07 -0700 | [diff] [blame] | 498 | if(sIdleFallBack && !ctx->listStats[mDpy].secureUI) { |
Saurabh Shah | 2d998a9 | 2013-05-14 17:55:58 -0700 | [diff] [blame] | 499 | ALOGD_IF(isDebug(), "%s: Idle fallback dpy %d",__FUNCTION__, mDpy); |
| 500 | return false; |
| 501 | } |
| 502 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 503 | if(isSkipPresent(ctx, mDpy)) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 504 | ALOGD_IF(isDebug(),"%s: SKIP present: %d", |
| 505 | __FUNCTION__, |
| 506 | isSkipPresent(ctx, mDpy)); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 507 | return false; |
| 508 | } |
| 509 | |
Saurabh Shah | 9f084ad | 2013-05-02 11:28:09 -0700 | [diff] [blame] | 510 | if(ctx->listStats[mDpy].needsAlphaScale |
| 511 | && ctx->mMDP.version < qdutils::MDSS_V5) { |
| 512 | ALOGD_IF(isDebug(), "%s: frame needs alpha downscaling",__FUNCTION__); |
| 513 | return false; |
| 514 | } |
| 515 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 516 | for(int i = 0; i < numAppLayers; ++i) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 517 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
| 518 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
Jeykumar Sankaran | a37fdbf | 2013-03-06 18:59:28 -0800 | [diff] [blame] | 519 | |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 520 | if(isYuvBuffer(hnd) && has90Transform(layer)) { |
| 521 | if(!canUseRotator(ctx, mDpy)) { |
| 522 | ALOGD_IF(isDebug(), "%s: Can't use rotator for dpy %d", |
| 523 | __FUNCTION__, mDpy); |
Amara Venkata Mastan Manoj Kumar | 9d373c0 | 2013-08-20 14:30:09 -0700 | [diff] [blame] | 524 | return false; |
| 525 | } |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 526 | } |
Prabhanjan Kandula | 9fb032a | 2013-06-18 17:37:22 +0530 | [diff] [blame] | 527 | |
| 528 | //For 8x26 with panel width>1k, if RGB layer needs HFLIP fail mdp comp |
| 529 | // may not need it if Gfx pre-rotation can handle all flips & rotations |
| 530 | if(qdutils::MDPVersion::getInstance().is8x26() && |
| 531 | (ctx->dpyAttr[mDpy].xres > 1024) && |
| 532 | (layer->transform & HWC_TRANSFORM_FLIP_H) && |
| 533 | (!isYuvBuffer(hnd))) |
| 534 | return false; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 535 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 536 | |
Saurabh Shah | a9da08f | 2013-07-03 13:27:53 -0700 | [diff] [blame] | 537 | if(ctx->mAD->isDoable()) { |
| 538 | return false; |
| 539 | } |
| 540 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 541 | //If all above hard conditions are met we can do full or partial MDP comp. |
| 542 | bool ret = false; |
| 543 | if(fullMDPComp(ctx, list)) { |
| 544 | ret = true; |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 545 | } else if(partialMDPComp(ctx, list)) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 546 | ret = true; |
| 547 | } |
| 548 | return ret; |
| 549 | } |
| 550 | |
| 551 | bool MDPComp::fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 552 | //Will benefit presentation / secondary-only layer. |
| 553 | if((mDpy > HWC_DISPLAY_PRIMARY) && |
| 554 | (list->numHwLayers - 1) > MAX_SEC_LAYERS) { |
| 555 | ALOGD_IF(isDebug(), "%s: Exceeds max secondary pipes",__FUNCTION__); |
| 556 | return false; |
| 557 | } |
| 558 | |
| 559 | const int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
| 560 | for(int i = 0; i < numAppLayers; i++) { |
| 561 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
| 562 | if(not isSupportedForMDPComp(ctx, layer)) { |
| 563 | ALOGD_IF(isDebug(), "%s: Unsupported layer in list",__FUNCTION__); |
| 564 | return false; |
| 565 | } |
| 566 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 567 | mCurrentFrame.fbCount = 0; |
| 568 | mCurrentFrame.fbZ = -1; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 569 | memcpy(&mCurrentFrame.isFBComposed, &mCurrentFrame.drop, |
| 570 | sizeof(mCurrentFrame.isFBComposed)); |
| 571 | mCurrentFrame.mdpCount = mCurrentFrame.layerCount - mCurrentFrame.fbCount - |
| 572 | mCurrentFrame.dropCount; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 573 | |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 574 | if(mCurrentFrame.mdpCount > sMaxPipesPerMixer) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 575 | ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__); |
| 576 | return false; |
| 577 | } |
| 578 | |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 579 | if(!arePipesAvailable(ctx, list)) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 580 | return false; |
| 581 | } |
| 582 | |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 583 | uint32_t size = calcMDPBytesRead(ctx, list); |
| 584 | if(!bandwidthCheck(ctx, size)) { |
| 585 | ALOGD_IF(isDebug(), "%s: Exceeds bandwidth",__FUNCTION__); |
| 586 | return false; |
| 587 | } |
| 588 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 589 | return true; |
| 590 | } |
| 591 | |
| 592 | bool MDPComp::partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list) |
| 593 | { |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 594 | if(!sEnableMixedMode) { |
| 595 | //Mixed mode is disabled. No need to even try caching. |
| 596 | return false; |
| 597 | } |
| 598 | |
Saurabh Shah | 8028e3b | 2013-10-15 12:27:59 -0700 | [diff] [blame] | 599 | bool ret = false; |
| 600 | if(isLoadBasedCompDoable(ctx, list)) { |
| 601 | ret = loadBasedComp(ctx, list); |
| 602 | } |
| 603 | |
| 604 | if(!ret) { |
| 605 | ret = cacheBasedComp(ctx, list); |
| 606 | } |
| 607 | |
| 608 | return ret; |
| 609 | } |
| 610 | |
| 611 | bool MDPComp::cacheBasedComp(hwc_context_t *ctx, |
| 612 | hwc_display_contents_1_t* list) { |
| 613 | int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 614 | mCurrentFrame.reset(numAppLayers); |
| 615 | updateLayerCache(ctx, list); |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 616 | |
| 617 | //If an MDP marked layer is unsupported cannot do partial MDP Comp |
| 618 | for(int i = 0; i < numAppLayers; i++) { |
| 619 | if(!mCurrentFrame.isFBComposed[i]) { |
| 620 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
| 621 | if(not isSupportedForMDPComp(ctx, layer)) { |
| 622 | ALOGD_IF(isDebug(), "%s: Unsupported layer in list", |
| 623 | __FUNCTION__); |
| 624 | return false; |
| 625 | } |
| 626 | } |
| 627 | } |
| 628 | |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 629 | updateYUV(ctx, list, false /*secure only*/); |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 630 | bool ret = markLayersForCaching(ctx, list); //sets up fbZ also |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 631 | if(!ret) { |
| 632 | ALOGD_IF(isDebug(),"%s: batching failed, dpy %d",__FUNCTION__, mDpy); |
| 633 | return false; |
| 634 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 635 | |
| 636 | int mdpCount = mCurrentFrame.mdpCount; |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 637 | |
| 638 | //Will benefit cases where a video has non-updating background. |
| 639 | if((mDpy > HWC_DISPLAY_PRIMARY) and |
| 640 | (mdpCount > MAX_SEC_LAYERS)) { |
| 641 | ALOGD_IF(isDebug(), "%s: Exceeds max secondary pipes",__FUNCTION__); |
| 642 | return false; |
| 643 | } |
| 644 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 645 | if(mdpCount > (sMaxPipesPerMixer - 1)) { // -1 since FB is used |
| 646 | ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__); |
| 647 | return false; |
| 648 | } |
| 649 | |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 650 | if(!arePipesAvailable(ctx, list)) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 651 | return false; |
| 652 | } |
| 653 | |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 654 | uint32_t size = calcMDPBytesRead(ctx, list); |
| 655 | if(!bandwidthCheck(ctx, size)) { |
| 656 | ALOGD_IF(isDebug(), "%s: Exceeds bandwidth",__FUNCTION__); |
| 657 | return false; |
| 658 | } |
| 659 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 660 | return true; |
| 661 | } |
| 662 | |
Saurabh Shah | 8028e3b | 2013-10-15 12:27:59 -0700 | [diff] [blame] | 663 | bool MDPComp::loadBasedComp(hwc_context_t *ctx, |
| 664 | hwc_display_contents_1_t* list) { |
| 665 | int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
| 666 | mCurrentFrame.reset(numAppLayers); |
| 667 | |
| 668 | //TODO BatchSize could be optimized further based on available pipes, split |
| 669 | //displays etc. |
| 670 | const int batchSize = numAppLayers - (sMaxPipesPerMixer - 1); |
| 671 | if(batchSize <= 0) { |
| 672 | ALOGD_IF(isDebug(), "%s: Not attempting", __FUNCTION__); |
| 673 | return false; |
| 674 | } |
| 675 | |
| 676 | int minBatchStart = -1; |
| 677 | size_t minBatchPixelCount = SIZE_MAX; |
| 678 | |
| 679 | for(int i = 0; i <= numAppLayers - batchSize; i++) { |
| 680 | uint32_t batchPixelCount = 0; |
| 681 | for(int j = i; j < i + batchSize; j++) { |
| 682 | hwc_layer_1_t* layer = &list->hwLayers[j]; |
Arun Kumar K.R | 91090c7 | 2013-10-28 19:40:18 -0700 | [diff] [blame] | 683 | hwc_rect_t crop = integerizeSourceCrop(layer->sourceCropf); |
Saurabh Shah | 8028e3b | 2013-10-15 12:27:59 -0700 | [diff] [blame] | 684 | batchPixelCount += (crop.right - crop.left) * |
| 685 | (crop.bottom - crop.top); |
| 686 | } |
| 687 | |
| 688 | if(batchPixelCount < minBatchPixelCount) { |
| 689 | minBatchPixelCount = batchPixelCount; |
| 690 | minBatchStart = i; |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | if(minBatchStart < 0) { |
| 695 | ALOGD_IF(isDebug(), "%s: No batch found batchSize %d numAppLayers %d", |
| 696 | __FUNCTION__, batchSize, numAppLayers); |
| 697 | return false; |
| 698 | } |
| 699 | |
| 700 | for(int i = 0; i < numAppLayers; i++) { |
| 701 | if(i < minBatchStart || i >= minBatchStart + batchSize) { |
| 702 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
| 703 | if(not isSupportedForMDPComp(ctx, layer)) { |
| 704 | ALOGD_IF(isDebug(), "%s: MDP unsupported layer found at %d", |
| 705 | __FUNCTION__, i); |
| 706 | return false; |
| 707 | } |
| 708 | mCurrentFrame.isFBComposed[i] = false; |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | mCurrentFrame.fbZ = minBatchStart; |
| 713 | mCurrentFrame.fbCount = batchSize; |
| 714 | mCurrentFrame.mdpCount = mCurrentFrame.layerCount - batchSize; |
| 715 | |
| 716 | if(!arePipesAvailable(ctx, list)) { |
| 717 | return false; |
| 718 | } |
| 719 | |
| 720 | ALOGD_IF(isDebug(), "%s: fbZ %d batchSize %d", |
| 721 | __FUNCTION__, mCurrentFrame.fbZ, batchSize); |
| 722 | return true; |
| 723 | } |
| 724 | |
| 725 | bool MDPComp::isLoadBasedCompDoable(hwc_context_t *ctx, |
| 726 | hwc_display_contents_1_t* list) { |
| 727 | if(mDpy or isSecurePresent(ctx, mDpy) or |
| 728 | not (list->flags & HWC_GEOMETRY_CHANGED)) { |
| 729 | return false; |
| 730 | } |
| 731 | return true; |
| 732 | } |
| 733 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 734 | bool MDPComp::isOnlyVideoDoable(hwc_context_t *ctx, |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 735 | hwc_display_contents_1_t* list, bool secureOnly) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 736 | int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 737 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 738 | mCurrentFrame.reset(numAppLayers); |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 739 | updateYUV(ctx, list, secureOnly); |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 740 | int mdpCount = mCurrentFrame.mdpCount; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 741 | int fbNeeded = (mCurrentFrame.fbCount != 0); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 742 | |
| 743 | if(!isYuvPresent(ctx, mDpy)) { |
| 744 | return false; |
| 745 | } |
| 746 | |
Jeykumar Sankaran | f42f0d8 | 2013-11-08 18:09:20 -0800 | [diff] [blame] | 747 | /* Bail out if we are processing only secured video layers |
| 748 | * and we dont have any */ |
| 749 | if(!isSecurePresent(ctx, mDpy) && secureOnly){ |
| 750 | return false; |
| 751 | } |
| 752 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 753 | if(!mdpCount) |
| 754 | return false; |
| 755 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 756 | if(mdpCount > (sMaxPipesPerMixer - fbNeeded)) { |
| 757 | ALOGD_IF(isDebug(), "%s: Exceeds MAX_PIPES_PER_MIXER",__FUNCTION__); |
| 758 | return false; |
| 759 | } |
| 760 | |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 761 | if(!arePipesAvailable(ctx, list)) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 762 | return false; |
| 763 | } |
| 764 | |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 765 | uint32_t size = calcMDPBytesRead(ctx, list); |
| 766 | if(!bandwidthCheck(ctx, size)) { |
| 767 | ALOGD_IF(isDebug(), "%s: Exceeds bandwidth",__FUNCTION__); |
| 768 | return false; |
| 769 | } |
| 770 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 771 | return true; |
| 772 | } |
| 773 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 774 | /* Checks for conditions where YUV layers cannot be bypassed */ |
| 775 | bool MDPComp::isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer) { |
Saurabh Shah | e247408 | 2013-05-15 16:32:13 -0700 | [diff] [blame] | 776 | bool extAnimBlockFeature = mDpy && ctx->listStats[mDpy].isDisplayAnimating; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 777 | |
Saurabh Shah | e247408 | 2013-05-15 16:32:13 -0700 | [diff] [blame] | 778 | if(isSkipLayer(layer) && !extAnimBlockFeature) { |
| 779 | ALOGD_IF(isDebug(), "%s: Video marked SKIP dpy %d", __FUNCTION__, mDpy); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 780 | return false; |
| 781 | } |
| 782 | |
Amara Venkata Mastan Manoj Kumar | 9d373c0 | 2013-08-20 14:30:09 -0700 | [diff] [blame] | 783 | if(layer->transform & HWC_TRANSFORM_ROT_90 && !canUseRotator(ctx,mDpy)) { |
| 784 | ALOGD_IF(isDebug(), "%s: no free DMA pipe",__FUNCTION__); |
| 785 | return false; |
| 786 | } |
| 787 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 788 | if(isSecuring(ctx, layer)) { |
| 789 | ALOGD_IF(isDebug(), "%s: MDP securing is active", __FUNCTION__); |
| 790 | return false; |
| 791 | } |
| 792 | |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 793 | if(!isValidDimension(ctx, layer)) { |
| 794 | ALOGD_IF(isDebug(), "%s: Buffer is of invalid width", |
| 795 | __FUNCTION__); |
| 796 | return false; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 797 | } |
Saurabh Shah | 4fdde76 | 2013-04-30 18:47:33 -0700 | [diff] [blame] | 798 | |
Naseer Ahmed | dc61a97 | 2013-07-10 17:50:54 -0400 | [diff] [blame] | 799 | if(layer->planeAlpha < 0xFF) { |
| 800 | ALOGD_IF(isDebug(), "%s: Cannot handle YUV layer with plane alpha\ |
| 801 | in video only mode", |
| 802 | __FUNCTION__); |
| 803 | return false; |
| 804 | } |
| 805 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 806 | return true; |
| 807 | } |
| 808 | |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 809 | /* starts at fromIndex and check for each layer to find |
| 810 | * if it it has overlapping with any Updating layer above it in zorder |
| 811 | * till the end of the batch. returns true if it finds any intersection */ |
| 812 | bool MDPComp::canPushBatchToTop(const hwc_display_contents_1_t* list, |
| 813 | int fromIndex, int toIndex) { |
| 814 | for(int i = fromIndex; i < toIndex; i++) { |
| 815 | if(mCurrentFrame.isFBComposed[i] && !mCurrentFrame.drop[i]) { |
| 816 | if(intersectingUpdatingLayers(list, i+1, toIndex, i)) { |
| 817 | return false; |
| 818 | } |
| 819 | } |
| 820 | } |
| 821 | return true; |
| 822 | } |
| 823 | |
| 824 | /* Checks if given layer at targetLayerIndex has any |
| 825 | * intersection with all the updating layers in beween |
| 826 | * fromIndex and toIndex. Returns true if it finds intersectiion */ |
| 827 | bool MDPComp::intersectingUpdatingLayers(const hwc_display_contents_1_t* list, |
| 828 | int fromIndex, int toIndex, int targetLayerIndex) { |
| 829 | for(int i = fromIndex; i <= toIndex; i++) { |
| 830 | if(!mCurrentFrame.isFBComposed[i]) { |
| 831 | if(areLayersIntersecting(&list->hwLayers[i], |
| 832 | &list->hwLayers[targetLayerIndex])) { |
| 833 | return true; |
| 834 | } |
| 835 | } |
| 836 | } |
| 837 | return false; |
| 838 | } |
| 839 | |
| 840 | int MDPComp::getBatch(hwc_display_contents_1_t* list, |
| 841 | int& maxBatchStart, int& maxBatchEnd, |
| 842 | int& maxBatchCount) { |
| 843 | int i = 0; |
| 844 | int updatingLayersAbove = 0;//Updating layer count in middle of batch |
| 845 | int fbZOrder =-1; |
| 846 | while (i < mCurrentFrame.layerCount) { |
| 847 | int batchCount = 0; |
| 848 | int batchStart = i; |
| 849 | int batchEnd = i; |
| 850 | int fbZ = batchStart; |
| 851 | int firstZReverseIndex = -1; |
| 852 | while(i < mCurrentFrame.layerCount) { |
| 853 | if(!mCurrentFrame.isFBComposed[i]) { |
| 854 | if(!batchCount) { |
| 855 | i++; |
| 856 | break; |
| 857 | } |
| 858 | updatingLayersAbove++; |
| 859 | i++; |
| 860 | continue; |
| 861 | } else { |
| 862 | if(mCurrentFrame.drop[i]) { |
| 863 | i++; |
| 864 | continue; |
| 865 | } else if(updatingLayersAbove <= 0) { |
| 866 | batchCount++; |
| 867 | batchEnd = i; |
| 868 | i++; |
| 869 | continue; |
| 870 | } else { //Layer is FBComposed, not a drop & updatingLayer > 0 |
| 871 | |
| 872 | // We have a valid updating layer already. If layer-i not |
| 873 | // have overlapping with all updating layers in between |
| 874 | // batch-start and i, then we can add layer i to batch. |
| 875 | if(!intersectingUpdatingLayers(list, batchStart, i-1, i)) { |
| 876 | batchCount++; |
| 877 | batchEnd = i; |
| 878 | i++; |
| 879 | continue; |
| 880 | } else if(canPushBatchToTop(list, batchStart, i)) { |
| 881 | //If All the non-updating layers with in this batch |
| 882 | //does not have intersection with the updating layers |
| 883 | //above in z-order, then we can safely move the batch to |
| 884 | //higher z-order. Increment fbZ as it is moving up. |
| 885 | if( firstZReverseIndex < 0) { |
| 886 | firstZReverseIndex = i; |
| 887 | } |
| 888 | batchCount++; |
| 889 | batchEnd = i; |
| 890 | fbZ += updatingLayersAbove; |
| 891 | i++; |
| 892 | updatingLayersAbove = 0; |
| 893 | continue; |
| 894 | } else { |
| 895 | //both failed.start the loop again from here. |
| 896 | if(firstZReverseIndex >= 0) { |
| 897 | i = firstZReverseIndex; |
| 898 | } |
| 899 | break; |
| 900 | } |
| 901 | } |
| 902 | } |
| 903 | } |
| 904 | if(batchCount > maxBatchCount) { |
| 905 | maxBatchCount = batchCount; |
| 906 | maxBatchStart = batchStart; |
| 907 | maxBatchEnd = batchEnd; |
| 908 | fbZOrder = fbZ; |
| 909 | } |
| 910 | } |
| 911 | return fbZOrder; |
| 912 | } |
| 913 | |
| 914 | bool MDPComp::markLayersForCaching(hwc_context_t* ctx, |
| 915 | hwc_display_contents_1_t* list) { |
| 916 | /* Idea is to keep as many non-updating(cached) layers in FB and |
| 917 | * send rest of them through MDP. This is done in 2 steps. |
| 918 | * 1. Find the maximum contiguous batch of non-updating layers. |
| 919 | * 2. See if we can improve this batch size for caching by adding |
| 920 | * opaque layers around the batch, if they don't have |
| 921 | * any overlapping with the updating layers in between. |
| 922 | * NEVER mark an updating layer for caching. |
| 923 | * But cached ones can be marked for MDP */ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 924 | |
| 925 | int maxBatchStart = -1; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 926 | int maxBatchEnd = -1; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 927 | int maxBatchCount = 0; |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 928 | int fbZ = -1; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 929 | |
| 930 | /* All or Nothing is cached. No batching needed */ |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 931 | if(!mCurrentFrame.fbCount) { |
| 932 | mCurrentFrame.fbZ = -1; |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 933 | return true; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 934 | } |
| 935 | if(!mCurrentFrame.mdpCount) { |
| 936 | mCurrentFrame.fbZ = 0; |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 937 | return true; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 938 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 939 | |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 940 | fbZ = getBatch(list, maxBatchStart, maxBatchEnd, maxBatchCount); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 941 | |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 942 | /* reset rest of the layers lying inside ROI for MDP comp */ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 943 | for(int i = 0; i < mCurrentFrame.layerCount; i++) { |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 944 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 945 | if((i < maxBatchStart || i > maxBatchEnd) && |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 946 | mCurrentFrame.isFBComposed[i]){ |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 947 | if(!mCurrentFrame.drop[i]){ |
| 948 | //If an unsupported layer is being attempted to |
| 949 | //be pulled out we should fail |
| 950 | if(not isSupportedForMDPComp(ctx, layer)) { |
| 951 | return false; |
| 952 | } |
| 953 | mCurrentFrame.isFBComposed[i] = false; |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 954 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 955 | } |
| 956 | } |
| 957 | |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 958 | // update the frame data |
| 959 | mCurrentFrame.fbZ = fbZ; |
| 960 | mCurrentFrame.fbCount = maxBatchCount; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 961 | mCurrentFrame.mdpCount = mCurrentFrame.layerCount - |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 962 | mCurrentFrame.fbCount - mCurrentFrame.dropCount; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 963 | |
| 964 | ALOGD_IF(isDebug(),"%s: cached count: %d",__FUNCTION__, |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 965 | mCurrentFrame.fbCount); |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 966 | |
| 967 | return true; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 968 | } |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 969 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 970 | void MDPComp::updateLayerCache(hwc_context_t* ctx, |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 971 | hwc_display_contents_1_t* list) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 972 | int numAppLayers = ctx->listStats[mDpy].numAppLayers; |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 973 | int fbCount = 0; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 974 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 975 | for(int i = 0; i < numAppLayers; i++) { |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 976 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 977 | if (mCachedFrame.hnd[i] == list->hwLayers[i].handle) { |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 978 | if(!mCurrentFrame.drop[i]) |
| 979 | fbCount++; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 980 | mCurrentFrame.isFBComposed[i] = true; |
| 981 | } else { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 982 | mCurrentFrame.isFBComposed[i] = false; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 983 | mCachedFrame.hnd[i] = list->hwLayers[i].handle; |
| 984 | } |
| 985 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 986 | |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 987 | mCurrentFrame.fbCount = fbCount; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 988 | mCurrentFrame.mdpCount = mCurrentFrame.layerCount - mCurrentFrame.fbCount |
| 989 | - mCurrentFrame.dropCount; |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 990 | |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 991 | ALOGD_IF(isDebug(),"%s: MDP count: %d FB count %d drop count: %d" |
| 992 | ,__FUNCTION__, mCurrentFrame.mdpCount, mCurrentFrame.fbCount, |
| 993 | mCurrentFrame.dropCount); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 994 | } |
| 995 | |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 996 | void MDPComp::updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list, |
| 997 | bool secureOnly) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 998 | int nYuvCount = ctx->listStats[mDpy].yuvCount; |
Ramkumar Radhakrishnan | 59a1107 | 2013-04-15 16:14:49 -0700 | [diff] [blame] | 999 | if(!nYuvCount && mDpy) { |
| 1000 | //Reset "No animation on external display" related parameters. |
| 1001 | ctx->mPrevCropVideo.left = ctx->mPrevCropVideo.top = |
| 1002 | ctx->mPrevCropVideo.right = ctx->mPrevCropVideo.bottom = 0; |
| 1003 | ctx->mPrevDestVideo.left = ctx->mPrevDestVideo.top = |
| 1004 | ctx->mPrevDestVideo.right = ctx->mPrevDestVideo.bottom = 0; |
| 1005 | ctx->mPrevTransformVideo = 0; |
| 1006 | return; |
| 1007 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1008 | for(int index = 0;index < nYuvCount; index++){ |
| 1009 | int nYuvIndex = ctx->listStats[mDpy].yuvIndices[index]; |
| 1010 | hwc_layer_1_t* layer = &list->hwLayers[nYuvIndex]; |
| 1011 | |
| 1012 | if(!isYUVDoable(ctx, layer)) { |
| 1013 | if(!mCurrentFrame.isFBComposed[nYuvIndex]) { |
| 1014 | mCurrentFrame.isFBComposed[nYuvIndex] = true; |
| 1015 | mCurrentFrame.fbCount++; |
| 1016 | } |
| 1017 | } else { |
| 1018 | if(mCurrentFrame.isFBComposed[nYuvIndex]) { |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 1019 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 1020 | if(!secureOnly || isSecureBuffer(hnd)) { |
| 1021 | mCurrentFrame.isFBComposed[nYuvIndex] = false; |
| 1022 | mCurrentFrame.fbCount--; |
| 1023 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1024 | } |
| 1025 | } |
| 1026 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 1027 | |
| 1028 | mCurrentFrame.mdpCount = mCurrentFrame.layerCount - |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 1029 | mCurrentFrame.fbCount - mCurrentFrame.dropCount; |
| 1030 | ALOGD_IF(isDebug(),"%s: fb count: %d",__FUNCTION__, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1031 | mCurrentFrame.fbCount); |
| 1032 | } |
| 1033 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 1034 | bool MDPComp::programMDP(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1035 | if(!allocLayerPipes(ctx, list)) { |
| 1036 | ALOGD_IF(isDebug(), "%s: Unable to allocate MDP pipes", __FUNCTION__); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 1037 | return false; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1038 | } |
| 1039 | |
| 1040 | for (int index = 0, mdpNextZOrder = 0; index < mCurrentFrame.layerCount; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 1041 | index++) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1042 | if(!mCurrentFrame.isFBComposed[index]) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1043 | int mdpIndex = mCurrentFrame.layerToMDP[index]; |
| 1044 | hwc_layer_1_t* layer = &list->hwLayers[index]; |
| 1045 | |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 1046 | //Leave fbZ for framebuffer. CACHE/GLES layers go here. |
| 1047 | if(mdpNextZOrder == mCurrentFrame.fbZ) { |
| 1048 | mdpNextZOrder++; |
| 1049 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1050 | MdpPipeInfo* cur_pipe = mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo; |
| 1051 | cur_pipe->zOrder = mdpNextZOrder++; |
| 1052 | |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 1053 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1054 | if(configure(ctx, layer, mCurrentFrame.mdpToLayer[mdpIndex]) != 0 ){ |
| 1055 | ALOGD_IF(isDebug(), "%s: Failed to configure overlay for \ |
| 1056 | layer %d",__FUNCTION__, index); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 1057 | return false; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1058 | } |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 1059 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1060 | } |
| 1061 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 1062 | return true; |
| 1063 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1064 | |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 1065 | bool MDPComp::programYUV(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
| 1066 | if(!allocLayerPipes(ctx, list)) { |
| 1067 | ALOGD_IF(isDebug(), "%s: Unable to allocate MDP pipes", __FUNCTION__); |
| 1068 | return false; |
| 1069 | } |
| 1070 | //If we are in this block, it means we have yuv + rgb layers both |
| 1071 | int mdpIdx = 0; |
| 1072 | for (int index = 0; index < mCurrentFrame.layerCount; index++) { |
| 1073 | if(!mCurrentFrame.isFBComposed[index]) { |
| 1074 | hwc_layer_1_t* layer = &list->hwLayers[index]; |
| 1075 | int mdpIndex = mCurrentFrame.layerToMDP[index]; |
| 1076 | MdpPipeInfo* cur_pipe = |
| 1077 | mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo; |
| 1078 | cur_pipe->zOrder = mdpIdx++; |
| 1079 | |
| 1080 | if(configure(ctx, layer, |
| 1081 | mCurrentFrame.mdpToLayer[mdpIndex]) != 0 ){ |
| 1082 | ALOGD_IF(isDebug(), "%s: Failed to configure overlay for \ |
| 1083 | layer %d",__FUNCTION__, index); |
| 1084 | return false; |
| 1085 | } |
| 1086 | } |
| 1087 | } |
| 1088 | return true; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1089 | } |
| 1090 | |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1091 | uint32_t MDPComp::calcMDPBytesRead(hwc_context_t *ctx, |
| 1092 | hwc_display_contents_1_t* list) { |
| 1093 | uint32_t size = 0; |
| 1094 | |
Terence Hampson | 9cd5fa9 | 2013-09-10 17:06:37 -0400 | [diff] [blame] | 1095 | if(!qdutils::MDPVersion::getInstance().is8x74v2()) |
| 1096 | return 0; |
| 1097 | |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1098 | for (uint32_t i = 0; i < list->numHwLayers - 1; i++) { |
| 1099 | if(!mCurrentFrame.isFBComposed[i]) { |
| 1100 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
| 1101 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
Terence Hampson | 9cd5fa9 | 2013-09-10 17:06:37 -0400 | [diff] [blame] | 1102 | if (hnd) { |
Saurabh Shah | 62e1d73 | 2013-09-17 10:44:05 -0700 | [diff] [blame] | 1103 | hwc_rect_t crop = integerizeSourceCrop(layer->sourceCropf); |
Saurabh Shah | 9078916 | 2013-09-16 10:29:20 -0700 | [diff] [blame] | 1104 | hwc_rect_t dst = layer->displayFrame; |
| 1105 | trimLayer(ctx, mDpy, layer->transform, crop, dst); |
Terence Hampson | 9cd5fa9 | 2013-09-10 17:06:37 -0400 | [diff] [blame] | 1106 | float bpp = ((float)hnd->size) / (hnd->width * hnd->height); |
Saurabh Shah | 9078916 | 2013-09-16 10:29:20 -0700 | [diff] [blame] | 1107 | size += bpp * (crop.right - crop.left) * |
| 1108 | (crop.bottom - crop.top) * |
| 1109 | ctx->dpyAttr[mDpy].yres / (dst.bottom - dst.top); |
Terence Hampson | 9cd5fa9 | 2013-09-10 17:06:37 -0400 | [diff] [blame] | 1110 | } |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1111 | } |
| 1112 | } |
| 1113 | |
| 1114 | if(mCurrentFrame.fbCount) { |
| 1115 | hwc_layer_1_t* layer = &list->hwLayers[list->numHwLayers - 1]; |
| 1116 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
Terence Hampson | 9cd5fa9 | 2013-09-10 17:06:37 -0400 | [diff] [blame] | 1117 | if (hnd) |
| 1118 | size += hnd->size; |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1119 | } |
| 1120 | |
| 1121 | return size; |
| 1122 | } |
| 1123 | |
| 1124 | bool MDPComp::bandwidthCheck(hwc_context_t *ctx, const uint32_t& size) { |
| 1125 | //Will be added for other targets if we run into bandwidth issues and when |
| 1126 | //we have profiling data to set an upper limit. |
| 1127 | if(qdutils::MDPVersion::getInstance().is8x74v2()) { |
| 1128 | const uint32_t ONE_GIG = 1024 * 1024 * 1024; |
| 1129 | double panelRefRate = |
| 1130 | 1000000000.0 / ctx->dpyAttr[mDpy].vsync_period; |
| 1131 | if((size + sCompBytesClaimed) > ((sMaxBw / panelRefRate) * ONE_GIG)) { |
| 1132 | return false; |
| 1133 | } |
| 1134 | } |
| 1135 | return true; |
| 1136 | } |
| 1137 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1138 | int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1139 | int ret = 0; |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 1140 | const int numLayers = ctx->listStats[mDpy].numAppLayers; |
Ramkumar Radhakrishnan | c5893f1 | 2013-06-06 19:43:53 -0700 | [diff] [blame] | 1141 | |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1142 | //reset old data |
| 1143 | mCurrentFrame.reset(numLayers); |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 1144 | memset(&mCurrentFrame.drop, 0, sizeof(mCurrentFrame.drop)); |
| 1145 | mCurrentFrame.dropCount = 0; |
Prabhanjan Kandula | 088bd89 | 2013-07-02 23:47:13 +0530 | [diff] [blame] | 1146 | |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1147 | //number of app layers exceeds MAX_NUM_APP_LAYERS fall back to GPU |
| 1148 | //do not cache the information for next draw cycle. |
| 1149 | if(numLayers > MAX_NUM_APP_LAYERS) { |
Prabhanjan Kandula | 25469a5 | 2013-07-12 16:19:31 +0530 | [diff] [blame] | 1150 | mCachedFrame.updateCounts(mCurrentFrame); |
Tatenda Chipeperekwa | 835337a | 2013-09-27 16:58:43 -0700 | [diff] [blame] | 1151 | ALOGE("%s: Number of App layers exceeded the limit ", |
| 1152 | __FUNCTION__); |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1153 | ret = -1; |
Tatenda Chipeperekwa | 835337a | 2013-09-27 16:58:43 -0700 | [diff] [blame] | 1154 | return ret; |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1155 | } |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1156 | |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1157 | //Hard conditions, if not met, cannot do MDP comp |
| 1158 | if(!isFrameDoable(ctx)) { |
| 1159 | ALOGD_IF( isDebug(),"%s: MDP Comp not possible for this frame", |
| 1160 | __FUNCTION__); |
| 1161 | reset(numLayers, list); |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1162 | ret = -1; |
| 1163 | goto exit; |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1164 | } |
| 1165 | |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 1166 | generateROI(ctx, list); |
| 1167 | |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1168 | //Check whether layers marked for MDP Composition is actually doable. |
| 1169 | if(isFullFrameDoable(ctx, list)) { |
| 1170 | mCurrentFrame.map(); |
| 1171 | //Configure framebuffer first if applicable |
| 1172 | if(mCurrentFrame.fbZ >= 0) { |
| 1173 | if(!ctx->mFBUpdate[mDpy]->prepare(ctx, list, |
| 1174 | mCurrentFrame.fbZ)) { |
| 1175 | ALOGE("%s configure framebuffer failed", __func__); |
| 1176 | reset(numLayers, list); |
Saurabh Shah | 6be7c78 | 2013-08-28 15:13:52 -0700 | [diff] [blame] | 1177 | ctx->mOverlay->clear(mDpy); |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1178 | ret = -1; |
| 1179 | goto exit; |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1180 | } |
| 1181 | } |
| 1182 | //Acquire and Program MDP pipes |
| 1183 | if(!programMDP(ctx, list)) { |
| 1184 | reset(numLayers, list); |
Saurabh Shah | 6be7c78 | 2013-08-28 15:13:52 -0700 | [diff] [blame] | 1185 | ctx->mOverlay->clear(mDpy); |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1186 | ret = -1; |
| 1187 | goto exit; |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1188 | } else { //Success |
| 1189 | //Any change in composition types needs an FB refresh |
| 1190 | mCurrentFrame.needsRedraw = false; |
Prabhanjan Kandula | 2243aa6 | 2013-10-24 12:58:55 +0530 | [diff] [blame] | 1191 | if(!mCachedFrame.isSameFrame(mCurrentFrame) || |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1192 | (list->flags & HWC_GEOMETRY_CHANGED) || |
Prabhanjan Kandula | 2243aa6 | 2013-10-24 12:58:55 +0530 | [diff] [blame] | 1193 | isSkipPresent(ctx, mDpy)) { |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1194 | mCurrentFrame.needsRedraw = true; |
| 1195 | } |
| 1196 | } |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 1197 | } else if(isOnlyVideoDoable(ctx, list, false /*secure only*/) || |
| 1198 | isOnlyVideoDoable(ctx, list, true /*secure only*/)) { |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1199 | //All layers marked for MDP comp cannot be bypassed. |
| 1200 | //Try to compose atleast YUV layers through MDP comp and let |
| 1201 | //all the RGB layers compose in FB |
| 1202 | //Destination over |
| 1203 | mCurrentFrame.fbZ = -1; |
| 1204 | if(mCurrentFrame.fbCount) |
| 1205 | mCurrentFrame.fbZ = mCurrentFrame.mdpCount; |
| 1206 | |
| 1207 | mCurrentFrame.map(); |
| 1208 | |
| 1209 | //Configure framebuffer first if applicable |
| 1210 | if(mCurrentFrame.fbZ >= 0) { |
| 1211 | if(!ctx->mFBUpdate[mDpy]->prepare(ctx, list, mCurrentFrame.fbZ)) { |
| 1212 | ALOGE("%s configure framebuffer failed", __func__); |
| 1213 | reset(numLayers, list); |
Saurabh Shah | 6be7c78 | 2013-08-28 15:13:52 -0700 | [diff] [blame] | 1214 | ctx->mOverlay->clear(mDpy); |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1215 | ret = -1; |
| 1216 | goto exit; |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1217 | } |
| 1218 | } |
| 1219 | if(!programYUV(ctx, list)) { |
| 1220 | reset(numLayers, list); |
Saurabh Shah | 6be7c78 | 2013-08-28 15:13:52 -0700 | [diff] [blame] | 1221 | ctx->mOverlay->clear(mDpy); |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1222 | ret = -1; |
| 1223 | goto exit; |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1224 | } |
| 1225 | } else { |
| 1226 | reset(numLayers, list); |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1227 | ret = -1; |
| 1228 | goto exit; |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1229 | } |
| 1230 | |
| 1231 | //UpdateLayerFlags |
| 1232 | setMDPCompLayerFlags(ctx, list); |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 1233 | mCachedFrame.cacheAll(list); |
Saurabh Shah | b39f815 | 2013-08-22 10:21:44 -0700 | [diff] [blame] | 1234 | mCachedFrame.updateCounts(mCurrentFrame); |
| 1235 | |
Prabhanjan Kandula | 25469a5 | 2013-07-12 16:19:31 +0530 | [diff] [blame] | 1236 | // unlock it before calling dump function to avoid deadlock |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1237 | if(isDebug()) { |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 1238 | ALOGD("GEOMETRY change: %d", (list->flags & HWC_GEOMETRY_CHANGED)); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1239 | android::String8 sDump(""); |
| 1240 | dump(sDump); |
| 1241 | ALOGE("%s",sDump.string()); |
| 1242 | } |
| 1243 | |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 1244 | exit: |
| 1245 | sCompBytesClaimed += calcMDPBytesRead(ctx, list); |
| 1246 | return ret; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1247 | } |
| 1248 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1249 | //=============MDPCompNonSplit=================================================== |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1250 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1251 | /* |
| 1252 | * Configures pipe(s) for MDP composition |
| 1253 | */ |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1254 | int MDPCompNonSplit::configure(hwc_context_t *ctx, hwc_layer_1_t *layer, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1255 | PipeLayerPair& PipeLayerPair) { |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1256 | MdpPipeInfoNonSplit& mdp_info = |
| 1257 | *(static_cast<MdpPipeInfoNonSplit*>(PipeLayerPair.pipeInfo)); |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1258 | eMdpFlags mdpFlags = OV_MDP_BACKEND_COMPOSITION; |
| 1259 | eZorder zOrder = static_cast<eZorder>(mdp_info.zOrder); |
| 1260 | eIsFg isFg = IS_FG_OFF; |
| 1261 | eDest dest = mdp_info.index; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1262 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1263 | ALOGD_IF(isDebug(),"%s: configuring: layer: %p z_order: %d dest_pipe: %d", |
| 1264 | __FUNCTION__, layer, zOrder, dest); |
| 1265 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1266 | return configureNonSplit(ctx, layer, mDpy, mdpFlags, zOrder, isFg, dest, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1267 | &PipeLayerPair.rot); |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1268 | } |
| 1269 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1270 | bool MDPCompNonSplit::arePipesAvailable(hwc_context_t *ctx, |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1271 | hwc_display_contents_1_t* list) { |
| 1272 | overlay::Overlay& ov = *ctx->mOverlay; |
| 1273 | int numPipesNeeded = mCurrentFrame.mdpCount; |
| 1274 | int availPipes = ov.availablePipes(mDpy, Overlay::MIXER_DEFAULT); |
| 1275 | |
| 1276 | //Reserve pipe for FB |
| 1277 | if(mCurrentFrame.fbCount) |
| 1278 | availPipes -= 1; |
| 1279 | |
| 1280 | if(numPipesNeeded > availPipes) { |
| 1281 | ALOGD_IF(isDebug(), "%s: Insufficient pipes, dpy %d needed %d, avail %d", |
| 1282 | __FUNCTION__, mDpy, numPipesNeeded, availPipes); |
| 1283 | return false; |
| 1284 | } |
| 1285 | |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 1286 | if(not areVGPipesAvailable(ctx, list)) { |
| 1287 | return false; |
| 1288 | } |
| 1289 | |
| 1290 | return true; |
| 1291 | } |
| 1292 | |
| 1293 | bool MDPCompNonSplit::areVGPipesAvailable(hwc_context_t *ctx, |
| 1294 | hwc_display_contents_1_t* list) { |
| 1295 | overlay::Overlay& ov = *ctx->mOverlay; |
| 1296 | int pipesNeeded = 0; |
| 1297 | for(int i = 0; i < mCurrentFrame.layerCount; ++i) { |
| 1298 | if(!mCurrentFrame.isFBComposed[i]) { |
| 1299 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
| 1300 | hwc_rect_t dst = layer->displayFrame; |
| 1301 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 1302 | if(isYuvBuffer(hnd)) { |
| 1303 | pipesNeeded++; |
| 1304 | } |
| 1305 | } |
| 1306 | } |
| 1307 | |
| 1308 | int availableVGPipes = ov.availablePipes(mDpy, ovutils::OV_MDP_PIPE_VG); |
| 1309 | if(pipesNeeded > availableVGPipes) { |
| 1310 | ALOGD_IF(isDebug(), "%s: Insufficient VG pipes for video layers" |
| 1311 | "dpy %d needed %d, avail %d", |
| 1312 | __FUNCTION__, mDpy, pipesNeeded, availableVGPipes); |
| 1313 | return false; |
| 1314 | } |
| 1315 | |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1316 | return true; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1317 | } |
| 1318 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1319 | bool MDPCompNonSplit::allocLayerPipes(hwc_context_t *ctx, |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1320 | hwc_display_contents_1_t* list) { |
| 1321 | for(int index = 0; index < mCurrentFrame.layerCount; index++) { |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1322 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1323 | if(mCurrentFrame.isFBComposed[index]) continue; |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1324 | |
Jeykumar Sankaran | cf53700 | 2013-01-21 21:19:15 -0800 | [diff] [blame] | 1325 | hwc_layer_1_t* layer = &list->hwLayers[index]; |
| 1326 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1327 | int mdpIndex = mCurrentFrame.layerToMDP[index]; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1328 | PipeLayerPair& info = mCurrentFrame.mdpToLayer[mdpIndex]; |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1329 | info.pipeInfo = new MdpPipeInfoNonSplit; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1330 | info.rot = NULL; |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1331 | MdpPipeInfoNonSplit& pipe_info = *(MdpPipeInfoNonSplit*)info.pipeInfo; |
Jeykumar Sankaran | a37fdbf | 2013-03-06 18:59:28 -0800 | [diff] [blame] | 1332 | ePipeType type = MDPCOMP_OV_ANY; |
| 1333 | |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1334 | if(isYuvBuffer(hnd)) { |
| 1335 | type = MDPCOMP_OV_VG; |
Saurabh Shah | 8a11793 | 2013-05-23 12:48:13 -0700 | [diff] [blame] | 1336 | } else if(!qhwc::needsScaling(ctx, layer, mDpy) |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 1337 | && Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE |
| 1338 | && ctx->mMDP.version >= qdutils::MDSS_V5) { |
Jeykumar Sankaran | a37fdbf | 2013-03-06 18:59:28 -0800 | [diff] [blame] | 1339 | type = MDPCOMP_OV_DMA; |
| 1340 | } |
| 1341 | |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1342 | pipe_info.index = getMdpPipe(ctx, type, Overlay::MIXER_DEFAULT); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1343 | if(pipe_info.index == ovutils::OV_INVALID) { |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1344 | ALOGD_IF(isDebug(), "%s: Unable to get pipe type = %d", |
| 1345 | __FUNCTION__, (int) type); |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 1346 | return false; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1347 | } |
| 1348 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1349 | return true; |
| 1350 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1351 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1352 | bool MDPCompNonSplit::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1353 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1354 | if(!isEnabled()) { |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 1355 | ALOGD_IF(isDebug(),"%s: MDP Comp not configured", __FUNCTION__); |
| 1356 | return true; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 1357 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1358 | |
| 1359 | if(!ctx || !list) { |
| 1360 | ALOGE("%s: invalid contxt or list",__FUNCTION__); |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 1361 | return false; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1362 | } |
| 1363 | |
Prabhanjan Kandula | 08222fc | 2013-07-10 17:20:59 +0530 | [diff] [blame] | 1364 | if(ctx->listStats[mDpy].numAppLayers > MAX_NUM_APP_LAYERS) { |
| 1365 | ALOGD_IF(isDebug(),"%s: Exceeding max layer count", __FUNCTION__); |
| 1366 | return true; |
| 1367 | } |
| 1368 | |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 1369 | /* reset Invalidator */ |
Saurabh Shah | 2d998a9 | 2013-05-14 17:55:58 -0700 | [diff] [blame] | 1370 | if(idleInvalidator && !sIdleFallBack && mCurrentFrame.mdpCount) |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 1371 | idleInvalidator->markForSleep(); |
| 1372 | |
| 1373 | overlay::Overlay& ov = *ctx->mOverlay; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1374 | LayerProp *layerProp = ctx->layerProp[mDpy]; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1375 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1376 | int numHwLayers = ctx->listStats[mDpy].numAppLayers; |
| 1377 | for(int i = 0; i < numHwLayers && mCurrentFrame.mdpCount; i++ ) |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1378 | { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1379 | if(mCurrentFrame.isFBComposed[i]) continue; |
| 1380 | |
Naseer Ahmed | 5b6708a | 2012-08-02 13:46:08 -0700 | [diff] [blame] | 1381 | hwc_layer_1_t *layer = &list->hwLayers[i]; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1382 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 1383 | if(!hnd) { |
| 1384 | ALOGE("%s handle null", __FUNCTION__); |
| 1385 | return false; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1386 | } |
| 1387 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1388 | int mdpIndex = mCurrentFrame.layerToMDP[i]; |
| 1389 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1390 | MdpPipeInfoNonSplit& pipe_info = |
| 1391 | *(MdpPipeInfoNonSplit*)mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1392 | ovutils::eDest dest = pipe_info.index; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1393 | if(dest == ovutils::OV_INVALID) { |
| 1394 | ALOGE("%s: Invalid pipe index (%d)", __FUNCTION__, dest); |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 1395 | return false; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1396 | } |
| 1397 | |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1398 | if(!(layerProp[i].mFlags & HWC_MDPCOMP)) { |
| 1399 | continue; |
| 1400 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1401 | |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1402 | ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1403 | using pipe: %d", __FUNCTION__, layer, |
| 1404 | hnd, dest ); |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1405 | |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1406 | int fd = hnd->fd; |
| 1407 | uint32_t offset = hnd->offset; |
Saurabh Shah | a9da08f | 2013-07-03 13:27:53 -0700 | [diff] [blame] | 1408 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1409 | Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1410 | if(rot) { |
| 1411 | if(!rot->queueBuffer(fd, offset)) |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 1412 | return false; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1413 | fd = rot->getDstMemId(); |
| 1414 | offset = rot->getDstOffset(); |
| 1415 | } |
| 1416 | |
| 1417 | if (!ov.queueBuffer(fd, offset, dest)) { |
Prabhanjan Kandula | 08222fc | 2013-07-10 17:20:59 +0530 | [diff] [blame] | 1418 | ALOGE("%s: queueBuffer failed for display:%d ", __FUNCTION__, mDpy); |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1419 | return false; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1420 | } |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 1421 | |
| 1422 | layerProp[i].mFlags &= ~HWC_MDPCOMP; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1423 | } |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 1424 | return true; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1425 | } |
| 1426 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1427 | //=============MDPCompSplit=================================================== |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1428 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1429 | int MDPCompSplit::pipesNeeded(hwc_context_t *ctx, |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1430 | hwc_display_contents_1_t* list, |
| 1431 | int mixer) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1432 | int pipesNeeded = 0; |
Saurabh Shah | 67a38c3 | 2013-06-10 16:23:15 -0700 | [diff] [blame] | 1433 | const int xres = ctx->dpyAttr[mDpy].xres; |
Saurabh Shah | 07a8ca8 | 2013-08-06 18:45:42 -0700 | [diff] [blame] | 1434 | |
| 1435 | const int lSplit = getLeftSplit(ctx, mDpy); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1436 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1437 | for(int i = 0; i < mCurrentFrame.layerCount; ++i) { |
| 1438 | if(!mCurrentFrame.isFBComposed[i]) { |
| 1439 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
| 1440 | hwc_rect_t dst = layer->displayFrame; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1441 | if(mixer == Overlay::MIXER_LEFT && dst.left < lSplit) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1442 | pipesNeeded++; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1443 | } else if(mixer == Overlay::MIXER_RIGHT && dst.right > lSplit) { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1444 | pipesNeeded++; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1445 | } |
| 1446 | } |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1447 | } |
| 1448 | return pipesNeeded; |
| 1449 | } |
| 1450 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1451 | bool MDPCompSplit::arePipesAvailable(hwc_context_t *ctx, |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1452 | hwc_display_contents_1_t* list) { |
| 1453 | overlay::Overlay& ov = *ctx->mOverlay; |
Saurabh Shah | 082468e | 2013-09-12 10:05:32 -0700 | [diff] [blame] | 1454 | int totalPipesNeeded = 0; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1455 | |
| 1456 | for(int i = 0; i < Overlay::MIXER_MAX; i++) { |
| 1457 | int numPipesNeeded = pipesNeeded(ctx, list, i); |
| 1458 | int availPipes = ov.availablePipes(mDpy, i); |
| 1459 | |
| 1460 | //Reserve pipe(s)for FB |
| 1461 | if(mCurrentFrame.fbCount) |
Saurabh Shah | 082468e | 2013-09-12 10:05:32 -0700 | [diff] [blame] | 1462 | numPipesNeeded += 1; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1463 | |
Saurabh Shah | 082468e | 2013-09-12 10:05:32 -0700 | [diff] [blame] | 1464 | totalPipesNeeded += numPipesNeeded; |
| 1465 | |
| 1466 | //Per mixer check. |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1467 | if(numPipesNeeded > availPipes) { |
| 1468 | ALOGD_IF(isDebug(), "%s: Insufficient pipes for " |
| 1469 | "dpy %d mixer %d needed %d, avail %d", |
| 1470 | __FUNCTION__, mDpy, i, numPipesNeeded, availPipes); |
| 1471 | return false; |
| 1472 | } |
| 1473 | } |
Saurabh Shah | 082468e | 2013-09-12 10:05:32 -0700 | [diff] [blame] | 1474 | |
| 1475 | //Per display check, since unused pipes can get counted twice. |
| 1476 | int totalPipesAvailable = ov.availablePipes(mDpy); |
| 1477 | if(totalPipesNeeded > totalPipesAvailable) { |
| 1478 | ALOGD_IF(isDebug(), "%s: Insufficient pipes for " |
| 1479 | "dpy %d needed %d, avail %d", |
| 1480 | __FUNCTION__, mDpy, totalPipesNeeded, totalPipesAvailable); |
| 1481 | return false; |
| 1482 | } |
| 1483 | |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 1484 | if(not areVGPipesAvailable(ctx, list)) { |
| 1485 | return false; |
| 1486 | } |
| 1487 | |
| 1488 | return true; |
| 1489 | } |
| 1490 | |
| 1491 | bool MDPCompSplit::areVGPipesAvailable(hwc_context_t *ctx, |
| 1492 | hwc_display_contents_1_t* list) { |
| 1493 | overlay::Overlay& ov = *ctx->mOverlay; |
| 1494 | int pipesNeeded = 0; |
| 1495 | const int lSplit = getLeftSplit(ctx, mDpy); |
| 1496 | for(int i = 0; i < mCurrentFrame.layerCount; ++i) { |
| 1497 | if(!mCurrentFrame.isFBComposed[i]) { |
| 1498 | hwc_layer_1_t* layer = &list->hwLayers[i]; |
| 1499 | hwc_rect_t dst = layer->displayFrame; |
| 1500 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 1501 | if(isYuvBuffer(hnd)) { |
| 1502 | if(dst.left < lSplit) { |
| 1503 | pipesNeeded++; |
| 1504 | } |
| 1505 | if(dst.right > lSplit) { |
| 1506 | pipesNeeded++; |
| 1507 | } |
| 1508 | } |
| 1509 | } |
| 1510 | } |
| 1511 | |
| 1512 | int availableVGPipes = ov.availablePipes(mDpy, ovutils::OV_MDP_PIPE_VG); |
| 1513 | if(pipesNeeded > availableVGPipes) { |
| 1514 | ALOGD_IF(isDebug(), "%s: Insufficient VG pipes for video layers" |
| 1515 | "dpy %d needed %d, avail %d", |
| 1516 | __FUNCTION__, mDpy, pipesNeeded, availableVGPipes); |
| 1517 | return false; |
| 1518 | } |
| 1519 | |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1520 | return true; |
| 1521 | } |
| 1522 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1523 | bool MDPCompSplit::acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer, |
| 1524 | MdpPipeInfoSplit& pipe_info, |
Saurabh Shah | 67a38c3 | 2013-06-10 16:23:15 -0700 | [diff] [blame] | 1525 | ePipeType type) { |
| 1526 | const int xres = ctx->dpyAttr[mDpy].xres; |
Saurabh Shah | 07a8ca8 | 2013-08-06 18:45:42 -0700 | [diff] [blame] | 1527 | const int lSplit = getLeftSplit(ctx, mDpy); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1528 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1529 | hwc_rect_t dst = layer->displayFrame; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1530 | pipe_info.lIndex = ovutils::OV_INVALID; |
| 1531 | pipe_info.rIndex = ovutils::OV_INVALID; |
| 1532 | |
| 1533 | if (dst.left < lSplit) { |
| 1534 | pipe_info.lIndex = getMdpPipe(ctx, type, Overlay::MIXER_LEFT); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1535 | if(pipe_info.lIndex == ovutils::OV_INVALID) |
| 1536 | return false; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1537 | } |
| 1538 | |
| 1539 | if(dst.right > lSplit) { |
| 1540 | pipe_info.rIndex = getMdpPipe(ctx, type, Overlay::MIXER_RIGHT); |
| 1541 | if(pipe_info.rIndex == ovutils::OV_INVALID) |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1542 | return false; |
| 1543 | } |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1544 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1545 | return true; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1546 | } |
| 1547 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1548 | bool MDPCompSplit::allocLayerPipes(hwc_context_t *ctx, |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1549 | hwc_display_contents_1_t* list) { |
| 1550 | for(int index = 0 ; index < mCurrentFrame.layerCount; index++) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1551 | |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1552 | if(mCurrentFrame.isFBComposed[index]) continue; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1553 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1554 | hwc_layer_1_t* layer = &list->hwLayers[index]; |
| 1555 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
Saurabh Shah | 0d65dbe | 2013-06-06 18:33:16 -0700 | [diff] [blame] | 1556 | int mdpIndex = mCurrentFrame.layerToMDP[index]; |
| 1557 | PipeLayerPair& info = mCurrentFrame.mdpToLayer[mdpIndex]; |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1558 | info.pipeInfo = new MdpPipeInfoSplit; |
Saurabh Shah | 9e3adb2 | 2013-03-26 11:16:27 -0700 | [diff] [blame] | 1559 | info.rot = NULL; |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1560 | MdpPipeInfoSplit& pipe_info = *(MdpPipeInfoSplit*)info.pipeInfo; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1561 | ePipeType type = MDPCOMP_OV_ANY; |
| 1562 | |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1563 | if(isYuvBuffer(hnd)) { |
| 1564 | type = MDPCOMP_OV_VG; |
Sushil Chauhan | 15a2ea6 | 2013-09-04 18:28:36 -0700 | [diff] [blame] | 1565 | } else if(!qhwc::needsScalingWithSplit(ctx, layer, mDpy) |
Saurabh Shah | 85234ec | 2013-04-12 17:09:00 -0700 | [diff] [blame] | 1566 | && Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1567 | && ctx->mMDP.version >= qdutils::MDSS_V5) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1568 | type = MDPCOMP_OV_DMA; |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1569 | } |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1570 | |
| 1571 | if(!acquireMDPPipes(ctx, layer, pipe_info, type)) { |
Saurabh Shah | e51f8ca | 2013-05-06 17:26:16 -0700 | [diff] [blame] | 1572 | ALOGD_IF(isDebug(), "%s: Unable to get pipe for type = %d", |
| 1573 | __FUNCTION__, (int) type); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1574 | return false; |
| 1575 | } |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1576 | } |
| 1577 | return true; |
| 1578 | } |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 1579 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1580 | /* |
| 1581 | * Configures pipe(s) for MDP composition |
| 1582 | */ |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1583 | int MDPCompSplit::configure(hwc_context_t *ctx, hwc_layer_1_t *layer, |
Saurabh Shah | 67a38c3 | 2013-06-10 16:23:15 -0700 | [diff] [blame] | 1584 | PipeLayerPair& PipeLayerPair) { |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1585 | MdpPipeInfoSplit& mdp_info = |
| 1586 | *(static_cast<MdpPipeInfoSplit*>(PipeLayerPair.pipeInfo)); |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1587 | eZorder zOrder = static_cast<eZorder>(mdp_info.zOrder); |
| 1588 | eIsFg isFg = IS_FG_OFF; |
| 1589 | eMdpFlags mdpFlagsL = OV_MDP_BACKEND_COMPOSITION; |
| 1590 | eDest lDest = mdp_info.lIndex; |
| 1591 | eDest rDest = mdp_info.rIndex; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1592 | |
| 1593 | ALOGD_IF(isDebug(),"%s: configuring: layer: %p z_order: %d dest_pipeL: %d" |
| 1594 | "dest_pipeR: %d",__FUNCTION__, layer, zOrder, lDest, rDest); |
| 1595 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1596 | return configureSplit(ctx, layer, mDpy, mdpFlagsL, zOrder, isFg, lDest, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1597 | rDest, &PipeLayerPair.rot); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1598 | } |
| 1599 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1600 | bool MDPCompSplit::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1601 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1602 | if(!isEnabled()) { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1603 | ALOGD_IF(isDebug(),"%s: MDP Comp not configured", __FUNCTION__); |
| 1604 | return true; |
| 1605 | } |
| 1606 | |
| 1607 | if(!ctx || !list) { |
| 1608 | ALOGE("%s: invalid contxt or list",__FUNCTION__); |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1609 | return false; |
| 1610 | } |
| 1611 | |
Prabhanjan Kandula | 08222fc | 2013-07-10 17:20:59 +0530 | [diff] [blame] | 1612 | if(ctx->listStats[mDpy].numAppLayers > MAX_NUM_APP_LAYERS) { |
| 1613 | ALOGD_IF(isDebug(),"%s: Exceeding max layer count", __FUNCTION__); |
| 1614 | return true; |
| 1615 | } |
| 1616 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1617 | /* reset Invalidator */ |
Saurabh Shah | 2d998a9 | 2013-05-14 17:55:58 -0700 | [diff] [blame] | 1618 | if(idleInvalidator && !sIdleFallBack && mCurrentFrame.mdpCount) |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1619 | idleInvalidator->markForSleep(); |
| 1620 | |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 1621 | overlay::Overlay& ov = *ctx->mOverlay; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1622 | LayerProp *layerProp = ctx->layerProp[mDpy]; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1623 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1624 | int numHwLayers = ctx->listStats[mDpy].numAppLayers; |
| 1625 | for(int i = 0; i < numHwLayers && mCurrentFrame.mdpCount; i++ ) |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1626 | { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1627 | if(mCurrentFrame.isFBComposed[i]) continue; |
| 1628 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1629 | hwc_layer_1_t *layer = &list->hwLayers[i]; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1630 | private_handle_t *hnd = (private_handle_t *)layer->handle; |
| 1631 | if(!hnd) { |
| 1632 | ALOGE("%s handle null", __FUNCTION__); |
| 1633 | return false; |
| 1634 | } |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1635 | |
| 1636 | if(!(layerProp[i].mFlags & HWC_MDPCOMP)) { |
| 1637 | continue; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1638 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1639 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1640 | int mdpIndex = mCurrentFrame.layerToMDP[i]; |
| 1641 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 1642 | MdpPipeInfoSplit& pipe_info = |
| 1643 | *(MdpPipeInfoSplit*)mCurrentFrame.mdpToLayer[mdpIndex].pipeInfo; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1644 | Rotator *rot = mCurrentFrame.mdpToLayer[mdpIndex].rot; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1645 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1646 | ovutils::eDest indexL = pipe_info.lIndex; |
| 1647 | ovutils::eDest indexR = pipe_info.rIndex; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1648 | |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1649 | int fd = hnd->fd; |
| 1650 | int offset = hnd->offset; |
| 1651 | |
Saurabh Shah | a9da08f | 2013-07-03 13:27:53 -0700 | [diff] [blame] | 1652 | if(ctx->mAD->isModeOn()) { |
| 1653 | if(ctx->mAD->draw(ctx, fd, offset)) { |
| 1654 | fd = ctx->mAD->getDstFd(ctx); |
| 1655 | offset = ctx->mAD->getDstOffset(ctx); |
| 1656 | } |
| 1657 | } |
| 1658 | |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1659 | if(rot) { |
| 1660 | rot->queueBuffer(fd, offset); |
| 1661 | fd = rot->getDstMemId(); |
| 1662 | offset = rot->getDstOffset(); |
| 1663 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1664 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1665 | //************* play left mixer ********** |
| 1666 | if(indexL != ovutils::OV_INVALID) { |
| 1667 | ovutils::eDest destL = (ovutils::eDest)indexL; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1668 | ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1669 | using pipe: %d", __FUNCTION__, layer, hnd, indexL ); |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1670 | if (!ov.queueBuffer(fd, offset, destL)) { |
| 1671 | ALOGE("%s: queueBuffer failed for left mixer", __FUNCTION__); |
| 1672 | return false; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1673 | } |
| 1674 | } |
| 1675 | |
| 1676 | //************* play right mixer ********** |
| 1677 | if(indexR != ovutils::OV_INVALID) { |
| 1678 | ovutils::eDest destR = (ovutils::eDest)indexR; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1679 | ALOGD_IF(isDebug(),"%s: MDP Comp: Drawing layer: %p hnd: %p \ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 1680 | using pipe: %d", __FUNCTION__, layer, hnd, indexR ); |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1681 | if (!ov.queueBuffer(fd, offset, destR)) { |
| 1682 | ALOGE("%s: queueBuffer failed for right mixer", __FUNCTION__); |
| 1683 | return false; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1684 | } |
| 1685 | } |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1686 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1687 | layerProp[i].mFlags &= ~HWC_MDPCOMP; |
| 1688 | } |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 1689 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 1690 | return true; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1691 | } |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 1692 | }; //namespace |
| 1693 | |