drm/amd/display: Use Nominal vBlank If Provided Instead Of Capping It
authorAustin Zheng <Austin.Zheng@amd.com>
Tue, 7 Jan 2025 22:49:36 +0000 (17:49 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 13 Feb 2025 02:02:57 +0000 (21:02 -0500)
[Why/How]
vBlank used to determine the max vStartup is based on the smallest between
the vblank provided by the timing and vblank in ip_caps.
Extra vblank time is not considered if the vblank provided by the timing ends
up being higher than what's defined by the ip_caps

Use 1 less than the vblank size in case the timing is interlaced
so vstartup will always be less than vblank_nom.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Austin Zheng <Austin.Zheng@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@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/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c

index ad4cf1f3d7ead1e67bb7e44cf4c963c61b715135..51b457b6d66fc65abd9c3507bb175367a1d4356b 100644 (file)
@@ -3709,13 +3709,12 @@ static unsigned int CalculateMaxVStartup(
        double line_time_us = (double)timing->h_total / ((double)timing->pixel_clock_khz / 1000);
        unsigned int vblank_actual = timing->v_total - timing->v_active;
        unsigned int vblank_nom_default_in_line = (unsigned int)math_floor2((double)vblank_nom_default_us / line_time_us, 1.0);
-       unsigned int vblank_nom_input = (unsigned int)math_min2(timing->vblank_nom, vblank_nom_default_in_line);
-       unsigned int vblank_avail = (vblank_nom_input == 0) ? vblank_nom_default_in_line : vblank_nom_input;
+       unsigned int vblank_avail = (timing->vblank_nom == 0) ? vblank_nom_default_in_line : (unsigned int)timing->vblank_nom;
 
        vblank_size = (unsigned int)math_min2(vblank_actual, vblank_avail);
 
        if (timing->interlaced && !ptoi_supported)
-               max_vstartup_lines = (unsigned int)(math_floor2(vblank_size / 2.0, 1.0));
+               max_vstartup_lines = (unsigned int)(math_floor2((vblank_size - 1) / 2.0, 1.0));
        else
                max_vstartup_lines = vblank_size - (unsigned int)math_max2(1.0, math_ceil2(write_back_delay_us / line_time_us, 1.0));
 #ifdef __DML_VBA_DEBUG__