Skip to content

Commit ce560ac

Browse files
Wesley Chalmersalexdeucher
authored andcommitted
drm/amd/display: Block optimize on consecutive FAMS enables
[WHY] It is possible to commit state multiple times in rapid succession with FAMS enabled; if each of these commits were to set optimized_required, then the user may see latency. [HOW] fw_based_mclk_switching is currently not used in dc->clk_mgr; use it to track whether the current state has FAMS enabled; if it has, then do not disable FAMS in prepare_bandwidth, and do not set optimized_required. Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> Signed-off-by: Wesley Chalmers <Wesley.Chalmers@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 474f010 commit ce560ac

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,9 @@ void dcn20_optimize_bandwidth(
21172117
dc_dmub_srv_p_state_delegate(dc,
21182118
true, context);
21192119
context->bw_ctx.bw.dcn.clk.p_state_change_support = true;
2120+
dc->clk_mgr->clks.fw_based_mclk_switching = true;
2121+
} else {
2122+
dc->clk_mgr->clks.fw_based_mclk_switching = false;
21202123
}
21212124

21222125
dc->clk_mgr->funcs->update_clocks(

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -983,9 +983,13 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc,
983983
}
984984

985985
void dcn30_prepare_bandwidth(struct dc *dc,
986-
struct dc_state *context)
986+
struct dc_state *context)
987987
{
988-
if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) {
988+
bool p_state_change_support = context->bw_ctx.bw.dcn.clk.p_state_change_support;
989+
/* Any transition into an FPO config should disable MCLK switching first to avoid
990+
* driver and FW P-State synchronization issues.
991+
*/
992+
if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching || dc->clk_mgr->clks.fw_based_mclk_switching) {
989993
dc->optimized_required = true;
990994
context->bw_ctx.bw.dcn.clk.p_state_change_support = false;
991995
}
@@ -996,7 +1000,19 @@ void dcn30_prepare_bandwidth(struct dc *dc,
9961000
dc->clk_mgr->funcs->set_max_memclk(dc->clk_mgr, dc->clk_mgr->bw_params->clk_table.entries[dc->clk_mgr->bw_params->clk_table.num_entries - 1].memclk_mhz);
9971001

9981002
dcn20_prepare_bandwidth(dc, context);
1003+
/*
1004+
* enabled -> enabled: do not disable
1005+
* enabled -> disabled: disable
1006+
* disabled -> enabled: don't care
1007+
* disabled -> disabled: don't care
1008+
*/
1009+
if (!context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching)
1010+
dc_dmub_srv_p_state_delegate(dc, false, context);
9991011

1000-
dc_dmub_srv_p_state_delegate(dc, false, context);
1012+
if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching || dc->clk_mgr->clks.fw_based_mclk_switching) {
1013+
/* After disabling P-State, restore the original value to ensure we get the correct P-State
1014+
* on the next optimize. */
1015+
context->bw_ctx.bw.dcn.clk.p_state_change_support = p_state_change_support;
1016+
}
10011017
}
10021018

0 commit comments

Comments
 (0)