From: Wenjing Liu <[email protected]> [Why] Bandwidth overrides must respect each current-state requirement while allowing descending requests to release previous peak votes.
[How] Recompute nominal and urgent requests from their corresponding current-state floors and the capped input on every call. Restore the state values when the request is zero. Cc: Alvin Lee <[email protected]> Signed-off-by: Wenjing Liu <[email protected]> Signed-off-by: Chenyu Chen <[email protected]> --- .../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c index f801f3337e5d..9556da79cdce 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c @@ -1614,23 +1614,27 @@ static unsigned int dcn60_override_memory_bandwidth_request( struct dc_clocks new_clocks; unsigned int max_bw_kbps; unsigned int capped_bw_kbps; + unsigned int original_nominal_bw_kbps = dc->current_state->bw_ctx.bw.dcn.clk.utm_nominal_bandwidth_lb_KBps; + unsigned int original_urgent_bw_kbps = dc->current_state->bw_ctx.bw.dcn.clk.utm_urgent_bandwidth_lb_KBps; int num_steps; memcpy(&new_clocks, &clk_mgr_base->clks, sizeof(struct dc_clocks)); if (bw_kbps == 0) { - /* Clearing the override restores the request of the committed mode. */ - new_clocks.utm_nominal_bandwidth_lb_KBps = - dc->current_state->bw_ctx.bw.dcn.clk.utm_nominal_bandwidth_lb_KBps; - new_clocks.utm_urgent_bandwidth_lb_KBps = - dc->current_state->bw_ctx.bw.dcn.clk.utm_urgent_bandwidth_lb_KBps; + new_clocks.utm_nominal_bandwidth_lb_KBps = original_nominal_bw_kbps; + new_clocks.utm_urgent_bandwidth_lb_KBps = original_urgent_bw_kbps; } else { max_bw_kbps = dcn60_get_max_active_utm_bandwidth_kbps(clk_mgr_base); capped_bw_kbps = (bw_kbps > max_bw_kbps) ? max_bw_kbps : bw_kbps; - new_clocks.utm_nominal_bandwidth_lb_KBps = capped_bw_kbps; - if (new_clocks.utm_urgent_bandwidth_lb_KBps < capped_bw_kbps) + if (capped_bw_kbps > original_nominal_bw_kbps) + new_clocks.utm_nominal_bandwidth_lb_KBps = capped_bw_kbps; + else + new_clocks.utm_nominal_bandwidth_lb_KBps = original_nominal_bw_kbps; + if (capped_bw_kbps > original_urgent_bw_kbps) new_clocks.utm_urgent_bandwidth_lb_KBps = capped_bw_kbps; + else + new_clocks.utm_urgent_bandwidth_lb_KBps = original_urgent_bw_kbps; } num_steps = dcn60_build_update_bandwidth_clocks_sequence(clk_mgr_base, -- 2.43.0
