Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Wesley Chalmers and committed by
Alex Deucher
ce560ac4 474f0101

+22 -3
+3
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
··· 2117 2117 dc_dmub_srv_p_state_delegate(dc, 2118 2118 true, context); 2119 2119 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; 2120 2123 } 2121 2124 2122 2125 dc->clk_mgr->funcs->update_clocks(
+19 -3
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c
··· 983 983 } 984 984 985 985 void dcn30_prepare_bandwidth(struct dc *dc, 986 - struct dc_state *context) 986 + struct dc_state *context) 987 987 { 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) { 989 993 dc->optimized_required = true; 990 994 context->bw_ctx.bw.dcn.clk.p_state_change_support = false; 991 995 } ··· 1000 996 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); 1001 997 1002 998 dcn20_prepare_bandwidth(dc, context); 999 + /* 1000 + * enabled -> enabled: do not disable 1001 + * enabled -> disabled: disable 1002 + * disabled -> enabled: don't care 1003 + * disabled -> disabled: don't care 1004 + */ 1005 + if (!context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) 1006 + dc_dmub_srv_p_state_delegate(dc, false, context); 1003 1007 1004 - dc_dmub_srv_p_state_delegate(dc, false, context); 1008 + if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching || dc->clk_mgr->clks.fw_based_mclk_switching) { 1009 + /* After disabling P-State, restore the original value to ensure we get the correct P-State 1010 + * on the next optimize. */ 1011 + context->bw_ctx.bw.dcn.clk.p_state_change_support = p_state_change_support; 1012 + } 1005 1013 } 1006 1014