From: Austin Zheng <austin.zh...@amd.com>

[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.var...@amd.com>
Signed-off-by: Austin Zheng <austin.zh...@amd.com>
Signed-off-by: Wayne Lin <wayne....@amd.com>
---
 .../dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c       | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 
a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c
 
b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c
index c4dbf27abaf8..b1da89a5e5e4 100644
--- 
a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c
+++ 
b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c
@@ -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__
-- 
2.37.3

Reply via email to