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>
This commit is contained in:
Jonas Ådahl 2022-05-27 17:00:35 +02:00 committed by Marge Bot
parent e7a8173f3a
commit 16af2e407b

View File

@ -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;