overlay: Add support for decimation.
Add support for decimation on top of what MDP can downscale,
because decimation can have quality issues.
B-family MDP downscale of 1/4, plus decimation of 1/16 can let
us have a total downscale of 1/64.
Also decimate by 2 (min) if width is greater than what layer mixer
supports and is not handled by the client.
Change-Id: I3b7c4bf321c7561bd98206ad118f4ac1ee2879ae
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index b81eb5e..6381f59 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -24,6 +24,7 @@
#include <overlayRotator.h>
using namespace overlay;
+using namespace qdutils;
using namespace overlay::utils;
namespace ovutils = overlay::utils;
@@ -405,12 +406,11 @@
return false;
}
- /* Workaround for downscales larger than 4x. Will be removed once decimator
- * block is enabled for MDSS*/
- if(ctx->mMDP.version == qdutils::MDSS_V5) {
+ if(!qdutils::MDPVersion::getInstance().supportsDecimation()) {
+ const uint32_t downscale =
+ qdutils::MDPVersion::getInstance().getMaxMDPDownscale();
hwc_rect_t crop = layer->sourceCrop;
hwc_rect_t dst = layer->displayFrame;
-
int cWidth = crop.right - crop.left;
int cHeight = crop.bottom - crop.top;
int dWidth = dst.right - dst.left;
@@ -420,7 +420,8 @@
swap(cWidth, cHeight);
}
- if((cWidth/dWidth) > 4 || (cHeight/dHeight) > 4)
+ if(cWidth > MAX_DISPLAY_DIM || (cWidth/dWidth) > downscale ||
+ (cHeight/dHeight) > downscale)
return false;
}
return true;