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 783535 - Poor Wacom drawing performance (dropped events) under wayland
Poor Wacom drawing performance (dropped events) under wayland
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
unspecified
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2017-06-08 00:19 UTC by Jason Gerecke
Modified: 2017-07-03 12:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
clutter: Do not throttle motion events on tablet tools (1.45 KB, patch)
2017-06-29 21:52 UTC, Carlos Garnacho
none Details | Review
clutter: Do not throttle motion events on tablet tools (1.80 KB, patch)
2017-06-30 12:18 UTC, Carlos Garnacho
committed Details | Review
wayland: Base tablet tool coordinates on the current event (2.30 KB, patch)
2017-06-30 12:18 UTC, Carlos Garnacho
committed Details | Review

Description Jason Gerecke 2017-06-08 00:19:48 UTC
The drawing performance of Wacom tablets under Wayland (e.g. with applications like 'MyPaint' or 'GIMP') is unacceptably poor. Rapidly-drawn curves are noticeably much more "angular" when drawn in a "GNOME" session versus "GNOME on Xorg".

Digging in to the issue further, it appears that events are being dropped. I assume (but have not verified) that this is due to the Clutter stage being set to throttle events by default. Throttling has advantages but is entirely inappropriate for graphics applications that require the higher input rates in order to produce smooth curves when a pen is rapidly moved.

To reproduce this issue, install and run 'MyPaint' version 1.2 or later. Click Help -> Debug -> Test Input Devices. A window will pop up that provides event information. As you move a Wacom pen around the canvas, take note of where it says "N events, timestamp spacing" near the top. 'N' is equal to the number of events MyPaint received in the last second. Under Xorg, this should be equal to the hardware rate (between 100-200 Hz). Under Wayland, this ends up being limited to just 60.

Alternatively, the 'master' branch of the Xorg server can be installed to gain access to recently-added Wayland tablet support in xwayland. Afterwards, note that the following three scripts all report the hardware rate when run under an X session. When run under a Wayland session, however, the final script (which is from an xwayland client) only reports 60 Hz.

 $ sudo evemu-record /dev/input/<device> | awk '/SYN_REPORT/ {COUNT=COUNT+1} { if (systime()-NOW > 0) {print COUNT, "Hz"; NOW=systime(); COUNT=0;} }'

 $ sudo libinput-debug-events --device /dev/input/<device> | awk '/TABLET_TOOL_AXIS/ {COUNT=COUNT+1} { if (systime()-NOW > 0) {print COUNT, "Hz"; NOW=systime(); COUNT=0;} }'

 $ xinput test-xi2 <device> | awk '/RawMotion/ {COUNT=COUNT+1} { if (systime()-NOW > 0) {print COUNT, "Hz"; NOW=systime(); COUNT=0;} }'
Comment 1 Carlos Garnacho 2017-06-29 21:51:48 UTC
Ugh, I'd swear that I had a patch done for this at some point, must have fallen through the cracks... Just redid it instead of digging across 3 computers.
Comment 2 Carlos Garnacho 2017-06-29 21:52:36 UTC
Created attachment 354708 [details] [review]
clutter: Do not throttle motion events on tablet tools

Events from tablets must not be filtered out, as the event coalescing
results in precision loss.
Comment 3 Jason Gerecke 2017-06-29 23:28:12 UTC
This does seem to increase the rate at which events are emitted (my examples all report correct values now) but software still behaves as though events are being dropped. Using `xinput test-xi2`, it looks like we're being delivered multiple copies of the same event. Perhaps there's still-more coalescing further along the processing chain?
Comment 4 Carlos Garnacho 2017-06-30 12:09:28 UTC
Looking closer, an unintended one, other patch coming.
Comment 5 Carlos Garnacho 2017-06-30 12:18:06 UTC
Created attachment 354727 [details] [review]
clutter: Do not throttle motion events on tablet tools

Events from tablets must not be filtered out, as the event coalescing
results in precision loss.
Comment 6 Carlos Garnacho 2017-06-30 12:18:13 UTC
Created attachment 354728 [details] [review]
wayland: Base tablet tool coordinates on the current event

Instead of the last device position. This was copied a little bit too
straight from MetaWaylandPointer.
Comment 7 Jason Gerecke 2017-06-30 17:13:59 UTC
That seems to do the trick! Thanks! :)
Comment 8 Carlos Garnacho 2017-07-03 12:38:49 UTC
Pushed to mutter master and gnome-3-24.

Attachment 354727 [details] pushed as a70ae50 - clutter: Do not throttle motion events on tablet tools
Attachment 354728 [details] pushed as 529e5ad - wayland: Base tablet tool coordinates on the current event