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