Commit 16a8cb7c authored by Dmytro Laktyushkin's avatar Dmytro Laktyushkin Committed by Alex Deucher

drm/amd/display: fix dcn3 p_state_change_support validation (v2)

Our validation is a known mess with actual validation mixed with
topology configuration. This change makes sure topolgical validation is
completed before any topology changes are made so we do not run into
issues where we merge and split a pipe over the course of a single call.

v2: Squash in compilation fix
Signed-off-by: default avatarDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: default avatarAlvin Lee <Alvin.Lee2@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1f9ce3cf
...@@ -1870,12 +1870,14 @@ static bool dcn30_split_stream_for_mpc_or_odm( ...@@ -1870,12 +1870,14 @@ static bool dcn30_split_stream_for_mpc_or_odm(
return true; return true;
} }
static bool dcn30_fast_validate_bw(
static bool dcn30_internal_validate_bw(
struct dc *dc, struct dc *dc,
struct dc_state *context, struct dc_state *context,
display_e2e_pipe_params_st *pipes, display_e2e_pipe_params_st *pipes,
int *pipe_cnt_out, int *pipe_cnt_out,
int *vlevel_out) int *vlevel_out,
bool fast_validate)
{ {
bool out = false; bool out = false;
bool repopulate_pipes = false; bool repopulate_pipes = false;
...@@ -1898,7 +1900,38 @@ static bool dcn30_fast_validate_bw( ...@@ -1898,7 +1900,38 @@ static bool dcn30_fast_validate_bw(
dml_log_pipe_params(&context->bw_ctx.dml, pipes, pipe_cnt); dml_log_pipe_params(&context->bw_ctx.dml, pipes, pipe_cnt);
vlevel = dml_get_voltage_level(&context->bw_ctx.dml, pipes, pipe_cnt); if (!fast_validate) {
/*
* DML favors voltage over p-state, but we're more interested in
* supporting p-state over voltage. We can't support p-state in
* prefetch mode > 0 so try capping the prefetch mode to start.
*/
context->bw_ctx.dml.soc.allow_dram_self_refresh_or_dram_clock_change_in_vblank =
dm_allow_self_refresh_and_mclk_switch;
vlevel = dml_get_voltage_level(&context->bw_ctx.dml, pipes, pipe_cnt);
/* This may adjust vlevel and maxMpcComb */
if (vlevel < context->bw_ctx.dml.soc.num_states)
vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, vlevel, split, merge);
}
if (fast_validate || vlevel == context->bw_ctx.dml.soc.num_states ||
vba->DRAMClockChangeSupport[vlevel][vba->maxMpcComb] == dm_dram_clock_change_unsupported) {
/*
* If mode is unsupported or there's still no p-state support then
* fall back to favoring voltage.
*
* We don't actually support prefetch mode 2, so require that we
* at least support prefetch mode 1.
*/
context->bw_ctx.dml.soc.allow_dram_self_refresh_or_dram_clock_change_in_vblank =
dm_allow_self_refresh;
vlevel = dml_get_voltage_level(&context->bw_ctx.dml, pipes, pipe_cnt);
if (vlevel < context->bw_ctx.dml.soc.num_states) {
memset(split, 0, sizeof(split));
memset(merge, 0, sizeof(merge));
vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, vlevel, split, merge);
}
}
dml_log_mode_support_params(&context->bw_ctx.dml); dml_log_mode_support_params(&context->bw_ctx.dml);
...@@ -1938,8 +1971,6 @@ static bool dcn30_fast_validate_bw( ...@@ -1938,8 +1971,6 @@ static bool dcn30_fast_validate_bw(
pipe_idx++; pipe_idx++;
} }
vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, vlevel, split, merge);
/* merge pipes if necessary */ /* merge pipes if necessary */
for (i = 0; i < dc->res_pool->pipe_count; i++) { for (i = 0; i < dc->res_pool->pipe_count; i++) {
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
...@@ -2187,7 +2218,8 @@ static void dcn30_calculate_wm( ...@@ -2187,7 +2218,8 @@ static void dcn30_calculate_wm(
} }
} }
bool dcn30_validate_bandwidth(struct dc *dc, struct dc_state *context, bool dcn30_validate_bandwidth(struct dc *dc,
struct dc_state *context,
bool fast_validate) bool fast_validate)
{ {
bool out = false; bool out = false;
...@@ -2201,7 +2233,7 @@ bool dcn30_validate_bandwidth(struct dc *dc, struct dc_state *context, ...@@ -2201,7 +2233,7 @@ bool dcn30_validate_bandwidth(struct dc *dc, struct dc_state *context,
BW_VAL_TRACE_COUNT(); BW_VAL_TRACE_COUNT();
out = dcn30_fast_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel); out = dcn30_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, fast_validate);
if (pipe_cnt == 0) if (pipe_cnt == 0)
goto validate_out; goto validate_out;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
*/ */
#include "dc_features.h" #include "dc_features.h"
#include "display_mode_enums.h"
#ifndef __DISPLAY_MODE_STRUCTS_H__ #ifndef __DISPLAY_MODE_STRUCTS_H__
#define __DISPLAY_MODE_STRUCTS_H__ #define __DISPLAY_MODE_STRUCTS_H__
...@@ -120,6 +121,7 @@ struct _vcs_dpi_soc_bounding_box_st { ...@@ -120,6 +121,7 @@ struct _vcs_dpi_soc_bounding_box_st {
double urgent_latency_adjustment_fabric_clock_reference_mhz; double urgent_latency_adjustment_fabric_clock_reference_mhz;
bool disable_dram_clock_change_vactive_support; bool disable_dram_clock_change_vactive_support;
bool allow_dram_clock_one_display_vactive; bool allow_dram_clock_one_display_vactive;
enum self_refresh_affinity allow_dram_self_refresh_or_dram_clock_change_in_vblank;
}; };
struct _vcs_dpi_ip_params_st { struct _vcs_dpi_ip_params_st {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment