drm/amd/display: fix hw rotated modes when PSR-SU is enabled
authorHamza Mahfooz <hamza.mahfooz@amd.com>
Tue, 5 Dec 2023 19:55:04 +0000 (14:55 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jan 2024 12:42:24 +0000 (12:42 +0000)
[ Upstream commit f528ee145bd0076cd0ed7e7b2d435893e6329e98 ]

We currently don't support dirty rectangles on hardware rotated modes.
So, if a user is using hardware rotated modes with PSR-SU enabled,
use PSR-SU FFU for all rotated planes (including cursor planes).

Cc: stable@vger.kernel.org
Fixes: 30ebe41582d1 ("drm/amd/display: add FB_DAMAGE_CLIPS support")
Reported-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2952
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: Bin Li <binli@gnome.org>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/dc/dc_hw_types.h
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c

index f5fdb61..d633601 100644 (file)
@@ -5170,6 +5170,9 @@ static void fill_dc_dirty_rects(struct drm_plane *plane,
        if (plane->type == DRM_PLANE_TYPE_CURSOR)
                return;
 
+       if (new_plane_state->rotation != DRM_MODE_ROTATE_0)
+               goto ffu;
+
        num_clips = drm_plane_get_damage_clips_count(new_plane_state);
        clips = drm_plane_get_damage_clips(new_plane_state);
 
index 100d621..99880b0 100644 (file)
@@ -465,6 +465,7 @@ struct dc_cursor_mi_param {
        struct fixed31_32 v_scale_ratio;
        enum dc_rotation_angle rotation;
        bool mirror;
+       struct dc_stream_state *stream;
 };
 
 /* IPP related types */
index 79befa1..13ccb57 100644 (file)
@@ -3407,7 +3407,8 @@ void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx)
                .h_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.horz,
                .v_scale_ratio = pipe_ctx->plane_res.scl_data.ratios.vert,
                .rotation = pipe_ctx->plane_state->rotation,
-               .mirror = pipe_ctx->plane_state->horizontal_mirror
+               .mirror = pipe_ctx->plane_state->horizontal_mirror,
+               .stream = pipe_ctx->stream,
        };
        bool pipe_split_on = false;
        bool odm_combine_on = (pipe_ctx->next_odm_pipe != NULL) ||
index 4566bc7..aa252dc 100644 (file)
@@ -1075,8 +1075,16 @@ void hubp2_cursor_set_position(
        if (src_y_offset < 0)
                src_y_offset = 0;
        /* Save necessary cursor info x, y position. w, h is saved in attribute func. */
-       hubp->cur_rect.x = src_x_offset + param->viewport.x;
-       hubp->cur_rect.y = src_y_offset + param->viewport.y;
+       if (param->stream->link->psr_settings.psr_version >= DC_PSR_VERSION_SU_1 &&
+           param->rotation != ROTATION_ANGLE_0) {
+               hubp->cur_rect.x = 0;
+               hubp->cur_rect.y = 0;
+               hubp->cur_rect.w = param->stream->timing.h_addressable;
+               hubp->cur_rect.h = param->stream->timing.v_addressable;
+       } else {
+               hubp->cur_rect.x = src_x_offset + param->viewport.x;
+               hubp->cur_rect.y = src_y_offset + param->viewport.y;
+       }
 }
 
 void hubp2_clk_cntl(struct hubp *hubp, bool enable)