Merge "hwc: hdmi: Add support for new HDMI resolutions"
diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index 30ae03d..43ae916 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -513,12 +513,13 @@
            based on an empirically derived value of panel height.
     */
 
-    bool primarySplitAlways = (mDpy == HWC_DISPLAY_PRIMARY) and
+    const bool primarySplitAlways = (mDpy == HWC_DISPLAY_PRIMARY) and
             qdutils::MDPVersion::getInstance().isSrcSplitAlways();
+    const uint32_t lSplit = getLeftSplit(ctx, mDpy);
+    const uint32_t cropWidth = sourceCrop.right - sourceCrop.left;
 
-    if(((sourceCrop.right - sourceCrop.left) >
-            (int)qdutils::MDPVersion::getInstance().getMaxMixerWidth()) or
-            primarySplitAlways) {
+    if((cropWidth > qdutils::MDPVersion::getInstance().getMaxMixerWidth()) or
+            (primarySplitAlways and cropWidth > lSplit)) {
         destR = ov.getPipe(pipeSpecs);
         if(destR == ovutils::OV_INVALID) {
             ALOGE("%s: No pipes available to configure fb for dpy %d's right"
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index d52955d..82d1f05 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -358,7 +358,7 @@
      * There also is a HW limilation in MDP, minimum block size is 2x2
      * Fallback to GPU if height is less than 2.
      */
-    if((crop_w < 5)||(crop_h < 5))
+    if(mdpHw.hasMinCropWidthLimitation() and (crop_w < 5 or crop_h < 5))
         return false;
 
     if((w_scale > 1.0f) || (h_scale > 1.0f)) {
@@ -2469,7 +2469,8 @@
             mdpHw.isSrcSplitAlways();
     int lSplit = getLeftSplit(ctx, mDpy);
     int dstWidth = dst.right - dst.left;
-    int cropWidth = crop.right - crop.left;
+    int cropWidth = has90Transform(layer) ? crop.bottom - crop.top :
+            crop.right - crop.left;
 
     //TODO Even if a 4k video is going to be rot-downscaled to dimensions under
     //pipe line length, we are still using 2 pipes. This is fine just because
diff --git a/libqdutils/mdp_version.cpp b/libqdutils/mdp_version.cpp
index b0a8d7d..088f82b 100644
--- a/libqdutils/mdp_version.cpp
+++ b/libqdutils/mdp_version.cpp
@@ -411,6 +411,10 @@
 }
 
 
+bool MDPVersion::hasMinCropWidthLimitation() const {
+    return mMdpRev <= MDSS_MDP_HW_REV_102;
+}
+
 bool MDPVersion::supportsDecimation() {
     return mFeatures & MDP_DECIMATION_EN;
 }
diff --git a/libqdutils/mdp_version.h b/libqdutils/mdp_version.h
index d26c55c..3c7f6a3 100644
--- a/libqdutils/mdp_version.h
+++ b/libqdutils/mdp_version.h
@@ -138,6 +138,7 @@
     uint32_t getMinFpsSupported() { return mPanelInfo.mMinFps; }
     uint32_t getMaxFpsSupported() { return mPanelInfo.mMaxFps; }
     uint32_t getMaxMixerWidth() const { return mMaxMixerWidth; }
+    bool hasMinCropWidthLimitation() const;
     bool isSrcSplit() const;
     bool isSrcSplitAlways() const;
     bool isRGBScalarSupported() const;