Merge "hwc: Derive view frame for external display."
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
736a9d93e7
@@ -781,6 +781,28 @@ static void trimList(hwc_context_t *ctx, hwc_display_contents_1_t *list,
|
||||
}
|
||||
}
|
||||
|
||||
hwc_rect_t calculateDisplayViewFrame(hwc_context_t *ctx, int dpy) {
|
||||
int dstWidth = ctx->dpyAttr[dpy].xres;
|
||||
int dstHeight = ctx->dpyAttr[dpy].yres;
|
||||
int srcWidth = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
|
||||
int srcHeight = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].yres;
|
||||
// default we assume viewframe as a full frame for primary display
|
||||
hwc_rect outRect = {0, 0, dstWidth, dstHeight};
|
||||
if(dpy) {
|
||||
// swap srcWidth and srcHeight, if the device orientation is 90 or 270.
|
||||
if(ctx->deviceOrientation & 0x1) {
|
||||
swap(srcWidth, srcHeight);
|
||||
}
|
||||
// Get Aspect Ratio for external
|
||||
getAspectRatioPosition(dstWidth, dstHeight, srcWidth,
|
||||
srcHeight, outRect);
|
||||
}
|
||||
ALOGD_IF(HWC_UTILS_DEBUG, "%s: view frame for dpy %d is [%d %d %d %d]",
|
||||
__FUNCTION__, dpy, outRect.left, outRect.top,
|
||||
outRect.right, outRect.bottom);
|
||||
return outRect;
|
||||
}
|
||||
|
||||
void setListStats(hwc_context_t *ctx,
|
||||
hwc_display_contents_1_t *list, int dpy) {
|
||||
const int prevYuvCount = ctx->listStats[dpy].yuvCount;
|
||||
@@ -804,13 +826,14 @@ void setListStats(hwc_context_t *ctx,
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
// Calculate view frame of each display from the layer displayframe
|
||||
ctx->mViewFrame[dpy] = getUnion(ctx->mViewFrame[dpy],
|
||||
layer->displayFrame);
|
||||
#ifdef QCOM_BSP
|
||||
if (layer->flags & HWC_SCREENSHOT_ANIMATOR_LAYER) {
|
||||
ctx->listStats[dpy].isDisplayAnimating = true;
|
||||
|
||||
Reference in New Issue
Block a user