blob: 8c833c2e906b60796cf25fd21ec2bdb8bd20f456 [file] [log] [blame]
Naseer Ahmed7c958d42012-07-31 18:57:03 -07001/*
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -08002 * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved.
3 *
Naseer Ahmed7c958d42012-07-31 18:57:03 -07004 * 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 Shah45782902013-11-15 10:13:14 -080028#define DEFAULT_IDLE_TIME 70
Sushil Chauhan69f2bb22013-02-13 10:50:47 -080029#define MAX_PIPES_PER_MIXER 4
Naseer Ahmed7c958d42012-07-31 18:57:03 -070030
Saurabh Shahacf10202013-02-26 10:15:15 -080031namespace overlay {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080032class Rotator;
Saurabh Shahacf10202013-02-26 10:15:15 -080033};
34
Naseer Ahmed7c958d42012-07-31 18:57:03 -070035namespace qhwc {
Naseer Ahmed54821fe2012-11-28 18:44:38 -050036namespace ovutils = overlay::utils;
Naseer Ahmed7c958d42012-07-31 18:57:03 -070037
38class MDPComp {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080039public:
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080040 explicit MDPComp(int);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080041 virtual ~MDPComp(){};
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080042 /*sets up mdp comp for the current frame */
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080043 int prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080044 /* draw */
45 virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list) = 0;
Raj Kamal4393eaa2014-06-06 13:45:20 +053046 //Reset values
47 void reset();
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080048 /* dumpsys */
Jeykumar Sankaran6850ac62014-05-27 10:07:26 -070049 void dump(android::String8& buf, hwc_context_t *ctx);
Ramkumar Radhakrishnan8bb48d32013-12-30 23:11:27 -080050 bool isGLESOnlyComp() { return (mCurrentFrame.mdpCount == 0); }
Sushil Chauhandefd3522014-05-13 18:17:12 -070051 int drawOverlap(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shah88e4d272013-09-03 13:31:29 -070052 static MDPComp* getObject(hwc_context_t *ctx, const int& dpy);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080053 /* Handler to invoke frame redraw on Idle Timer expiry */
54 static void timeout_handler(void *udata);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080055 /* Initialize MDP comp*/
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080056 static bool init(hwc_context_t *ctx);
Saurabh Shah98acd092013-05-03 10:48:24 -070057 static void resetIdleFallBack() { sIdleFallBack = false; }
Ramkumar Radhakrishnanfb822912014-03-14 17:28:14 -070058 static bool isIdleFallback() { return sIdleFallBack; }
Naseer Ahmed35a268c2014-06-24 19:07:13 -040059 static void dynamicDebug(bool enable){ sDebugLogs = enable; }
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080060
61protected:
Saurabh Shahe9bc60f2013-08-29 12:58:06 -070062 enum { MAX_SEC_LAYERS = 1 }; //TODO add property support
63
Naseer Ahmed54821fe2012-11-28 18:44:38 -050064 enum ePipeType {
65 MDPCOMP_OV_RGB = ovutils::OV_MDP_PIPE_RGB,
66 MDPCOMP_OV_VG = ovutils::OV_MDP_PIPE_VG,
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080067 MDPCOMP_OV_DMA = ovutils::OV_MDP_PIPE_DMA,
Naseer Ahmed54821fe2012-11-28 18:44:38 -050068 MDPCOMP_OV_ANY,
Naseer Ahmed7c958d42012-07-31 18:57:03 -070069 };
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080070
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -070071 //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 Radhakrishnan4ec775f2014-07-23 17:43:18 -070077 MDPCOMP_AVOID_MDP_ONLY_LAYERS = 0x010,
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -070078 };
79
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080080 /* mdp pipe data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080081 struct MdpPipeInfo {
82 int zOrder;
83 virtual ~MdpPipeInfo(){};
84 };
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080085
radhakrishnac9a67412013-09-25 17:40:42 +053086 struct MdpYUVPipeInfo : public MdpPipeInfo{
87 ovutils::eDest lIndex;
88 ovutils::eDest rIndex;
89 virtual ~MdpYUVPipeInfo(){};
90 };
91
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080092 /* per layer data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080093 struct PipeLayerPair {
94 MdpPipeInfo *pipeInfo;
Saurabh Shahacf10202013-02-26 10:15:15 -080095 overlay::Rotator* rot;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080096 int listIndex;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080097 };
98
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080099 /* per frame data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800100 struct FrameInfo {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800101 /* maps layer list to mdp list */
102 int layerCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700103 int layerToMDP[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800104
105 /* maps mdp list to layer list */
106 int mdpCount;
107 struct PipeLayerPair mdpToLayer[MAX_PIPES_PER_MIXER];
108
109 /* layer composing on FB? */
110 int fbCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700111 bool isFBComposed[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran6a9bb9e2013-08-01 14:19:26 -0700112 /* layers lying outside ROI. Will
113 * be dropped off from the composition */
114 int dropCount;
115 bool drop[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800116
117 bool needsRedraw;
118 int fbZ;
119
120 /* c'tor */
121 FrameInfo();
122 /* clear old frame data */
Saurabh Shahaa236822013-04-24 18:07:26 -0700123 void reset(const int& numLayers);
124 void map();
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800125 };
126
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800127 /* cached data */
128 struct LayerCache {
129 int layerCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700130 buffer_handle_t hnd[MAX_NUM_APP_LAYERS];
Prabhanjan Kandula2243aa62013-10-24 12:58:55 +0530131 bool isFBComposed[MAX_NUM_APP_LAYERS];
132 bool drop[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800133
134 /* c'tor */
135 LayerCache();
136 /* clear caching info*/
137 void reset();
Saurabh Shahaa236822013-04-24 18:07:26 -0700138 void cacheAll(hwc_display_contents_1_t* list);
139 void updateCounts(const FrameInfo&);
Jeykumar Sankaran988d3682013-11-15 11:57:16 -0800140 bool isSameFrame(const FrameInfo& curFrame,
141 hwc_display_contents_1_t* list);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800142 };
143
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800144 /* allocates pipe from pipe book */
145 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800146 hwc_display_contents_1_t* list) = 0;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800147 /* configures MPD pipes */
148 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800149 PipeLayerPair& pipeLayerPair) = 0;
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800150 /* Increments mdpCount if 4k2k yuv layer split is enabled.
151 * updates framebuffer z order if fb lies above source-split layer */
152 virtual void adjustForSourceSplit(hwc_context_t *ctx,
radhakrishnac9a67412013-09-25 17:40:42 +0530153 hwc_display_contents_1_t* list) = 0;
154 /* configures 4kx2k yuv layer*/
155 virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer,
156 PipeLayerPair& PipeLayerPair) = 0;
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800157 /* generates ROI based on the modified area of the frame */
158 virtual void generateROI(hwc_context_t *ctx,
159 hwc_display_contents_1_t* list) = 0;
160 /* validates the ROI generated for fallback conditions */
161 virtual bool validateAndApplyROI(hwc_context_t *ctx,
162 hwc_display_contents_1_t* list) = 0;
163 /* Trims fbRect calculated against ROI generated */
164 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect) = 0;
165
Jeykumar Sankaran1e156112014-04-30 11:03:23 -0700166 /* set/reset flags for MDPComp */
167 void setMDPCompLayerFlags(hwc_context_t *ctx,
168 hwc_display_contents_1_t* list);
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800169 void setRedraw(hwc_context_t *ctx,
170 hwc_display_contents_1_t* list);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800171 /* checks for conditions where mdpcomp is not possible */
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800172 bool isFrameDoable(hwc_context_t *ctx);
173 /* checks for conditions where RGB layers cannot be bypassed */
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800174 bool tryFullFrame(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahaa236822013-04-24 18:07:26 -0700175 /* checks if full MDP comp can be done */
176 bool fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Sushil Chauhandefd3522014-05-13 18:17:12 -0700177 /* Full MDP Composition with Peripheral Tiny Overlap Removal */
178 bool fullMDPCompWithPTOR(hwc_context_t *ctx,hwc_display_contents_1_t* list);
Saurabh Shahaa236822013-04-24 18:07:26 -0700179 /* check if we can use layer cache to do at least partial MDP comp */
180 bool partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shah8028e3b2013-10-15 12:27:59 -0700181 /* Partial MDP comp that uses caching to save power as primary goal */
182 bool cacheBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahbe7bd322014-02-20 16:18:45 -0800183 /* Partial MDP comp that balances the load between MDP and GPU such that
184 * MDP is loaded to the max of its capacity. The lower z order layers are
185 * fed to MDP, whereas the upper ones to GPU, because the upper ones have
186 * lower number of pixels and can reduce GPU processing time */
187 bool loadBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shah8028e3b2013-10-15 12:27:59 -0700188 /* Checks if its worth doing load based partial comp */
Arun Kumar K.R2aa44c62014-01-21 23:08:28 -0800189 bool isLoadBasedCompDoable(hwc_context_t *ctx);
Saurabh Shahaa236822013-04-24 18:07:26 -0700190 /* checks for conditions where only video can be bypassed */
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800191 bool tryVideoOnly(hwc_context_t *ctx, hwc_display_contents_1_t* list);
192 bool videoOnlyComp(hwc_context_t *ctx, hwc_display_contents_1_t* list,
Saurabh Shah90b7b9b2013-09-12 16:36:08 -0700193 bool secureOnly);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700194 /* checks for conditions where only secure RGB and video can be bypassed */
195 bool tryMDPOnlyLayers(hwc_context_t *ctx, hwc_display_contents_1_t* list);
196 bool mdpOnlyLayersComp(hwc_context_t *ctx, hwc_display_contents_1_t* list,
197 bool secureOnly);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800198 /* checks for conditions where YUV layers cannot be bypassed */
199 bool isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700200 /* checks for conditions where Secure RGB layers cannot be bypassed */
201 bool isSecureRGBDoable(hwc_context_t* ctx, hwc_layer_1_t* layer);
Prabhanjan Kandula21918db2013-11-26 15:51:58 +0530202 /* checks if MDP/MDSS can process current list w.r.to HW limitations
203 * All peculiar HW limitations should go here */
204 bool hwLimitationsCheck(hwc_context_t* ctx, hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800205 /* Is debug enabled */
206 static bool isDebug() { return sDebugLogs ? true : false; };
207 /* Is feature enabled */
208 static bool isEnabled() { return sEnabled; };
Sravan Kumar D.V.Nad5d9292013-04-24 14:23:04 +0530209 /* checks for mdp comp dimension limitation */
210 bool isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800211 /* tracks non updating layers*/
212 void updateLayerCache(hwc_context_t* ctx, hwc_display_contents_1_t* list);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800213 /* optimize layers for mdp comp*/
Prabhanjan Kandula9bd5f642013-09-25 17:00:36 +0530214 bool markLayersForCaching(hwc_context_t* ctx,
215 hwc_display_contents_1_t* list);
216 int getBatch(hwc_display_contents_1_t* list,
217 int& maxBatchStart, int& maxBatchEnd,
218 int& maxBatchCount);
219 bool canPushBatchToTop(const hwc_display_contents_1_t* list,
220 int fromIndex, int toIndex);
221 bool intersectingUpdatingLayers(const hwc_display_contents_1_t* list,
222 int fromIndex, int toIndex, int targetLayerIndex);
223
224 /* updates cache map with YUV info */
Saurabh Shah90b7b9b2013-09-12 16:36:08 -0700225 void updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
226 bool secureOnly);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700227 /* updates cache map with secure RGB info */
228 void updateSecureRGB(hwc_context_t* ctx,
229 hwc_display_contents_1_t* list);
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800230 /* Validates if the GPU/MDP layer split chosen by a strategy is supported
231 * by MDP.
232 * Sets up MDP comp data structures to reflect covnversion from layers to
233 * overlay pipes.
234 * Configures overlay.
235 * Configures if GPU should redraw.
236 */
237 bool postHeuristicsHandling(hwc_context_t *ctx,
238 hwc_display_contents_1_t* list);
239 void reset(hwc_context_t *ctx);
Saurabh Shahe9bc60f2013-08-29 12:58:06 -0700240 bool isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer);
Ramkumar Radhakrishnan9d20b392013-11-15 19:32:47 -0800241 bool resourceCheck(hwc_context_t* ctx, hwc_display_contents_1_t* list);
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800242 hwc_rect_t getUpdatingFBRect(hwc_context_t *ctx,
243 hwc_display_contents_1_t* list);
244 /* checks for conditions to enable partial udpate */
245 bool canPartialUpdate(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800246
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800247 int mDpy;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800248 static bool sEnabled;
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700249 static bool sEnableMixedMode;
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -0700250 static int sSimulationFlags;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800251 static bool sDebugLogs;
252 static bool sIdleFallBack;
Ramkumar Radhakrishnan92abb4f2014-02-06 21:31:29 -0800253 /* Handles the timeout event from kernel, if the value is set to true */
254 static bool sHandleTimeout;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800255 static int sMaxPipesPerMixer;
Manoj Kumar AVM8cbbf7c2014-03-11 01:15:31 -0700256 static bool sSrcSplitEnabled;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800257 static IdleInvalidator *idleInvalidator;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800258 struct FrameInfo mCurrentFrame;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800259 struct LayerCache mCachedFrame;
radhakrishnac9a67412013-09-25 17:40:42 +0530260 //Enable 4kx2k yuv layer split
Raj Kamal389d6e32014-08-04 14:43:24 +0530261 static bool sEnableYUVsplit;
Raj Kamal4393eaa2014-06-06 13:45:20 +0530262 bool mModeOn; // if prepare happened
Arun Kumar K.R2aa44c62014-01-21 23:08:28 -0800263 bool allocSplitVGPipesfor4k2k(hwc_context_t *ctx, int index);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800264};
265
Saurabh Shah88e4d272013-09-03 13:31:29 -0700266class MDPCompNonSplit : public MDPComp {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800267public:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700268 explicit MDPCompNonSplit(int dpy):MDPComp(dpy){};
269 virtual ~MDPCompNonSplit(){};
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800270 virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800271
272private:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700273 struct MdpPipeInfoNonSplit : public MdpPipeInfo {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800274 ovutils::eDest index;
Saurabh Shah88e4d272013-09-03 13:31:29 -0700275 virtual ~MdpPipeInfoNonSplit() {};
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700276 };
277
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700278 /* configure's overlay pipes for the frame */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800279 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800280 PipeLayerPair& pipeLayerPair);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800281
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700282 /* allocates pipes to selected candidates */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800283 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800284 hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800285
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800286 /* Increments mdpCount if 4k2k yuv layer split is enabled.
287 * updates framebuffer z order if fb lies above source-split layer */
288 virtual void adjustForSourceSplit(hwc_context_t *ctx,
Arun Kumar K.R2aa44c62014-01-21 23:08:28 -0800289 hwc_display_contents_1_t* list);
radhakrishnac9a67412013-09-25 17:40:42 +0530290
291 /* configures 4kx2k yuv layer to 2 VG pipes*/
292 virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer,
293 PipeLayerPair& PipeLayerPair);
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800294 /* generates ROI based on the modified area of the frame */
295 virtual void generateROI(hwc_context_t *ctx,
296 hwc_display_contents_1_t* list);
297 /* validates the ROI generated for fallback conditions */
298 virtual bool validateAndApplyROI(hwc_context_t *ctx,
299 hwc_display_contents_1_t* list);
300 /* Trims fbRect calculated against ROI generated */
301 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect);
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700302};
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800303
Saurabh Shah88e4d272013-09-03 13:31:29 -0700304class MDPCompSplit : public MDPComp {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800305public:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700306 explicit MDPCompSplit(int dpy):MDPComp(dpy){};
307 virtual ~MDPCompSplit(){};
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800308 virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
Saurabh Shahab47c692014-02-12 18:45:57 -0800309
310protected:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700311 struct MdpPipeInfoSplit : public MdpPipeInfo {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800312 ovutils::eDest lIndex;
313 ovutils::eDest rIndex;
Saurabh Shah88e4d272013-09-03 13:31:29 -0700314 virtual ~MdpPipeInfoSplit() {};
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800315 };
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800316
Saurabh Shahab47c692014-02-12 18:45:57 -0800317 virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
Saurabh Shahc62f3982014-03-05 14:28:26 -0800318 MdpPipeInfoSplit& pipe_info);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800319
320 /* configure's overlay pipes for the frame */
321 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800322 PipeLayerPair& pipeLayerPair);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800323
324 /* allocates pipes to selected candidates */
325 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800326 hwc_display_contents_1_t* list);
Saurabh Shahab47c692014-02-12 18:45:57 -0800327private:
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800328 /* Increments mdpCount if 4k2k yuv layer split is enabled.
329 * updates framebuffer z order if fb lies above source-split layer */
330 virtual void adjustForSourceSplit(hwc_context_t *ctx,
radhakrishnac9a67412013-09-25 17:40:42 +0530331 hwc_display_contents_1_t* list);
332
333 /* configures 4kx2k yuv layer*/
334 virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer,
335 PipeLayerPair& PipeLayerPair);
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800336 /* generates ROI based on the modified area of the frame */
337 virtual void generateROI(hwc_context_t *ctx,
338 hwc_display_contents_1_t* list);
339 /* validates the ROI generated for fallback conditions */
340 virtual bool validateAndApplyROI(hwc_context_t *ctx,
341 hwc_display_contents_1_t* list);
342 /* Trims fbRect calculated against ROI generated */
343 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800344};
Saurabh Shah2a4eb1b2013-07-22 16:33:23 -0700345
Saurabh Shahab47c692014-02-12 18:45:57 -0800346class MDPCompSrcSplit : public MDPCompSplit {
347public:
348 explicit MDPCompSrcSplit(int dpy) : MDPCompSplit(dpy){};
349 virtual ~MDPCompSrcSplit(){};
350private:
351 virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
Saurabh Shahc62f3982014-03-05 14:28:26 -0800352 MdpPipeInfoSplit& pipe_info);
Saurabh Shahab47c692014-02-12 18:45:57 -0800353
Saurabh Shahab47c692014-02-12 18:45:57 -0800354 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
355 PipeLayerPair& pipeLayerPair);
356};
357
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700358}; //namespace
359#endif