Revert "hwc: Perform MDP downscaling for WFD/HDMI Scenario"
This reverts commit 1291675ee44cadc234c4403cf1b0cfe70eadaf3a.
diff --git a/libexternal/Android.mk b/libexternal/Android.mk
index 3df6984..f723113 100644
--- a/libexternal/Android.mk
+++ b/libexternal/Android.mk
@@ -6,7 +6,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
-LOCAL_SHARED_LIBRARIES := $(common_libs) liboverlay libqdutils
+LOCAL_SHARED_LIBRARIES := $(common_libs) liboverlay
LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"qdexternal\"
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
LOCAL_SRC_FILES := external.cpp
diff --git a/libexternal/external.cpp b/libexternal/external.cpp
index 89d63e9..b247dfb 100644
--- a/libexternal/external.cpp
+++ b/libexternal/external.cpp
@@ -34,7 +34,6 @@
#include "external.h"
#include "overlayUtils.h"
#include "overlay.h"
-#include "mdp_version.h"
using namespace android;
@@ -66,11 +65,6 @@
return 0;
}
-void ExternalDisplay::getAttributes(int& width, int& height) {
- int fps = 0;
- getAttrForMode(width, height, fps);
-}
-
int ExternalDisplay::teardown() {
closeFrameBuffer();
resetInfo();
@@ -570,38 +564,15 @@
return ret;
}
-
void ExternalDisplay::setAttributes() {
int width = 0, height = 0, fps = 0;
getAttrForMode(width, height, fps);
+
ALOGD("ExtDisplay setting xres = %d, yres = %d", width, height);
- if(mHwcContext) {
- // Always set dpyAttr res to mVInfo res
- mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = width;
- mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = height;
- mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode = false;
- if(!qdutils::MDPVersion::getInstance().is8x26()) {
- int priW = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
- int priH = mHwcContext->dpyAttr[HWC_DISPLAY_PRIMARY].yres;
- // if primary resolution is more than the hdmi resolution
- // configure dpy attr to primary resolution and set
- // downscale mode
- if((priW * priH) > (width * height)) {
- mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = priW;
- mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = priH;
- // HDMI is always in landscape, so always assign the higher
- // dimension to hdmi's xres
- if(priH > priW) {
- mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = priH;
- mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = priW;
- }
- // Set External Display MDP Downscale mode indicator
- mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode =true;
- }
- }
- mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].vsync_period =
- 1000000000l / fps;
- }
+ mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].xres = width;
+ mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].yres = height;
+ mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].vsync_period =
+ 1000000000l / fps;
}
void ExternalDisplay::getAttrForMode(int& width, int& height, int& fps) {
diff --git a/libexternal/external.h b/libexternal/external.h
index 1a3602d..2fbb027 100644
--- a/libexternal/external.h
+++ b/libexternal/external.h
@@ -45,7 +45,6 @@
void setActionSafeDimension(int w, int h);
bool isCEUnderscanSupported() { return mUnderscanSupported; }
int configure();
- void getAttributes(int& width, int& height);
int teardown();
bool isConnected() {
return mHwcContext->dpyAttr[HWC_DISPLAY_EXTERNAL].connected;
diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index 7c2e643..b5ac2b8 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -26,12 +26,10 @@
#include "hwc_fbupdate.h"
#include "mdp_version.h"
#include "external.h"
-#include "virtual.h"
using namespace qdutils;
using namespace overlay;
using overlay::Rotator;
-using namespace overlay::utils;
namespace qhwc {
@@ -120,32 +118,27 @@
// Do not use getNonWormholeRegion() function to calculate the
// sourceCrop during animation on external display and
// Dont do wormhole calculation when extorientation is set on External
- // Dont do wormhole calculation when extDownscale is enabled on External
if(ctx->listStats[mDpy].isDisplayAnimating && mDpy) {
sourceCrop = layer->displayFrame;
displayFrame = sourceCrop;
- } else if((!mDpy ||
- (mDpy && !ctx->mExtOrientation
- && !ctx->dpyAttr[mDpy].mDownScaleMode))
- && (extOnlyLayerIndex == -1)) {
+ } else if((!mDpy || (mDpy && !ctx->mExtOrientation))
+ && extOnlyLayerIndex == -1) {
if(!qdutils::MDPVersion::getInstance().is8x26()) {
getNonWormholeRegion(list, sourceCrop);
displayFrame = sourceCrop;
}
}
+
if(mDpy && !qdutils::MDPVersion::getInstance().is8x26()) {
- if(ctx->mExtOrientation || ctx->dpyAttr[mDpy].mDownScaleMode) {
- calcExtDisplayPosition(ctx, mDpy, sourceCrop, displayFrame);
+ if(ctx->mExtOrientation) {
+ calcExtDisplayPosition(ctx, mDpy, displayFrame);
// If there is a external orientation set, use that
- if(ctx->mExtOrientation) {
- transform = ctx->mExtOrientation;
- orient =
- static_cast<ovutils::eTransform >(ctx->mExtOrientation);
- }
+ transform = ctx->mExtOrientation;
+ orient = static_cast<ovutils::eTransform >(ctx->mExtOrientation);
}
// Calculate the actionsafe dimensions for External(dpy = 1 or 2)
getActionSafePosition(ctx, mDpy, displayFrame);
- }
+ }
setMdpFlags(layer, mdpFlags, 0, transform);
// For External use rotator if there is a rotation value set
if(mDpy && (ctx->mExtOrientation & HWC_TRANSFORM_ROT_90)) {
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index e013876..91cf337 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -159,9 +159,6 @@
ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].connected = false;
ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].isActive = false;
ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].connected = false;
- ctx->dpyAttr[HWC_DISPLAY_PRIMARY].mDownScaleMode= false;
- ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].mDownScaleMode = false;
- ctx->dpyAttr[HWC_DISPLAY_VIRTUAL].mDownScaleMode = false;
ctx->mMDPComp[HWC_DISPLAY_PRIMARY] =
MDPComp::getObject(ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres,
@@ -417,56 +414,6 @@
"y = %d w = %d h = %d", __FUNCTION__, outPos.x, outPos.y,
outPos.w, outPos.h);
- // For sidesync, the dest fb will be in portrait orientation, and the crop
- // will be updated to avoid the black side bands, and it will be upscaled
- // to fit the dest RB, so recalculate
- // the position based on the new width and height
- if ((extOrientation & HWC_TRANSFORM_ROT_90) &&
- isOrientationPortrait(ctx)) {
- hwc_rect_t r;
- //Calculate the position
- xRatio = (outPos.x - xPos)/width;
- // GetaspectRatio -- tricky to get the correct aspect ratio
- // But we need to do this.
- getAspectRatioPosition(width, height, width, height, r);
- xPos = r.left;
- yPos = r.top;
- float tempWidth = r.right - r.left;
- float tempHeight = r.bottom - r.top;
- yRatio = yPos/height;
- wRatio = outPos.w/width;
- hRatio = tempHeight/height;
-
- //Map the coordinates back to Framebuffer domain
- outPos.x = (xRatio * fbWidth);
- outPos.y = (yRatio * fbHeight);
- outPos.w = wRatio * fbWidth;
- outPos.h = hRatio * fbHeight;
-
- ALOGD_IF(HWC_UTILS_DEBUG, "%s: Calculated AspectRatio for device in"
- "portrait: x = %d,y = %d w = %d h = %d", __FUNCTION__,
- outPos.x, outPos.y,
- outPos.w, outPos.h);
- }
- if(ctx->dpyAttr[dpy].mDownScaleMode) {
- int extW, extH;
- if(dpy == HWC_DISPLAY_EXTERNAL)
- ctx->mExtDisplay->getAttributes(extW, extH);
- else
- ctx->mVirtualDisplay->getAttributes(extW, extH);
- fbWidth = ctx->dpyAttr[dpy].xres;
- fbHeight = ctx->dpyAttr[dpy].yres;
- //Calculate the position...
- xRatio = outPos.x/fbWidth;
- yRatio = outPos.y/fbHeight;
- wRatio = outPos.w/fbWidth;
- hRatio = outPos.h/fbHeight;
-
- outPos.x = xRatio * extW;
- outPos.y = yRatio * extH;
- outPos.w = wRatio * extW;
- outPos.h = hRatio * extH;
- }
// Convert Dim to hwc_rect_t
outRect.left = outPos.x;
outRect.top = outPos.y;
@@ -485,60 +432,20 @@
return false;
}
-bool isOrientationPortrait(hwc_context_t *ctx) {
- if(isPrimaryPortrait(ctx)) {
- return !(ctx->deviceOrientation & 0x1);
- }
- return (ctx->deviceOrientation & 0x1);
-}
-
-void calcExtDisplayPosition(hwc_context_t *ctx, int dpy,
- hwc_rect_t& sourceCrop,
- hwc_rect_t& displayFrame) {
+void calcExtDisplayPosition(hwc_context_t *ctx,
+ int dpy, hwc_rect_t& displayFrame) {
+ int dstWidth = ctx->dpyAttr[dpy].xres;
+ int dstHeight = ctx->dpyAttr[dpy].yres;;
+ int srcWidth = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
+ int srcHeight = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].yres;
// Swap width and height when there is a 90deg transform
if(ctx->mExtOrientation & HWC_TRANSFORM_ROT_90) {
- int dstWidth = ctx->dpyAttr[dpy].xres;
- int dstHeight = ctx->dpyAttr[dpy].yres;;
- int srcWidth = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
- int srcHeight = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].yres;
if(!isPrimaryPortrait(ctx)) {
swap(srcWidth, srcHeight);
} // Get Aspect Ratio for external
getAspectRatioPosition(dstWidth, dstHeight, srcWidth,
srcHeight, displayFrame);
- // Crop - this is needed, because for sidesync, the dest fb will
- // be in portrait orientation, so update the crop to not show the
- // black side bands.
- if (isOrientationPortrait(ctx)) {
- sourceCrop = displayFrame;
- displayFrame.left = 0;
- displayFrame.top = 0;
- displayFrame.right = dstWidth;
- displayFrame.bottom = dstHeight;
- }
}
- if(ctx->dpyAttr[dpy].mDownScaleMode) {
- int extW, extH;
- // if downscale is enabled, map the co-ordinates to new
- // domain(downscaled)
- float fbWidth = ctx->dpyAttr[dpy].xres;
- float fbHeight = ctx->dpyAttr[dpy].yres;
- // query MDP configured attributes
- if(dpy == HWC_DISPLAY_EXTERNAL)
- ctx->mExtDisplay->getAttributes(extW, extH);
- else
- ctx->mVirtualDisplay->getAttributes(extW, extH);
- //Calculate the ratio...
- float wRatio = ((float)extW)/fbWidth;
- float hRatio = ((float)extH)/fbHeight;
-
- //convert Dim to hwc_rect_t
- displayFrame.left *= wRatio;
- displayFrame.top *= hRatio;
- displayFrame.right *= wRatio;
- displayFrame.bottom *= hRatio;
- }
-
}
bool needsScaling(hwc_context_t* ctx, hwc_layer_1_t const* layer,
@@ -1167,12 +1074,8 @@
if(dpy) {
// Just need to set the position to portrait as the transformation
// will already be set to required orientation on TV
- if(ctx->mExtOrientation || ctx->dpyAttr[dpy].mDownScaleMode) {
+ if(ctx->mExtOrientation) {
getAspectRatioPosition(ctx, dpy, ctx->mExtOrientation, dst, dst);
- if(ctx->mExtOrientation) {
- transform = ctx->mExtOrientation;
- orient = static_cast<eTransform>(transform);
- }
}
// Calculate the actionsafe dimensions for External(dpy = 1 or 2)
getActionSafePosition(ctx, dpy, dst);
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 8809493..251b3cb 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -83,8 +83,6 @@
// To trigger padding round to clean up mdp
// pipes
bool isConfiguring;
- // External Display is in MDP Downscale mode indicator
- bool mDownScaleMode;
};
struct ListStats {
@@ -187,12 +185,8 @@
bool isPrimaryPortrait(hwc_context_t *ctx);
-bool isOrientationPortrait(hwc_context_t *ctx);
-
void calcExtDisplayPosition(hwc_context_t *ctx,
- int dpy,
- hwc_rect_t& sourceCrop,
- hwc_rect_t& displayFrame);
+ int dpy, hwc_rect_t& displayFrame);
//Close acquireFenceFds of all layers of incoming list
void closeAcquireFds(hwc_display_contents_1_t* list);
diff --git a/libvirtual/Android.mk b/libvirtual/Android.mk
index beeef25..1231f8d 100644
--- a/libvirtual/Android.mk
+++ b/libvirtual/Android.mk
@@ -6,7 +6,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes)
-LOCAL_SHARED_LIBRARIES := $(common_libs) liboverlay libqdutils
+LOCAL_SHARED_LIBRARIES := $(common_libs) liboverlay
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 8e96a56..e2f239a 100644
--- a/libvirtual/virtual.cpp
+++ b/libvirtual/virtual.cpp
@@ -47,7 +47,6 @@
#include "virtual.h"
#include "overlayUtils.h"
#include "overlay.h"
-#include "mdp_version.h"
using namespace android;
@@ -68,11 +67,6 @@
return 0;
}
-void VirtualDisplay::getAttributes(int& width, int& height) {
- width = mVInfo.xres;
- height = mVInfo.yres;
-}
-
int VirtualDisplay::teardown() {
closeFrameBuffer();
memset(&mVInfo, 0, sizeof(mVInfo));
@@ -91,35 +85,12 @@
}
void VirtualDisplay::setAttributes() {
- 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);
- }
+ 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);
}
bool VirtualDisplay::openFrameBuffer()
diff --git a/libvirtual/virtual.h b/libvirtual/virtual.h
index 8003e23..cd0e7da 100644
--- a/libvirtual/virtual.h
+++ b/libvirtual/virtual.h
@@ -43,7 +43,6 @@
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;