After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 758653 - KMS/Wayland calculates wrong refresh rate
KMS/Wayland calculates wrong refresh rate
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
3.18.x
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
: 764228 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-11-25 13:10 UTC by Daniel Stone
Modified: 2016-03-26 13:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
KMS/Wayland: Correct refresh rate units (4.20 KB, patch)
2015-11-25 13:19 UTC, Daniel Stone
committed Details | Review

Description Daniel Stone 2015-11-25 13:10:54 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.
Comment 1 Daniel Stone 2015-11-25 13:19:24 UTC
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.
Comment 2 Rui Matos 2015-11-25 14:22:40 UTC
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.
Comment 3 Rui Matos 2015-11-25 14:32:05 UTC
Review of attachment 316237 [details] [review]:

sorry, I missed the division at the end. looks good
Comment 4 Rui Matos 2015-11-25 14:46:50 UTC
Attachment 316237 [details] pushed as c16a5ec - KMS/Wayland: Correct refresh rate units
Comment 5 Yaroslav Isakov 2016-03-26 13:49:00 UTC
*** Bug 764228 has been marked as a duplicate of this bug. ***