hwc: Enable mdp downscale feature for 4k resolution

Enable MDP Downscale feature for primary resolution greater than
2048 only for the targets that supports source split.

Change-Id: I21871b099f74543aa8c2416bac41e3a16d4ce72d
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 0d968c8..6b114a9 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -2478,6 +2478,9 @@
         else if (hnd->format == HAL_PIXEL_FORMAT_RGBX_8888)
             whf.format = getMdpFormat(HAL_PIXEL_FORMAT_BGRX_8888);
     }
+    /* Calculate the external display position based on MDP downscale,
+       ActionSafe, and extorientation features. */
+    calcExtDisplayPosition(ctx, hnd, mDpy, crop, dst, transform, orient);
 
     int downscale = getRotDownscale(ctx, layer);
     eMdpFlags mdpFlags = OV_MDP_BACKEND_COMPOSITION;
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index e57e573..6c04965 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -636,6 +636,10 @@
                 displayFrame.top = int(hRatio*(float)displayFrame.top);
                 displayFrame.right = int(wRatio*(float)displayFrame.right);
                 displayFrame.bottom = int(hRatio*(float)displayFrame.bottom);
+                ALOGD_IF(DEBUG_MDPDOWNSCALE, "Calculated external display frame"
+                         " for MDPDownscale feature [%d %d %d %d]",
+                         displayFrame.left, displayFrame.top,
+                         displayFrame.right, displayFrame.bottom);
             }
         }else {
             if(extOrient || ctx->dpyAttr[dpy].mDownScaleMode) {
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 98e53a6..845897c 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -21,7 +21,9 @@
 #ifndef HWC_UTILS_H
 #define HWC_UTILS_H
 
+#define DEBUG_MDPDOWNSCALE 0
 #define HWC_REMOVE_DEPRECATED_VERSIONS 1
+
 #include <fcntl.h>
 #include <math.h>
 #include <hardware/hwcomposer.h>