Skip to content

Commit 056fb8c

Browse files
George Shenalexdeucher
authored andcommitted
drm/amd/display: Update dummy P-state search to use DCN32 DML
[Why] Current DCN3.2 logic for finding the dummy P-state index uses the DCN3.0 DML validation function instead of DCN3.2 DML. This can result in either unexpected DML VBA values, or unexpected dummy P-state index to be used. [How] Update the dummy P-state logic to use DCN3.2 DML validation function. Reviewed-by: Alvin Lee <[email protected]> Reviewed-by: Nevenko Stupar <[email protected]> Acked-by: Wayne Lin <[email protected]> Signed-off-by: George Shen <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 65fbfb0 commit 056fb8c

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,50 @@ void dcn32_build_wm_range_table_fpu(struct clk_mgr_internal *clk_mgr)
243243
clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].pmfw_breakdown.max_uclk = 0xFFFF;
244244
}
245245

246+
/**
247+
* Finds dummy_latency_index when MCLK switching using firmware based
248+
* vblank stretch is enabled. This function will iterate through the
249+
* table of dummy pstate latencies until the lowest value that allows
250+
* dm_allow_self_refresh_and_mclk_switch to happen is found
251+
*/
252+
int dcn32_find_dummy_latency_index_for_fw_based_mclk_switch(struct dc *dc,
253+
struct dc_state *context,
254+
display_e2e_pipe_params_st *pipes,
255+
int pipe_cnt,
256+
int vlevel)
257+
{
258+
const int max_latency_table_entries = 4;
259+
const struct vba_vars_st *vba = &context->bw_ctx.dml.vba;
260+
int dummy_latency_index = 0;
261+
262+
dc_assert_fp_enabled();
263+
264+
while (dummy_latency_index < max_latency_table_entries) {
265+
context->bw_ctx.dml.soc.dram_clock_change_latency_us =
266+
dc->clk_mgr->bw_params->dummy_pstate_table[dummy_latency_index].dummy_pstate_latency_us;
267+
dcn32_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, false);
268+
269+
if (vlevel < context->bw_ctx.dml.vba.soc.num_states &&
270+
vba->DRAMClockChangeSupport[vlevel][vba->maxMpcComb] != dm_dram_clock_change_unsupported)
271+
break;
272+
273+
dummy_latency_index++;
274+
}
275+
276+
if (dummy_latency_index == max_latency_table_entries) {
277+
ASSERT(dummy_latency_index != max_latency_table_entries);
278+
/* If the execution gets here, it means dummy p_states are
279+
* not possible. This should never happen and would mean
280+
* something is severely wrong.
281+
* Here we reset dummy_latency_index to 3, because it is
282+
* better to have underflows than system crashes.
283+
*/
284+
dummy_latency_index = max_latency_table_entries - 1;
285+
}
286+
287+
return dummy_latency_index;
288+
}
289+
246290
/**
247291
* dcn32_helper_populate_phantom_dlg_params - Get DLG params for phantom pipes
248292
* and populate pipe_ctx with those params.
@@ -1646,7 +1690,7 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context,
16461690
dcn30_can_support_mclk_switch_using_fw_based_vblank_stretch(dc, context);
16471691

16481692
if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) {
1649-
dummy_latency_index = dcn30_find_dummy_latency_index_for_fw_based_mclk_switch(dc,
1693+
dummy_latency_index = dcn32_find_dummy_latency_index_for_fw_based_mclk_switch(dc,
16501694
context, pipes, pipe_cnt, vlevel);
16511695

16521696
/* After calling dcn30_find_dummy_latency_index_for_fw_based_mclk_switch

drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,10 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context,
7171

7272
void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_params);
7373

74+
int dcn32_find_dummy_latency_index_for_fw_based_mclk_switch(struct dc *dc,
75+
struct dc_state *context,
76+
display_e2e_pipe_params_st *pipes,
77+
int pipe_cnt,
78+
int vlevel);
79+
7480
#endif

0 commit comments

Comments
 (0)