drm/amd/display: Do not set drr on pipe commit
Subsystems (3)
PATCH 1/2 drm/amd/display: Do not set drr on pipe commit
From: Wesley Chalmers <[email protected]>
[WHY]
Writing to DRR registers such as OTG_V_TOTAL_MIN on the same frame as a pipe commit can cause underflow.
[HOW]
Move DMUB p-state delegate into optimze_bandwidth; enabling FAMS sets optimized_required.
This change expects that Freesync requests are blocked when optimized_required is true.
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 6 ++++++ drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 7 +++++++ 2 files changed, 13 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +6 -0
@@ -2123,6 +2123,12 @@ void dcn20_optimize_bandwidth(if (hubbub->funcs->program_compbuf_size) hubbub->funcs->program_compbuf_size (hubbub, context->bw_ctx.bw.dcn.compbuf_size_kb, true); +if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) { +dc_dmub_srv_p_state_delegate (dc, + true, context); + context->bw_ctx.bw.dcn.clk.p_state_change_support = true; + } + dc->clk_mgr->funcs->update_clocks( dc->clk_mgr, context,
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +7 -0
@@ -951,11 +951,18 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc,void dcn30_prepare_bandwidth (struct dc *dc,struct dc_state *context) { +if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) { + dc->optimized_required = true; + context->bw_ctx.bw.dcn.clk.p_state_change_support = false; + } +if (dc->clk_mgr->dc_mode_softmax_enabled)if (dc->clk_mgr->clks.dramclk_khz <= dc->clk_mgr->bw_params->dc_mode_softmax_memclk *1000 && context->bw_ctx.bw.dcn.clk.dramclk_khz > dc->clk_mgr->bw_params->dc_mode_softmax_memclk *1000 ) 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);dcn20_prepare_bandwidth (dc, context); + +dc_dmub_srv_p_state_delegate (dc, false, context); }
Signature · 1 line
2.41.0
PATCH 2/2 drm/amd/display: Block optimize on consecutive FAMS enables
From: Wesley Chalmers <[email protected]>
[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.
--- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 3 +++ .../drm/amd/display/dc/dcn30/dcn30_hwseq.c | 20 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +3 -0
@@ -2127,6 +2127,9 @@ void dcn20_optimize_bandwidth(dc_dmub_srv_p_state_delegate (dc, true, context); context->bw_ctx.bw.dcn.clk.p_state_change_support = true; + dc->clk_mgr->clks.fw_based_mclk_switching = true; + }else { + dc->clk_mgr->clks.fw_based_mclk_switching = false; } dc->clk_mgr->funcs->update_clocks(
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +18 -2
@@ -951,7 +951,11 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc,void dcn30_prepare_bandwidth (struct dc *dc,struct dc_state *context) { -if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) { +bool p_state_change_support = context->bw_ctx.bw.dcn.clk.p_state_change_support; +/* Any transition into an FPO config should disable MCLK switching first to avoid +* driver and FW P-State synchronization issues. +*/ +if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching || dc->clk_mgr->clks.fw_based_mclk_switching) { dc->optimized_required = true; context->bw_ctx.bw.dcn.clk.p_state_change_support = false; }
@@ -962,7 +966,19 @@ void dcn30_prepare_bandwidth(struct dc *dc, 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);dcn20_prepare_bandwidth (dc, context); +/* +* enabled -> enabled: do not disable +* enabled -> disabled: disable +* disabled -> enabled: don't care +* disabled -> disabled: don't care +*/ +if (!context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) +dc_dmub_srv_p_state_delegate (dc, false, context); -dc_dmub_srv_p_state_delegate (dc, false, context); +if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching || dc->clk_mgr->clks.fw_based_mclk_switching) { +/* After disabling P-State, restore the original value to ensure we get the correct P-State +* on the next optimize. */ + context->bw_ctx.bw.dcn.clk.p_state_change_support = p_state_change_support; + } }
Signature · 1 line
2.41.0
Quoted 10 lines · Aurabindo Pillai
From: Wesley Chalmers <[email protected]>
[WHY]
Writing to DRR registers such asOTG_V_TOTAL_MINon the same frame as a pipe commit can cause underflow.[HOW]
Move DMUB p-state delegate intooptimze_bandwidth; enabling FAMS setsoptimized_required.
Quoted 8 lines
This change expects that Freesync requests are blocked when
optimized_requiredis true.Fixes de1da2f7fe25 ("drm/amd/display: Add monitor specific edid quirk")Reviewed-by Rodrigo Siqueira <[email protected]>Signed-off-by Wesley Chalmers <[email protected]>Tested-by Daniel Wheeler <[email protected]>Signed-off-by Alex Deucher <[email protected]>
This series is:
Quoted 45 lines
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 6 ++++++ drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 7 +++++++ 2 files changed, 13 insertions(+)drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +6
-0@@ -2123,6 +2123,12 @@ void dcn20_optimize_bandwidth(if (hubbub->funcs->program_compbuf_size) hubbub->funcs->program_compbuf_size (hubbub, context->bw_ctx.bw.dcn.compbuf_size_kb, true); +if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) { +dc_dmub_srv_p_state_delegate (dc, + true, context); + context->bw_ctx.bw.dcn.clk.p_state_change_support = true; + } + dc->clk_mgr->funcs->update_clocks( dc->clk_mgr, context,drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +7
-0@@ -951,11 +951,18 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc,void dcn30_prepare_bandwidth (struct dc *dc,struct dc_state *context) { +if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) { + dc->optimized_required = true; + context->bw_ctx.bw.dcn.clk.p_state_change_support = false; + } +if (dc->clk_mgr->dc_mode_softmax_enabled)if (dc->clk_mgr->clks.dramclk_khz <= dc->clk_mgr->bw_params->dc_mode_softmax_memclk *1000 && context->bw_ctx.bw.dcn.clk.dramclk_khz > dc->clk_mgr->bw_params->dc_mode_softmax_memclk *1000 ) 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);dcn20_prepare_bandwidth (dc, context); + +dc_dmub_srv_p_state_delegate (dc, false, context); }
Signature · 1 line
Hamza
Quoted 6 lines · Aurabindo Pillai
From: Wesley Chalmers <[email protected]>
[WHY]
Writing to DRR registers such asOTG_V_TOTAL_MINon the same frame as a pipe commit can cause underflow.
Quoted 8 lines
[HOW]
Move DMUB p-state delegate intooptimze_bandwidth; enabling FAMS setsoptimized_required.This change expects that Freesync requests are blocked when
optimized_requiredis true.Fixes de1da2f7fe25 ("drm/amd/display: Add monitor specific edid quirk")
Seems like inappropriate use of Fixes:, or how does this commit "fix" the referenced commit?
(Also a bit surprised to learn about that one only now, and that it landed without my confirming it actually works)
Signature · 2 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer
[Public]
Hi Michel,
You confirmed in another thread the monitor specific quirk for disabling FAMS fixed your hang. Fixes references the commit which adds such quirk:
de1da2f7fe25 drm/amd/display: Add monitor specific edid quirk
The intention is that these two patches should only be merged into stable trees after applying the monitor specific quirk.
--
Regards,
Jay
________________________________
From: Michel Dänzer <[email protected]>
Sent: Thursday, July 6, 2023 6:05 AM
To: Pillai, Aurabindo <[email protected]>; [email protected] <[email protected]>
Cc: Chalmers, Wesley <[email protected]>; Siqueira, Rodrigo <[email protected]>; Wheeler, Daniel <[email protected]>; Mahfooz, Hamza <[email protected]>; Deucher, Alexander <[email protected]>; Wentland, Harry <[email protected]>
Subject: Re: [PATCH 1/2] drm/amd/display: Do not set drr on pipe commit
Quoted 6 lines · Aurabindo Pillai
From: Wesley Chalmers <[email protected]>
[WHY]
Writing to DRR registers such asOTG_V_TOTAL_MINon the same frame as a pipe commit can cause underflow.
Quoted 8 lines
[HOW]
Move DMUB p-state delegate intooptimze_bandwidth; enabling FAMS setsoptimized_required.This change expects that Freesync requests are blocked when
optimized_requiredis true.Fixes de1da2f7fe25 ("drm/amd/display: Add monitor specific edid quirk")
Seems like inappropriate use of Fixes:, or how does this commit "fix" the referenced commit?
(Also a bit surprised to learn about that one only now, and that it landed without my confirming it actually works)
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and Xwayland developer
Quoted 4 lines · Aurabindo
Hi Michel,
You confirmed in another thread the monitor specific quirk for disabling FAMS fixed your hang.
That's not quite accurate. I confirmed that hard-coding FAMS to be disabled works around the hangs I reported, and you asked me to test an EDID quirk patch, which I reported not to have any effect for my monitor. Then I didn't hear back anything until this patch series today, so I haven't tested the de1da2f7fe25 commit. (I expect it to work, but I can't confirm it yet)
Signature · 2 lines
Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer
[Public]
From the log you provided, I extracted the panel id so I expect FAMS to get disabled on your monitor. If it doesn't work, let me know.
--
Regards,
Jay
________________________________
From: Michel Dänzer <[email protected]>
Sent: Thursday, July 6, 2023 10:11 AM
To: Pillai, Aurabindo <[email protected]>; [email protected] <[email protected]>
Cc: Chalmers, Wesley <[email protected]>; Siqueira, Rodrigo <[email protected]>; Wheeler, Daniel <[email protected]>; Mahfooz, Hamza <[email protected]>; Deucher, Alexander <[email protected]>; Wentland, Harry <[email protected]>
Subject: Re: [PATCH 1/2] drm/amd/display: Do not set drr on pipe commit
Quoted 4 lines · Aurabindo
Hi Michel,
You confirmed in another thread the monitor specific quirk for disabling FAMS fixed your hang.
That's not quite accurate. I confirmed that hard-coding FAMS to be disabled works around the hangs I reported, and you asked me to test an EDID quirk patch, which I reported not to have any effect for my monitor. Then I didn't hear back anything until this patch series today, so I haven't tested the de1da2f7fe25 commit. (I expect it to work, but I can't confirm it yet)
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and Xwayland developer