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. |
| 3 | * |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 4 | * Not a Contribution, Apache license notifications and license are retained |
| 5 | * for attribution purposes only. |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | */ |
| 19 | |
| 20 | #ifndef HWC_MDP_COMP |
| 21 | #define HWC_MDP_COMP |
| 22 | |
| 23 | #include <hwc_utils.h> |
| 24 | #include <idle_invalidator.h> |
| 25 | #include <cutils/properties.h> |
| 26 | #include <overlay.h> |
| 27 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 28 | #define DEFAULT_IDLE_TIME 2000 |
Sushil Chauhan | 69f2bb2 | 2013-02-13 10:50:47 -0800 | [diff] [blame] | 29 | #define MAX_PIPES_PER_MIXER 4 |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 30 | |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 31 | namespace overlay { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 32 | class Rotator; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 33 | }; |
| 34 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 35 | namespace qhwc { |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 36 | namespace ovutils = overlay::utils; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 37 | |
| 38 | class MDPComp { |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 39 | public: |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 40 | explicit MDPComp(int); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 41 | virtual ~MDPComp(){}; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 42 | /*sets up mdp comp for the current frame */ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 43 | int prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 44 | /* draw */ |
| 45 | virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list) = 0; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 46 | /* dumpsys */ |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 47 | void dump(android::String8& buf); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 48 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 49 | static MDPComp* getObject(hwc_context_t *ctx, const int& dpy); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 50 | /* Handler to invoke frame redraw on Idle Timer expiry */ |
| 51 | static void timeout_handler(void *udata); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 52 | /* Initialize MDP comp*/ |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 53 | static bool init(hwc_context_t *ctx); |
Saurabh Shah | 98acd09 | 2013-05-03 10:48:24 -0700 | [diff] [blame] | 54 | static void resetIdleFallBack() { sIdleFallBack = false; } |
Saurabh Shah | 3c1a6b0 | 2013-11-22 11:10:20 -0800 | [diff] [blame] | 55 | static void reset() { sBwClaimed = 0.0; }; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 56 | |
| 57 | protected: |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 58 | enum { MAX_SEC_LAYERS = 1 }; //TODO add property support |
| 59 | |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 60 | enum ePipeType { |
| 61 | MDPCOMP_OV_RGB = ovutils::OV_MDP_PIPE_RGB, |
| 62 | MDPCOMP_OV_VG = ovutils::OV_MDP_PIPE_VG, |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 63 | MDPCOMP_OV_DMA = ovutils::OV_MDP_PIPE_DMA, |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 64 | MDPCOMP_OV_ANY, |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 65 | }; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 66 | |
| 67 | /* mdp pipe data */ |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 68 | struct MdpPipeInfo { |
| 69 | int zOrder; |
| 70 | virtual ~MdpPipeInfo(){}; |
| 71 | }; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 72 | |
radhakrishna | c9a6741 | 2013-09-25 17:40:42 +0530 | [diff] [blame] | 73 | struct MdpYUVPipeInfo : public MdpPipeInfo{ |
| 74 | ovutils::eDest lIndex; |
| 75 | ovutils::eDest rIndex; |
| 76 | virtual ~MdpYUVPipeInfo(){}; |
| 77 | }; |
| 78 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 79 | /* per layer data */ |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 80 | struct PipeLayerPair { |
| 81 | MdpPipeInfo *pipeInfo; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 82 | overlay::Rotator* rot; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 83 | int listIndex; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 84 | }; |
| 85 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 86 | /* per frame data */ |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 87 | struct FrameInfo { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 88 | /* maps layer list to mdp list */ |
| 89 | int layerCount; |
Ramkumar Radhakrishnan | e661f96 | 2013-06-05 17:21:38 -0700 | [diff] [blame] | 90 | int layerToMDP[MAX_NUM_APP_LAYERS]; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 91 | |
| 92 | /* maps mdp list to layer list */ |
| 93 | int mdpCount; |
| 94 | struct PipeLayerPair mdpToLayer[MAX_PIPES_PER_MIXER]; |
| 95 | |
| 96 | /* layer composing on FB? */ |
| 97 | int fbCount; |
Ramkumar Radhakrishnan | e661f96 | 2013-06-05 17:21:38 -0700 | [diff] [blame] | 98 | bool isFBComposed[MAX_NUM_APP_LAYERS]; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 99 | /* layers lying outside ROI. Will |
| 100 | * be dropped off from the composition */ |
| 101 | int dropCount; |
| 102 | bool drop[MAX_NUM_APP_LAYERS]; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 103 | |
| 104 | bool needsRedraw; |
| 105 | int fbZ; |
| 106 | |
| 107 | /* c'tor */ |
| 108 | FrameInfo(); |
| 109 | /* clear old frame data */ |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 110 | void reset(const int& numLayers); |
| 111 | void map(); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 112 | }; |
| 113 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 114 | /* cached data */ |
| 115 | struct LayerCache { |
| 116 | int layerCount; |
Ramkumar Radhakrishnan | e661f96 | 2013-06-05 17:21:38 -0700 | [diff] [blame] | 117 | buffer_handle_t hnd[MAX_NUM_APP_LAYERS]; |
Prabhanjan Kandula | 2243aa6 | 2013-10-24 12:58:55 +0530 | [diff] [blame] | 118 | bool isFBComposed[MAX_NUM_APP_LAYERS]; |
| 119 | bool drop[MAX_NUM_APP_LAYERS]; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 120 | |
| 121 | /* c'tor */ |
| 122 | LayerCache(); |
| 123 | /* clear caching info*/ |
| 124 | void reset(); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 125 | void cacheAll(hwc_display_contents_1_t* list); |
| 126 | void updateCounts(const FrameInfo&); |
Jeykumar Sankaran | 988d368 | 2013-11-15 11:57:16 -0800 | [diff] [blame] | 127 | bool isSameFrame(const FrameInfo& curFrame, |
| 128 | hwc_display_contents_1_t* list); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 129 | }; |
| 130 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 131 | /* allocates pipe from pipe book */ |
| 132 | virtual bool allocLayerPipes(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 133 | hwc_display_contents_1_t* list) = 0; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 134 | /* allocate MDP pipes from overlay */ |
| 135 | ovutils::eDest getMdpPipe(hwc_context_t *ctx, ePipeType type, int mixer); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 136 | /* configures MPD pipes */ |
| 137 | virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 138 | PipeLayerPair& pipeLayerPair) = 0; |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 139 | /* Checks for pipes needed versus pipes available */ |
| 140 | virtual bool arePipesAvailable(hwc_context_t *ctx, |
| 141 | hwc_display_contents_1_t* list) = 0; |
radhakrishna | c9a6741 | 2013-09-25 17:40:42 +0530 | [diff] [blame] | 142 | /* increments mdpCount if 4k2k yuv layer split is enabled*/ |
| 143 | virtual void modifymdpCountfor4k2k(hwc_context_t *ctx, |
| 144 | hwc_display_contents_1_t* list) = 0; |
| 145 | /* configures 4kx2k yuv layer*/ |
| 146 | virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer, |
| 147 | PipeLayerPair& PipeLayerPair) = 0; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 148 | /* set/reset flags for MDPComp */ |
| 149 | void setMDPCompLayerFlags(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 150 | hwc_display_contents_1_t* list); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 151 | /* checks for conditions where mdpcomp is not possible */ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 152 | bool isFrameDoable(hwc_context_t *ctx); |
| 153 | /* checks for conditions where RGB layers cannot be bypassed */ |
| 154 | bool isFullFrameDoable(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 155 | /* checks if full MDP comp can be done */ |
| 156 | bool fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
| 157 | /* check if we can use layer cache to do at least partial MDP comp */ |
| 158 | bool partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | 8028e3b | 2013-10-15 12:27:59 -0700 | [diff] [blame] | 159 | /* Partial MDP comp that uses caching to save power as primary goal */ |
| 160 | bool cacheBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | b772ae3 | 2013-11-18 15:40:02 -0800 | [diff] [blame] | 161 | /* Partial MDP comp that prefers GPU perf-wise. Since the GPU's |
| 162 | * perf is proportional to the pixels it processes, we use the number of |
| 163 | * pixels as a heuristic */ |
| 164 | bool loadBasedCompPreferGPU(hwc_context_t *ctx, |
| 165 | hwc_display_contents_1_t* list); |
| 166 | /* Partial MDP comp that prefers MDP perf-wise. Since the MDP's perf is |
| 167 | * proportional to the bandwidth, overlaps it sees, we use that as a |
| 168 | * heuristic */ |
| 169 | bool loadBasedCompPreferMDP(hwc_context_t *ctx, |
| 170 | hwc_display_contents_1_t* list); |
Saurabh Shah | 8028e3b | 2013-10-15 12:27:59 -0700 | [diff] [blame] | 171 | /* Checks if its worth doing load based partial comp */ |
| 172 | bool isLoadBasedCompDoable(hwc_context_t *ctx, |
| 173 | hwc_display_contents_1_t* list); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 174 | /* checks for conditions where only video can be bypassed */ |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 175 | bool isOnlyVideoDoable(hwc_context_t *ctx, hwc_display_contents_1_t* list, |
| 176 | bool secureOnly); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 177 | /* checks for conditions where YUV layers cannot be bypassed */ |
| 178 | bool isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer); |
Saurabh Shah | f5f2b13 | 2013-11-25 12:08:35 -0800 | [diff] [blame] | 179 | /* calcs bytes read by MDP in gigs for a given frame */ |
| 180 | double calcMDPBytesRead(hwc_context_t *ctx, |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 181 | hwc_display_contents_1_t* list); |
| 182 | /* checks if the required bandwidth exceeds a certain max */ |
Saurabh Shah | f5f2b13 | 2013-11-25 12:08:35 -0800 | [diff] [blame] | 183 | bool bandwidthCheck(hwc_context_t *ctx, const double& size); |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 184 | /* generates ROI based on the modified area of the frame */ |
| 185 | void generateROI(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
| 186 | bool validateAndApplyROI(hwc_context_t *ctx, hwc_display_contents_1_t* list, |
| 187 | hwc_rect_t roi); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 188 | |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 189 | /* Is debug enabled */ |
| 190 | static bool isDebug() { return sDebugLogs ? true : false; }; |
| 191 | /* Is feature enabled */ |
| 192 | static bool isEnabled() { return sEnabled; }; |
Sravan Kumar D.V.N | ad5d929 | 2013-04-24 14:23:04 +0530 | [diff] [blame] | 193 | /* checks for mdp comp dimension limitation */ |
| 194 | bool isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 195 | /* tracks non updating layers*/ |
| 196 | void updateLayerCache(hwc_context_t* ctx, hwc_display_contents_1_t* list); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 197 | /* optimize layers for mdp comp*/ |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 198 | bool markLayersForCaching(hwc_context_t* ctx, |
| 199 | hwc_display_contents_1_t* list); |
| 200 | int getBatch(hwc_display_contents_1_t* list, |
| 201 | int& maxBatchStart, int& maxBatchEnd, |
| 202 | int& maxBatchCount); |
| 203 | bool canPushBatchToTop(const hwc_display_contents_1_t* list, |
| 204 | int fromIndex, int toIndex); |
| 205 | bool intersectingUpdatingLayers(const hwc_display_contents_1_t* list, |
| 206 | int fromIndex, int toIndex, int targetLayerIndex); |
| 207 | |
| 208 | /* updates cache map with YUV info */ |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 209 | void updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list, |
| 210 | bool secureOnly); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 211 | bool programMDP(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
| 212 | bool programYUV(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | 2a4eb1b | 2013-07-22 16:33:23 -0700 | [diff] [blame] | 213 | void reset(const int& numAppLayers, hwc_display_contents_1_t* list); |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 214 | bool isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer); |
Saurabh Shah | 173f424 | 2013-11-20 09:50:12 -0800 | [diff] [blame] | 215 | bool resourceCheck(hwc_context_t *ctx, hwc_display_contents_1_t *list); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 216 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 217 | int mDpy; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 218 | static bool sEnabled; |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 219 | static bool sEnableMixedMode; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 220 | /* Enables Partial frame composition */ |
| 221 | static bool sEnablePartialFrameUpdate; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 222 | static bool sDebugLogs; |
| 223 | static bool sIdleFallBack; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 224 | static int sMaxPipesPerMixer; |
Saurabh Shah | 8c5c852 | 2013-08-29 17:32:49 -0700 | [diff] [blame] | 225 | //Max bandwidth. Value is in GBPS. For ex: 2.3 means 2.3GBPS |
Saurabh Shah | f5f2b13 | 2013-11-25 12:08:35 -0800 | [diff] [blame] | 226 | static double sMaxBw; |
Saurabh Shah | 3c1a6b0 | 2013-11-22 11:10:20 -0800 | [diff] [blame] | 227 | //Tracks composition bandwidth claimed. Represented as the total |
| 228 | //w*h*bpp*fps (gigabytes-per-second) going to MDP mixers. |
| 229 | static double sBwClaimed; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 230 | static IdleInvalidator *idleInvalidator; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 231 | struct FrameInfo mCurrentFrame; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 232 | struct LayerCache mCachedFrame; |
radhakrishna | c9a6741 | 2013-09-25 17:40:42 +0530 | [diff] [blame] | 233 | //Enable 4kx2k yuv layer split |
| 234 | static bool sEnable4k2kYUVSplit; |
| 235 | bool allocSplitVGPipesfor4k2k(hwc_context_t *ctx, |
| 236 | hwc_display_contents_1_t* list, int index); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 237 | }; |
| 238 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 239 | class MDPCompNonSplit : public MDPComp { |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 240 | public: |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 241 | explicit MDPCompNonSplit(int dpy):MDPComp(dpy){}; |
| 242 | virtual ~MDPCompNonSplit(){}; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 243 | virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 244 | |
| 245 | private: |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 246 | struct MdpPipeInfoNonSplit : public MdpPipeInfo { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 247 | ovutils::eDest index; |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 248 | virtual ~MdpPipeInfoNonSplit() {}; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 249 | }; |
| 250 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 251 | /* configure's overlay pipes for the frame */ |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 252 | virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 253 | PipeLayerPair& pipeLayerPair); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 254 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 255 | /* allocates pipes to selected candidates */ |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 256 | virtual bool allocLayerPipes(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 257 | hwc_display_contents_1_t* list); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 258 | |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 259 | /* Checks for pipes needed versus pipes available */ |
| 260 | virtual bool arePipesAvailable(hwc_context_t *ctx, |
| 261 | hwc_display_contents_1_t* list); |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 262 | |
| 263 | /* Checks for video pipes needed versus pipes available */ |
| 264 | virtual bool areVGPipesAvailable(hwc_context_t *ctx, |
| 265 | hwc_display_contents_1_t* list); |
radhakrishna | c9a6741 | 2013-09-25 17:40:42 +0530 | [diff] [blame] | 266 | |
| 267 | /* increments mdpCount if 4k2k yuv layer split is enabled*/ |
| 268 | virtual void modifymdpCountfor4k2k(hwc_context_t *ctx, |
| 269 | hwc_display_contents_1_t* list); |
| 270 | |
| 271 | /* configures 4kx2k yuv layer to 2 VG pipes*/ |
| 272 | virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer, |
| 273 | PipeLayerPair& PipeLayerPair); |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 274 | }; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 275 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 276 | class MDPCompSplit : public MDPComp { |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 277 | public: |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 278 | explicit MDPCompSplit(int dpy):MDPComp(dpy){}; |
| 279 | virtual ~MDPCompSplit(){}; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 280 | virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list); |
| 281 | private: |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 282 | struct MdpPipeInfoSplit : public MdpPipeInfo { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 283 | ovutils::eDest lIndex; |
| 284 | ovutils::eDest rIndex; |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 285 | virtual ~MdpPipeInfoSplit() {}; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 286 | }; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 287 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 288 | bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer, |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 289 | MdpPipeInfoSplit& pipe_info, ePipeType type); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 290 | |
| 291 | /* configure's overlay pipes for the frame */ |
| 292 | virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 293 | PipeLayerPair& pipeLayerPair); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 294 | |
| 295 | /* allocates pipes to selected candidates */ |
| 296 | virtual bool allocLayerPipes(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 297 | hwc_display_contents_1_t* list); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 298 | |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 299 | /* Checks for pipes needed versus pipes available */ |
| 300 | virtual bool arePipesAvailable(hwc_context_t *ctx, |
| 301 | hwc_display_contents_1_t* list); |
| 302 | |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 303 | /* Checks for video pipes needed versus pipes available */ |
| 304 | virtual bool areVGPipesAvailable(hwc_context_t *ctx, |
| 305 | hwc_display_contents_1_t* list); |
| 306 | |
radhakrishna | c9a6741 | 2013-09-25 17:40:42 +0530 | [diff] [blame] | 307 | /* increments mdpCount if 4k2k yuv layer split is enabled*/ |
| 308 | virtual void modifymdpCountfor4k2k(hwc_context_t *ctx, |
| 309 | hwc_display_contents_1_t* list); |
| 310 | |
| 311 | /* configures 4kx2k yuv layer*/ |
| 312 | virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer, |
| 313 | PipeLayerPair& PipeLayerPair); |
| 314 | |
Saurabh Shah | af5f597 | 2013-07-30 13:56:35 -0700 | [diff] [blame] | 315 | int pipesNeeded(hwc_context_t *ctx, hwc_display_contents_1_t* list, |
| 316 | int mixer); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 317 | }; |
Saurabh Shah | 2a4eb1b | 2013-07-22 16:33:23 -0700 | [diff] [blame] | 318 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 319 | }; //namespace |
| 320 | #endif |