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