107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* 207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. 307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * Redistribution and use in source and binary forms, with or without 507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * modification, are permitted provided that the following conditions are 607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * met: 707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * * Redistributions of source code must retain the above copyright 807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * notice, this list of conditions and the following disclaimer. 907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * * Redistributions in binary form must reproduce the above 1007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * copyright notice, this list of conditions and the following 1107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * disclaimer in the documentation and/or other materials provided 1207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * with the distribution. 1307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * * Neither the name of The Linux Foundation nor the names of its 1407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * contributors may be used to endorse or promote products derived 1507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * from this software without specific prior written permission. 1607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * 1707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 1807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 2007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 2107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 2407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 2607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 2707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani */ 2907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 3007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#ifndef INCLUDE_LIBQCOMUTILS_MDPVER 3107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define INCLUDE_LIBQCOMUTILS_MDPVER 3207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 3307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#include <stdint.h> 3407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#include <utils/Singleton.h> 3507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#include <cutils/properties.h> 3607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 3707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani/* This class gets the MSM type from the soc info 3807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani*/ 3907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malaniusing namespace android; 4007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malaninamespace qdutils { 4107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani// These panel definitions are available at mdss_mdp.h which is internal header 4207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani// file and is not available at <linux/mdss_mdp.h>. 4307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani// ToDo: once it is available at linux/mdss_mdp.h, these below definitions can 4407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani// be removed. 4507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanienum mdp_version { 4607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V_UNKNOWN = 0, 4707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V2_2 = 220, 4807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V3_0 = 300, 4907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V3_0_3 = 303, 5007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V3_0_4 = 304, 5107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V3_0_5 = 305, 5207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V3_1 = 310, 5307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V4_0 = 400, 5407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V4_1 = 410, 5507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V4_2 = 420, 5607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V4_3 = 430, 5707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDP_V4_4 = 440, 5807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDSS_V5 = 500, 5907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani}; 6007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 6107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define NO_PANEL '0' 6207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define MDDI_PANEL '1' 6307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define EBI2_PANEL '2' 6407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define LCDC_PANEL '3' 6507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define EXT_MDDI_PANEL '4' 6607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define TV_PANEL '5' 6707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define DTV_PANEL '7' 6807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define MIPI_VIDEO_PANEL '8' 6907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define MIPI_CMD_PANEL '9' 7007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define WRITEBACK_PANEL 'a' 7107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define LVDS_PANEL 'b' 7207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#define EDP_PANEL 'c' 7307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 7407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malaniclass MDPVersion; 7507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 7607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanistruct Split { 7707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int mLeft; 7807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int mRight; 7907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani Split() : mLeft(0), mRight(0){} 8007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int left() { return mLeft; } 8107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int right() { return mRight; } 8207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani friend class MDPVersion; 8307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani}; 8407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 8507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanistruct PanelInfo { 8607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani char mType; // Smart or Dumb 8707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int mPartialUpdateEnable; // Partial update feature 8807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int mLeftAlign; // ROI left alignment restriction 8907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int mWidthAlign; // ROI width alignment restriction 9007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int mTopAlign; // ROI top alignment restriction 9107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int mHeightAlign; // ROI height alignment restriction 9207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int mMinROIWidth; // Min width needed for ROI 9307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int mMinROIHeight; // Min height needed for ROI 9407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool mNeedsROIMerge; // Merge ROI's of both the DSI's 9507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool mDynFpsSupported; // Panel Supports dyn fps 9607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t mMinFps; // Min fps supported by panel 9707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t mMaxFps; // Max fps supported by panel 9807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani PanelInfo() : mType(NO_PANEL), mPartialUpdateEnable(0), 9907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani mLeftAlign(0), mWidthAlign(0), mTopAlign(0), mHeightAlign(0), 10007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani mMinROIWidth(0), mMinROIHeight(0), mNeedsROIMerge(false), 10107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani mDynFpsSupported(0), mMinFps(0), mMaxFps(0) {} 10207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani friend class MDPVersion; 10307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani}; 10407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 10507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malaniclass MDPVersion : public Singleton <MDPVersion> 10607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani{ 10707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malanipublic: 10807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani MDPVersion(); 10907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani ~MDPVersion(); 11007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int getMDPVersion() {return mMDPVersion;} 11107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani char getPanelType() {return mPanelInfo.mType;} 11207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool hasOverlay() {return mHasOverlay;} 11307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint8_t getTotalPipes() { 11407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani return (uint8_t)(mRGBPipes + mVGPipes + mDMAPipes); 11507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani } 11607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint8_t getRGBPipes() { return mRGBPipes; } 11707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint8_t getVGPipes() { return mVGPipes; } 11807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint8_t getDMAPipes() { return mDMAPipes; } 11907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool supportsDecimation(); 12007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t getMaxMDPDownscale(); 12107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t getMaxMDPUpscale(); 12207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool supportsBWC(); 12307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool supportsMacroTile(); 12407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int getLeftSplit() { return mSplit.left(); } 12507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int getRightSplit() { return mSplit.right(); } 12607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool isPartialUpdateEnabled() { return mPanelInfo.mPartialUpdateEnable; } 12707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int getLeftAlign() { return mPanelInfo.mLeftAlign; } 12807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int getWidthAlign() { return mPanelInfo.mWidthAlign; } 12907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int getTopAlign() { return mPanelInfo.mTopAlign; } 13007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int getHeightAlign() { return mPanelInfo.mHeightAlign; } 13107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int getMinROIWidth() { return mPanelInfo.mMinROIWidth; } 13207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int getMinROIHeight() { return mPanelInfo.mMinROIHeight; } 13307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool needsROIMerge() { return mPanelInfo.mNeedsROIMerge; } 13407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani unsigned long getLowBw() { return mLowBw; } 13507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani unsigned long getHighBw() { return mHighBw; } 13607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool isRotDownscaleEnabled() { return mRotDownscale; } 13707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool isDynFpsSupported() { return mPanelInfo.mDynFpsSupported; } 13807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t getMinFpsSupported() { return mPanelInfo.mMinFps; } 13907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t getMaxFpsSupported() { return mPanelInfo.mMaxFps; } 14007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t getMaxMixerWidth() const { return mMaxMixerWidth; } 14107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool hasMinCropWidthLimitation() const; 14207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool isSrcSplit() const; 14307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool isSrcSplitAlways() const; 14407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool isRGBScalarSupported() const; 14507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool is8x26(); 14607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool is8x74v2(); 14707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool is8084(); 14807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool is8092(); 14907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool is8994(); 15007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool is8x16(); 15107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool is8x39(); 15207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani 15307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malaniprivate: 15407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool updateSysFsInfo(); 15507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani void updatePanelInfo(); 15607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool updateSplitInfo(); 15707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int tokenizeParams(char *inputParams, const char *delim, 15807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani char* tokenStr[], int *idx); 15907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int mFd; 16007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani int mMDPVersion; 16107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool mHasOverlay; 16207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t mMdpRev; 16307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint8_t mRGBPipes; 16407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint8_t mVGPipes; 16507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint8_t mDMAPipes; 16607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t mFeatures; 16707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t mMDPDownscale; 16807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t mMDPUpscale; 16907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool mMacroTileEnabled; 17007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani Split mSplit; 17107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani PanelInfo mPanelInfo; 17207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani unsigned long mLowBw; //kbps 17307bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani unsigned long mHighBw; //kbps 17407bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool mSourceSplit; 17507bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani //Additional property on top of source split 17607bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool mSourceSplitAlways; 17707bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool mRGBHasNoScalar; 17807bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani bool mRotDownscale; 17907bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani uint32_t mMaxMixerWidth; //maximum x-res of a given mdss mixer. 18007bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani}; 18107bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani}; //namespace qdutils 18207bbf1e89c031a5d41a7561433e832d396c311a5Prashant Malani#endif //INCLUDE_LIBQCOMUTILS_MDPVER 183