Commit 9e6c74ce authored by Dmytro Laktyushkin's avatar Dmytro Laktyushkin Committed by Alex Deucher

drm/amd/display: fix hsplit viewport calculation for rotated/mirrored usecases

Signed-off-by: default avatarDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b2d0a103
......@@ -412,6 +412,8 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)
struct rect clip = {0};
int vpc_div = (data->format == PIXEL_FORMAT_420BPP12
|| data->format == PIXEL_FORMAT_420BPP15) ? 2 : 1;
bool need_split = (pipe_ctx->top_pipe && pipe_ctx->top_pipe->surface == pipe_ctx->surface)
|| (pipe_ctx->bottom_pipe && pipe_ctx->bottom_pipe->surface == pipe_ctx->surface);
if (surface->rotation == ROTATION_ANGLE_90 ||
......@@ -466,18 +468,41 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)
data->viewport_c.height = (data->viewport.height + vpc_div - 1) / vpc_div;
/* Handle hsplit */
if (pipe_ctx->top_pipe && pipe_ctx->top_pipe->surface == pipe_ctx->surface) {
if (need_split && (surface->rotation == ROTATION_ANGLE_90 ||
surface->rotation == ROTATION_ANGLE_270)) {
bool lower_view = (surface->rotation == ROTATION_ANGLE_270) ^
(pipe_ctx->top_pipe && pipe_ctx->top_pipe->surface == pipe_ctx->surface);
if (lower_view) {
data->viewport.height /= 2;
data->viewport_c.height /= 2;
data->viewport.y += data->viewport.height;
data->viewport_c.y += data->viewport_c.height;
/* Ceil offset pipe */
data->viewport.height += data->viewport.height % 2;
data->viewport_c.height += data->viewport_c.height % 2;
} else {
data->viewport.height /= 2;
data->viewport_c.height /= 2;
}
} else if (need_split) {
bool right_view = (surface->rotation == ROTATION_ANGLE_180) ^
(pipe_ctx->top_pipe && pipe_ctx->top_pipe->surface == pipe_ctx->surface) ^
surface->horizontal_mirror;
if (right_view) {
data->viewport.width /= 2;
data->viewport_c.width /= 2;
data->viewport.x += data->viewport.width;
data->viewport_c.x += data->viewport_c.width;
/* Floor primary pipe, ceil 2ndary pipe */
/* Ceil offset pipe */
data->viewport.width += data->viewport.width % 2;
data->viewport_c.width += data->viewport_c.width % 2;
} else if (pipe_ctx->bottom_pipe && pipe_ctx->bottom_pipe->surface == pipe_ctx->surface) {
} else {
data->viewport.width /= 2;
data->viewport_c.width /= 2;
}
}
}
static void calculate_recout(struct pipe_ctx *pipe_ctx, struct view *recout_skip)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment