[mutter] gpu/xrandr: Gracefully handle 0.0 refresh rate



commit 16af2e407b49cd4464935a6f9b4efdc32f1339e5
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Fri May 27 17:00:35 2022 +0200

    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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2434>

 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 6c84be6ce8..4046290246 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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]