drm/amd/display: Update vactive margin and max vblank for fpo + vactive
authorAlvin Lee <alvin.lee2@amd.com>
Tue, 2 May 2023 16:27:26 +0000 (12:27 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Jun 2023 13:39:38 +0000 (09:39 -0400)
[Description]
- Some 1920x1080@60hz displays have VBLANK time > 600us which we
  still want to accept for FPO + Vactive configs based on testing
- Increase max VBLANK time to 1000us to allow these configs
  for FPO + Vactive
- Increase minimum vactive switch margin for FPO + Vactive to 200us
- Based on testing, 1920x1080@120hz can have a switch margin
  of ~160us which requires significantly longer FPO stretch
  margin (5ms) which we don't want to accept for now
- Also move margins into debug option

Reviewed-by: Jun Lei <jun.lei@amd.com>
Reviewed-by: Nevenko Stupar <nevenko.stupar@amd.com>
Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alvin Lee <alvin.lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@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/dcn32/dcn32_resource.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.h
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c
drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c

index e89de10..1ebb8d3 100644 (file)
@@ -893,6 +893,8 @@ struct dc_debug_options {
        bool minimize_dispclk_using_odm;
        bool disable_subvp_high_refresh;
        bool disable_dp_plus_plus_wa;
+       uint32_t fpo_vactive_min_active_margin_us;
+       uint32_t fpo_vactive_max_blank_us;
 };
 
 struct gpu_info_soc_bounding_box_v1_0;
index 4de2f88..98c394f 100644 (file)
@@ -730,6 +730,8 @@ static const struct dc_debug_options debug_defaults_drv = {
        .disable_boot_optimizations = false,
        .disable_subvp_high_refresh = true,
        .disable_dp_plus_plus_wa = true,
+       .fpo_vactive_min_active_margin_us = 200,
+       .fpo_vactive_max_blank_us = 1000,
 };
 
 static const struct dc_debug_options debug_defaults_diags = {
index 42ccfd1..58826e0 100644 (file)
@@ -39,7 +39,6 @@
 #define DCN3_2_MBLK_HEIGHT_8BPE 64
 #define DCN3_2_VMIN_DISPCLK_HZ 717000000
 #define DCN3_2_DCFCLK_DS_INIT_KHZ 10000 // Choose 10Mhz for init DCFCLK DS freq
-#define DCN3_2_MIN_ACTIVE_SWITCH_MARGIN_FPO_US 100 // Only allow FPO + Vactive if active margin >= 100
 #define SUBVP_HIGH_REFRESH_LIST_LEN 3
 #define DCN3_2_MAX_SUBVP_PIXEL_RATE_MHZ 1800
 
index df912c3..a808258 100644 (file)
@@ -626,7 +626,7 @@ struct dc_stream_state *dcn32_can_support_mclk_switch_using_fw_based_vblank_stre
                DC_FP_END();
 
                DC_FP_START();
-               is_fpo_vactive = dcn32_find_vactive_pipe(dc, context, DCN3_2_MIN_ACTIVE_SWITCH_MARGIN_FPO_US);
+               is_fpo_vactive = dcn32_find_vactive_pipe(dc, context, dc->debug.fpo_vactive_min_active_margin_us);
                DC_FP_END();
                if (!is_fpo_vactive || dc->debug.disable_fpo_vactive)
                        return NULL;
index 4c1e0f5..f4cd974 100644 (file)
@@ -728,6 +728,8 @@ static const struct dc_debug_options debug_defaults_drv = {
        .disable_fpo_vactive = false,
        .disable_boot_optimizations = false,
        .disable_subvp_high_refresh = true,
+       .fpo_vactive_min_active_margin_us = 200,
+       .fpo_vactive_max_blank_us = 1000,
 };
 
 static const struct dc_debug_options debug_defaults_diags = {
index f7e45d9..8c60b88 100644 (file)
@@ -35,7 +35,6 @@
 
 #define DC_LOGGER_INIT(logger)
 
-static const unsigned int MAX_FPO_VACTIVE_BLANK_US = 600;
 static const struct subvp_high_refresh_list subvp_high_refresh_list = {
                        .min_refresh = 120,
                        .max_refresh = 165,
@@ -2937,7 +2936,7 @@ bool dcn32_find_vactive_pipe(struct dc *dc, const struct dc_state *context, uint
                blank_us = ((pipe->stream->timing.v_total - pipe->stream->timing.v_addressable) * pipe->stream->timing.h_total /
                                (double)(pipe->stream->timing.pix_clk_100hz * 100)) * 1000000;
                if (vba->ActiveDRAMClockChangeLatencyMarginPerState[vba->VoltageLevel][vba->maxMpcComb][vba->pipe_plane[pipe_idx]] >= vactive_margin_req_us &&
-                               !(pipe->stream->vrr_active_variable || pipe->stream->vrr_active_fixed) && blank_us < MAX_FPO_VACTIVE_BLANK_US) {
+                               !(pipe->stream->vrr_active_variable || pipe->stream->vrr_active_fixed) && blank_us < dc->debug.fpo_vactive_max_blank_us) {
                        vactive_found = true;
                        break;
                }