From 912842f62dff8ed80d52869e09c6598fc8d01b83 Mon Sep 17 00:00:00 2001 From: Naseer Ahmed Date: Wed, 25 Jul 2012 18:27:14 -0700 Subject: [PATCH] display: Get panel type from framebuffer Change-Id: I5dc16125bbb7d864dcb7106166e91b950a44d686 --- libhwcomposer/hwc.cpp | 1 + libhwcomposer/hwc_copybit.cpp | 4 ++-- libhwcomposer/hwc_uimirror.cpp | 2 +- libhwcomposer/hwc_utils.cpp | 7 ++++--- libhwcomposer/hwc_utils.h | 14 ++++++++++---- libhwcomposer/hwc_video.cpp | 2 +- libqdutils/mdp_version.cpp | 19 ++++++++++--------- libqdutils/mdp_version.h | 14 ++++++++++++++ 8 files changed, 43 insertions(+), 20 deletions(-) diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index 10c2948..ad0000c 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp @@ -24,6 +24,7 @@ #include #include +#include #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 @@ bool CopyBit::canUseCopybit(hwc_context_t *ctx, const hwc_layer_list_t* list, { // 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 @@ bool CopyBit::canUseCopybit(hwc_context_t *ctx, const hwc_layer_list_t* list, 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 @@ bool UIMirrorOverlay::prepare(hwc_context_t *ctx, hwc_layer_list_t *list) { 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 @@ void initContext(hwc_context_t *ctx) 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 @@ void initContext(hwc_context_t *ctx) 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 @@ class Overlay; 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 @@ enum { }; -class ExternalDisplay; -class CopybitEngine; // ----------------------------------------------------------------------------- // Utility functions - implemented in hwc_utils.cpp void dumpLayer(hwc_layer_t const* l); @@ -102,8 +108,6 @@ inline void getLayerResolution(const hwc_layer_t* layer, struct hwc_context_t { hwc_composer_device_t device; int numHwLayers; - int mdpVersion; - bool hasOverlay; int overlayInUse; //Framebuffer device @@ -121,6 +125,8 @@ struct hwc_context_t { // 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 @@ bool VideoOverlay::sIsLayerSkip = false; //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 @@ static int getMDPVersionFromFB() } 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 @@ enum mdp_version { 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 { public: MDPVersion(); ~MDPVersion() { } int getMDPVersion() {return mMDPVersion;} + char getPanelType() {return mPanelType;} bool hasOverlay() {return mHasOverlay;} private: int mMDPVersion; + char mPanelType; bool mHasOverlay; }; }; //namespace qdutils