hwc: Extend partial frame update for split displays
Extends partial frame update support for split displays by calculating
changing region(ROI) independently for each half of the screen. In case of
only one half updating, display driver shuts down the DSI/MDP mixer control
of the non updating half.
Maintains two ROI's for each display. In case of Non-split
displays, only left ROI is updated.
Change-Id: I8a67fe40aac665a48b6f8a46beffb9f8027851b2
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 4cc8243..b5a7629 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -834,13 +834,13 @@
char property[PROPERTY_VALUE_MAX];
ctx->listStats[dpy].extOnlyLayerIndex = -1;
ctx->listStats[dpy].isDisplayAnimating = false;
- ctx->listStats[dpy].roi = ovutils::Dim(0, 0,
- (int)ctx->dpyAttr[dpy].xres, (int)ctx->dpyAttr[dpy].yres);
ctx->listStats[dpy].secureUI = false;
ctx->listStats[dpy].yuv4k2kCount = 0;
ctx->mViewFrame[dpy] = (hwc_rect_t){0, 0, 0, 0};
ctx->dpyAttr[dpy].mActionSafePresent = isActionSafePresent(ctx, dpy);
+ resetROI(ctx, dpy);
+
// Calculate view frame of ext display from primary resolution
// and primary device orientation.
ctx->mViewFrame[dpy] = calculateDisplayViewFrame(ctx, dpy);
@@ -1070,6 +1070,12 @@
return isValidRect(irect);
}
+bool isSameRect(const hwc_rect& rect1, const hwc_rect& rect2)
+{
+ return ((rect1.left == rect2.left) && (rect1.top == rect2.top) &&
+ (rect1.right == rect2.right) && (rect1.bottom == rect2.bottom));
+}
+
bool isValidRect(const hwc_rect& rect)
{
return ((rect.bottom > rect.top) && (rect.right > rect.left)) ;
@@ -2164,7 +2170,20 @@
}
}
-hwc_rect_t sanitizeROI(struct hwc_rect roi, hwc_rect boundary)
+void resetROI(hwc_context_t *ctx, const int dpy) {
+ const int fbXRes = (int)ctx->dpyAttr[dpy].xres;
+ const int fbYRes = (int)ctx->dpyAttr[dpy].yres;
+ if(isDisplaySplit(ctx, dpy)) {
+ const int lSplit = getLeftSplit(ctx, dpy);
+ ctx->listStats[dpy].lRoi = (struct hwc_rect){0, 0, lSplit, fbYRes};
+ ctx->listStats[dpy].rRoi = (struct hwc_rect){lSplit, 0, fbXRes, fbYRes};
+ } else {
+ ctx->listStats[dpy].lRoi = (struct hwc_rect){0, 0,fbXRes, fbYRes};
+ ctx->listStats[dpy].rRoi = (struct hwc_rect){0, 0, 0, 0};
+ }
+}
+
+hwc_rect_t getSanitizeROI(struct hwc_rect roi, hwc_rect boundary)
{
if(!isValidRect(roi))
return roi;
@@ -2176,6 +2195,7 @@
const int TOP_ALIGN = qdutils::MDPVersion::getInstance().getTopAlign();
const int HEIGHT_ALIGN = qdutils::MDPVersion::getInstance().getHeightAlign();
const int MIN_WIDTH = qdutils::MDPVersion::getInstance().getMinROIWidth();
+ const int MIN_HEIGHT = qdutils::MDPVersion::getInstance().getMinROIHeight();
/* Align to minimum width recommended by the panel */
if((t_roi.right - t_roi.left) < MIN_WIDTH) {
@@ -2185,7 +2205,18 @@
t_roi.right = t_roi.left + MIN_WIDTH;
}
+ /* Align to minimum height recommended by the panel */
+ if((t_roi.bottom - t_roi.top) < MIN_HEIGHT) {
+ if((t_roi.top + MIN_HEIGHT) > boundary.bottom)
+ t_roi.top = t_roi.bottom - MIN_HEIGHT;
+ else
+ t_roi.bottom = t_roi.top + MIN_HEIGHT;
+ }
+
/* Align left and width to meet panel restrictions */
+ if(LEFT_ALIGN)
+ t_roi.left = t_roi.left - (t_roi.left % LEFT_ALIGN);
+
if(WIDTH_ALIGN) {
int width = t_roi.right - t_roi.left;
width = WIDTH_ALIGN * ((width + (WIDTH_ALIGN - 1)) / WIDTH_ALIGN);
@@ -2194,13 +2225,17 @@
if(t_roi.right > boundary.right) {
t_roi.right = boundary.right;
t_roi.left = t_roi.right - width;
+
+ if(LEFT_ALIGN)
+ t_roi.left = t_roi.left - (t_roi.left % LEFT_ALIGN);
}
}
- if(LEFT_ALIGN)
- t_roi.left = t_roi.left - (t_roi.left % LEFT_ALIGN);
/* Align top and height to meet panel restrictions */
+ if(TOP_ALIGN)
+ t_roi.top = t_roi.top - (t_roi.top % TOP_ALIGN);
+
if(HEIGHT_ALIGN) {
int height = t_roi.bottom - t_roi.top;
height = HEIGHT_ALIGN * ((height + (HEIGHT_ALIGN - 1)) / HEIGHT_ALIGN);
@@ -2209,11 +2244,12 @@
if(t_roi.bottom > boundary.bottom) {
t_roi.bottom = boundary.bottom;
t_roi.top = t_roi.bottom - height;
+
+ if(TOP_ALIGN)
+ t_roi.top = t_roi.top - (t_roi.top % TOP_ALIGN);
}
}
- if(TOP_ALIGN)
- t_roi.top = t_roi.top - (t_roi.top % TOP_ALIGN);
return t_roi;
}