touchpad: use the fuzz value (if any) for the hysteresis margin
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 21 Feb 2018 03:41:31 +0000 (13:41 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 9 Apr 2018 01:38:08 +0000 (11:38 +1000)
We currently used 0.5mm on touchpads as hysteresis value. This causes pointer
movement delays, it is likely too high. Reduce it to a kernel-set fuzz value
(if any) and see how we go with that. On many touchpads, the fuzz is 8 which
would be closer to 0.2mm on e.g. a T440.

Note that the does some defuzzing anyway, but the response of that function is
nonlinear, e.g. for a fuzz of 8, the physical deltas map to:

phys 0..3  → delta 0
phys 4..7  → delta 1
phys 8..15 → delta 4, 5, 6, 7
phys 16..N → delta 16..N

In other words, we never see some logical deltas 2 and 3. While this shouldn't
matter given the average touchpad resolution, reducing the hysteresis margin
is likely to provide some better response. We never see values 8-15 either
which could be the cause of some pointer jumps we've been seeing.

see https://bugs.freedesktop.org/show_bug.cgi?id=105303

Devices with a fuzz of 0 have the hysteresis margin reduced to 0.25mm (from
0.5mm).

https://bugs.freedesktop.org/show_bug.cgi?id=105108

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ea7498ef971350454db9c78b9ba160e7d6bb455b)

src/evdev-mt-touchpad.c

index d6e1e4f97806c13156b345765b17dc128e74d60d..8a3923c73cd9d4e16d56a8e4a3fb99024c3c7ede 100644 (file)
@@ -3026,12 +3026,22 @@ tp_init_default_resolution(struct tp_dispatch *tp,
 static inline void
 tp_init_hysteresis(struct tp_dispatch *tp)
 {
-       int res_x, res_y;
+       int xmargin, ymargin;
+       const struct input_absinfo *ax = tp->device->abs.absinfo_x,
+                                  *ay = tp->device->abs.absinfo_y;
 
-       res_x = tp->device->abs.absinfo_x->resolution;
-       res_y = tp->device->abs.absinfo_y->resolution;
-       tp->hysteresis.margin.x = res_x/2;
-       tp->hysteresis.margin.y = res_y/2;
+       if (ax->fuzz)
+               xmargin = ax->fuzz;
+       else
+               xmargin = ax->resolution/4;
+
+       if (ay->fuzz)
+               ymargin = ay->fuzz;
+       else
+               ymargin = ay->resolution/4;
+
+       tp->hysteresis.margin.x = xmargin;
+       tp->hysteresis.margin.y = ymargin;
        tp->hysteresis.enabled = false;
 }