blob: 8929c40dd6132085404c4393337c136a760cbf51 [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 Shahacf10202013-02-26 10:15:15 -080028namespace overlay {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080029class Rotator;
Saurabh Shahacf10202013-02-26 10:15:15 -080030};
31
Naseer Ahmed7c958d42012-07-31 18:57:03 -070032namespace qhwc {
Naseer Ahmed54821fe2012-11-28 18:44:38 -050033namespace ovutils = overlay::utils;
Naseer Ahmed7c958d42012-07-31 18:57:03 -070034
35class MDPComp {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080036public:
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080037 explicit MDPComp(int);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080038 virtual ~MDPComp(){};
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080039 /*sets up mdp comp for the current frame */
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080040 int prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080041 /* draw */
42 virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list) = 0;
Raj Kamal4393eaa2014-06-06 13:45:20 +053043 //Reset values
44 void reset();
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080045 /* dumpsys */
Jeykumar Sankaran6850ac62014-05-27 10:07:26 -070046 void dump(android::String8& buf, hwc_context_t *ctx);
Ramkumar Radhakrishnan8bb48d32013-12-30 23:11:27 -080047 bool isGLESOnlyComp() { return (mCurrentFrame.mdpCount == 0); }
Sushil Chauhandefd3522014-05-13 18:17:12 -070048 int drawOverlap(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shah88e4d272013-09-03 13:31:29 -070049 static MDPComp* getObject(hwc_context_t *ctx, const int& dpy);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080050 /* Handler to invoke frame redraw on Idle Timer expiry */
51 static void timeout_handler(void *udata);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080052 /* Initialize MDP comp*/
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080053 static bool init(hwc_context_t *ctx);
Saurabh Shah98acd092013-05-03 10:48:24 -070054 static void resetIdleFallBack() { sIdleFallBack = false; }
Ramkumar Radhakrishnanfb822912014-03-14 17:28:14 -070055 static bool isIdleFallback() { return sIdleFallBack; }
Naseer Ahmed35a268c2014-06-24 19:07:13 -040056 static void dynamicDebug(bool enable){ sDebugLogs = enable; }
Saurabh Shah59562ff2014-09-30 16:13:12 -070057 static void setIdleTimeout(const uint32_t& timeout);
Jeykumar Sankaranbe93e272014-06-19 18:15:57 -070058 static void setMaxPipesPerMixer(const uint32_t value);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080059
60protected:
Naseer Ahmed54821fe2012-11-28 18:44:38 -050061 enum ePipeType {
62 MDPCOMP_OV_RGB = ovutils::OV_MDP_PIPE_RGB,
63 MDPCOMP_OV_VG = ovutils::OV_MDP_PIPE_VG,
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080064 MDPCOMP_OV_DMA = ovutils::OV_MDP_PIPE_DMA,
Naseer Ahmed54821fe2012-11-28 18:44:38 -050065 MDPCOMP_OV_ANY,
Naseer Ahmed7c958d42012-07-31 18:57:03 -070066 };
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080067
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -070068 //Simulation flags
69 enum {
70 MDPCOMP_AVOID_FULL_MDP = 0x001,
71 MDPCOMP_AVOID_CACHE_MDP = 0x002,
72 MDPCOMP_AVOID_LOAD_MDP = 0x004,
73 MDPCOMP_AVOID_VIDEO_ONLY = 0x008,
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -070074 MDPCOMP_AVOID_MDP_ONLY_LAYERS = 0x010,
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -070075 };
76
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080077 /* mdp pipe data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080078 struct MdpPipeInfo {
79 int zOrder;
80 virtual ~MdpPipeInfo(){};
81 };
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080082
radhakrishnac9a67412013-09-25 17:40:42 +053083 struct MdpYUVPipeInfo : public MdpPipeInfo{
84 ovutils::eDest lIndex;
85 ovutils::eDest rIndex;
86 virtual ~MdpYUVPipeInfo(){};
87 };
88
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080089 /* per layer data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080090 struct PipeLayerPair {
91 MdpPipeInfo *pipeInfo;
Saurabh Shahacf10202013-02-26 10:15:15 -080092 overlay::Rotator* rot;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080093 int listIndex;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080094 };
95
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080096 /* per frame data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080097 struct FrameInfo {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080098 /* maps layer list to mdp list */
99 int layerCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700100 int layerToMDP[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800101
102 /* maps mdp list to layer list */
103 int mdpCount;
Jeykumar Sankaranbe93e272014-06-19 18:15:57 -0700104 struct PipeLayerPair mdpToLayer[MAX_NUM_BLEND_STAGES];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800105
106 /* layer composing on FB? */
107 int fbCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700108 bool isFBComposed[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran6a9bb9e2013-08-01 14:19:26 -0700109 /* layers lying outside ROI. Will
110 * be dropped off from the composition */
111 int dropCount;
112 bool drop[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800113
114 bool needsRedraw;
115 int fbZ;
116
117 /* c'tor */
118 FrameInfo();
119 /* clear old frame data */
Saurabh Shahaa236822013-04-24 18:07:26 -0700120 void reset(const int& numLayers);
121 void map();
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800122 };
123
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800124 /* cached data */
125 struct LayerCache {
126 int layerCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700127 buffer_handle_t hnd[MAX_NUM_APP_LAYERS];
Prabhanjan Kandula2243aa62013-10-24 12:58:55 +0530128 bool isFBComposed[MAX_NUM_APP_LAYERS];
129 bool drop[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800130
131 /* c'tor */
132 LayerCache();
133 /* clear caching info*/
134 void reset();
Saurabh Shahaa236822013-04-24 18:07:26 -0700135 void cacheAll(hwc_display_contents_1_t* list);
136 void updateCounts(const FrameInfo&);
Jeykumar Sankaran988d3682013-11-15 11:57:16 -0800137 bool isSameFrame(const FrameInfo& curFrame,
138 hwc_display_contents_1_t* list);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800139 };
140
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800141 /* allocates pipe from pipe book */
142 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800143 hwc_display_contents_1_t* list) = 0;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800144 /* configures MPD pipes */
145 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800146 PipeLayerPair& pipeLayerPair) = 0;
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800147 /* Increments mdpCount if 4k2k yuv layer split is enabled.
148 * updates framebuffer z order if fb lies above source-split layer */
149 virtual void adjustForSourceSplit(hwc_context_t *ctx,
radhakrishnac9a67412013-09-25 17:40:42 +0530150 hwc_display_contents_1_t* list) = 0;
151 /* configures 4kx2k yuv layer*/
152 virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer,
153 PipeLayerPair& PipeLayerPair) = 0;
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800154 /* generates ROI based on the modified area of the frame */
155 virtual void generateROI(hwc_context_t *ctx,
156 hwc_display_contents_1_t* list) = 0;
157 /* validates the ROI generated for fallback conditions */
158 virtual bool validateAndApplyROI(hwc_context_t *ctx,
159 hwc_display_contents_1_t* list) = 0;
160 /* Trims fbRect calculated against ROI generated */
161 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect) = 0;
162
Jeykumar Sankaran1e156112014-04-30 11:03:23 -0700163 /* set/reset flags for MDPComp */
164 void setMDPCompLayerFlags(hwc_context_t *ctx,
165 hwc_display_contents_1_t* list);
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800166 void setRedraw(hwc_context_t *ctx,
167 hwc_display_contents_1_t* list);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800168 /* checks for conditions where mdpcomp is not possible */
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800169 bool isFrameDoable(hwc_context_t *ctx);
170 /* checks for conditions where RGB layers cannot be bypassed */
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800171 bool tryFullFrame(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahaa236822013-04-24 18:07:26 -0700172 /* checks if full MDP comp can be done */
173 bool fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Sushil Chauhandefd3522014-05-13 18:17:12 -0700174 /* Full MDP Composition with Peripheral Tiny Overlap Removal */
175 bool fullMDPCompWithPTOR(hwc_context_t *ctx,hwc_display_contents_1_t* list);
Saurabh Shahaa236822013-04-24 18:07:26 -0700176 /* check if we can use layer cache to do at least partial MDP comp */
177 bool partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shah8028e3b2013-10-15 12:27:59 -0700178 /* Partial MDP comp that uses caching to save power as primary goal */
179 bool cacheBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahbe7bd322014-02-20 16:18:45 -0800180 /* Partial MDP comp that balances the load between MDP and GPU such that
181 * MDP is loaded to the max of its capacity. The lower z order layers are
182 * fed to MDP, whereas the upper ones to GPU, because the upper ones have
183 * lower number of pixels and can reduce GPU processing time */
184 bool loadBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shah8028e3b2013-10-15 12:27:59 -0700185 /* Checks if its worth doing load based partial comp */
Arun Kumar K.R2aa44c62014-01-21 23:08:28 -0800186 bool isLoadBasedCompDoable(hwc_context_t *ctx);
Saurabh Shahaa236822013-04-24 18:07:26 -0700187 /* checks for conditions where only video can be bypassed */
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800188 bool tryVideoOnly(hwc_context_t *ctx, hwc_display_contents_1_t* list);
189 bool videoOnlyComp(hwc_context_t *ctx, hwc_display_contents_1_t* list,
Saurabh Shah90b7b9b2013-09-12 16:36:08 -0700190 bool secureOnly);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700191 /* checks for conditions where only secure RGB and video can be bypassed */
192 bool tryMDPOnlyLayers(hwc_context_t *ctx, hwc_display_contents_1_t* list);
193 bool mdpOnlyLayersComp(hwc_context_t *ctx, hwc_display_contents_1_t* list,
194 bool secureOnly);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800195 /* checks for conditions where YUV layers cannot be bypassed */
196 bool isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700197 /* checks for conditions where Secure RGB layers cannot be bypassed */
198 bool isSecureRGBDoable(hwc_context_t* ctx, hwc_layer_1_t* layer);
Prabhanjan Kandula21918db2013-11-26 15:51:58 +0530199 /* checks if MDP/MDSS can process current list w.r.to HW limitations
200 * All peculiar HW limitations should go here */
201 bool hwLimitationsCheck(hwc_context_t* ctx, hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800202 /* Is debug enabled */
203 static bool isDebug() { return sDebugLogs ? true : false; };
204 /* Is feature enabled */
205 static bool isEnabled() { return sEnabled; };
Sravan Kumar D.V.Nad5d9292013-04-24 14:23:04 +0530206 /* checks for mdp comp dimension limitation */
207 bool isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800208 /* tracks non updating layers*/
Arun Kumar K.Ra727a882014-08-20 17:14:26 -0700209 void updateLayerCache(hwc_context_t* ctx, hwc_display_contents_1_t* list,
210 FrameInfo& frame);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800211 /* optimize layers for mdp comp*/
Prabhanjan Kandula9bd5f642013-09-25 17:00:36 +0530212 bool markLayersForCaching(hwc_context_t* ctx,
213 hwc_display_contents_1_t* list);
214 int getBatch(hwc_display_contents_1_t* list,
215 int& maxBatchStart, int& maxBatchEnd,
216 int& maxBatchCount);
217 bool canPushBatchToTop(const hwc_display_contents_1_t* list,
218 int fromIndex, int toIndex);
219 bool intersectingUpdatingLayers(const hwc_display_contents_1_t* list,
220 int fromIndex, int toIndex, int targetLayerIndex);
221
Ramkumar Radhakrishnanb33f4902014-10-03 16:46:35 -0700222 /* drop other non-AIV layers from external display list.*/
223 void dropNonAIVLayers(hwc_context_t* ctx, hwc_display_contents_1_t* list);
Ramkumar Radhakrishnan9d7bc312014-08-13 19:38:13 -0700224
Prabhanjan Kandula9bd5f642013-09-25 17:00:36 +0530225 /* updates cache map with YUV info */
Saurabh Shah90b7b9b2013-09-12 16:36:08 -0700226 void updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
Arun Kumar K.Ra727a882014-08-20 17:14:26 -0700227 bool secureOnly, FrameInfo& frame);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700228 /* updates cache map with secure RGB info */
229 void updateSecureRGB(hwc_context_t* ctx,
230 hwc_display_contents_1_t* list);
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800231 /* Validates if the GPU/MDP layer split chosen by a strategy is supported
232 * by MDP.
233 * Sets up MDP comp data structures to reflect covnversion from layers to
234 * overlay pipes.
235 * Configures overlay.
236 * Configures if GPU should redraw.
237 */
238 bool postHeuristicsHandling(hwc_context_t *ctx,
239 hwc_display_contents_1_t* list);
240 void reset(hwc_context_t *ctx);
Saurabh Shahe9bc60f2013-08-29 12:58:06 -0700241 bool isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer);
Ramkumar Radhakrishnan9d20b392013-11-15 19:32:47 -0800242 bool resourceCheck(hwc_context_t* ctx, hwc_display_contents_1_t* list);
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800243 hwc_rect_t getUpdatingFBRect(hwc_context_t *ctx,
244 hwc_display_contents_1_t* list);
245 /* checks for conditions to enable partial udpate */
246 bool canPartialUpdate(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800247
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800248 int mDpy;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800249 static bool sEnabled;
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700250 static bool sEnableMixedMode;
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -0700251 static int sSimulationFlags;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800252 static bool sDebugLogs;
253 static bool sIdleFallBack;
Ramkumar Radhakrishnan92abb4f2014-02-06 21:31:29 -0800254 /* Handles the timeout event from kernel, if the value is set to true */
255 static bool sHandleTimeout;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800256 static int sMaxPipesPerMixer;
Manoj Kumar AVM8cbbf7c2014-03-11 01:15:31 -0700257 static bool sSrcSplitEnabled;
Saurabh Shah59562ff2014-09-30 16:13:12 -0700258 static IdleInvalidator *sIdleInvalidator;
Saurabh Shahacec8e42014-11-25 11:07:04 -0800259 static int sMaxSecLayers;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800260 struct FrameInfo mCurrentFrame;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800261 struct LayerCache mCachedFrame;
radhakrishnac9a67412013-09-25 17:40:42 +0530262 //Enable 4kx2k yuv layer split
Raj Kamal389d6e32014-08-04 14:43:24 +0530263 static bool sEnableYUVsplit;
Raj Kamal4393eaa2014-06-06 13:45:20 +0530264 bool mModeOn; // if prepare happened
Arun Kumar K.R2aa44c62014-01-21 23:08:28 -0800265 bool allocSplitVGPipesfor4k2k(hwc_context_t *ctx, int index);
Dileep Kumar Reddi4070e932014-09-30 09:00:57 +0530266 //Enable Partial Update for MDP3 targets
267 static bool enablePartialUpdateForMDP3;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800268};
269
Saurabh Shah88e4d272013-09-03 13:31:29 -0700270class MDPCompNonSplit : public MDPComp {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800271public:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700272 explicit MDPCompNonSplit(int dpy):MDPComp(dpy){};
273 virtual ~MDPCompNonSplit(){};
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800274 virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800275
276private:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700277 struct MdpPipeInfoNonSplit : public MdpPipeInfo {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800278 ovutils::eDest index;
Saurabh Shah88e4d272013-09-03 13:31:29 -0700279 virtual ~MdpPipeInfoNonSplit() {};
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700280 };
281
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700282 /* configure's overlay pipes for the frame */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800283 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800284 PipeLayerPair& pipeLayerPair);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800285
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700286 /* allocates pipes to selected candidates */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800287 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800288 hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800289
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800290 /* Increments mdpCount if 4k2k yuv layer split is enabled.
291 * updates framebuffer z order if fb lies above source-split layer */
292 virtual void adjustForSourceSplit(hwc_context_t *ctx,
Arun Kumar K.R2aa44c62014-01-21 23:08:28 -0800293 hwc_display_contents_1_t* list);
radhakrishnac9a67412013-09-25 17:40:42 +0530294
295 /* configures 4kx2k yuv layer to 2 VG pipes*/
296 virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer,
297 PipeLayerPair& PipeLayerPair);
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800298 /* generates ROI based on the modified area of the frame */
299 virtual void generateROI(hwc_context_t *ctx,
300 hwc_display_contents_1_t* list);
301 /* validates the ROI generated for fallback conditions */
302 virtual bool validateAndApplyROI(hwc_context_t *ctx,
303 hwc_display_contents_1_t* list);
304 /* Trims fbRect calculated against ROI generated */
305 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect);
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700306};
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800307
Saurabh Shah88e4d272013-09-03 13:31:29 -0700308class MDPCompSplit : public MDPComp {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800309public:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700310 explicit MDPCompSplit(int dpy):MDPComp(dpy){};
311 virtual ~MDPCompSplit(){};
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800312 virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
Saurabh Shahab47c692014-02-12 18:45:57 -0800313
314protected:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700315 struct MdpPipeInfoSplit : public MdpPipeInfo {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800316 ovutils::eDest lIndex;
317 ovutils::eDest rIndex;
Saurabh Shah88e4d272013-09-03 13:31:29 -0700318 virtual ~MdpPipeInfoSplit() {};
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800319 };
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800320
Saurabh Shahab47c692014-02-12 18:45:57 -0800321 virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
Saurabh Shahc62f3982014-03-05 14:28:26 -0800322 MdpPipeInfoSplit& pipe_info);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800323
324 /* configure's overlay pipes for the frame */
325 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800326 PipeLayerPair& pipeLayerPair);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800327
328 /* allocates pipes to selected candidates */
329 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800330 hwc_display_contents_1_t* list);
Saurabh Shahab47c692014-02-12 18:45:57 -0800331private:
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800332 /* Increments mdpCount if 4k2k yuv layer split is enabled.
333 * updates framebuffer z order if fb lies above source-split layer */
334 virtual void adjustForSourceSplit(hwc_context_t *ctx,
radhakrishnac9a67412013-09-25 17:40:42 +0530335 hwc_display_contents_1_t* list);
336
337 /* configures 4kx2k yuv layer*/
338 virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer,
339 PipeLayerPair& PipeLayerPair);
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800340 /* generates ROI based on the modified area of the frame */
341 virtual void generateROI(hwc_context_t *ctx,
342 hwc_display_contents_1_t* list);
343 /* validates the ROI generated for fallback conditions */
344 virtual bool validateAndApplyROI(hwc_context_t *ctx,
345 hwc_display_contents_1_t* list);
346 /* Trims fbRect calculated against ROI generated */
347 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800348};
Saurabh Shah2a4eb1b2013-07-22 16:33:23 -0700349
Saurabh Shahab47c692014-02-12 18:45:57 -0800350class MDPCompSrcSplit : public MDPCompSplit {
351public:
352 explicit MDPCompSrcSplit(int dpy) : MDPCompSplit(dpy){};
353 virtual ~MDPCompSrcSplit(){};
354private:
355 virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
Saurabh Shahc62f3982014-03-05 14:28:26 -0800356 MdpPipeInfoSplit& pipe_info);
Saurabh Shahab47c692014-02-12 18:45:57 -0800357
Saurabh Shahab47c692014-02-12 18:45:57 -0800358 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
359 PipeLayerPair& pipeLayerPair);
360};
361
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700362}; //namespace
363#endif