hwc: hdmi: Add support for action safe scaling for HDMI primary

Apply action safe scaling when HDMI is either the external or the
primary display.

Change-Id: I6de5d14e4d03beb59e81bed8ce96a64030c766f6
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 5de3081..03c6341 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -854,7 +854,8 @@
                                ovutils::eTransform& orient) {
     // Swap width and height when there is a 90deg transform
     int extOrient = getExtOrientation(ctx);
-    if(dpy && ctx->mOverlay->isUIScalingOnExternalSupported()) {
+    if ((dpy || ctx->mHDMIDisplay->isHDMIPrimaryDisplay())
+            && ctx->mOverlay->isUIScalingOnExternalSupported()) {
         if(!isYuvBuffer(hnd)) {
             if(extOrient & HWC_TRANSFORM_ROT_90) {
                 int dstWidth = ctx->dpyAttr[dpy].xres;
@@ -1377,8 +1378,9 @@
     // Disable Action safe for 8974 due to HW limitation for downscaling
     // layers with overlapped region
     // Disable Actionsafe for non HDMI displays.
-    if(!(dpy == HWC_DISPLAY_EXTERNAL) ||
-        qdutils::MDPVersion::getInstance().is8x74v2() ||
+    if (!(dpy == HWC_DISPLAY_EXTERNAL ||
+                ctx->mHDMIDisplay->isHDMIPrimaryDisplay()) ||
+            qdutils::MDPVersion::getInstance().is8x74v2() ||
         ctx->mHDMIDisplay->isCEUnderscanSupported()) {
         return false;
     }