Merge "hwc: Use 1 pipe if rotator downscale reduces dimensions"
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 7343814..caa1344 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -2772,19 +2772,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