display: Get panel type from framebuffer
Change-Id: I3b7cb78d7c6019482ae698b30d553ca782f5022b
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index c28cf03..13d6274 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -24,6 +24,7 @@
#include <overlay.h>
#include <fb_priv.h>
+#include <mdp_version.h>
#include "hwc_utils.h"
#include "hwc_qbuf.h"
#include "hwc_video.h"
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index 7892632..99aecca 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -380,7 +380,7 @@
{
// XXX : TODO , currently returning false for MDP4 targets,
// This has to be modified after adding C2D support.
- if(ctx->hasOverlay)
+ if(ctx->mMDP.hasOverlay)
return false;
framebuffer_device_t* fbDev = ctx->mFbDev;
@@ -397,7 +397,7 @@
LINK_eglGetCurrentSurface == NULL )
return false;
- if(!ctx->hasOverlay) {
+ if(!ctx->mMDP.hasOverlay) {
if (numYUVBuffers)
return true;
}
diff --git a/libhwcomposer/hwc_uimirror.cpp b/libhwcomposer/hwc_uimirror.cpp
index 3bbe30e..d2b766d 100644
--- a/libhwcomposer/hwc_uimirror.cpp
+++ b/libhwcomposer/hwc_uimirror.cpp
@@ -61,7 +61,7 @@
sState = ovutils::OV_CLOSED;
sIsUiMirroringOn = false;
- if(!ctx->hasOverlay) {
+ if(!ctx->mMDP.hasOverlay) {
ALOGD_IF(HWC_UI_MIRROR, "%s, this hw doesnt support mirroring",
__FUNCTION__);
return false;
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 0b62a98..dd890a9 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -40,8 +40,9 @@
openFramebufferDevice(ctx);
ctx->mOverlay = overlay::Overlay::getInstance();
ctx->qbuf = new QueuedBufferStore();
- ctx->mdpVersion = qdutils::MDPVersion::getInstance().getMDPVersion();
- ctx->hasOverlay = qdutils::MDPVersion::getInstance().hasOverlay();
+ ctx->mMDP.version = qdutils::MDPVersion::getInstance().getMDPVersion();
+ ctx->mMDP.hasOverlay = qdutils::MDPVersion::getInstance().hasOverlay();
+ ctx->mMDP.panel = qdutils::MDPVersion::getInstance().getPanelType();
ctx->mCopybitEngine = CopybitEngine::getInstance();
ctx->mExtDisplay = new ExternalDisplay(ctx);
MDPComp::init(ctx);
@@ -49,7 +50,7 @@
init_uevent_thread(ctx);
ALOGI("Initializing Qualcomm Hardware Composer");
- ALOGI("MDP version: %d", ctx->mdpVersion);
+ ALOGI("MDP version: %d", ctx->mMDP.version);
}
void closeContext(hwc_context_t *ctx)
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index a6c1446..9ce0815 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -37,6 +37,14 @@
namespace qhwc {
//fwrd decl
class QueuedBufferStore;
+class ExternalDisplay;
+class CopybitEngine;
+
+struct MDPInfo {
+ int version;
+ char panel;
+ bool hasOverlay;
+};
enum external_display_type {
EXT_TYPE_NONE,
@@ -57,8 +65,6 @@
};
-class ExternalDisplay;
-class CopybitEngine;
// -----------------------------------------------------------------------------
// Utility functions - implemented in hwc_utils.cpp
void dumpLayer(hwc_layer_t const* l);
@@ -102,8 +108,6 @@
struct hwc_context_t {
hwc_composer_device_t device;
int numHwLayers;
- int mdpVersion;
- bool hasOverlay;
int overlayInUse;
//Framebuffer device
@@ -121,6 +125,8 @@
// External display related information
qhwc::ExternalDisplay *mExtDisplay;
+ qhwc::MDPInfo mMDP;
+
};
#endif //HWC_UTILS_H
diff --git a/libhwcomposer/hwc_video.cpp b/libhwcomposer/hwc_video.cpp
index 190e31b..5b20ba4 100644
--- a/libhwcomposer/hwc_video.cpp
+++ b/libhwcomposer/hwc_video.cpp
@@ -35,7 +35,7 @@
//Cache stats, figure out the state, config overlay
bool VideoOverlay::prepare(hwc_context_t *ctx, hwc_layer_list_t *list) {
sIsModeOn = false;
- if(!ctx->hasOverlay) {
+ if(!ctx->mMDP.hasOverlay) {
ALOGD_IF(VIDEO_DEBUG,"%s, this hw doesnt support overlay", __FUNCTION__);
return false;
}
diff --git a/libqdutils/mdp_version.cpp b/libqdutils/mdp_version.cpp
index 25f1142..78ca52f 100644
--- a/libqdutils/mdp_version.cpp
+++ b/libqdutils/mdp_version.cpp
@@ -34,10 +34,11 @@
ANDROID_SINGLETON_STATIC_INSTANCE(qdutils::MDPVersion);
namespace qdutils {
-static int getMDPVersionFromFB()
+MDPVersion::MDPVersion()
{
int fb_fd = open("/dev/graphics/fb0", O_RDWR);
int mdp_version = MDP_V_UNKNOWN;
+ char panel_type = 0;
struct fb_fix_screeninfo fb_finfo;
if (ioctl(fb_fd, FBIOGET_FSCREENINFO, &fb_finfo) < 0) {
ALOGE("FBIOGET_FSCREENINFO failed");
@@ -61,18 +62,18 @@
} else {
mdp_version = MDP_V_UNKNOWN;
}
+ int len = strlen("msmfbXX_");
+ if (mdp_version == MDP_V3_0_3)
+ len++;
+ panel_type = fb_finfo.id[len];
+
}
close(fb_fd);
- return mdp_version;
-}
-
-MDPVersion::MDPVersion()
-{
- mMDPVersion = getMDPVersionFromFB();
+ mMDPVersion = mdp_version;
+ mHasOverlay = false;
if((mMDPVersion >= MDP_V4_0) || (mMDPVersion == MDP_V_UNKNOWN))
mHasOverlay = true;
- else
- mHasOverlay = false;
+ mPanelType = panel_type;
}
}; //namespace qdutils
diff --git a/libqdutils/mdp_version.h b/libqdutils/mdp_version.h
index 5ec0c67..9137cd4 100644
--- a/libqdutils/mdp_version.h
+++ b/libqdutils/mdp_version.h
@@ -52,15 +52,29 @@
MDSS_V5 = 500,
};
+#define MDDI_PANEL '1'
+#define EBI2_PANEL '2'
+#define LCDC_PANEL '3'
+#define EXT_MDDI_PANEL '4'
+#define TV_PANEL '5'
+#define DTV_PANEL '7'
+#define MIPI_VIDEO_PANEL '8'
+#define MIPI_CMD_PANEL '9'
+#define WRITEBACK_PANEL 'a'
+#define LVDS_PANEL 'b'
+
+
class MDPVersion : public Singleton <MDPVersion>
{
public:
MDPVersion();
~MDPVersion() { }
int getMDPVersion() {return mMDPVersion;}
+ char getPanelType() {return mPanelType;}
bool hasOverlay() {return mHasOverlay;}
private:
int mMDPVersion;
+ char mPanelType;
bool mHasOverlay;
};
}; //namespace qdutils