hwc: Validate yuv layer dimensions to overcome hw limitation.
Crop width and crop height should be even for yuv layer, so fallback
to GPU composition if the values are less than 2.
Change-Id: I8677dd32bfd88e5509b8890377afd82e83b07e45
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index b130193..b2ae7fe 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -434,6 +434,13 @@
if(mdpHw.hasMinCropWidthLimitation() and (crop_w < 5 or crop_h < 5))
return false;
+ /* crop_w and crop_h should be even for yuv layer, so fallback to GPU for
+ * those cases
+ */
+ if(isYuvBuffer(hnd) && (crop_w < 2 || crop_h < 2)) {
+ return false;
+ }
+
if((w_scale > 1.0f) || (h_scale > 1.0f)) {
const uint32_t maxMDPDownscale = mdpHw.getMaxMDPDownscale();
const float w_dscale = w_scale;