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 | |
Saurabh Shah | 4578290 | 2013-11-15 10:13:14 -0800 | [diff] [blame] | 28 | #define DEFAULT_IDLE_TIME 70 |
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; |
Raj Kamal | 4393eaa | 2014-06-06 13:45:20 +0530 | [diff] [blame] | 46 | //Reset values |
| 47 | void reset(); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 48 | /* dumpsys */ |
Jeykumar Sankaran | 6850ac6 | 2014-05-27 10:07:26 -0700 | [diff] [blame] | 49 | void dump(android::String8& buf, hwc_context_t *ctx); |
Ramkumar Radhakrishnan | 8bb48d3 | 2013-12-30 23:11:27 -0800 | [diff] [blame] | 50 | bool isGLESOnlyComp() { return (mCurrentFrame.mdpCount == 0); } |
Sushil Chauhan | defd352 | 2014-05-13 18:17:12 -0700 | [diff] [blame] | 51 | bool isPTORActive() { return (mOverlapIndex != -1); } |
| 52 | int drawOverlap(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 53 | static MDPComp* getObject(hwc_context_t *ctx, const int& dpy); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 54 | /* Handler to invoke frame redraw on Idle Timer expiry */ |
| 55 | static void timeout_handler(void *udata); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 56 | /* Initialize MDP comp*/ |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 57 | static bool init(hwc_context_t *ctx); |
Saurabh Shah | 98acd09 | 2013-05-03 10:48:24 -0700 | [diff] [blame] | 58 | static void resetIdleFallBack() { sIdleFallBack = false; } |
Ramkumar Radhakrishnan | fb82291 | 2014-03-14 17:28:14 -0700 | [diff] [blame] | 59 | static bool isIdleFallback() { return sIdleFallBack; } |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 60 | |
| 61 | protected: |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 62 | enum { MAX_SEC_LAYERS = 1 }; //TODO add property support |
| 63 | |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 64 | enum ePipeType { |
| 65 | MDPCOMP_OV_RGB = ovutils::OV_MDP_PIPE_RGB, |
| 66 | MDPCOMP_OV_VG = ovutils::OV_MDP_PIPE_VG, |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 67 | MDPCOMP_OV_DMA = ovutils::OV_MDP_PIPE_DMA, |
Naseer Ahmed | 54821fe | 2012-11-28 18:44:38 -0500 | [diff] [blame] | 68 | MDPCOMP_OV_ANY, |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 69 | }; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 70 | |
Jeykumar Sankaran | 0ad97c4 | 2014-03-09 23:00:53 -0700 | [diff] [blame] | 71 | //Simulation flags |
| 72 | enum { |
| 73 | MDPCOMP_AVOID_FULL_MDP = 0x001, |
| 74 | MDPCOMP_AVOID_CACHE_MDP = 0x002, |
| 75 | MDPCOMP_AVOID_LOAD_MDP = 0x004, |
| 76 | MDPCOMP_AVOID_VIDEO_ONLY = 0x008, |
| 77 | }; |
| 78 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 79 | /* mdp pipe data */ |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 80 | struct MdpPipeInfo { |
| 81 | int zOrder; |
| 82 | virtual ~MdpPipeInfo(){}; |
| 83 | }; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 84 | |
radhakrishna | c9a6741 | 2013-09-25 17:40:42 +0530 | [diff] [blame] | 85 | struct MdpYUVPipeInfo : public MdpPipeInfo{ |
| 86 | ovutils::eDest lIndex; |
| 87 | ovutils::eDest rIndex; |
| 88 | virtual ~MdpYUVPipeInfo(){}; |
| 89 | }; |
| 90 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 91 | /* per layer data */ |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 92 | struct PipeLayerPair { |
| 93 | MdpPipeInfo *pipeInfo; |
Saurabh Shah | acf1020 | 2013-02-26 10:15:15 -0800 | [diff] [blame] | 94 | overlay::Rotator* rot; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 95 | int listIndex; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 96 | }; |
| 97 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 98 | /* per frame data */ |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 99 | struct FrameInfo { |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 100 | /* maps layer list to mdp list */ |
| 101 | int layerCount; |
Ramkumar Radhakrishnan | e661f96 | 2013-06-05 17:21:38 -0700 | [diff] [blame] | 102 | int layerToMDP[MAX_NUM_APP_LAYERS]; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 103 | |
| 104 | /* maps mdp list to layer list */ |
| 105 | int mdpCount; |
| 106 | struct PipeLayerPair mdpToLayer[MAX_PIPES_PER_MIXER]; |
| 107 | |
| 108 | /* layer composing on FB? */ |
| 109 | int fbCount; |
Ramkumar Radhakrishnan | e661f96 | 2013-06-05 17:21:38 -0700 | [diff] [blame] | 110 | bool isFBComposed[MAX_NUM_APP_LAYERS]; |
Jeykumar Sankaran | 6a9bb9e | 2013-08-01 14:19:26 -0700 | [diff] [blame] | 111 | /* layers lying outside ROI. Will |
| 112 | * be dropped off from the composition */ |
| 113 | int dropCount; |
| 114 | bool drop[MAX_NUM_APP_LAYERS]; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 115 | |
| 116 | bool needsRedraw; |
| 117 | int fbZ; |
| 118 | |
| 119 | /* c'tor */ |
| 120 | FrameInfo(); |
| 121 | /* clear old frame data */ |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 122 | void reset(const int& numLayers); |
| 123 | void map(); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 124 | }; |
| 125 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 126 | /* cached data */ |
| 127 | struct LayerCache { |
| 128 | int layerCount; |
Ramkumar Radhakrishnan | e661f96 | 2013-06-05 17:21:38 -0700 | [diff] [blame] | 129 | buffer_handle_t hnd[MAX_NUM_APP_LAYERS]; |
Prabhanjan Kandula | 2243aa6 | 2013-10-24 12:58:55 +0530 | [diff] [blame] | 130 | bool isFBComposed[MAX_NUM_APP_LAYERS]; |
| 131 | bool drop[MAX_NUM_APP_LAYERS]; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 132 | |
| 133 | /* c'tor */ |
| 134 | LayerCache(); |
| 135 | /* clear caching info*/ |
| 136 | void reset(); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 137 | void cacheAll(hwc_display_contents_1_t* list); |
| 138 | void updateCounts(const FrameInfo&); |
Jeykumar Sankaran | 988d368 | 2013-11-15 11:57:16 -0800 | [diff] [blame] | 139 | bool isSameFrame(const FrameInfo& curFrame, |
| 140 | hwc_display_contents_1_t* list); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 141 | }; |
| 142 | |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 143 | /* allocates pipe from pipe book */ |
| 144 | virtual bool allocLayerPipes(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 145 | hwc_display_contents_1_t* list) = 0; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 146 | /* configures MPD pipes */ |
| 147 | virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 148 | PipeLayerPair& pipeLayerPair) = 0; |
Saurabh Shah | 3d4b804 | 2013-12-10 15:19:17 -0800 | [diff] [blame] | 149 | /* Increments mdpCount if 4k2k yuv layer split is enabled. |
| 150 | * updates framebuffer z order if fb lies above source-split layer */ |
| 151 | virtual void adjustForSourceSplit(hwc_context_t *ctx, |
radhakrishna | c9a6741 | 2013-09-25 17:40:42 +0530 | [diff] [blame] | 152 | hwc_display_contents_1_t* list) = 0; |
| 153 | /* configures 4kx2k yuv layer*/ |
| 154 | virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer, |
| 155 | PipeLayerPair& PipeLayerPair) = 0; |
Jeykumar Sankaran | 6c7eeac | 2013-11-18 11:19:45 -0800 | [diff] [blame] | 156 | /* generates ROI based on the modified area of the frame */ |
| 157 | virtual void generateROI(hwc_context_t *ctx, |
| 158 | hwc_display_contents_1_t* list) = 0; |
| 159 | /* validates the ROI generated for fallback conditions */ |
| 160 | virtual bool validateAndApplyROI(hwc_context_t *ctx, |
| 161 | hwc_display_contents_1_t* list) = 0; |
| 162 | /* Trims fbRect calculated against ROI generated */ |
| 163 | virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect) = 0; |
| 164 | |
Jeykumar Sankaran | 1e15611 | 2014-04-30 11:03:23 -0700 | [diff] [blame] | 165 | /* set/reset flags for MDPComp */ |
| 166 | void setMDPCompLayerFlags(hwc_context_t *ctx, |
| 167 | hwc_display_contents_1_t* list); |
Saurabh Shah | df4741d | 2013-12-12 16:40:28 -0800 | [diff] [blame] | 168 | void setRedraw(hwc_context_t *ctx, |
| 169 | hwc_display_contents_1_t* list); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 170 | /* checks for conditions where mdpcomp is not possible */ |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 171 | bool isFrameDoable(hwc_context_t *ctx); |
| 172 | /* checks for conditions where RGB layers cannot be bypassed */ |
Saurabh Shah | df4741d | 2013-12-12 16:40:28 -0800 | [diff] [blame] | 173 | bool tryFullFrame(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 174 | /* checks if full MDP comp can be done */ |
| 175 | bool fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Sushil Chauhan | defd352 | 2014-05-13 18:17:12 -0700 | [diff] [blame] | 176 | /* Full MDP Composition with Peripheral Tiny Overlap Removal */ |
| 177 | bool fullMDPCompWithPTOR(hwc_context_t *ctx,hwc_display_contents_1_t* list); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 178 | /* check if we can use layer cache to do at least partial MDP comp */ |
| 179 | bool partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | 8028e3b | 2013-10-15 12:27:59 -0700 | [diff] [blame] | 180 | /* Partial MDP comp that uses caching to save power as primary goal */ |
| 181 | bool cacheBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | be7bd32 | 2014-02-20 16:18:45 -0800 | [diff] [blame] | 182 | /* Partial MDP comp that balances the load between MDP and GPU such that |
| 183 | * MDP is loaded to the max of its capacity. The lower z order layers are |
| 184 | * fed to MDP, whereas the upper ones to GPU, because the upper ones have |
| 185 | * lower number of pixels and can reduce GPU processing time */ |
| 186 | bool loadBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | 8028e3b | 2013-10-15 12:27:59 -0700 | [diff] [blame] | 187 | /* Checks if its worth doing load based partial comp */ |
Arun Kumar K.R | 2aa44c6 | 2014-01-21 23:08:28 -0800 | [diff] [blame] | 188 | bool isLoadBasedCompDoable(hwc_context_t *ctx); |
Saurabh Shah | aa23682 | 2013-04-24 18:07:26 -0700 | [diff] [blame] | 189 | /* checks for conditions where only video can be bypassed */ |
Saurabh Shah | df4741d | 2013-12-12 16:40:28 -0800 | [diff] [blame] | 190 | bool tryVideoOnly(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
| 191 | bool videoOnlyComp(hwc_context_t *ctx, hwc_display_contents_1_t* list, |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 192 | bool secureOnly); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 193 | /* checks for conditions where YUV layers cannot be bypassed */ |
| 194 | bool isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer); |
Prabhanjan Kandula | 21918db | 2013-11-26 15:51:58 +0530 | [diff] [blame] | 195 | /* checks if MDP/MDSS can process current list w.r.to HW limitations |
| 196 | * All peculiar HW limitations should go here */ |
| 197 | bool hwLimitationsCheck(hwc_context_t* ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 198 | /* Is debug enabled */ |
| 199 | static bool isDebug() { return sDebugLogs ? true : false; }; |
| 200 | /* Is feature enabled */ |
| 201 | static bool isEnabled() { return sEnabled; }; |
Sravan Kumar D.V.N | ad5d929 | 2013-04-24 14:23:04 +0530 | [diff] [blame] | 202 | /* checks for mdp comp dimension limitation */ |
| 203 | bool isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 204 | /* tracks non updating layers*/ |
| 205 | void updateLayerCache(hwc_context_t* ctx, hwc_display_contents_1_t* list); |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 206 | /* optimize layers for mdp comp*/ |
Prabhanjan Kandula | 9bd5f64 | 2013-09-25 17:00:36 +0530 | [diff] [blame] | 207 | bool markLayersForCaching(hwc_context_t* ctx, |
| 208 | hwc_display_contents_1_t* list); |
| 209 | int getBatch(hwc_display_contents_1_t* list, |
| 210 | int& maxBatchStart, int& maxBatchEnd, |
| 211 | int& maxBatchCount); |
| 212 | bool canPushBatchToTop(const hwc_display_contents_1_t* list, |
| 213 | int fromIndex, int toIndex); |
| 214 | bool intersectingUpdatingLayers(const hwc_display_contents_1_t* list, |
| 215 | int fromIndex, int toIndex, int targetLayerIndex); |
| 216 | |
| 217 | /* updates cache map with YUV info */ |
Saurabh Shah | 90b7b9b | 2013-09-12 16:36:08 -0700 | [diff] [blame] | 218 | void updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list, |
| 219 | bool secureOnly); |
Saurabh Shah | df4741d | 2013-12-12 16:40:28 -0800 | [diff] [blame] | 220 | /* Validates if the GPU/MDP layer split chosen by a strategy is supported |
| 221 | * by MDP. |
| 222 | * Sets up MDP comp data structures to reflect covnversion from layers to |
| 223 | * overlay pipes. |
| 224 | * Configures overlay. |
| 225 | * Configures if GPU should redraw. |
| 226 | */ |
| 227 | bool postHeuristicsHandling(hwc_context_t *ctx, |
| 228 | hwc_display_contents_1_t* list); |
| 229 | void reset(hwc_context_t *ctx); |
Saurabh Shah | e9bc60f | 2013-08-29 12:58:06 -0700 | [diff] [blame] | 230 | bool isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer); |
Praveena Pachipulusu | d9443c7 | 2014-02-17 10:42:28 +0530 | [diff] [blame] | 231 | bool resourceCheck(); |
Jeykumar Sankaran | 6c7eeac | 2013-11-18 11:19:45 -0800 | [diff] [blame] | 232 | hwc_rect_t getUpdatingFBRect(hwc_context_t *ctx, |
| 233 | hwc_display_contents_1_t* list); |
| 234 | /* checks for conditions to enable partial udpate */ |
| 235 | bool canPartialUpdate(hwc_context_t *ctx, hwc_display_contents_1_t* list); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 236 | |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 237 | int mDpy; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 238 | static bool sEnabled; |
Jeykumar Sankaran | 24c199d | 2013-05-24 09:40:36 -0700 | [diff] [blame] | 239 | static bool sEnableMixedMode; |
Jeykumar Sankaran | 0ad97c4 | 2014-03-09 23:00:53 -0700 | [diff] [blame] | 240 | static int sSimulationFlags; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 241 | static bool sDebugLogs; |
| 242 | static bool sIdleFallBack; |
Ramkumar Radhakrishnan | 92abb4f | 2014-02-06 21:31:29 -0800 | [diff] [blame] | 243 | /* Handles the timeout event from kernel, if the value is set to true */ |
| 244 | static bool sHandleTimeout; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 245 | static int sMaxPipesPerMixer; |
Manoj Kumar AVM | 8cbbf7c | 2014-03-11 01:15:31 -0700 | [diff] [blame] | 246 | static bool sSrcSplitEnabled; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 247 | static IdleInvalidator *idleInvalidator; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 248 | struct FrameInfo mCurrentFrame; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 249 | struct LayerCache mCachedFrame; |
radhakrishna | c9a6741 | 2013-09-25 17:40:42 +0530 | [diff] [blame] | 250 | //Enable 4kx2k yuv layer split |
| 251 | static bool sEnable4k2kYUVSplit; |
Sushil Chauhan | defd352 | 2014-05-13 18:17:12 -0700 | [diff] [blame] | 252 | /* Overlap layer index */ |
| 253 | int mOverlapIndex; |
Raj Kamal | 4393eaa | 2014-06-06 13:45:20 +0530 | [diff] [blame] | 254 | bool mModeOn; // if prepare happened |
Arun Kumar K.R | 2aa44c6 | 2014-01-21 23:08:28 -0800 | [diff] [blame] | 255 | bool allocSplitVGPipesfor4k2k(hwc_context_t *ctx, int index); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 256 | }; |
| 257 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 258 | class MDPCompNonSplit : public MDPComp { |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 259 | public: |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 260 | explicit MDPCompNonSplit(int dpy):MDPComp(dpy){}; |
| 261 | virtual ~MDPCompNonSplit(){}; |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 262 | 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] | 263 | |
| 264 | private: |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 265 | struct MdpPipeInfoNonSplit : public MdpPipeInfo { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 266 | ovutils::eDest index; |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 267 | virtual ~MdpPipeInfoNonSplit() {}; |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 268 | }; |
| 269 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 270 | /* configure's overlay pipes for the frame */ |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 271 | virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 272 | PipeLayerPair& pipeLayerPair); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 273 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 274 | /* allocates pipes to selected candidates */ |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 275 | virtual bool allocLayerPipes(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 276 | hwc_display_contents_1_t* list); |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 277 | |
Saurabh Shah | 3d4b804 | 2013-12-10 15:19:17 -0800 | [diff] [blame] | 278 | /* Increments mdpCount if 4k2k yuv layer split is enabled. |
| 279 | * updates framebuffer z order if fb lies above source-split layer */ |
| 280 | virtual void adjustForSourceSplit(hwc_context_t *ctx, |
Arun Kumar K.R | 2aa44c6 | 2014-01-21 23:08:28 -0800 | [diff] [blame] | 281 | hwc_display_contents_1_t* list); |
radhakrishna | c9a6741 | 2013-09-25 17:40:42 +0530 | [diff] [blame] | 282 | |
| 283 | /* configures 4kx2k yuv layer to 2 VG pipes*/ |
| 284 | virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer, |
| 285 | PipeLayerPair& PipeLayerPair); |
Jeykumar Sankaran | 6c7eeac | 2013-11-18 11:19:45 -0800 | [diff] [blame] | 286 | /* generates ROI based on the modified area of the frame */ |
| 287 | virtual void generateROI(hwc_context_t *ctx, |
| 288 | hwc_display_contents_1_t* list); |
| 289 | /* validates the ROI generated for fallback conditions */ |
| 290 | virtual bool validateAndApplyROI(hwc_context_t *ctx, |
| 291 | hwc_display_contents_1_t* list); |
| 292 | /* Trims fbRect calculated against ROI generated */ |
| 293 | virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect); |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 294 | }; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 295 | |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 296 | class MDPCompSplit : public MDPComp { |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 297 | public: |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 298 | explicit MDPCompSplit(int dpy):MDPComp(dpy){}; |
| 299 | virtual ~MDPCompSplit(){}; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 300 | virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list); |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 301 | |
| 302 | protected: |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 303 | struct MdpPipeInfoSplit : public MdpPipeInfo { |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 304 | ovutils::eDest lIndex; |
| 305 | ovutils::eDest rIndex; |
Saurabh Shah | 88e4d27 | 2013-09-03 13:31:29 -0700 | [diff] [blame] | 306 | virtual ~MdpPipeInfoSplit() {}; |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 307 | }; |
Saurabh Shah | cbf7ccc | 2012-12-19 16:45:51 -0800 | [diff] [blame] | 308 | |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 309 | virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer, |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 310 | MdpPipeInfoSplit& pipe_info); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 311 | |
| 312 | /* configure's overlay pipes for the frame */ |
| 313 | virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 314 | PipeLayerPair& pipeLayerPair); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 315 | |
| 316 | /* allocates pipes to selected candidates */ |
| 317 | virtual bool allocLayerPipes(hwc_context_t *ctx, |
Jeykumar Sankaran | 85977e3 | 2013-02-25 17:06:08 -0800 | [diff] [blame] | 318 | hwc_display_contents_1_t* list); |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 319 | private: |
Saurabh Shah | 3d4b804 | 2013-12-10 15:19:17 -0800 | [diff] [blame] | 320 | /* Increments mdpCount if 4k2k yuv layer split is enabled. |
| 321 | * updates framebuffer z order if fb lies above source-split layer */ |
| 322 | virtual void adjustForSourceSplit(hwc_context_t *ctx, |
radhakrishna | c9a6741 | 2013-09-25 17:40:42 +0530 | [diff] [blame] | 323 | hwc_display_contents_1_t* list); |
| 324 | |
| 325 | /* configures 4kx2k yuv layer*/ |
| 326 | virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer, |
| 327 | PipeLayerPair& PipeLayerPair); |
Jeykumar Sankaran | 6c7eeac | 2013-11-18 11:19:45 -0800 | [diff] [blame] | 328 | /* generates ROI based on the modified area of the frame */ |
| 329 | virtual void generateROI(hwc_context_t *ctx, |
| 330 | hwc_display_contents_1_t* list); |
| 331 | /* validates the ROI generated for fallback conditions */ |
| 332 | virtual bool validateAndApplyROI(hwc_context_t *ctx, |
| 333 | hwc_display_contents_1_t* list); |
| 334 | /* Trims fbRect calculated against ROI generated */ |
| 335 | virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect); |
Jeykumar Sankaran | b551ce4 | 2013-01-10 16:26:48 -0800 | [diff] [blame] | 336 | }; |
Saurabh Shah | 2a4eb1b | 2013-07-22 16:33:23 -0700 | [diff] [blame] | 337 | |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 338 | class MDPCompSrcSplit : public MDPCompSplit { |
| 339 | public: |
| 340 | explicit MDPCompSrcSplit(int dpy) : MDPCompSplit(dpy){}; |
| 341 | virtual ~MDPCompSrcSplit(){}; |
| 342 | private: |
| 343 | virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer, |
Saurabh Shah | c62f398 | 2014-03-05 14:28:26 -0800 | [diff] [blame] | 344 | MdpPipeInfoSplit& pipe_info); |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 345 | |
Saurabh Shah | ab47c69 | 2014-02-12 18:45:57 -0800 | [diff] [blame] | 346 | virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer, |
| 347 | PipeLayerPair& pipeLayerPair); |
| 348 | }; |
| 349 | |
Naseer Ahmed | 7c958d4 | 2012-07-31 18:57:03 -0700 | [diff] [blame] | 350 | }; //namespace |
| 351 | #endif |