hwc_mdpcomp.h revision 463feeb515f0cc7454eac70ae8bb96df4b852a38
1ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson/* 2ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * Copyright (C) 2012-2013, The Linux Foundation. All rights reserved. 3ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * 4ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * Not a Contribution, Apache license notifications and license are retained 5ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * for attribution purposes only. 6ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * 7ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * Licensed under the Apache License, Version 2.0 (the "License"); 8ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * you may not use this file except in compliance with the License. 9ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * You may obtain a copy of the License at 10ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * 11ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * http://www.apache.org/licenses/LICENSE-2.0 12ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * 13ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * Unless required by applicable law or agreed to in writing, software 14ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * distributed under the License is distributed on an "AS IS" BASIS, 15ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * See the License for the specific language governing permissions and 17ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * limitations under the License. 18ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson */ 19ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 20ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#ifndef HWC_MDP_COMP 21ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define HWC_MDP_COMP 22ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 23ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#include <hwc_utils.h> 24ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#include <idle_invalidator.h> 25ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#include <cutils/properties.h> 26ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#include <overlay.h> 27ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 28a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson#define DEFAULT_IDLE_TIME 70 29ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define MAX_PIPES_PER_MIXER 4 30ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 31ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonnamespace overlay { 32ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonclass Rotator; 33ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson}; 34ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 35ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonnamespace qhwc { 36ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonnamespace ovutils = overlay::utils; 37ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 38ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonclass MDPComp { 39ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonpublic: 40ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson explicit MDPComp(int); 41ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson virtual ~MDPComp(){}; 42ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /*sets up mdp comp for the current frame */ 43ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson int prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list); 44ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* draw */ 45ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list) = 0; 46ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* dumpsys */ 47463feeb515f0cc7454eac70ae8bb96df4b852a38Jeykumar Sankaran void dump(android::String8& buf, hwc_context_t *ctx); 48a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool isGLESOnlyComp() { return (mCurrentFrame.mdpCount == 0); } 49a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson static MDPComp* getObject(hwc_context_t *ctx, const int& dpy); 50ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* Handler to invoke frame redraw on Idle Timer expiry */ 51ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson static void timeout_handler(void *udata); 52ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* Initialize MDP comp*/ 53ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson static bool init(hwc_context_t *ctx); 54ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson static void resetIdleFallBack() { sIdleFallBack = false; } 55a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson static void reset() { sHandleTimeout = false; }; 561b0c2f1b1c7201502f75c12131e3bc54f92d60eaRamkumar Radhakrishnan static bool isIdleFallback() { return sIdleFallBack; } 57ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 58ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonprotected: 59ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson enum { MAX_SEC_LAYERS = 1 }; //TODO add property support 60ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 61ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson enum ePipeType { 62ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson MDPCOMP_OV_RGB = ovutils::OV_MDP_PIPE_RGB, 63ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson MDPCOMP_OV_VG = ovutils::OV_MDP_PIPE_VG, 64ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson MDPCOMP_OV_DMA = ovutils::OV_MDP_PIPE_DMA, 65ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson MDPCOMP_OV_ANY, 66ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson }; 67ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 68484b141e59f02304121b7da45a04ef722a97c294Jeykumar Sankaran //Simulation flags 69484b141e59f02304121b7da45a04ef722a97c294Jeykumar Sankaran enum { 70484b141e59f02304121b7da45a04ef722a97c294Jeykumar Sankaran MDPCOMP_AVOID_FULL_MDP = 0x001, 71484b141e59f02304121b7da45a04ef722a97c294Jeykumar Sankaran MDPCOMP_AVOID_CACHE_MDP = 0x002, 72484b141e59f02304121b7da45a04ef722a97c294Jeykumar Sankaran MDPCOMP_AVOID_LOAD_MDP = 0x004, 73484b141e59f02304121b7da45a04ef722a97c294Jeykumar Sankaran MDPCOMP_AVOID_VIDEO_ONLY = 0x008, 74484b141e59f02304121b7da45a04ef722a97c294Jeykumar Sankaran }; 75484b141e59f02304121b7da45a04ef722a97c294Jeykumar Sankaran 76ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* mdp pipe data */ 77ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson struct MdpPipeInfo { 78ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson int zOrder; 79ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson virtual ~MdpPipeInfo(){}; 80ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson }; 81ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 82a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson struct MdpYUVPipeInfo : public MdpPipeInfo{ 83a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson ovutils::eDest lIndex; 84a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson ovutils::eDest rIndex; 85a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual ~MdpYUVPipeInfo(){}; 86a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson }; 87a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 88ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* per layer data */ 89ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson struct PipeLayerPair { 90ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson MdpPipeInfo *pipeInfo; 91ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson overlay::Rotator* rot; 92ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson int listIndex; 93ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson }; 94ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 95ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* per frame data */ 96ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson struct FrameInfo { 97ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* maps layer list to mdp list */ 98ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson int layerCount; 99ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson int layerToMDP[MAX_NUM_APP_LAYERS]; 100ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 101ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* maps mdp list to layer list */ 102ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson int mdpCount; 103ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson struct PipeLayerPair mdpToLayer[MAX_PIPES_PER_MIXER]; 104ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 105ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* layer composing on FB? */ 106ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson int fbCount; 107ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool isFBComposed[MAX_NUM_APP_LAYERS]; 108a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* layers lying outside ROI. Will 109a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * be dropped off from the composition */ 110a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson int dropCount; 111a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool drop[MAX_NUM_APP_LAYERS]; 112ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 113ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool needsRedraw; 114ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson int fbZ; 115ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 116ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* c'tor */ 117ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson FrameInfo(); 118ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* clear old frame data */ 119ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void reset(const int& numLayers); 120ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void map(); 121ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson }; 122ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 123ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* cached data */ 124ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson struct LayerCache { 125ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson int layerCount; 126ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson buffer_handle_t hnd[MAX_NUM_APP_LAYERS]; 127a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool isFBComposed[MAX_NUM_APP_LAYERS]; 128a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool drop[MAX_NUM_APP_LAYERS]; 129ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 130ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* c'tor */ 131ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson LayerCache(); 132ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* clear caching info*/ 133ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void reset(); 134ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void cacheAll(hwc_display_contents_1_t* list); 135ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void updateCounts(const FrameInfo&); 136a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool isSameFrame(const FrameInfo& curFrame, 137a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson hwc_display_contents_1_t* list); 138ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson }; 139ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 140ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* allocates pipe from pipe book */ 141ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson virtual bool allocLayerPipes(hwc_context_t *ctx, 142ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson hwc_display_contents_1_t* list) = 0; 143ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* configures MPD pipes */ 144ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer, 145ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson PipeLayerPair& pipeLayerPair) = 0; 146a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* Increments mdpCount if 4k2k yuv layer split is enabled. 147a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * updates framebuffer z order if fb lies above source-split layer */ 148a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual void adjustForSourceSplit(hwc_context_t *ctx, 149ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson hwc_display_contents_1_t* list) = 0; 150a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* configures 4kx2k yuv layer*/ 151a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer, 152a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson PipeLayerPair& PipeLayerPair) = 0; 1536f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran /* generates ROI based on the modified area of the frame */ 1546f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran virtual void generateROI(hwc_context_t *ctx, 1556f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran hwc_display_contents_1_t* list) = 0; 1566f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran /* validates the ROI generated for fallback conditions */ 1576f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran virtual bool validateAndApplyROI(hwc_context_t *ctx, 1586f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran hwc_display_contents_1_t* list) = 0; 1596f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran /* Trims fbRect calculated against ROI generated */ 1606f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect) = 0; 1616f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran 16253b0b5fcf40f174642b0a58cba91b5479d31fe91Jeykumar Sankaran /* set/reset flags for MDPComp */ 16353b0b5fcf40f174642b0a58cba91b5479d31fe91Jeykumar Sankaran void setMDPCompLayerFlags(hwc_context_t *ctx, 16453b0b5fcf40f174642b0a58cba91b5479d31fe91Jeykumar Sankaran hwc_display_contents_1_t* list); 165a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson void setRedraw(hwc_context_t *ctx, 166a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson hwc_display_contents_1_t* list); 167ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* checks for conditions where mdpcomp is not possible */ 168ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool isFrameDoable(hwc_context_t *ctx); 169ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* checks for conditions where RGB layers cannot be bypassed */ 170a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool tryFullFrame(hwc_context_t *ctx, hwc_display_contents_1_t* list); 171ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* checks if full MDP comp can be done */ 172ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list); 173ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* check if we can use layer cache to do at least partial MDP comp */ 174ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool partialMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list); 175ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* Partial MDP comp that uses caching to save power as primary goal */ 176ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool cacheBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list); 177a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* Partial MDP comp that balances the load between MDP and GPU such that 178a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * MDP is loaded to the max of its capacity. The lower z order layers are 179a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * fed to MDP, whereas the upper ones to GPU, because the upper ones have 180a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * lower number of pixels and can reduce GPU processing time */ 181ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool loadBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list); 182ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* Checks if its worth doing load based partial comp */ 183a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool isLoadBasedCompDoable(hwc_context_t *ctx); 184ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* checks for conditions where only video can be bypassed */ 185a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool tryVideoOnly(hwc_context_t *ctx, hwc_display_contents_1_t* list); 186a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool videoOnlyComp(hwc_context_t *ctx, hwc_display_contents_1_t* list, 187a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool secureOnly); 188ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* checks for conditions where YUV layers cannot be bypassed */ 189ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer); 190a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* checks if MDP/MDSS can process current list w.r.to HW limitations 191a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * All peculiar HW limitations should go here */ 192a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool hwLimitationsCheck(hwc_context_t* ctx, hwc_display_contents_1_t* list); 193ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* Is debug enabled */ 194ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson static bool isDebug() { return sDebugLogs ? true : false; }; 195ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* Is feature enabled */ 196ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson static bool isEnabled() { return sEnabled; }; 197ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* checks for mdp comp dimension limitation */ 198ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer); 199ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* tracks non updating layers*/ 200ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson void updateLayerCache(hwc_context_t* ctx, hwc_display_contents_1_t* list); 201ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* optimize layers for mdp comp*/ 202a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool markLayersForCaching(hwc_context_t* ctx, 203a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson hwc_display_contents_1_t* list); 204a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson int getBatch(hwc_display_contents_1_t* list, 205a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson int& maxBatchStart, int& maxBatchEnd, 206a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson int& maxBatchCount); 207a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool canPushBatchToTop(const hwc_display_contents_1_t* list, 208a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson int fromIndex, int toIndex); 209a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool intersectingUpdatingLayers(const hwc_display_contents_1_t* list, 210a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson int fromIndex, int toIndex, int targetLayerIndex); 211a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 212a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* updates cache map with YUV info */ 213a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson void updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list, 214a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool secureOnly); 215a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* Validates if the GPU/MDP layer split chosen by a strategy is supported 216a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * by MDP. 217a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * Sets up MDP comp data structures to reflect covnversion from layers to 218a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * overlay pipes. 219a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * Configures overlay. 220a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * Configures if GPU should redraw. 221a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson */ 222a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool postHeuristicsHandling(hwc_context_t *ctx, 223a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson hwc_display_contents_1_t* list); 224a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson void reset(hwc_context_t *ctx); 225ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson bool isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer); 2264217cbfc47f3b4f8f0436e3953cf169f7f18a506Praveena Pachipulusu bool resourceCheck(); 2276f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran hwc_rect_t getUpdatingFBRect(hwc_context_t *ctx, 2286f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran hwc_display_contents_1_t* list); 2296f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran /* checks for conditions to enable partial udpate */ 2306f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran bool canPartialUpdate(hwc_context_t *ctx, hwc_display_contents_1_t* list); 231ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 232ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson int mDpy; 233ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson static bool sEnabled; 234ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson static bool sEnableMixedMode; 235484b141e59f02304121b7da45a04ef722a97c294Jeykumar Sankaran static int sSimulationFlags; 236ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson static bool sDebugLogs; 237ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson static bool sIdleFallBack; 238a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* Handles the timeout event from kernel, if the value is set to true */ 239a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson static bool sHandleTimeout; 240ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson static int sMaxPipesPerMixer; 241ef898e19da9a67d99c50376af694877e2c87b5e6Manoj Kumar AVM static bool sSrcSplitEnabled; 242ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson static IdleInvalidator *idleInvalidator; 243ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson struct FrameInfo mCurrentFrame; 244ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson struct LayerCache mCachedFrame; 245a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson //Enable 4kx2k yuv layer split 246a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson static bool sEnable4k2kYUVSplit; 247a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson bool allocSplitVGPipesfor4k2k(hwc_context_t *ctx, int index); 248ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson}; 249ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 250a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonclass MDPCompNonSplit : public MDPComp { 251ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonpublic: 252a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson explicit MDPCompNonSplit(int dpy):MDPComp(dpy){}; 253a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual ~MDPCompNonSplit(){}; 254ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list); 255ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 256ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonprivate: 257a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson struct MdpPipeInfoNonSplit : public MdpPipeInfo { 258ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson ovutils::eDest index; 259a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual ~MdpPipeInfoNonSplit() {}; 260ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson }; 261ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 262ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* configure's overlay pipes for the frame */ 263ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer, 264ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson PipeLayerPair& pipeLayerPair); 265ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 266ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* allocates pipes to selected candidates */ 267ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson virtual bool allocLayerPipes(hwc_context_t *ctx, 268ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson hwc_display_contents_1_t* list); 269ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 270a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* Increments mdpCount if 4k2k yuv layer split is enabled. 271a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * updates framebuffer z order if fb lies above source-split layer */ 272a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual void adjustForSourceSplit(hwc_context_t *ctx, 273ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson hwc_display_contents_1_t* list); 274a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 275a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* configures 4kx2k yuv layer to 2 VG pipes*/ 276a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer, 277a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson PipeLayerPair& PipeLayerPair); 2786f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran /* generates ROI based on the modified area of the frame */ 2796f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran virtual void generateROI(hwc_context_t *ctx, 2806f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran hwc_display_contents_1_t* list); 2816f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran /* validates the ROI generated for fallback conditions */ 2826f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran virtual bool validateAndApplyROI(hwc_context_t *ctx, 2836f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran hwc_display_contents_1_t* list); 2846f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran /* Trims fbRect calculated against ROI generated */ 2856f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect); 286ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson}; 287ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 288a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonclass MDPCompSplit : public MDPComp { 289ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonpublic: 290a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson explicit MDPCompSplit(int dpy):MDPComp(dpy){}; 291a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual ~MDPCompSplit(){}; 292ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson virtual bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list); 293a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 294a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonprotected: 295a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson struct MdpPipeInfoSplit : public MdpPipeInfo { 296ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson ovutils::eDest lIndex; 297ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson ovutils::eDest rIndex; 298a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual ~MdpPipeInfoSplit() {}; 299ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson }; 300ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 301a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer, 302a83d776f160d90db1cb5df28a793f4f06a93f020Saurabh Shah MdpPipeInfoSplit& pipe_info); 303ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 304ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* configure's overlay pipes for the frame */ 305ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer, 306ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson PipeLayerPair& pipeLayerPair); 307ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 308ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson /* allocates pipes to selected candidates */ 309ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson virtual bool allocLayerPipes(hwc_context_t *ctx, 310ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson hwc_display_contents_1_t* list); 311a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonprivate: 312a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* Increments mdpCount if 4k2k yuv layer split is enabled. 313a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson * updates framebuffer z order if fb lies above source-split layer */ 314a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual void adjustForSourceSplit(hwc_context_t *ctx, 315a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson hwc_display_contents_1_t* list); 316a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 317a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson /* configures 4kx2k yuv layer*/ 318a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer, 319a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson PipeLayerPair& PipeLayerPair); 3206f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran /* generates ROI based on the modified area of the frame */ 3216f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran virtual void generateROI(hwc_context_t *ctx, 3226f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran hwc_display_contents_1_t* list); 3236f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran /* validates the ROI generated for fallback conditions */ 3246f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran virtual bool validateAndApplyROI(hwc_context_t *ctx, 3256f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran hwc_display_contents_1_t* list); 3266f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran /* Trims fbRect calculated against ROI generated */ 3276f7634666209698e4835b9f326278a7068834383Jeykumar Sankaran virtual void trimAgainstROI(hwc_context_t *ctx, hwc_rect_t& fbRect); 328a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson}; 329a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 330a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonclass MDPCompSrcSplit : public MDPCompSplit { 331a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonpublic: 332a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson explicit MDPCompSrcSplit(int dpy) : MDPCompSplit(dpy){}; 333a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual ~MDPCompSrcSplit(){}; 334a653efede03423aa840da24634f1ec6f20796f1eSimon Wilsonprivate: 335a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual bool acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer, 336a83d776f160d90db1cb5df28a793f4f06a93f020Saurabh Shah MdpPipeInfoSplit& pipe_info); 337a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson 338a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer, 339a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson PipeLayerPair& pipeLayerPair); 340ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson}; 341ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson 342ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson}; //namespace 343ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#endif 344