From 2ee5145559c8c14877934f98ac2abfb41a7c8e04 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Tue, 3 Jul 2018 22:01:33 +0300 Subject: [PATCH] vsync_hblank can be zero if DISPLAYCONFIG_VIDEO_SIGNAL_INFO is not available. --- custom.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/custom.cpp b/custom.cpp index 7a06904f..71ddf146 100644 --- a/custom.cpp +++ b/custom.cpp @@ -8260,11 +8260,13 @@ static void scanlinesleep(int currline, int nextline) return; if (currline >= nextline) return; - int diff = vsync_hblank / (nextline - currline); - int us = 1000000 / diff; - if (us < target_sleep_nanos(-1)) { // spin if less than minimum sleep time - target_spin(nextline - currline - 1); - return; + if (vsync_hblank) { + int diff = vsync_hblank / (nextline - currline); + int us = 1000000 / diff; + if (us < target_sleep_nanos(-1)) { // spin if less than minimum sleep time + target_spin(nextline - currline - 1); + return; + } } if (busywait) { target_spin(1); -- 2.47.3