Skip to content

Commit a905b0b

Browse files
AMD-aricgregkh
authored andcommitted
drm/amd/display: Do not update DRR while BW optimizations pending
commit 3295348 upstream. [why] While bandwidth optimizations are pending, it's possible a pstate change will occur. During this time, VSYNC handler should not also try to update DRR parameters causing pstate hang [how] Do not adjust DRR if optimize bandwidth is set. Reviewed-by: Aric Cyr <[email protected]> Acked-by: Qingqing Zhuo <[email protected]> Signed-off-by: Aric Cyr <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: Mario Limonciello <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent dd6d6f9 commit a905b0b

File tree

1 file changed

+29
-19
lines changed
  • drivers/gpu/drm/amd/display/dc/core

1 file changed

+29
-19
lines changed

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,13 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,
401401
{
402402
int i;
403403

404+
/*
405+
* Don't adjust DRR while there's bandwidth optimizations pending to
406+
* avoid conflicting with firmware updates.
407+
*/
408+
if (dc->optimized_required || dc->wm_optimized_required)
409+
return false;
410+
404411
stream->adjust.v_total_max = adjust->v_total_max;
405412
stream->adjust.v_total_mid = adjust->v_total_mid;
406413
stream->adjust.v_total_mid_frame_num = adjust->v_total_mid_frame_num;
@@ -2021,27 +2028,33 @@ void dc_post_update_surfaces_to_stream(struct dc *dc)
20212028

20222029
post_surface_trace(dc);
20232030

2024-
if (dc->ctx->dce_version >= DCE_VERSION_MAX)
2025-
TRACE_DCN_CLOCK_STATE(&context->bw_ctx.bw.dcn.clk);
2026-
else
2031+
/*
2032+
* Only relevant for DCN behavior where we can guarantee the optimization
2033+
* is safe to apply - retain the legacy behavior for DCE.
2034+
*/
2035+
2036+
if (dc->ctx->dce_version < DCE_VERSION_MAX)
20272037
TRACE_DCE_CLOCK_STATE(&context->bw_ctx.bw.dce);
2038+
else {
2039+
TRACE_DCN_CLOCK_STATE(&context->bw_ctx.bw.dcn.clk);
20282040

2029-
if (is_flip_pending_in_pipes(dc, context))
2030-
return;
2041+
if (is_flip_pending_in_pipes(dc, context))
2042+
return;
20312043

2032-
for (i = 0; i < dc->res_pool->pipe_count; i++)
2033-
if (context->res_ctx.pipe_ctx[i].stream == NULL ||
2034-
context->res_ctx.pipe_ctx[i].plane_state == NULL) {
2035-
context->res_ctx.pipe_ctx[i].pipe_idx = i;
2036-
dc->hwss.disable_plane(dc, &context->res_ctx.pipe_ctx[i]);
2037-
}
2044+
for (i = 0; i < dc->res_pool->pipe_count; i++)
2045+
if (context->res_ctx.pipe_ctx[i].stream == NULL ||
2046+
context->res_ctx.pipe_ctx[i].plane_state == NULL) {
2047+
context->res_ctx.pipe_ctx[i].pipe_idx = i;
2048+
dc->hwss.disable_plane(dc, &context->res_ctx.pipe_ctx[i]);
2049+
}
20382050

2039-
process_deferred_updates(dc);
2051+
process_deferred_updates(dc);
20402052

2041-
dc->hwss.optimize_bandwidth(dc, context);
2053+
dc->hwss.optimize_bandwidth(dc, context);
20422054

2043-
if (dc->debug.enable_double_buffered_dsc_pg_support)
2044-
dc->hwss.update_dsc_pg(dc, context, true);
2055+
if (dc->debug.enable_double_buffered_dsc_pg_support)
2056+
dc->hwss.update_dsc_pg(dc, context, true);
2057+
}
20452058

20462059
dc->optimized_required = false;
20472060
dc->wm_optimized_required = false;
@@ -3866,12 +3879,9 @@ void dc_commit_updates_for_stream(struct dc *dc,
38663879
if (new_pipe->plane_state && new_pipe->plane_state != old_pipe->plane_state)
38673880
new_pipe->plane_state->force_full_update = true;
38683881
}
3869-
} else if (update_type == UPDATE_TYPE_FAST && dc_ctx->dce_version >= DCE_VERSION_MAX) {
3882+
} else if (update_type == UPDATE_TYPE_FAST) {
38703883
/*
38713884
* Previous frame finished and HW is ready for optimization.
3872-
*
3873-
* Only relevant for DCN behavior where we can guarantee the optimization
3874-
* is safe to apply - retain the legacy behavior for DCE.
38753885
*/
38763886
dc_post_update_surfaces_to_stream(dc);
38773887
}

0 commit comments

Comments
 (0)