GNOME Bugzilla – Bug 783535
Poor Wacom drawing performance (dropped events) under wayland
Last modified: 2017-07-03 12:38:58 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;} }'
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.
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.
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?
Looking closer, an unintended one, other patch coming.
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.
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.
That seems to do the trick! Thanks! :)
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