From 84ade779dfc03076dd9e7772f345b20999430f02 Mon Sep 17 00:00:00 2001 From: Sorgelig Date: Thu, 30 Jun 2022 22:59:16 +0800 Subject: [PATCH] video: adjust VRR vblank to a minimum possible value instead of discarding. --- video.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/video.cpp b/video.cpp index 47d5ec0..d6c3309 100644 --- a/video.cpp +++ b/video.cpp @@ -1669,15 +1669,13 @@ static void set_video(vmode_custom_t *v, double Fpix) // try to adjust VBlank to match max refresh int vbl_fmax = ((v_cur.Fpix * 1000000.f) / (vrr_max_fr * horz)) - v_fix.param.vact - v_fix.param.vs - 1; - if (vbl_fmax >= 2) + if (vbl_fmax < 2) vbl_fmax = 2; + int vfp = vbl_fmax - v_fix.param.vbp; + v_fix.param.vfp = vfp; + if (vfp < 1) { - int vfp = vbl_fmax - v_fix.param.vbp; - v_fix.param.vfp = vfp; - if (vfp < 1) - { - v_fix.param.vfp = 1; - v_fix.param.vbp = vbl_fmax - 1; - } + v_fix.param.vfp = 1; + v_fix.param.vbp = vbl_fmax - 1; } int vert = v_fix.param.vact + v_fix.param.vbp + v_fix.param.vfp + v_fix.param.vs;