hwc: Fix alpha downscale check for mdp composition

Do not allow mdp composition when any layer format has alpha channel
and needs scaling as the VG pipes are not supporting alpha downscaling.

In few scenarios, at the beginning/ending of animations Surface Flinger
passes few frames with flag HWC_BLENDING_NONE though it has Alpha.
When such layer passed to VG piple and if needs scaling , it results in
flicker. Hence, just checking for HWC_BLENDING_NONE is not enough.

Change-Id: I70fdfe4547df6fe7b2771ed8042f43aa4e07a71d
CRs-fixed: 462508
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 7444777..f0d3695 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -284,9 +284,21 @@
 }
 
 bool isAlphaScaled(hwc_layer_1_t const* layer) {
-    if(needsScaling(layer)) {
-        if(layer->blending != HWC_BLENDING_NONE)
+    if(needsScaling(layer) && isAlphaPresent(layer)) {
+        return true;
+    }
+    return false;
+}
+
+bool isAlphaPresent(hwc_layer_1_t const* layer) {
+    private_handle_t *hnd = (private_handle_t *)layer->handle;
+    int format = hnd->format;
+    switch(format) {
+        case HAL_PIXEL_FORMAT_RGBA_8888:
+        case HAL_PIXEL_FORMAT_BGRA_8888:
+            // In any more formats with Alpha go here..
             return true;
+        default : return false;
     }
     return false;
 }