]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: Only program P-State force if pipe config changed
authorAlvin Lee <alvin.lee2@amd.com>
Wed, 17 Apr 2024 22:44:16 +0000 (18:44 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 30 Apr 2024 13:56:21 +0000 (09:56 -0400)
[Description]
Today for MED update type we do not call update clocks. However, for FPO
the assumption is that update clocks should be called to disable P-State
switch before any HW programming since FPO in FW and driver are not
synchronized. This causes an issue where on a MED update, an FPO P-State
switch could be taking place, then driver forces P-State disallow in the below
code and prevents FPO from completing the sequence. In this case we add a check
to avoid re-programming (and thus re-setting) the P-State force register by
only reprogramming if the pipe was not previously Subvp or FPO. The assumption
is that the P-State force register should be programmed correctly the first
time SubVP / FPO was enabled, so there's no need to update / reset it if the
pipe config has never exited SubVP / FPO.

Reviewed-by: Samson Tam <samson.tam@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Alvin Lee <alvin.lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c

index b8e884368dc6e5580bfb740d8872d9a7e578b907..4d75ce5561e4caa1761f1a2b94712e09f9a7213e 100644 (file)
@@ -614,10 +614,26 @@ void dcn32_update_force_pstate(struct dc *dc, struct dc_state *context)
         */
        for (i = 0; i < dc->res_pool->pipe_count; i++) {
                struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
+               struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];
                struct hubp *hubp = pipe->plane_res.hubp;
 
+               /* Today for MED update type we do not call update clocks. However, for FPO
+                * the assumption is that update clocks should be called to disable P-State
+                * switch before any HW programming since FPO in FW and driver are not
+                * synchronized. This causes an issue where on a MED update, an FPO P-State
+                * switch could be taking place, then driver forces P-State disallow in the below
+                * code and prevents FPO from completing the sequence. In this case we add a check
+                * to avoid re-programming (and thus re-setting) the P-State force register by
+                * only reprogramming if the pipe was not previously Subvp or FPO. The assumption
+                * is that the P-State force register should be programmed correctly the first
+                * time SubVP / FPO was enabled, so there's no need to update / reset it if the
+                * pipe config has never exited SubVP / FPO.
+                */
                if (pipe->stream && (dc_state_get_pipe_subvp_type(context, pipe) == SUBVP_MAIN ||
-                               pipe->stream->fpo_in_use)) {
+                               pipe->stream->fpo_in_use) &&
+                               (!old_pipe->stream ||
+                               (dc_state_get_pipe_subvp_type(context, old_pipe) != SUBVP_MAIN &&
+                               !old_pipe->stream->fpo_in_use))) {
                        if (hubp && hubp->funcs->hubp_update_force_pstate_disallow)
                                hubp->funcs->hubp_update_force_pstate_disallow(hubp, true);
                        if (hubp && hubp->funcs->hubp_update_force_cursor_pstate_disallow)