blob: 7752384503897cb26bf7ab30b7b16ee9439f1bf2 [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);
Jeykumar Sankaran53b05f22014-08-05 11:27:03 -070059 static int setPartialUpdatePref(hwc_context_t *ctx, bool enable);
Jeykumar Sankaranf4eb9fb2014-12-04 13:06:43 -080060 static bool getPartialUpdatePref(hwc_context_t *ctx);
Jeykumar Sankaran14d41a82015-03-11 14:13:43 -070061 static void enablePartialUpdate(bool enable)
62 { sIsPartialUpdateActive = enable; };
Praveena Pachipulusu66c8ef72014-11-25 18:47:54 +053063 void setDynRefreshRate(hwc_context_t *ctx, hwc_display_contents_1_t* list);
64
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080065protected:
Naseer Ahmed54821fe2012-11-28 18:44:38 -050066 enum ePipeType {
67 MDPCOMP_OV_RGB = ovutils::OV_MDP_PIPE_RGB,
68 MDPCOMP_OV_VG = ovutils::OV_MDP_PIPE_VG,
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080069 MDPCOMP_OV_DMA = ovutils::OV_MDP_PIPE_DMA,
Naseer Ahmed54821fe2012-11-28 18:44:38 -050070 MDPCOMP_OV_ANY,
Naseer Ahmed7c958d42012-07-31 18:57:03 -070071 };
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080072
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -070073 //Simulation flags
74 enum {
75 MDPCOMP_AVOID_FULL_MDP = 0x001,
76 MDPCOMP_AVOID_CACHE_MDP = 0x002,
77 MDPCOMP_AVOID_LOAD_MDP = 0x004,
78 MDPCOMP_AVOID_VIDEO_ONLY = 0x008,
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -070079 MDPCOMP_AVOID_MDP_ONLY_LAYERS = 0x010,
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -070080 };
81
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080082 /* mdp pipe data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080083 struct MdpPipeInfo {
84 int zOrder;
85 virtual ~MdpPipeInfo(){};
86 };
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080087
radhakrishnac9a67412013-09-25 17:40:42 +053088 struct MdpYUVPipeInfo : public MdpPipeInfo{
89 ovutils::eDest lIndex;
90 ovutils::eDest rIndex;
91 virtual ~MdpYUVPipeInfo(){};
92 };
93
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080094 /* per layer data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080095 struct PipeLayerPair {
96 MdpPipeInfo *pipeInfo;
Saurabh Shahacf10202013-02-26 10:15:15 -080097 overlay::Rotator* rot;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080098 int listIndex;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080099 };
100
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800101 /* per frame data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800102 struct FrameInfo {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800103 /* maps layer list to mdp list */
104 int layerCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700105 int layerToMDP[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800106
107 /* maps mdp list to layer list */
108 int mdpCount;
Jeykumar Sankaranbe93e272014-06-19 18:15:57 -0700109 struct PipeLayerPair mdpToLayer[MAX_NUM_BLEND_STAGES];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800110
111 /* layer composing on FB? */
112 int fbCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700113 bool isFBComposed[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran6a9bb9e2013-08-01 14:19:26 -0700114 /* layers lying outside ROI. Will
115 * be dropped off from the composition */
116 int dropCount;
117 bool drop[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800118
119 bool needsRedraw;
120 int fbZ;
121
122 /* c'tor */
123 FrameInfo();
124 /* clear old frame data */
Saurabh Shahaa236822013-04-24 18:07:26 -0700125 void reset(const int& numLayers);
126 void map();
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800127 };
128
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800129 /* cached data */
130 struct LayerCache {
131 int layerCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700132 buffer_handle_t hnd[MAX_NUM_APP_LAYERS];
Prabhanjan Kandula2243aa62013-10-24 12:58:55 +0530133 bool isFBComposed[MAX_NUM_APP_LAYERS];
134 bool drop[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800135
136 /* c'tor */
137 LayerCache();
138 /* clear caching info*/
139 void reset();
Saurabh Shahaa236822013-04-24 18:07:26 -0700140 void cacheAll(hwc_display_contents_1_t* list);
141 void updateCounts(const FrameInfo&);
Jeykumar Sankaran988d3682013-11-15 11:57:16 -0800142 bool isSameFrame(const FrameInfo& curFrame,
143 hwc_display_contents_1_t* list);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800144 };
145
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800146 /* allocates pipe from pipe book */
147 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800148 hwc_display_contents_1_t* list) = 0;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800149 /* configures MPD pipes */
150 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800151 PipeLayerPair& pipeLayerPair) = 0;
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800152 /* Increments mdpCount if 4k2k yuv layer split is enabled.
153 * updates framebuffer z order if fb lies above source-split layer */
154 virtual void adjustForSourceSplit(hwc_context_t *ctx,
radhakrishnac9a67412013-09-25 17:40:42 +0530155 hwc_display_contents_1_t* list) = 0;
156 /* configures 4kx2k yuv layer*/
157 virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer,
158 PipeLayerPair& PipeLayerPair) = 0;
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800159 /* generates ROI based on the modified area of the frame */
160 virtual void generateROI(hwc_context_t *ctx,
161 hwc_display_contents_1_t* list) = 0;
162 /* validates the ROI generated for fallback conditions */
163 virtual bool validateAndApplyROI(hwc_context_t *ctx,
164 hwc_display_contents_1_t* list) = 0;
Jeykumar Sankaranaedd1432015-01-15 11:25:03 -0800165 /* Trims layer coordinates against ROI generated */
166 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& crop,
167 hwc_rect& dst) = 0;
Jeykumar Sankaran1e156112014-04-30 11:03:23 -0700168 /* set/reset flags for MDPComp */
169 void setMDPCompLayerFlags(hwc_context_t *ctx,
170 hwc_display_contents_1_t* list);
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800171 void setRedraw(hwc_context_t *ctx,
172 hwc_display_contents_1_t* list);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800173 /* checks for conditions where mdpcomp is not possible */
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800174 bool isFrameDoable(hwc_context_t *ctx);
175 /* checks for conditions where RGB layers cannot be bypassed */
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800176 bool tryFullFrame(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahaa236822013-04-24 18:07:26 -0700177 /* checks if full MDP comp can be done */
178 bool fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Sushil Chauhandefd3522014-05-13 18:17:12 -0700179 /* Full MDP Composition with Peripheral Tiny Overlap Removal */
180 bool fullMDPCompWithPTOR(hwc_context_t *ctx,hwc_display_contents_1_t* list);
Saurabh Shahaa236822013-04-24 18:07:26 -0700181 /* check if we can use layer cache to do at least partial MDP comp */
182 bool partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shah8028e3b2013-10-15 12:27:59 -0700183 /* Partial MDP comp that uses caching to save power as primary goal */
184 bool cacheBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahbe7bd322014-02-20 16:18:45 -0800185 /* Partial MDP comp that balances the load between MDP and GPU such that
186 * MDP is loaded to the max of its capacity. The lower z order layers are
187 * fed to MDP, whereas the upper ones to GPU, because the upper ones have
188 * lower number of pixels and can reduce GPU processing time */
189 bool loadBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shah8028e3b2013-10-15 12:27:59 -0700190 /* Checks if its worth doing load based partial comp */
Arun Kumar K.R2aa44c62014-01-21 23:08:28 -0800191 bool isLoadBasedCompDoable(hwc_context_t *ctx);
Saurabh Shahaa236822013-04-24 18:07:26 -0700192 /* checks for conditions where only video can be bypassed */
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800193 bool tryVideoOnly(hwc_context_t *ctx, hwc_display_contents_1_t* list);
194 bool videoOnlyComp(hwc_context_t *ctx, hwc_display_contents_1_t* list,
Saurabh Shah90b7b9b2013-09-12 16:36:08 -0700195 bool secureOnly);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700196 /* checks for conditions where only secure RGB and video can be bypassed */
197 bool tryMDPOnlyLayers(hwc_context_t *ctx, hwc_display_contents_1_t* list);
198 bool mdpOnlyLayersComp(hwc_context_t *ctx, hwc_display_contents_1_t* list,
199 bool secureOnly);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800200 /* checks for conditions where YUV layers cannot be bypassed */
201 bool isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700202 /* checks for conditions where Secure RGB layers cannot be bypassed */
203 bool isSecureRGBDoable(hwc_context_t* ctx, hwc_layer_1_t* layer);
Prabhanjan Kandula21918db2013-11-26 15:51:58 +0530204 /* checks if MDP/MDSS can process current list w.r.to HW limitations
205 * All peculiar HW limitations should go here */
206 bool hwLimitationsCheck(hwc_context_t* ctx, hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800207 /* Is debug enabled */
208 static bool isDebug() { return sDebugLogs ? true : false; };
209 /* Is feature enabled */
210 static bool isEnabled() { return sEnabled; };
Sravan Kumar D.V.Nad5d9292013-04-24 14:23:04 +0530211 /* checks for mdp comp dimension limitation */
212 bool isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800213 /* tracks non updating layers*/
Arun Kumar K.Ra727a882014-08-20 17:14:26 -0700214 void updateLayerCache(hwc_context_t* ctx, hwc_display_contents_1_t* list,
215 FrameInfo& frame);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800216 /* optimize layers for mdp comp*/
Prabhanjan Kandula9bd5f642013-09-25 17:00:36 +0530217 bool markLayersForCaching(hwc_context_t* ctx,
218 hwc_display_contents_1_t* list);
219 int getBatch(hwc_display_contents_1_t* list,
220 int& maxBatchStart, int& maxBatchEnd,
221 int& maxBatchCount);
222 bool canPushBatchToTop(const hwc_display_contents_1_t* list,
223 int fromIndex, int toIndex);
224 bool intersectingUpdatingLayers(const hwc_display_contents_1_t* list,
225 int fromIndex, int toIndex, int targetLayerIndex);
226
Ramkumar Radhakrishnanb33f4902014-10-03 16:46:35 -0700227 /* drop other non-AIV layers from external display list.*/
228 void dropNonAIVLayers(hwc_context_t* ctx, hwc_display_contents_1_t* list);
Ramkumar Radhakrishnan9d7bc312014-08-13 19:38:13 -0700229
Prabhanjan Kandula9bd5f642013-09-25 17:00:36 +0530230 /* updates cache map with YUV info */
Saurabh Shah90b7b9b2013-09-12 16:36:08 -0700231 void updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
Arun Kumar K.Ra727a882014-08-20 17:14:26 -0700232 bool secureOnly, FrameInfo& frame);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700233 /* updates cache map with secure RGB info */
234 void updateSecureRGB(hwc_context_t* ctx,
235 hwc_display_contents_1_t* list);
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800236 /* Validates if the GPU/MDP layer split chosen by a strategy is supported
237 * by MDP.
238 * Sets up MDP comp data structures to reflect covnversion from layers to
239 * overlay pipes.
240 * Configures overlay.
241 * Configures if GPU should redraw.
242 */
243 bool postHeuristicsHandling(hwc_context_t *ctx,
244 hwc_display_contents_1_t* list);
245 void reset(hwc_context_t *ctx);
Saurabh Shahe9bc60f2013-08-29 12:58:06 -0700246 bool isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer);
Ramkumar Radhakrishnan9d20b392013-11-15 19:32:47 -0800247 bool resourceCheck(hwc_context_t* ctx, hwc_display_contents_1_t* list);
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800248 hwc_rect_t getUpdatingFBRect(hwc_context_t *ctx,
249 hwc_display_contents_1_t* list);
250 /* checks for conditions to enable partial udpate */
251 bool canPartialUpdate(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Arun Kumar K.R299bcda2014-12-18 19:36:40 -0800252 // Checks if only videocontent is updating
253 bool onlyVideosUpdating(hwc_context_t *ctx, hwc_display_contents_1_t* list);
254 static bool loadPerfLib();
255 void setPerfHint(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800256
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800257 int mDpy;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800258 static bool sEnabled;
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700259 static bool sEnableMixedMode;
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -0700260 static int sSimulationFlags;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800261 static bool sDebugLogs;
262 static bool sIdleFallBack;
Ramkumar Radhakrishnan92abb4f2014-02-06 21:31:29 -0800263 /* Handles the timeout event from kernel, if the value is set to true */
264 static bool sHandleTimeout;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800265 static int sMaxPipesPerMixer;
Manoj Kumar AVM8cbbf7c2014-03-11 01:15:31 -0700266 static bool sSrcSplitEnabled;
Saurabh Shah59562ff2014-09-30 16:13:12 -0700267 static IdleInvalidator *sIdleInvalidator;
Saurabh Shahacec8e42014-11-25 11:07:04 -0800268 static int sMaxSecLayers;
Jeykumar Sankaran53b05f22014-08-05 11:27:03 -0700269 static bool sIsPartialUpdateActive;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800270 struct FrameInfo mCurrentFrame;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800271 struct LayerCache mCachedFrame;
radhakrishnac9a67412013-09-25 17:40:42 +0530272 //Enable 4kx2k yuv layer split
Raj Kamal389d6e32014-08-04 14:43:24 +0530273 static bool sEnableYUVsplit;
Raj Kamal4393eaa2014-06-06 13:45:20 +0530274 bool mModeOn; // if prepare happened
Naseer Ahmed6bbd0a12015-01-23 11:57:10 -0500275 bool allocSplitVGPipes(hwc_context_t *ctx, int index);
Dileep Kumar Reddi4070e932014-09-30 09:00:57 +0530276 //Enable Partial Update for MDP3 targets
277 static bool enablePartialUpdateForMDP3;
Arun Kumar K.R299bcda2014-12-18 19:36:40 -0800278 static void *sLibPerfHint;
279 static int sPerfLockHandle;
280 static int (*sPerfLockAcquire)(int, int, int*, int);
281 static int (*sPerfLockRelease)(int value);
282 static int sPerfHintWindow;
283
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800284};
285
Saurabh Shah88e4d272013-09-03 13:31:29 -0700286class MDPCompNonSplit : public MDPComp {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800287public:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700288 explicit MDPCompNonSplit(int dpy):MDPComp(dpy){};
289 virtual ~MDPCompNonSplit(){};
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800290 virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800291
292private:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700293 struct MdpPipeInfoNonSplit : public MdpPipeInfo {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800294 ovutils::eDest index;
Saurabh Shah88e4d272013-09-03 13:31:29 -0700295 virtual ~MdpPipeInfoNonSplit() {};
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700296 };
297
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700298 /* configure's overlay pipes for the frame */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800299 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800300 PipeLayerPair& pipeLayerPair);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800301
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700302 /* allocates pipes to selected candidates */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800303 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800304 hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800305
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800306 /* Increments mdpCount if 4k2k yuv layer split is enabled.
307 * updates framebuffer z order if fb lies above source-split layer */
308 virtual void adjustForSourceSplit(hwc_context_t *ctx,
Arun Kumar K.R2aa44c62014-01-21 23:08:28 -0800309 hwc_display_contents_1_t* list);
radhakrishnac9a67412013-09-25 17:40:42 +0530310
311 /* configures 4kx2k yuv layer to 2 VG pipes*/
312 virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer,
313 PipeLayerPair& PipeLayerPair);
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800314 /* generates ROI based on the modified area of the frame */
315 virtual void generateROI(hwc_context_t *ctx,
316 hwc_display_contents_1_t* list);
317 /* validates the ROI generated for fallback conditions */
318 virtual bool validateAndApplyROI(hwc_context_t *ctx,
319 hwc_display_contents_1_t* list);
Jeykumar Sankaranaedd1432015-01-15 11:25:03 -0800320 /* Trims layer coordinates against ROI generated */
321 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& crop,
322 hwc_rect& dst);
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700323};
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800324
Saurabh Shah88e4d272013-09-03 13:31:29 -0700325class MDPCompSplit : public MDPComp {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800326public:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700327 explicit MDPCompSplit(int dpy):MDPComp(dpy){};
328 virtual ~MDPCompSplit(){};
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800329 virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
Saurabh Shahab47c692014-02-12 18:45:57 -0800330
331protected:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700332 struct MdpPipeInfoSplit : public MdpPipeInfo {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800333 ovutils::eDest lIndex;
334 ovutils::eDest rIndex;
Saurabh Shah88e4d272013-09-03 13:31:29 -0700335 virtual ~MdpPipeInfoSplit() {};
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800336 };
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800337
Saurabh Shahab47c692014-02-12 18:45:57 -0800338 virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
Saurabh Shahc62f3982014-03-05 14:28:26 -0800339 MdpPipeInfoSplit& pipe_info);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800340
341 /* configure's overlay pipes for the frame */
342 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800343 PipeLayerPair& pipeLayerPair);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800344
345 /* allocates pipes to selected candidates */
346 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800347 hwc_display_contents_1_t* list);
Jeykumar Sankaranaedd1432015-01-15 11:25:03 -0800348 /* Trims layer coordinates against ROI generated */
349 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& crop,
350 hwc_rect& dst);
Saurabh Shahab47c692014-02-12 18:45:57 -0800351private:
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800352 /* Increments mdpCount if 4k2k yuv layer split is enabled.
353 * updates framebuffer z order if fb lies above source-split layer */
354 virtual void adjustForSourceSplit(hwc_context_t *ctx,
radhakrishnac9a67412013-09-25 17:40:42 +0530355 hwc_display_contents_1_t* list);
356
357 /* configures 4kx2k yuv layer*/
358 virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer,
359 PipeLayerPair& PipeLayerPair);
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800360 /* generates ROI based on the modified area of the frame */
361 virtual void generateROI(hwc_context_t *ctx,
362 hwc_display_contents_1_t* list);
363 /* validates the ROI generated for fallback conditions */
364 virtual bool validateAndApplyROI(hwc_context_t *ctx,
365 hwc_display_contents_1_t* list);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800366};
Saurabh Shah2a4eb1b2013-07-22 16:33:23 -0700367
Saurabh Shahab47c692014-02-12 18:45:57 -0800368class MDPCompSrcSplit : public MDPCompSplit {
369public:
370 explicit MDPCompSrcSplit(int dpy) : MDPCompSplit(dpy){};
371 virtual ~MDPCompSrcSplit(){};
372private:
373 virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
Saurabh Shahc62f3982014-03-05 14:28:26 -0800374 MdpPipeInfoSplit& pipe_info);
Saurabh Shahab47c692014-02-12 18:45:57 -0800375
Saurabh Shahab47c692014-02-12 18:45:57 -0800376 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
377 PipeLayerPair& pipeLayerPair);
Jeykumar Sankaranaedd1432015-01-15 11:25:03 -0800378 /* generates ROI based on the modified area of the frame */
379 virtual void generateROI(hwc_context_t *ctx,
380 hwc_display_contents_1_t* list);
381 /* validates the ROI generated for fallback conditions */
382 virtual bool validateAndApplyROI(hwc_context_t *ctx,
383 hwc_display_contents_1_t* list);
Saurabh Shahab47c692014-02-12 18:45:57 -0800384};
385
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700386}; //namespace
387#endif