GNOME Bugzilla – Bug 758653
KMS/Wayland calculates wrong refresh rate
Last modified: 2016-03-26 13:49:00 UTC
wl_output expects to give refresh rates in milliHz on the wire, but Mutter gives updates out in Hz. This breaks expectations of GTK+ and XWayland, amongst others.
Created attachment 316237 [details] [review] KMS/Wayland: Correct refresh rate units On the wire, Wayland specifies the refresh rate in milliHz. Mutter sends the refresh rate in Hz, which confuses clients, e.g. weston-info: interface: 'wl_output', version: 2, name: 4 mode: width: 2560 px, height: 1440 px, refresh: 0 Hz, flags: current preferred interface: 'wl_output', version: 2, name: 5 mode: width: 3200 px, height: 1800 px, refresh: 0 Hz, flags: current preferred and xrandr: XWAYLAND0 connected 2560x1440+3200+0 600mm x 340mm 2560x1440@0.1Hz 0.05*+ XWAYLAND1 connected 3200x1800+0+0 290mm x 170mm 3200x1800@0.1Hz 0.03*+ Export the refresh rate in the correct units. For improved precision, perform the KMS intermediate calculations in milliHz as well, and account for interlaced/doublescan modes. This is also consistent with what GTK+ expects: timings->refresh_interval = 16667; /* default to 1/60th of a second */ /* We pick a random output out of the outputs that the window touches * The rate here is in milli-hertz */ int refresh_rate = _gdk_wayland_screen_get_output_refresh_rate (wayland_display->screen, impl->outputs->data); if (refresh_rate != 0) timings->refresh_interval = G_GINT64_CONSTANT(1000000000) / refresh_rate; Where the 'refresh_rate' given is exactly what's come off the wire. 1000000000/60000 comes out as 16667, whereas divided by 60 is ... substantially less.
Review of attachment 316237 [details] [review]: Oops, we need to fix this. I think redefining MetaMonitorMode->refresh_rate's to be in mHz is fine but we need to change all other places where it's assumed to be in Hz.
Review of attachment 316237 [details] [review]: sorry, I missed the division at the end. looks good
Attachment 316237 [details] pushed as c16a5ec - KMS/Wayland: Correct refresh rate units
*** Bug 764228 has been marked as a duplicate of this bug. ***