blob: db68e825efe354880529b61ce7000cf7eeb9fd15 [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); }
Raj Kamalfdfdddf2015-03-16 21:59:25 +053048 bool isMDPComp() { return mModeOn; }
Sushil Chauhandefd3522014-05-13 18:17:12 -070049 int drawOverlap(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shah88e4d272013-09-03 13:31:29 -070050 static MDPComp* getObject(hwc_context_t *ctx, const int& dpy);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080051 /* Handler to invoke frame redraw on Idle Timer expiry */
52 static void timeout_handler(void *udata);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080053 /* Initialize MDP comp*/
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080054 static bool init(hwc_context_t *ctx);
Saurabh Shah98acd092013-05-03 10:48:24 -070055 static void resetIdleFallBack() { sIdleFallBack = false; }
Ramkumar Radhakrishnanfb822912014-03-14 17:28:14 -070056 static bool isIdleFallback() { return sIdleFallBack; }
Naseer Ahmed35a268c2014-06-24 19:07:13 -040057 static void dynamicDebug(bool enable){ sDebugLogs = enable; }
Saurabh Shah59562ff2014-09-30 16:13:12 -070058 static void setIdleTimeout(const uint32_t& timeout);
Jeykumar Sankaranbe93e272014-06-19 18:15:57 -070059 static void setMaxPipesPerMixer(const uint32_t value);
Jeykumar Sankaran53b05f22014-08-05 11:27:03 -070060 static int setPartialUpdatePref(hwc_context_t *ctx, bool enable);
Jeykumar Sankaranf4eb9fb2014-12-04 13:06:43 -080061 static bool getPartialUpdatePref(hwc_context_t *ctx);
Jeykumar Sankaran14d41a82015-03-11 14:13:43 -070062 static void enablePartialUpdate(bool enable)
63 { sIsPartialUpdateActive = enable; };
Praveena Pachipulusu66c8ef72014-11-25 18:47:54 +053064 void setDynRefreshRate(hwc_context_t *ctx, hwc_display_contents_1_t* list);
65
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -080066protected:
Naseer Ahmed54821fe2012-11-28 18:44:38 -050067 enum ePipeType {
68 MDPCOMP_OV_RGB = ovutils::OV_MDP_PIPE_RGB,
69 MDPCOMP_OV_VG = ovutils::OV_MDP_PIPE_VG,
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080070 MDPCOMP_OV_DMA = ovutils::OV_MDP_PIPE_DMA,
Naseer Ahmed54821fe2012-11-28 18:44:38 -050071 MDPCOMP_OV_ANY,
Naseer Ahmed7c958d42012-07-31 18:57:03 -070072 };
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080073
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -070074 //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 Radhakrishnan4ec775f2014-07-23 17:43:18 -070080 MDPCOMP_AVOID_MDP_ONLY_LAYERS = 0x010,
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -070081 };
82
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080083 /* mdp pipe data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080084 struct MdpPipeInfo {
85 int zOrder;
86 virtual ~MdpPipeInfo(){};
87 };
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080088
radhakrishnac9a67412013-09-25 17:40:42 +053089 struct MdpYUVPipeInfo : public MdpPipeInfo{
90 ovutils::eDest lIndex;
91 ovutils::eDest rIndex;
92 virtual ~MdpYUVPipeInfo(){};
93 };
94
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080095 /* per layer data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -080096 struct PipeLayerPair {
97 MdpPipeInfo *pipeInfo;
Saurabh Shahacf10202013-02-26 10:15:15 -080098 overlay::Rotator* rot;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -080099 int listIndex;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800100 };
101
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800102 /* per frame data */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800103 struct FrameInfo {
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800104 /* maps layer list to mdp list */
105 int layerCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700106 int layerToMDP[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800107
108 /* maps mdp list to layer list */
109 int mdpCount;
Jeykumar Sankaranbe93e272014-06-19 18:15:57 -0700110 struct PipeLayerPair mdpToLayer[MAX_NUM_BLEND_STAGES];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800111
112 /* layer composing on FB? */
113 int fbCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700114 bool isFBComposed[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran6a9bb9e2013-08-01 14:19:26 -0700115 /* layers lying outside ROI. Will
116 * be dropped off from the composition */
117 int dropCount;
118 bool drop[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800119
120 bool needsRedraw;
121 int fbZ;
Arun Kumar K.R00b84792015-03-27 11:28:36 -0700122 int hwCursorIndex;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800123
124 /* c'tor */
125 FrameInfo();
126 /* clear old frame data */
Saurabh Shahaa236822013-04-24 18:07:26 -0700127 void reset(const int& numLayers);
128 void map();
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800129 };
130
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800131 /* cached data */
132 struct LayerCache {
133 int layerCount;
Ramkumar Radhakrishnane661f962013-06-05 17:21:38 -0700134 buffer_handle_t hnd[MAX_NUM_APP_LAYERS];
Prabhanjan Kandula2243aa62013-10-24 12:58:55 +0530135 bool isFBComposed[MAX_NUM_APP_LAYERS];
136 bool drop[MAX_NUM_APP_LAYERS];
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800137
138 /* c'tor */
139 LayerCache();
140 /* clear caching info*/
141 void reset();
Saurabh Shahaa236822013-04-24 18:07:26 -0700142 void cacheAll(hwc_display_contents_1_t* list);
143 void updateCounts(const FrameInfo&);
Jeykumar Sankaran988d3682013-11-15 11:57:16 -0800144 bool isSameFrame(const FrameInfo& curFrame,
145 hwc_display_contents_1_t* list);
Raj Kamalfdfdddf2015-03-16 21:59:25 +0530146 bool isSameFrame(hwc_context_t *ctx, int dpy,
147 hwc_display_contents_1_t* list);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800148 };
149
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800150 /* allocates pipe from pipe book */
151 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800152 hwc_display_contents_1_t* list) = 0;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800153 /* configures MPD pipes */
154 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800155 PipeLayerPair& pipeLayerPair) = 0;
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800156 /* 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,
radhakrishnac9a67412013-09-25 17:40:42 +0530159 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 Sankaran6c7eeac2013-11-18 11:19:45 -0800163 /* 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 Sankaranaedd1432015-01-15 11:25:03 -0800169 /* Trims layer coordinates against ROI generated */
170 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& crop,
171 hwc_rect& dst) = 0;
Jeykumar Sankaran1e156112014-04-30 11:03:23 -0700172 /* set/reset flags for MDPComp */
173 void setMDPCompLayerFlags(hwc_context_t *ctx,
174 hwc_display_contents_1_t* list);
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800175 void setRedraw(hwc_context_t *ctx,
176 hwc_display_contents_1_t* list);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800177 /* checks for conditions where mdpcomp is not possible */
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800178 bool isFrameDoable(hwc_context_t *ctx);
179 /* checks for conditions where RGB layers cannot be bypassed */
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800180 bool tryFullFrame(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Saurabh Shahaa236822013-04-24 18:07:26 -0700181 /* checks if full MDP comp can be done */
182 bool fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
Sushil Chauhandefd3522014-05-13 18:17:12 -0700183 /* Full MDP Composition with Peripheral Tiny Overlap Removal */
184 bool fullMDPCompWithPTOR(hwc_context_t *ctx,hwc_display_contents_1_t* list);
Saurabh Shahaa236822013-04-24 18:07:26 -0700185 /* 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 Shah8028e3b2013-10-15 12:27:59 -0700187 /* 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 Shahbe7bd322014-02-20 16:18:45 -0800189 /* 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 Shah8028e3b2013-10-15 12:27:59 -0700194 /* Checks if its worth doing load based partial comp */
Arun Kumar K.R2aa44c62014-01-21 23:08:28 -0800195 bool isLoadBasedCompDoable(hwc_context_t *ctx);
Saurabh Shahaa236822013-04-24 18:07:26 -0700196 /* checks for conditions where only video can be bypassed */
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800197 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 Shah90b7b9b2013-09-12 16:36:08 -0700199 bool secureOnly);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700200 /* 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 Sankaran85977e32013-02-25 17:06:08 -0800204 /* checks for conditions where YUV layers cannot be bypassed */
205 bool isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700206 /* checks for conditions where Secure RGB layers cannot be bypassed */
207 bool isSecureRGBDoable(hwc_context_t* ctx, hwc_layer_1_t* layer);
Prabhanjan Kandula21918db2013-11-26 15:51:58 +0530208 /* 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 Shahcbf7ccc2012-12-19 16:45:51 -0800211 /* 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.Nad5d9292013-04-24 14:23:04 +0530215 /* checks for mdp comp dimension limitation */
216 bool isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800217 /* tracks non updating layers*/
Arun Kumar K.Ra727a882014-08-20 17:14:26 -0700218 void updateLayerCache(hwc_context_t* ctx, hwc_display_contents_1_t* list,
219 FrameInfo& frame);
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800220 /* optimize layers for mdp comp*/
Prabhanjan Kandula9bd5f642013-09-25 17:00:36 +0530221 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 Radhakrishnanb33f4902014-10-03 16:46:35 -0700231 /* drop other non-AIV layers from external display list.*/
232 void dropNonAIVLayers(hwc_context_t* ctx, hwc_display_contents_1_t* list);
Ramkumar Radhakrishnan9d7bc312014-08-13 19:38:13 -0700233
Prabhanjan Kandula9bd5f642013-09-25 17:00:36 +0530234 /* updates cache map with YUV info */
Saurabh Shah90b7b9b2013-09-12 16:36:08 -0700235 void updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
Arun Kumar K.Ra727a882014-08-20 17:14:26 -0700236 bool secureOnly, FrameInfo& frame);
Ramkumar Radhakrishnan4ec775f2014-07-23 17:43:18 -0700237 /* updates cache map with secure RGB info */
238 void updateSecureRGB(hwc_context_t* ctx,
239 hwc_display_contents_1_t* list);
Saurabh Shahdf4741d2013-12-12 16:40:28 -0800240 /* 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 Shahe9bc60f2013-08-29 12:58:06 -0700250 bool isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer);
Ramkumar Radhakrishnan9d20b392013-11-15 19:32:47 -0800251 bool resourceCheck(hwc_context_t* ctx, hwc_display_contents_1_t* list);
Jeykumar Sankaran6c7eeac2013-11-18 11:19:45 -0800252 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.R299bcda2014-12-18 19:36:40 -0800256 // 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 Shahcbf7ccc2012-12-19 16:45:51 -0800260
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800261 int mDpy;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800262 static bool sEnabled;
Jeykumar Sankaran24c199d2013-05-24 09:40:36 -0700263 static bool sEnableMixedMode;
Jeykumar Sankaran0ad97c42014-03-09 23:00:53 -0700264 static int sSimulationFlags;
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800265 static bool sDebugLogs;
266 static bool sIdleFallBack;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800267 static int sMaxPipesPerMixer;
Manoj Kumar AVM8cbbf7c2014-03-11 01:15:31 -0700268 static bool sSrcSplitEnabled;
Saurabh Shah59562ff2014-09-30 16:13:12 -0700269 static IdleInvalidator *sIdleInvalidator;
Saurabh Shahacec8e42014-11-25 11:07:04 -0800270 static int sMaxSecLayers;
Jeykumar Sankaran53b05f22014-08-05 11:27:03 -0700271 static bool sIsPartialUpdateActive;
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800272 struct FrameInfo mCurrentFrame;
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800273 struct LayerCache mCachedFrame;
radhakrishnac9a67412013-09-25 17:40:42 +0530274 //Enable 4kx2k yuv layer split
Raj Kamal389d6e32014-08-04 14:43:24 +0530275 static bool sEnableYUVsplit;
Raj Kamal4393eaa2014-06-06 13:45:20 +0530276 bool mModeOn; // if prepare happened
Naseer Ahmed6bbd0a12015-01-23 11:57:10 -0500277 bool allocSplitVGPipes(hwc_context_t *ctx, int index);
Raj Kamalfdfdddf2015-03-16 21:59:25 +0530278 bool mPrevModeOn; //if previous prepare happened
Dileep Kumar Reddi4070e932014-09-30 09:00:57 +0530279 //Enable Partial Update for MDP3 targets
280 static bool enablePartialUpdateForMDP3;
Arun Kumar K.R299bcda2014-12-18 19:36:40 -0800281 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 Shahcbf7ccc2012-12-19 16:45:51 -0800287};
288
Saurabh Shah88e4d272013-09-03 13:31:29 -0700289class MDPCompNonSplit : public MDPComp {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800290public:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700291 explicit MDPCompNonSplit(int dpy):MDPComp(dpy){};
292 virtual ~MDPCompNonSplit(){};
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800293 virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800294
295private:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700296 struct MdpPipeInfoNonSplit : public MdpPipeInfo {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800297 ovutils::eDest index;
Saurabh Shah88e4d272013-09-03 13:31:29 -0700298 virtual ~MdpPipeInfoNonSplit() {};
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700299 };
300
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700301 /* configure's overlay pipes for the frame */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800302 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800303 PipeLayerPair& pipeLayerPair);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800304
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700305 /* allocates pipes to selected candidates */
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800306 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800307 hwc_display_contents_1_t* list);
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800308
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800309 /* 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.R2aa44c62014-01-21 23:08:28 -0800312 hwc_display_contents_1_t* list);
radhakrishnac9a67412013-09-25 17:40:42 +0530313
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 Sankaran6c7eeac2013-11-18 11:19:45 -0800317 /* 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 Sankaranaedd1432015-01-15 11:25:03 -0800323 /* Trims layer coordinates against ROI generated */
324 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& crop,
325 hwc_rect& dst);
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700326};
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800327
Saurabh Shah88e4d272013-09-03 13:31:29 -0700328class MDPCompSplit : public MDPComp {
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800329public:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700330 explicit MDPCompSplit(int dpy):MDPComp(dpy){};
331 virtual ~MDPCompSplit(){};
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800332 virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
Saurabh Shahab47c692014-02-12 18:45:57 -0800333
334protected:
Saurabh Shah88e4d272013-09-03 13:31:29 -0700335 struct MdpPipeInfoSplit : public MdpPipeInfo {
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800336 ovutils::eDest lIndex;
337 ovutils::eDest rIndex;
Saurabh Shah88e4d272013-09-03 13:31:29 -0700338 virtual ~MdpPipeInfoSplit() {};
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800339 };
Saurabh Shahcbf7ccc2012-12-19 16:45:51 -0800340
Saurabh Shahab47c692014-02-12 18:45:57 -0800341 virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
Saurabh Shahc62f3982014-03-05 14:28:26 -0800342 MdpPipeInfoSplit& pipe_info);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800343
344 /* configure's overlay pipes for the frame */
345 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800346 PipeLayerPair& pipeLayerPair);
Jeykumar Sankaranb551ce42013-01-10 16:26:48 -0800347
348 /* allocates pipes to selected candidates */
349 virtual bool allocLayerPipes(hwc_context_t *ctx,
Jeykumar Sankaran85977e32013-02-25 17:06:08 -0800350 hwc_display_contents_1_t* list);
Jeykumar Sankaranaedd1432015-01-15 11:25:03 -0800351 /* Trims layer coordinates against ROI generated */
352 virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& crop,
353 hwc_rect& dst);
Saurabh Shahab47c692014-02-12 18:45:57 -0800354private:
Saurabh Shah3d4b8042013-12-10 15:19:17 -0800355 /* 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,
radhakrishnac9a67412013-09-25 17:40:42 +0530358 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 Sankaran6c7eeac2013-11-18 11:19:45 -0800363 /* 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 Sankaranb551ce42013-01-10 16:26:48 -0800369};
Saurabh Shah2a4eb1b2013-07-22 16:33:23 -0700370
Saurabh Shahab47c692014-02-12 18:45:57 -0800371class MDPCompSrcSplit : public MDPCompSplit {
372public:
373 explicit MDPCompSrcSplit(int dpy) : MDPCompSplit(dpy){};
374 virtual ~MDPCompSrcSplit(){};
375private:
376 virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
Saurabh Shahc62f3982014-03-05 14:28:26 -0800377 MdpPipeInfoSplit& pipe_info);
Saurabh Shahab47c692014-02-12 18:45:57 -0800378
Saurabh Shahab47c692014-02-12 18:45:57 -0800379 virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
380 PipeLayerPair& pipeLayerPair);
Jeykumar Sankaranaedd1432015-01-15 11:25:03 -0800381 /* 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 Shahab47c692014-02-12 18:45:57 -0800387};
388
Naseer Ahmed7c958d42012-07-31 18:57:03 -0700389}; //namespace
390#endif