hwc: Display view frame needs to be set before using it.
The display view frame needs to be set before calling trimLayer api
because it uses view frame to find the scissor for display, which is
used to clip crop for out-of-bounds display frame sent by framework.
If mViewFrame is not set, scissor will be empty rect, which leads to
wrong source crop calculation.
Change-Id: I52ad4eb9037d34aff24c30fe65e3793684445264
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 3f5d77a..1e3e87c 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -817,13 +817,13 @@
ctx->mViewFrame[dpy] = (hwc_rect_t){0, 0, 0, 0};
ctx->dpyAttr[dpy].mActionSafePresent = isActionSafePresent(ctx, dpy);
- trimList(ctx, list, dpy);
- optimizeLayerRects(list);
-
// Calculate view frame of ext display from primary resolution
// and primary device orientation.
ctx->mViewFrame[dpy] = calculateDisplayViewFrame(ctx, dpy);
+ trimList(ctx, list, dpy);
+ optimizeLayerRects(list);
+
for (size_t i = 0; i < (size_t)ctx->listStats[dpy].numAppLayers; i++) {
hwc_layer_1_t const* layer = &list->hwLayers[i];
private_handle_t *hnd = (private_handle_t *)layer->handle;