diff options
author | Amara Venkata Mastan Manoj Kumar <manojavm@codeaurora.org> | 2013-03-13 19:18:47 -0700 |
---|---|---|
committer | Ramkumar Radhakrishnan <ramkumar@codeaurora.org> | 2013-08-22 15:34:29 -0700 |
commit | 376d8a8c014a0f9d54c74fac845ade1361f734a7 (patch) | |
tree | 29cc87119f884ab34ad27328b1f4a21532bd59d1 /libvirtual | |
parent | 31f4c4e7b903f1608a45db22f621703bd9c412f9 (diff) | |
download | display-376d8a8c014a0f9d54c74fac845ade1361f734a7.tar.gz |
hwc: Perform MDP downscaling for WFD/HDMI Scenario
On WFD/HDMI connection, if the configured resolution is less than
Primary Resolution, Display HAL does the following:
1. sends hpd notification to SF with primary resolution.
2. configures MDP pipes with configured Resolution.
This is done to improve UI quality as MDP has better downscale
filter options compared to GPU.
Change-Id: I33570c13016a35ed6c5d22d4c34dfe75b2c605a1
Diffstat (limited to 'libvirtual')
-rw-r--r-- | libvirtual/Android.mk | 2 | ||||
-rw-r--r-- | libvirtual/virtual.cpp | 41 | ||||
-rw-r--r-- | libvirtual/virtual.h | 1 |
3 files changed, 37 insertions, 7 deletions
diff --git a/libvirtual/Android.mk b/libvirtual/Android.mk index 1231f8d8..beeef255 100644 --- a/libvirtual/Android.mk +++ b/libvirtual/Android.mk @@ -6,7 +6,7 @@ LOCAL_MODULE := libvirtual LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES) LOCAL_MODULE_TAGS := optional LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes) -LOCAL_SHARED_LIBRARIES := $(common_libs) liboverlay +LOCAL_SHARED_LIBRARIES := $(common_libs) liboverlay libqdutils LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdvirtual\" LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) LOCAL_SRC_FILES := virtual.cpp diff --git a/libvirtual/virtual.cpp b/libvirtual/virtual.cpp index e2f239a8..8e96a569 100644 --- a/libvirtual/virtual.cpp +++ b/libvirtual/virtual.cpp @@ -47,6 +47,7 @@ #include "virtual.h" #include "overlayUtils.h" #include "overlay.h" +#include "mdp_version.h" using namespace android; @@ -67,6 +68,11 @@ int VirtualDisplay::configure() { return 0; } +void VirtualDisplay::getAttributes(int& width, int& height) { + width = mVInfo.xres; + height = mVInfo.yres; +} + int VirtualDisplay::teardown() { closeFrameBuffer(); memset(&mVInfo, 0, sizeof(mVInfo)); @@ -85,12 +91,35 @@ VirtualDisplay::~VirtualDisplay() } void VirtualDisplay::setAttributes() { - mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].xres = mVInfo.xres; - mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].yres = mVInfo.yres; - mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].vsync_period = - 1000000000l /60; - ALOGD_IF(DEBUG,"%s: Setting Virtual Attr: res(%d x %d)",__FUNCTION__, - mVInfo.xres, mVInfo.yres); + if(mHwcContext) { + // Always set dpyAttr res to mVInfo res + mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].xres = mVInfo.xres; + mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].yres = mVInfo.yres; + mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].mDownScaleMode = false; + if(!qdutils::MDPVersion::getInstance().is8x26()) { + uint32_t priW = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].xres; + uint32_t priH = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].yres; + // if primary resolution is more than the wfd resolution + // configure dpy attr to primary resolution and set + // downscale mode + if((priW * priH) > (mVInfo.xres * mVInfo.yres)) { + mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].xres = priW; + mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].yres = priH; + // WFD is always in landscape, so always assign the higher + // dimension to wfd's xres + if(priH > priW) { + mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].xres = priH; + mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].yres = priW; + } + // Set External Display MDP Downscale mode indicator + mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].mDownScaleMode = true; + } + } + mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].vsync_period = + 1000000000l /60; + ALOGD_IF(DEBUG,"%s: Setting Virtual Attr: res(%d x %d)",__FUNCTION__, + mVInfo.xres, mVInfo.yres); + } } bool VirtualDisplay::openFrameBuffer() diff --git a/libvirtual/virtual.h b/libvirtual/virtual.h index cd0e7da0..8003e239 100644 --- a/libvirtual/virtual.h +++ b/libvirtual/virtual.h @@ -43,6 +43,7 @@ public: VirtualDisplay(hwc_context_t* ctx); ~VirtualDisplay(); int configure(); + void getAttributes(int& width, int& height); int teardown(); bool isConnected() { return mHwcContext->dpyAttr[HWC_DISPLAY_VIRTUAL].connected; |