Bug 104533 - Hysteresis detection fails on the single-touch axes after a while
Summary: Hysteresis detection fails on the single-touch axes after a while
Status: RESOLVED NOTOURBUG
Alias: None
Product: Wayland
Classification: Unclassified
Component: libinput (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 98839
Blocks:
  Show dependency treegraph
 
Reported: 2018-01-08 02:39 UTC by Peter Hutterer
Modified: 2018-01-16 05:35 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
evemu recording of a finger-hold (141.68 KB, text/plain)
2018-01-08 02:39 UTC, Peter Hutterer
Details
finger hold recording with comment #2 patch (27.73 KB, text/plain)
2018-01-11 22:37 UTC, James Cowgill
Details

Description Peter Hutterer 2018-01-08 02:39:18 UTC
Created attachment 136606 [details]
evemu recording of a finger-hold

Spin-off of bug 98839, see the attachment (originally from attachment 136276 [details]).

When replayed, libinput leaves the hysteresis in place until the 6.799107 frame. That frame is 84ms after the previous one and disables the hysteresis. At that point the pointer starts wobbling.

Noteworthy is: this only wobbles because it's a semi-mt where we disable MT and look at ABS_X/ABS_Y only. And only ABS_X/Y events have wobbles because fuzz is 0 - the ABS_MT_POSITION_X/Y axes have a fuzz of 8 which makes the kernel suppress the wobbles.

The mismatched fuzz is a result of input_mt_init_slots() in the kernel, copy_abs() forces fuzz to zero. See kernel commit 352ce2b0575f195c8e6452a9802e6c186b39409a. But that commit seems to be a bug, at least the synaptics driver doesn't use any in-kernel single-touch emulation but sends ABS_X/Y directly (as opposed to calling input_mt_report_pointer_emulation). Benjamin, can you have a look at that please?
Comment 1 Benjamin Tissoires 2018-01-08 08:32:30 UTC
I think 352ce2b0575f195c8e6452a9 is right, as we really do not want the events to be applied twice the fuzz.

The bug is more likely in synaptics.c for semi-mt devices. Only these devices are not using input_mt_report_pointer_emulation(), so we should more likely set the fuzz to ABS_X/Y manually in set_input_params() when the branch SYN_CAP_ADV_GESTURE(info->ext_cap_0c) is selected.
Comment 2 Peter Hutterer 2018-01-09 02:13:50 UTC
I think this diff should do it. Not ideal, but better than trying to rewrite all of the semi-mt event code without a device to test... James, please give this one a test, should show up a fuzz of 8 for ABS_X/Y now.

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index ee5466a374bf..0e04275e0d74 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -1280,6 +1280,14 @@ static void set_input_params(struct psmouse *psmouse,
                                    INPUT_MT_POINTER |
                                    (cr48_profile_sensor ?
                                        INPUT_MT_TRACK : INPUT_MT_SEMI_MT));
+
+               /* For semi-mt devices we send ABS_X/Y ourselves instead of
+                * input_mt_report_pointer_emulation. But
+                * input_mt_init_slots() resets the fuzz to 0, leading to a
+                * filtered ABS_MT_POSITION_X but an unfiltered ABS_X
+                * position. Let's re-initialize ABS_X/Y here. */
+               if (!cr48_profile_sensor)
+                       set_abs_position_params(dev, &priv->info, ABS_X, ABS_Y);
        }
 
        if (SYN_CAP_PALMDETECT(info->capabilities))
Comment 3 James Cowgill 2018-01-11 22:37:29 UTC
Created attachment 136669 [details]
finger hold recording with comment #2 patch

Thanks. With your patch applied on top of 4.15-rc7, the situation is much better than before. I do notice the mouse being slightly more wobbly than before libinput was changed, but that doesn't bother me too much.

I've attached a new evemu recording with the patch applied.
Comment 4 Peter Hutterer 2018-01-16 05:35:49 UTC
looks much better, the single touch and multitouch axis events are now in sync. The hysteresis is disabled now too and with the above recording I can see a few events get through but they're almost all in the subpixel range. 

 event19  POINTER_MOTION    +1.44s	  0.00/ -1.68
 event19  POINTER_MOTION    +1.47s	  0.00/ -0.33
 event19  POINTER_MOTION    +2.61s	 -0.13/  0.00
 event19  POINTER_MOTION    +3.10s	  0.00/ -0.12
 event19  POINTER_MOTION   +10.00s	  0.00/ -0.12
 event19  POINTER_MOTION   +12.73s	  0.00/  0.12
 event19  POINTER_MOTION   +12.80s	  0.11/  0.00

If there's real pointer wobble we may have to adjust the fuzz factor, that seems to be something worth doing with an EV_ABS override. But meanwhile, I'm going to claim this is a kernel bug.

https://patchwork.kernel.org/patch/10166045/


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.