libvirtual: Fix logic to detect DRC use case.
We detect DRC based on the resolution of the external display stored
in the HAL, and the dimensions of the framebuffer(fb2) after receiving
a RESUME event. If the stored resolution is greater than that of fb2
it means fb2 was reconfigured due to DRC. This is the only case in
which we trigger the DRC path (and the MDP downscale path thereafter).
For all other cases, the RESUME event is just treated as normal and
should not result in triggering the DRC path.
Change-Id: I2c8a854434f09a840938f00b88faa59c6cb57e7f
diff --git a/libvirtual/virtual.cpp b/libvirtual/virtual.cpp
index 5453e3a..bed5e4c 100644
--- a/libvirtual/virtual.cpp
+++ b/libvirtual/virtual.cpp
@@ -177,12 +177,12 @@
uint32_t priW = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
uint32_t priH = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].yres;
- initResolution(extW, extH);
-
// Dynamic Resolution Change depends on MDP downscaling.
// MDP downscale property will be ignored to exercise DRC use case.
// If DRC is in progress, ext WxH will have non-zero values.
- bool isDRC = (extW > 0) && (extH > 0);
+ bool isDRC = (extW > mVInfo.xres) && (extH > mVInfo.yres);
+
+ initResolution(extW, extH);
if(!qdutils::MDPVersion::getInstance().is8x26()
&& (mHwcContext->mMDPDownscaleEnabled || isDRC)) {