OSDN Git Service

drm/amd/display: Add DSC delay factor workaround
authorGeorge Shen <george.shen@amd.com>
Fri, 14 Oct 2022 21:46:03 +0000 (17:46 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 2 Nov 2022 21:16:25 +0000 (17:16 -0400)
[Why]
Certain 4K high refresh rate modes requiring DSC are exhibiting top
of screen underflow corruption. Increasing the DSC delay by a factor
of 6 percent stops the underflow for most use cases.

[How]
Multiply DSC delay requirement in DML by a factor.
Add debug option to make this DSC delay factor configurable.

Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: George Shen <george.shen@amd.com>
Tested-by: Mark Broadworth <mark.broadworth@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c
drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h

index bfc5474..737b221 100644 (file)
@@ -852,6 +852,7 @@ struct dc_debug_options {
        bool enable_double_buffered_dsc_pg_support;
        bool enable_dp_dig_pixel_rate_div_policy;
        enum lttpr_mode lttpr_mode_override;
+       unsigned int dsc_delay_factor_wa_x1000;
 };
 
 struct gpu_info_soc_bounding_box_v1_0;
index 819de0f..f37c9a6 100644 (file)
@@ -2359,9 +2359,11 @@ void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_pa
 
                if (dc->ctx->dc_bios->vram_info.dram_channel_width_bytes)
                        dcn3_2_soc.dram_channel_width_bytes = dc->ctx->dc_bios->vram_info.dram_channel_width_bytes;
-
        }
 
+       /* DML DSC delay factor workaround */
+       dcn3_2_ip.dsc_delay_factor_wa = dc->debug.dsc_delay_factor_wa_x1000 / 1000.0;
+
        /* Override dispclk_dppclk_vco_speed_mhz from Clk Mgr */
        dcn3_2_soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
        dc->dml.soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
index 60351b2..47ff0a8 100644 (file)
@@ -367,7 +367,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
                                mode_lib->vba.OutputBpp[k], mode_lib->vba.HActive[k], mode_lib->vba.HTotal[k],
                                mode_lib->vba.NumberOfDSCSlices[k], mode_lib->vba.OutputFormat[k],
                                mode_lib->vba.Output[k], mode_lib->vba.PixelClock[k],
-                               mode_lib->vba.PixelClockBackEnd[k]);
+                               mode_lib->vba.PixelClockBackEnd[k], mode_lib->vba.ip.dsc_delay_factor_wa);
        }
 
        for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k)
@@ -2475,7 +2475,8 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                        mode_lib->vba.OutputBppPerState[i][k], mode_lib->vba.HActive[k],
                                        mode_lib->vba.HTotal[k], mode_lib->vba.NumberOfDSCSlices[k],
                                        mode_lib->vba.OutputFormat[k], mode_lib->vba.Output[k],
-                                       mode_lib->vba.PixelClock[k], mode_lib->vba.PixelClockBackEnd[k]);
+                                       mode_lib->vba.PixelClock[k], mode_lib->vba.PixelClockBackEnd[k],
+                                       mode_lib->vba.ip.dsc_delay_factor_wa);
                }
 
                for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
index 4a3e7a5..968924c 100644 (file)
@@ -1726,7 +1726,8 @@ unsigned int dml32_DSCDelayRequirement(bool DSCEnabled,
                enum output_format_class  OutputFormat,
                enum output_encoder_class Output,
                double PixelClock,
-               double PixelClockBackEnd)
+               double PixelClockBackEnd,
+               double dsc_delay_factor_wa)
 {
        unsigned int DSCDelayRequirement_val;
 
@@ -1764,7 +1765,7 @@ unsigned int dml32_DSCDelayRequirement(bool DSCEnabled,
        dml_print("DML::%s: DSCDelayRequirement_val = %d\n", __func__, DSCDelayRequirement_val);
 #endif
 
-       return DSCDelayRequirement_val;
+       return dml_ceil(DSCDelayRequirement_val * dsc_delay_factor_wa, 1);
 }
 
 void dml32_CalculateSurfaceSizeInMall(
index 55cead0..2c38275 100644 (file)
@@ -327,7 +327,8 @@ unsigned int dml32_DSCDelayRequirement(bool DSCEnabled,
                enum output_format_class  OutputFormat,
                enum output_encoder_class Output,
                double PixelClock,
-               double PixelClockBackEnd);
+               double PixelClockBackEnd,
+               double dsc_delay_factor_wa);
 
 void dml32_CalculateSurfaceSizeInMall(
                unsigned int NumberOfActiveSurfaces,
index 7352f75..ec0486e 100644 (file)
@@ -29,6 +29,7 @@
 #include "dcn321_fpu.h"
 #include "dcn32/dcn32_resource.h"
 #include "dcn321/dcn321_resource.h"
+#include "dml/dcn32/display_mode_vba_util_32.h"
 
 #define DCN3_2_DEFAULT_DET_SIZE 256
 
@@ -538,9 +539,11 @@ void dcn321_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p
 
                if (dc->ctx->dc_bios->vram_info.dram_channel_width_bytes)
                        dcn3_21_soc.dram_channel_width_bytes = dc->ctx->dc_bios->vram_info.dram_channel_width_bytes;
-
        }
 
+       /* DML DSC delay factor workaround */
+       dcn3_21_ip.dsc_delay_factor_wa = dc->debug.dsc_delay_factor_wa_x1000 / 1000.0;
+
        /* Override dispclk_dppclk_vco_speed_mhz from Clk Mgr */
        dcn3_21_soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
        dc->dml.soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
index f33a887..d7be01a 100644 (file)
@@ -364,6 +364,9 @@ struct _vcs_dpi_ip_params_st {
        unsigned int max_num_dp2p0_outputs;
        unsigned int max_num_dp2p0_streams;
        unsigned int VBlankNomDefaultUS;
+
+       /* DM workarounds */
+       double dsc_delay_factor_wa; // TODO: Remove after implementing root cause fix
 };
 
 struct _vcs_dpi_display_xfc_params_st {