]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/amd/display: fix dcn3 p_state_change_support validation (v2)
authorDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Tue, 30 Jun 2020 14:20:06 +0000 (10:20 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 14 Jul 2020 18:37:33 +0000 (14:37 -0400)
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: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h

index d7ba895de7653f272f5b2242720b01caf3a8c80e..653a571e366d1b03369f060f66341ae07f8f0611 100644 (file)
@@ -1870,12 +1870,14 @@ static bool dcn30_split_stream_for_mpc_or_odm(
 
        return true;
 }
-static bool dcn30_fast_validate_bw(
+
+static bool dcn30_internal_validate_bw(
                struct dc *dc,
                struct dc_state *context,
                display_e2e_pipe_params_st *pipes,
                int *pipe_cnt_out,
-               int *vlevel_out)
+               int *vlevel_out,
+               bool fast_validate)
 {
        bool out = false;
        bool repopulate_pipes = false;
@@ -1898,7 +1900,38 @@ static bool dcn30_fast_validate_bw(
 
        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);
 
@@ -1938,8 +1971,6 @@ static bool dcn30_fast_validate_bw(
                pipe_idx++;
        }
 
-       vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, vlevel, split, merge);
-
        /* merge pipes if necessary */
        for (i = 0; i < dc->res_pool->pipe_count; i++) {
                struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
@@ -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 out = false;
@@ -2201,7 +2233,7 @@ bool dcn30_validate_bandwidth(struct dc *dc, struct dc_state *context,
 
        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)
                goto validate_out;
index 0fac7f754604c25b2d2bf12f087d0330c5ef2ec4..6ab74640c0da75f5f7254e01f2b99a4416f58b1b 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include "dc_features.h"
+#include "display_mode_enums.h"
 
 #ifndef __DISPLAY_MODE_STRUCTS_H__
 #define __DISPLAY_MODE_STRUCTS_H__
@@ -120,6 +121,7 @@ struct _vcs_dpi_soc_bounding_box_st {
        double urgent_latency_adjustment_fabric_clock_reference_mhz;
        bool disable_dram_clock_change_vactive_support;
        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 {