Thursday, May 10, 2018

X server pointer acceleration analysis - part 4

In the first three parts, I covered the X server and synaptics pointer
acceleration curves and how libinput compares to the X server pointer
acceleration curve. In this post, I will compare libinput to the synaptics
acceleration curve.

Comparison of synaptics and libinput

libinput has multiple different pointer acceleration curves, depending on the device.
In this post, I will only consider the one used for touchpads. So let's
compare the synaptics curve with the libinput curve at the default
configurations:

These two graphs show that libinput is both very different and similar. Both
curves have an acceleration factor less than 1 for the majority of speeds,
they both decelerate the touchpad more than accelerating it.
synaptics has two factors it sticks to and a short curve,
libinput has a short deceleration curve and its plateau is the same or lower
than synaptics for the most part. Once the threshold is hit at around 250
mm/s, libinput's acceleration keeps increasing until it hits a maximum much later.

So, anything under ~20mm/s, libinput should be the same as synaptics
(ignoring the <7mm/s deceleration). For anything less than 250mm/s, libinput should be
slower. I say "should be" because that is not actually the case, synaptics
is slower so I suspect the server scaling slows down synaptics even further.
Hacking around in the libinput code, I found that moving libinput's baseline
to 0.2 matches the synaptics cursor's speed. However, AFAIK that scaling
depends on the screen size, so your mileage may vary.

Comparing configuration settings

Let's overlay the libinput speed toggles. In
Part
2 we've seen the synaptics toggles and they're open-ended, so it's a bit
hard to pick a specific set to go with to compare. I'll be using the same
combined configuration options from the diagram there.

There isn't much I can talk about here in direct comparison, the curves
are quite different and the synaptics curves vary greatly with the
configuration options (even though the shape remains the same).

Analysis

It's fairly obvious that the acceleration profiles are very different once
depart from the default settings. Most notable,
only libinput's slowest speed setting matches the 0.2 speed
that is the synaptics default setting. In other words, if your touchpad
is too fast compared to synaptics, it may not be possible to slow it down
sufficiently. Likewise, even at the fastest speed, the baseline is well
below the synaptics baseline for e.g. 0.6 [1], so if your touchpad is too slow,
you may not be able to speed it up sufficiently (at least for low speeds).
That problem won't exist for the maximum acceleration factor, the main
question here is simply whether they are too high. Answer: I don't know.

So the base speed of the touchpad in libinput needs a higher range, that's
IMO a definitive bug that I need to work on. The rest... I don't know. Let's
see how we go.

[1] A configuration I found suggested in some forum when googling for MinSpeed, so let's assume there's at least one person out there using it.