hwc: Use 1 pipe if rotator downscale reduces dimensions

If rotator downscale is able to reduce output dimensions below
MDP's pipe limits, then use only 1 pipe if possible in source split
cases.

Change-Id: I6739a1fcd32b1047ce266d60c0123961c9daa657
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 23cea5a..b17bdaf 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -2645,19 +2645,21 @@
     const uint32_t lSplit = getLeftSplit(ctx, mDpy);
     const uint32_t dstWidth = dst.right - dst.left;
     const uint32_t dstHeight = dst.bottom - dst.top;
-    const uint32_t cropWidth = has90Transform(layer) ? crop.bottom - crop.top :
+    uint32_t cropWidth = has90Transform(layer) ? crop.bottom - crop.top :
             crop.right - crop.left;
-    const uint32_t cropHeight = has90Transform(layer) ? crop.right - crop.left :
+    uint32_t cropHeight = has90Transform(layer) ? crop.right - crop.left :
             crop.bottom - crop.top;
     //Approximation to actual clock, ignoring the common factors in pipe and
     //mixer cases like line_time
     const uint32_t layerClock = getLayerClock(dstWidth, dstHeight, cropHeight);
     const uint32_t mixerClock = lSplit;
 
-    //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
-    //this is source split where destination doesn't matter. Evaluate later to
-    //see if going through all the calcs to save a pipe is worth it
+    const uint32_t downscale = getRotDownscale(ctx, layer);
+    if(downscale) {
+        cropWidth /= downscale;
+        cropHeight /= downscale;
+    }
+
     if(dstWidth > mdpHw.getMaxPipeWidth() or
             cropWidth > mdpHw.getMaxPipeWidth() or
             (primarySplitAlways and