Skip to content

Commit 9a46890

Browse files
Michael Straussjfvogel
Michael Strauss
authored andcommitted
drm/amd/display: Set min dcfclk if pipe count is 0
[ Upstream commit bc20477 ] [WHY] Clocks don't get recalculated in 0 stream/0 pipe configs, blocking S0i3 if dcfclk gets high enough [HOW] Create DCN31 copy of DCN30 bandwidth validation func which doesn't entirely skip validation in 0 pipe scenarios Override dcfclk to vlevel 0/min value during validation if pipe count is 0 Reviewed-by: Eric Yang <[email protected]> Acked-by: Qingqing Zhuo <[email protected]> Signed-off-by: Michael Strauss <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit f276634b12fa8f63988be9cf5492c7d60d5ad7b1) Signed-off-by: Jack Vogel <[email protected]>
1 parent 567147f commit 9a46890

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ static struct pipe_ctx *dcn30_find_split_pipe(
18561856
return pipe;
18571857
}
18581858

1859-
static noinline bool dcn30_internal_validate_bw(
1859+
noinline bool dcn30_internal_validate_bw(
18601860
struct dc *dc,
18611861
struct dc_state *context,
18621862
display_e2e_pipe_params_st *pipes,

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ unsigned int dcn30_calc_max_scaled_time(
5555

5656
bool dcn30_validate_bandwidth(struct dc *dc, struct dc_state *context,
5757
bool fast_validate);
58+
bool dcn30_internal_validate_bw(
59+
struct dc *dc,
60+
struct dc_state *context,
61+
display_e2e_pipe_params_st *pipes,
62+
int *pipe_cnt_out,
63+
int *vlevel_out,
64+
bool fast_validate);
5865
void dcn30_calculate_wm_and_dlg(
5966
struct dc *dc, struct dc_state *context,
6067
display_e2e_pipe_params_st *pipes,

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1664,6 +1664,15 @@ static void dcn31_calculate_wm_and_dlg_fp(
16641664
if (context->bw_ctx.dml.soc.min_dcfclk > dcfclk)
16651665
dcfclk = context->bw_ctx.dml.soc.min_dcfclk;
16661666

1667+
/* We don't recalculate clocks for 0 pipe configs, which can block
1668+
* S0i3 as high clocks will block low power states
1669+
* Override any clocks that can block S0i3 to min here
1670+
*/
1671+
if (pipe_cnt == 0) {
1672+
context->bw_ctx.bw.dcn.clk.dcfclk_khz = dcfclk; // always should be vlevel 0
1673+
return;
1674+
}
1675+
16671676
pipes[0].clks_cfg.voltage = vlevel;
16681677
pipes[0].clks_cfg.dcfclk_mhz = dcfclk;
16691678
pipes[0].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].socclk_mhz;
@@ -1789,6 +1798,58 @@ static void dcn31_calculate_wm_and_dlg(
17891798
DC_FP_END();
17901799
}
17911800

1801+
bool dcn31_validate_bandwidth(struct dc *dc,
1802+
struct dc_state *context,
1803+
bool fast_validate)
1804+
{
1805+
bool out = false;
1806+
1807+
BW_VAL_TRACE_SETUP();
1808+
1809+
int vlevel = 0;
1810+
int pipe_cnt = 0;
1811+
display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_KERNEL);
1812+
DC_LOGGER_INIT(dc->ctx->logger);
1813+
1814+
BW_VAL_TRACE_COUNT();
1815+
1816+
out = dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, fast_validate);
1817+
1818+
// Disable fast_validate to set min dcfclk in alculate_wm_and_dlg
1819+
if (pipe_cnt == 0)
1820+
fast_validate = false;
1821+
1822+
if (!out)
1823+
goto validate_fail;
1824+
1825+
BW_VAL_TRACE_END_VOLTAGE_LEVEL();
1826+
1827+
if (fast_validate) {
1828+
BW_VAL_TRACE_SKIP(fast);
1829+
goto validate_out;
1830+
}
1831+
1832+
dc->res_pool->funcs->calculate_wm_and_dlg(dc, context, pipes, pipe_cnt, vlevel);
1833+
1834+
BW_VAL_TRACE_END_WATERMARKS();
1835+
1836+
goto validate_out;
1837+
1838+
validate_fail:
1839+
DC_LOG_WARNING("Mode Validation Warning: %s failed alidation.\n",
1840+
dml_get_status_message(context->bw_ctx.dml.vba.ValidationStatus[context->bw_ctx.dml.vba.soc.num_states]));
1841+
1842+
BW_VAL_TRACE_SKIP(fail);
1843+
out = false;
1844+
1845+
validate_out:
1846+
kfree(pipes);
1847+
1848+
BW_VAL_TRACE_FINISH();
1849+
1850+
return out;
1851+
}
1852+
17921853
static struct dc_cap_funcs cap_funcs = {
17931854
.get_dcc_compression_cap = dcn20_get_dcc_compression_cap
17941855
};
@@ -1871,7 +1932,7 @@ static struct resource_funcs dcn31_res_pool_funcs = {
18711932
.link_encs_assign = link_enc_cfg_link_encs_assign,
18721933
.link_enc_unassign = link_enc_cfg_link_enc_unassign,
18731934
.panel_cntl_create = dcn31_panel_cntl_create,
1874-
.validate_bandwidth = dcn30_validate_bandwidth,
1935+
.validate_bandwidth = dcn31_validate_bandwidth,
18751936
.calculate_wm_and_dlg = dcn31_calculate_wm_and_dlg,
18761937
.update_soc_for_wm_a = dcn31_update_soc_for_wm_a,
18771938
.populate_dml_pipes = dcn31_populate_dml_pipes_from_context,

0 commit comments

Comments
 (0)