aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4358-drm-amd-display-Unify-all-scaling-when-Integer-Scali.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4358-drm-amd-display-Unify-all-scaling-when-Integer-Scali.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4358-drm-amd-display-Unify-all-scaling-when-Integer-Scali.patch109
1 files changed, 109 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4358-drm-amd-display-Unify-all-scaling-when-Integer-Scali.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4358-drm-amd-display-Unify-all-scaling-when-Integer-Scali.patch
new file mode 100644
index 00000000..6444cf87
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/4358-drm-amd-display-Unify-all-scaling-when-Integer-Scali.patch
@@ -0,0 +1,109 @@
+From 9e82c03526a0875547dde5bfbcc0a68132a14b84 Mon Sep 17 00:00:00 2001
+From: Reza Amini <Reza.Amini@amd.com>
+Date: Thu, 17 Oct 2019 16:40:02 -0400
+Subject: [PATCH 4358/4736] drm/amd/display: Unify all scaling when Integer
+ Scaling enabled
+
+[why]
+We want to guarantee integer ratio scaling for all scaling modes.
+
+[how]
+Treat centered, fullscreen, preserve aspect ratio the same: scale
+the view as many times as possible, and fill in the rest with a black
+border.
+
+Signed-off-by: Reza Amini <Reza.Amini@amd.com>
+Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
+Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
+---
+ drivers/gpu/drm/amd/display/dc/core/dc.c | 8 +++++--
+ .../gpu/drm/amd/display/dc/core/dc_resource.c | 21 ++++---------------
+ drivers/gpu/drm/amd/display/dc/dc_stream.h | 1 +
+ 3 files changed, 11 insertions(+), 19 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
+index a652ebd77f7a..a0ad1796af08 100644
+--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
++++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
+@@ -1545,7 +1545,10 @@ static enum surface_update_type get_scaling_info_update_type(
+ if (u->scaling_info->clip_rect.width != u->surface->clip_rect.width
+ || u->scaling_info->clip_rect.height != u->surface->clip_rect.height
+ || u->scaling_info->dst_rect.width != u->surface->dst_rect.width
+- || u->scaling_info->dst_rect.height != u->surface->dst_rect.height) {
++ || u->scaling_info->dst_rect.height != u->surface->dst_rect.height
++ || u->scaling_info->scaling_quality.integer_scaling !=
++ u->surface->scaling_quality.integer_scaling
++ ) {
+ update_flags->bits.scaling_change = 1;
+
+ if ((u->scaling_info->dst_rect.width < u->surface->dst_rect.width
+@@ -1666,7 +1669,8 @@ static enum surface_update_type check_update_surfaces_for_stream(
+ union stream_update_flags *su_flags = &stream_update->stream->update_flags;
+
+ if ((stream_update->src.height != 0 && stream_update->src.width != 0) ||
+- (stream_update->dst.height != 0 && stream_update->dst.width != 0))
++ (stream_update->dst.height != 0 && stream_update->dst.width != 0) ||
++ stream_update->integer_scaling_update)
+ su_flags->bits.scaling = 1;
+
+ if (stream_update->out_transfer_func)
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+index 42c44c05759f..2acfaa9a24cd 100644
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+@@ -948,25 +948,14 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx)
+ data->inits.v_c_bot = dc_fixpt_add(data->inits.v_c, data->ratios.vert_c);
+
+ }
+-static bool are_rects_integer_multiples(struct rect src, struct rect dest)
+-{
+- if (dest.width >= src.width && dest.width % src.width == 0 &&
+- dest.height >= src.height && dest.height % src.height == 0)
+- return true;
+-
+- return false;
+-}
+
+ static void calculate_integer_scaling(struct pipe_ctx *pipe_ctx)
+ {
+- if (!pipe_ctx->plane_state->scaling_quality.integer_scaling)
+- return;
++ unsigned int integer_multiple = 1;
+
+- //for Centered Mode
+- if (pipe_ctx->stream->dst.width == pipe_ctx->stream->src.width &&
+- pipe_ctx->stream->dst.height == pipe_ctx->stream->src.height) {
++ if (pipe_ctx->plane_state->scaling_quality.integer_scaling) {
+ // calculate maximum # of replication of src onto addressable
+- unsigned int integer_multiple = min(
++ integer_multiple = min(
+ pipe_ctx->stream->timing.h_addressable / pipe_ctx->stream->src.width,
+ pipe_ctx->stream->timing.v_addressable / pipe_ctx->stream->src.height);
+
+@@ -977,10 +966,8 @@ static void calculate_integer_scaling(struct pipe_ctx *pipe_ctx)
+ //center dst onto addressable
+ pipe_ctx->stream->dst.x = (pipe_ctx->stream->timing.h_addressable - pipe_ctx->stream->dst.width)/2;
+ pipe_ctx->stream->dst.y = (pipe_ctx->stream->timing.v_addressable - pipe_ctx->stream->dst.height)/2;
+- }
+
+- //disable taps if src & dst are integer ratio
+- if (are_rects_integer_multiples(pipe_ctx->stream->src, pipe_ctx->stream->dst)) {
++ //We are guaranteed that we are scaling in integer ratio
+ pipe_ctx->plane_state->scaling_quality.v_taps = 1;
+ pipe_ctx->plane_state->scaling_quality.h_taps = 1;
+ pipe_ctx->plane_state->scaling_quality.v_taps_c = 1;
+diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h b/drivers/gpu/drm/amd/display/dc/dc_stream.h
+index f8c07d5a4054..70274fc43a72 100644
+--- a/drivers/gpu/drm/amd/display/dc/dc_stream.h
++++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h
+@@ -252,6 +252,7 @@ struct dc_stream_update {
+ struct dc_info_packet *vsp_infopacket;
+
+ bool *dpms_off;
++ bool integer_scaling_update;
+
+ struct colorspace_transform *gamut_remap;
+ enum dc_color_space *output_color_space;
+--
+2.17.1
+