From 16af2e407b49cd4464935a6f9b4efdc32f1339e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 27 May 2022 17:00:35 +0200 Subject: [PATCH] gpu/xrandr: Gracefully handle 0.0 refresh rate We don't make use of the refresh rate in any useful way in the X11, and in this case we just ended up with warnings since the refresh rate was NaN. Fix this by making it 0.0 to mean "no refresh rate". This also is what 'xrandr' itself reports. Fixes warnings when launching 'mutter --x11' in Xvfb. Part-of: --- src/backends/x11/meta-gpu-xrandr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/backends/x11/meta-gpu-xrandr.c b/src/backends/x11/meta-gpu-xrandr.c index 6c84be6ce..404629024 100644 --- a/src/backends/x11/meta-gpu-xrandr.c +++ b/src/backends/x11/meta-gpu-xrandr.c @@ -95,6 +95,9 @@ calculate_xrandr_refresh_rate (XRRModeInfo *xmode) h_total = (float) xmode->hTotal; v_total = (float) xmode->vTotal; + if (h_total == 0.0 || v_total == 0.0) + return 0.0; + if (xmode->modeFlags & RR_DoubleScan) v_total *= 2.0;