From: Dmytro Laktyushkin <dmytro.laktyush...@amd.com>

Dml merges mpc/odm combine pipes to do calculations. This merge is
imperfect if there is a viewport overlap. This change saves pre overlap
viewport for dml use.

Signed-off-by: Dmytro Laktyushkin <dmytro.laktyush...@amd.com>
Reviewed-by: Tony Cheng <tony.ch...@amd.com>
Reviewed-by: Wesley Chalmers <wesley.chalm...@amd.com>
Acked-by: Rodrigo Siqueira <rodrigo.sique...@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c    |  3 +++
 .../gpu/drm/amd/display/dc/dcn20/dcn20_resource.c    | 12 ++++++------
 drivers/gpu/drm/amd/display/dc/inc/hw/transform.h    |  2 ++
 3 files changed, 11 insertions(+), 6 deletions(-)

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 7b32a34908c8..12f5c6881cd0 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -692,6 +692,9 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)
        /* Round up, assume original video size always even dimensions */
        data->viewport_c.width = (data->viewport.width + vpc_div - 1) / vpc_div;
        data->viewport_c.height = (data->viewport.height + vpc_div - 1) / 
vpc_div;
+
+       data->viewport_unadjusted = data->viewport;
+       data->viewport_c_unadjusted = data->viewport_c;
 }
 
 static void calculate_recout(struct pipe_ctx *pipe_ctx)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c 
b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
index 44f056fae3ea..ede0723e667d 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
@@ -2219,12 +2219,12 @@ int dcn20_populate_dml_pipes_from_context(
                                        || 
pipes[pipe_cnt].pipe.dest.odm_combine != dm_odm_combine_mode_disabled;
                        pipes[pipe_cnt].pipe.src.source_scan = pln->rotation == 
ROTATION_ANGLE_90
                                        || pln->rotation == ROTATION_ANGLE_270 
? dm_vert : dm_horz;
-                       pipes[pipe_cnt].pipe.src.viewport_y_y = scl->viewport.y;
-                       pipes[pipe_cnt].pipe.src.viewport_y_c = 
scl->viewport_c.y;
-                       pipes[pipe_cnt].pipe.src.viewport_width = 
scl->viewport.width;
-                       pipes[pipe_cnt].pipe.src.viewport_width_c = 
scl->viewport_c.width;
-                       pipes[pipe_cnt].pipe.src.viewport_height = 
scl->viewport.height;
-                       pipes[pipe_cnt].pipe.src.viewport_height_c = 
scl->viewport_c.height;
+                       pipes[pipe_cnt].pipe.src.viewport_y_y = 
scl->viewport_unadjusted.y;
+                       pipes[pipe_cnt].pipe.src.viewport_y_c = 
scl->viewport_c_unadjusted.y;
+                       pipes[pipe_cnt].pipe.src.viewport_width = 
scl->viewport_unadjusted.width;
+                       pipes[pipe_cnt].pipe.src.viewport_width_c = 
scl->viewport_c_unadjusted.width;
+                       pipes[pipe_cnt].pipe.src.viewport_height = 
scl->viewport_unadjusted.height;
+                       pipes[pipe_cnt].pipe.src.viewport_height_c = 
scl->viewport_c_unadjusted.height;
                        pipes[pipe_cnt].pipe.src.surface_width_y = 
pln->plane_size.surface_size.width;
                        pipes[pipe_cnt].pipe.src.surface_height_y = 
pln->plane_size.surface_size.height;
                        pipes[pipe_cnt].pipe.src.surface_width_c = 
pln->plane_size.chroma_size.width;
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h 
b/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h
index fecc80c47c26..2947d1b15512 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h
@@ -173,6 +173,8 @@ struct scaler_data {
        struct scaling_taps taps;
        struct rect viewport;
        struct rect viewport_c;
+       struct rect viewport_unadjusted;
+       struct rect viewport_c_unadjusted;
        struct rect recout;
        struct scaling_ratios ratios;
        struct scl_inits inits;
-- 
2.26.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to