libqdutils: Update panel capabilities from sys node
This change adds support to read more panel related informations
from sys node.
Change-Id: I64f37a35945ac700388335059cbb1cfbc9d4b4d7
diff --git a/libqdutils/mdp_version.cpp b/libqdutils/mdp_version.cpp
index 9ee2d8d..a757e69 100644
--- a/libqdutils/mdp_version.cpp
+++ b/libqdutils/mdp_version.cpp
@@ -68,15 +68,13 @@
mMDPUpscale = 0;
mMDPDownscale = 0;
mMacroTileEnabled = false;
- mPanelType = NO_PANEL;
mLowBw = 0;
mHighBw = 0;
mSourceSplit = false;
mRGBHasNoScalar = false;
- if(!updatePanelInfo()) {
- ALOGE("Unable to read Primary Panel Information");
- }
+ updatePanelInfo();
+
if(!updateSysFsInfo()) {
ALOGE("Unable to read display sysfs node");
}
@@ -116,10 +114,12 @@
}
// This function reads the sysfs node to read the primary panel type
// and updates information accordingly
-bool MDPVersion::updatePanelInfo() {
+void MDPVersion::updatePanelInfo() {
FILE *displayDeviceFP = NULL;
+ FILE *panelInfoNodeFP = NULL;
const int MAX_FRAME_BUFFER_NAME_SIZE = 128;
char fbType[MAX_FRAME_BUFFER_NAME_SIZE];
+ char panelInfo[MAX_FRAME_BUFFER_NAME_SIZE];
const char *strCmdPanel = "mipi dsi cmd panel";
const char *strVideoPanel = "mipi dsi video panel";
const char *strLVDSPanel = "lvds panel";
@@ -130,21 +130,62 @@
fread(fbType, sizeof(char), MAX_FRAME_BUFFER_NAME_SIZE,
displayDeviceFP);
if(strncmp(fbType, strCmdPanel, strlen(strCmdPanel)) == 0) {
- mPanelType = MIPI_CMD_PANEL;
+ mPanelInfo.mType = MIPI_CMD_PANEL;
}
else if(strncmp(fbType, strVideoPanel, strlen(strVideoPanel)) == 0) {
- mPanelType = MIPI_VIDEO_PANEL;
+ mPanelInfo.mType = MIPI_VIDEO_PANEL;
}
else if(strncmp(fbType, strLVDSPanel, strlen(strLVDSPanel)) == 0) {
- mPanelType = LVDS_PANEL;
+ mPanelInfo.mType = LVDS_PANEL;
}
else if(strncmp(fbType, strEDPPanel, strlen(strEDPPanel)) == 0) {
- mPanelType = EDP_PANEL;
+ mPanelInfo.mType = EDP_PANEL;
}
fclose(displayDeviceFP);
- return true;
- }else {
- return false;
+ } else {
+ ALOGE("Unable to read Primary Panel Information");
+ }
+
+ panelInfoNodeFP = fopen("/sys/class/graphics/fb0/msm_fb_panel_info", "r");
+ if(panelInfoNodeFP){
+ size_t len = PAGE_SIZE;
+ ssize_t read;
+ char *readLine = (char *) malloc (len);
+ while((read = getline((char **)&readLine, &len,
+ panelInfoNodeFP)) != -1) {
+ int token_ct=0;
+ char *tokens[10];
+ memset(tokens, 0, sizeof(tokens));
+
+ if(!tokenizeParams(readLine, TOKEN_PARAMS_DELIM, tokens,
+ &token_ct)) {
+ if(!strncmp(tokens[0], "pu_en", strlen("pu_en"))) {
+ mPanelInfo.mPartialUpdateEnable = atoi(tokens[1]);
+ ALOGI("PartialUpdate status: %s",
+ mPanelInfo.mPartialUpdateEnable? "Enabled" :
+ "Disabled");
+ }
+ if(!strncmp(tokens[0], "xalign", strlen("xalign"))) {
+ mPanelInfo.mLeftAlign = atoi(tokens[1]);
+ ALOGI("Left Align: %d", mPanelInfo.mLeftAlign);
+ }
+ if(!strncmp(tokens[0], "walign", strlen("walign"))) {
+ mPanelInfo.mWidthAlign = atoi(tokens[1]);
+ ALOGI("Width Align: %d", mPanelInfo.mWidthAlign);
+ }
+ if(!strncmp(tokens[0], "ystart", strlen("ystart"))) {
+ mPanelInfo.mTopAlign = atoi(tokens[1]);
+ ALOGI("Top Align: %d", mPanelInfo.mTopAlign);
+ }
+ if(!strncmp(tokens[0], "halign", strlen("halign"))) {
+ mPanelInfo.mHeightAlign = atoi(tokens[1]);
+ ALOGI("Height Align: %d", mPanelInfo.mHeightAlign);
+ }
+ }
+ }
+ fclose(panelInfoNodeFP);
+ } else {
+ ALOGE("Failed to open msm_fb_panel_info node");
}
}
diff --git a/libqdutils/mdp_version.h b/libqdutils/mdp_version.h
index 04c84cd..aab8643 100644
--- a/libqdutils/mdp_version.h
+++ b/libqdutils/mdp_version.h
@@ -92,13 +92,25 @@
friend class MDPVersion;
};
+struct PanelInfo {
+ char mType; // Smart or Dumb
+ int mPartialUpdateEnable; // Partial update feature
+ int mLeftAlign; // ROI left alignment restriction
+ int mWidthAlign; // ROI width alignment restriction
+ int mTopAlign; // ROI top alignment restriction
+ int mHeightAlign; // ROI height alignment restriction
+ PanelInfo() : mType(NO_PANEL), mPartialUpdateEnable(0),
+ mLeftAlign(0), mWidthAlign(0), mTopAlign(0), mHeightAlign(0){}
+ friend class MDPVersion;
+};
+
class MDPVersion : public Singleton <MDPVersion>
{
public:
MDPVersion();
~MDPVersion();
int getMDPVersion() {return mMDPVersion;}
- char getPanelType() {return mPanelType;}
+ char getPanelType() {return mPanelInfo.mType;}
bool hasOverlay() {return mHasOverlay;}
uint8_t getTotalPipes() {
return (uint8_t)(mRGBPipes + mVGPipes + mDMAPipes);
@@ -113,6 +125,11 @@
bool supportsMacroTile();
int getLeftSplit() { return mSplit.left(); }
int getRightSplit() { return mSplit.right(); }
+ int isPartialUpdateEnabled() { return mPanelInfo.mPartialUpdateEnable; }
+ int getLeftAlign() { return mPanelInfo.mLeftAlign; }
+ int getWidthAlign() { return mPanelInfo.mWidthAlign; }
+ int getTopAlign() { return mPanelInfo.mTopAlign; }
+ int getHeightAlign() { return mPanelInfo.mHeightAlign; }
unsigned long getLowBw() { return mLowBw; }
unsigned long getHighBw() { return mHighBw; }
bool isSrcSplit() const;
@@ -125,13 +142,12 @@
private:
bool updateSysFsInfo();
- bool updatePanelInfo();
+ void updatePanelInfo();
bool updateSplitInfo();
int tokenizeParams(char *inputParams, const char *delim,
char* tokenStr[], int *idx);
int mFd;
int mMDPVersion;
- char mPanelType;
bool mHasOverlay;
uint32_t mMdpRev;
uint8_t mRGBPipes;
@@ -142,6 +158,7 @@
uint32_t mMDPUpscale;
bool mMacroTileEnabled;
Split mSplit;
+ PanelInfo mPanelInfo;
unsigned long mLowBw; //kbps
unsigned long mHighBw; //kbps
bool mSourceSplit;