hwc: Split display: Correct source crops split, enable overfetch
For split source crop of YUV ensure that Left and Width
(thus Right) of each crop is even.
For split source crop of RGB and YUV ensure that Crops have
no gaps (i.e right of left-crop = left of right-crop)
Enable overfetch of pixels in the center, for split layers,
to get a smooth upscale
Change-Id: I8e4a91b637c840f75742580645c6468b5769432d
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index ffaa9cb..2494511 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -1291,6 +1291,35 @@
return 0;
}
+//Helper to 1) Ensure crops dont have gaps 2) Ensure L and W are even
+static void sanitizeSourceCrop(hwc_rect_t& cropL, hwc_rect_t& cropR,
+ private_handle_t *hnd) {
+ if(cropL.right - cropL.left) {
+ if(isYuvBuffer(hnd)) {
+ //Always safe to even down left
+ ovutils::even_floor(cropL.left);
+ //If right is even, automatically width is even, since left is
+ //already even
+ ovutils::even_floor(cropL.right);
+ }
+ //Make sure there are no gaps between left and right splits if the layer
+ //is spread across BOTH halves
+ if(cropR.right - cropR.left) {
+ cropR.left = cropL.right;
+ }
+ }
+
+ if(cropR.right - cropR.left) {
+ if(isYuvBuffer(hnd)) {
+ //Always safe to even down left
+ ovutils::even_floor(cropR.left);
+ //If right is even, automatically width is even, since left is
+ //already even
+ ovutils::even_floor(cropR.right);
+ }
+ }
+}
+
int configureHighRes(hwc_context_t *ctx, hwc_layer_1_t *layer,
const int& dpy, eMdpFlags& mdpFlagsL, eZorder& z,
eIsFg& isFg, const eDest& lDest, const eDest& rDest,
@@ -1339,6 +1368,12 @@
setMdpFlags(layer, mdpFlagsL, 0, transform);
+
+ if(lDest != OV_INVALID && rDest != OV_INVALID) {
+ //Enable overfetch
+ setMdpFlags(mdpFlagsL, OV_MDSS_MDP_DUAL_PIPE);
+ }
+
trimLayer(ctx, dpy, transform, crop, dst);
//Will do something only if feature enabled and conditions suitable
@@ -1366,8 +1401,8 @@
eMdpFlags mdpFlagsR = mdpFlagsL;
setMdpFlags(mdpFlagsR, OV_MDSS_MDP_RIGHT_MIXER);
- hwc_rect_t tmp_cropL, tmp_dstL;
- hwc_rect_t tmp_cropR, tmp_dstR;
+ hwc_rect_t tmp_cropL = {0}, tmp_dstL = {0};
+ hwc_rect_t tmp_cropR = {0}, tmp_dstR = {0};
const int lSplit = getLeftSplit(ctx, dpy);
@@ -1384,6 +1419,8 @@
qhwc::calculate_crop_rects(tmp_cropR, tmp_dstR, scissor, 0);
}
+ sanitizeSourceCrop(tmp_cropL, tmp_cropR, hnd);
+
//When buffer is H-flipped, contents of mixer config also needs to swapped
//Not needed if the layer is confined to one half of the screen.
//If rotator has been used then it has also done the flips, so ignore them.