Skip to content

Commit 37717b8

Browse files
Zhan Liualexdeucher
authored andcommitted
drm/amd/display: Use DCN30 watermark calc for DCN301
[why] dcn301_calculate_wm_and_dl() causes flickering when external monitor is connected. This issue has been fixed before by commit 0e4c0ae ("drm/amdgpu/display: drop dcn301_calculate_wm_and_dl for now"), however part of the fix was gone after commit 2cbcb78 ("Merge tag 'amd-drm-next-5.13-2021-03-23' of https://gitlab.freedesktop.org/agd5f/linux into drm-next"). [how] Use dcn30_calculate_wm_and_dlg() instead as in the original fix. Fixes: 2cbcb78 ("Merge tag 'amd-drm-next-5.13-2021-03-23' of https://gitlab.freedesktop.org/agd5f/linux into drm-next") Signed-off-by: Nikola Cornij <[email protected]> Reviewed-by: Zhan Liu <[email protected]> Tested-by: Zhan Liu <[email protected]> Tested-by: Oliver Logush <[email protected]> Signed-off-by: Zhan Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 71ae580 commit 37717b8

File tree

1 file changed

+1
-95
lines changed

1 file changed

+1
-95
lines changed

drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c

Lines changed: 1 addition & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,106 +1622,12 @@ static void dcn301_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *b
16221622
dml_init_instance(&dc->dml, &dcn3_01_soc, &dcn3_01_ip, DML_PROJECT_DCN30);
16231623
}
16241624

1625-
static void calculate_wm_set_for_vlevel(
1626-
int vlevel,
1627-
struct wm_range_table_entry *table_entry,
1628-
struct dcn_watermarks *wm_set,
1629-
struct display_mode_lib *dml,
1630-
display_e2e_pipe_params_st *pipes,
1631-
int pipe_cnt)
1632-
{
1633-
double dram_clock_change_latency_cached = dml->soc.dram_clock_change_latency_us;
1634-
1635-
ASSERT(vlevel < dml->soc.num_states);
1636-
/* only pipe 0 is read for voltage and dcf/soc clocks */
1637-
pipes[0].clks_cfg.voltage = vlevel;
1638-
pipes[0].clks_cfg.dcfclk_mhz = dml->soc.clock_limits[vlevel].dcfclk_mhz;
1639-
pipes[0].clks_cfg.socclk_mhz = dml->soc.clock_limits[vlevel].socclk_mhz;
1640-
1641-
dml->soc.dram_clock_change_latency_us = table_entry->pstate_latency_us;
1642-
dml->soc.sr_exit_time_us = table_entry->sr_exit_time_us;
1643-
dml->soc.sr_enter_plus_exit_time_us = table_entry->sr_enter_plus_exit_time_us;
1644-
1645-
wm_set->urgent_ns = get_wm_urgent(dml, pipes, pipe_cnt) * 1000;
1646-
wm_set->cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(dml, pipes, pipe_cnt) * 1000;
1647-
wm_set->cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(dml, pipes, pipe_cnt) * 1000;
1648-
wm_set->cstate_pstate.pstate_change_ns = get_wm_dram_clock_change(dml, pipes, pipe_cnt) * 1000;
1649-
wm_set->pte_meta_urgent_ns = get_wm_memory_trip(dml, pipes, pipe_cnt) * 1000;
1650-
wm_set->frac_urg_bw_nom = get_fraction_of_urgent_bandwidth(dml, pipes, pipe_cnt) * 1000;
1651-
wm_set->frac_urg_bw_flip = get_fraction_of_urgent_bandwidth_imm_flip(dml, pipes, pipe_cnt) * 1000;
1652-
wm_set->urgent_latency_ns = get_urgent_latency(dml, pipes, pipe_cnt) * 1000;
1653-
dml->soc.dram_clock_change_latency_us = dram_clock_change_latency_cached;
1654-
1655-
}
1656-
1657-
static void dcn301_calculate_wm_and_dlg(
1658-
struct dc *dc, struct dc_state *context,
1659-
display_e2e_pipe_params_st *pipes,
1660-
int pipe_cnt,
1661-
int vlevel_req)
1662-
{
1663-
int i, pipe_idx;
1664-
int vlevel, vlevel_max;
1665-
struct wm_range_table_entry *table_entry;
1666-
struct clk_bw_params *bw_params = dc->clk_mgr->bw_params;
1667-
1668-
ASSERT(bw_params);
1669-
1670-
vlevel_max = bw_params->clk_table.num_entries - 1;
1671-
1672-
/* WM Set D */
1673-
table_entry = &bw_params->wm_table.entries[WM_D];
1674-
if (table_entry->wm_type == WM_TYPE_RETRAINING)
1675-
vlevel = 0;
1676-
else
1677-
vlevel = vlevel_max;
1678-
calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.d,
1679-
&context->bw_ctx.dml, pipes, pipe_cnt);
1680-
/* WM Set C */
1681-
table_entry = &bw_params->wm_table.entries[WM_C];
1682-
vlevel = min(max(vlevel_req, 2), vlevel_max);
1683-
calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.c,
1684-
&context->bw_ctx.dml, pipes, pipe_cnt);
1685-
/* WM Set B */
1686-
table_entry = &bw_params->wm_table.entries[WM_B];
1687-
vlevel = min(max(vlevel_req, 1), vlevel_max);
1688-
calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.b,
1689-
&context->bw_ctx.dml, pipes, pipe_cnt);
1690-
1691-
/* WM Set A */
1692-
table_entry = &bw_params->wm_table.entries[WM_A];
1693-
vlevel = min(vlevel_req, vlevel_max);
1694-
calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.a,
1695-
&context->bw_ctx.dml, pipes, pipe_cnt);
1696-
1697-
for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
1698-
if (!context->res_ctx.pipe_ctx[i].stream)
1699-
continue;
1700-
1701-
pipes[pipe_idx].clks_cfg.dispclk_mhz = get_dispclk_calculated(&context->bw_ctx.dml, pipes, pipe_cnt);
1702-
pipes[pipe_idx].clks_cfg.dppclk_mhz = get_dppclk_calculated(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);
1703-
1704-
if (dc->config.forced_clocks) {
1705-
pipes[pipe_idx].clks_cfg.dispclk_mhz = context->bw_ctx.dml.soc.clock_limits[0].dispclk_mhz;
1706-
pipes[pipe_idx].clks_cfg.dppclk_mhz = context->bw_ctx.dml.soc.clock_limits[0].dppclk_mhz;
1707-
}
1708-
if (dc->debug.min_disp_clk_khz > pipes[pipe_idx].clks_cfg.dispclk_mhz * 1000)
1709-
pipes[pipe_idx].clks_cfg.dispclk_mhz = dc->debug.min_disp_clk_khz / 1000.0;
1710-
if (dc->debug.min_dpp_clk_khz > pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000)
1711-
pipes[pipe_idx].clks_cfg.dppclk_mhz = dc->debug.min_dpp_clk_khz / 1000.0;
1712-
1713-
pipe_idx++;
1714-
}
1715-
1716-
dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel);
1717-
}
1718-
17191625
static struct resource_funcs dcn301_res_pool_funcs = {
17201626
.destroy = dcn301_destroy_resource_pool,
17211627
.link_enc_create = dcn301_link_encoder_create,
17221628
.panel_cntl_create = dcn301_panel_cntl_create,
17231629
.validate_bandwidth = dcn30_validate_bandwidth,
1724-
.calculate_wm_and_dlg = dcn301_calculate_wm_and_dlg,
1630+
.calculate_wm_and_dlg = dcn30_calculate_wm_and_dlg,
17251631
.update_soc_for_wm_a = dcn30_update_soc_for_wm_a,
17261632
.populate_dml_pipes = dcn30_populate_dml_pipes_from_context,
17271633
.acquire_idle_pipe_for_layer = dcn20_acquire_idle_pipe_for_layer,

0 commit comments

Comments
 (0)