From 8aea6ef159da9923338adda4ef26bfe1f2e61292 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 6 Aug 2017 13:09:39 +0300 Subject: [PATCH] Disable low latency vsync if returned calibrated refresh rate is impossible. --- od-win32/win32gfx.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 0195b4a8..d9f92e56 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -4004,9 +4004,14 @@ double vblank_calibrate (double approx_vblank, bool waitonly) maxvpos = maxvpos1 > maxvpos2 ? maxvpos1 : maxvpos2; // count two fields: works with interlaced modes too. tval = (double)syncbase * 2.0 / (t2 - t1); - if (cnt == 0) + if (cnt == 0) { tfirst = tval; - if (abs (tval - tfirst) > 1) { + } + if (tval > 1100 && maxcnt >= maxtotal - 1) { + write_log (_T("Out of range value %.6f, disabling low latency vsync..\n"), tval); + goto fail; + } + if (tval > 1100 || abs (tval - tfirst) > 1) { write_log (_T("Very unstable vsync! %.6f vs %.6f, retrying..\n"), tval, tfirst); break; } -- 2.47.3