]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:13:28 +0000 (11:13 +0200)
[ Upstream commit 41df56b1fc24cc36fffb10e437385b3a49fbb5e2 ]

[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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c

index 913f33c31cf38522623846dfc47713975e2e938d..a72b4c05e1fbf5ef90a52c1bf84db25ba8c0c0b1 100644 (file)
@@ -3713,13 +3713,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__