]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: Fix DPMS using partially updated pipe context
authorDominik Kaszewski <dominik.kaszewski@amd.com>
Thu, 2 Apr 2026 12:46:05 +0000 (14:46 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 17 Apr 2026 19:41:16 +0000 (15:41 -0400)
[Why & How]
DPMS functions should not use partially updated pipe context passed
as argument of commit_planes_do_stream_update, and instead use the
one in current_state, which is guaranteed to be the most recently
programmed HW config.

Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Dominik Kaszewski <dominik.kaszewski@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c

index 56c56dc5fcdb23f3a4d2c3fc671379f0d861ae42..c3f9ba454642174a5c1ae7a0a66037acb1701976 100644 (file)
@@ -3897,27 +3897,34 @@ static void commit_planes_do_stream_update(struct dc *dc,
                                resource_build_test_pattern_params(&context->res_ctx, pipe_ctx);
                        }
 
+                       // DPMS should not use partially updated pipe context
+                       struct pipe_ctx *dpms_pipe_ctx = &dc->current_state->res_ctx.pipe_ctx[j];
+
                        if (stream_update->dpms_off) {
                                if (*stream_update->dpms_off) {
-                                       dc->link_srv->set_dpms_off(pipe_ctx);
+                                       dc->link_srv->set_dpms_off(dpms_pipe_ctx);
                                        /* for dpms, keep acquired resources*/
-                                       if (pipe_ctx->stream_res.audio && !dc->debug.az_endpoint_mute_only)
-                                               pipe_ctx->stream_res.audio->funcs->az_disable(pipe_ctx->stream_res.audio);
+                                       if (dpms_pipe_ctx->stream_res.audio && !dc->debug.az_endpoint_mute_only) {
+                                               struct audio *audio = dpms_pipe_ctx->stream_res.audio;
+
+                                               audio->funcs->az_disable(audio);
+                                       }
 
                                        dc->optimized_required = true;
 
                                } else {
                                        if (get_seamless_boot_stream_count(context) == 0)
                                                dc->hwss.prepare_bandwidth(dc, dc->current_state);
-                                       dc->link_srv->set_dpms_on(dc->current_state, pipe_ctx);
+                                       dc->link_srv->set_dpms_on(dc->current_state, dpms_pipe_ctx);
                                }
-                       } else if (pipe_ctx->stream->link->wa_flags.blank_stream_on_ocs_change && stream_update->output_color_space
-                                       && !stream->dpms_off && dc_is_dp_signal(pipe_ctx->stream->signal)) {
+                       } else if (dpms_pipe_ctx->stream->link->wa_flags.blank_stream_on_ocs_change &&
+                                       stream_update->output_color_space &&
+                                       !stream->dpms_off && dc_is_dp_signal(dpms_pipe_ctx->stream->signal)) {
                                /*
                                 * Workaround for firmware issue in some receivers where they don't pick up
                                 * correct output color space unless DP link is disabled/re-enabled
                                 */
-                               dc->link_srv->set_dpms_on(dc->current_state, pipe_ctx);
+                               dc->link_srv->set_dpms_on(dc->current_state, dpms_pipe_ctx);
                        }
 
                        if (stream_update->abm_level && pipe_ctx->stream_res.abm) {