Bug 95290 - synaptics touchpad jitter
Summary: synaptics touchpad jitter
Status: RESOLVED FIXED
Alias: None
Product: Wayland
Classification: Unclassified
Component: libinput (show other bugs)
Version: 1.2.x
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Wayland bug list
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-06 03:31 UTC by liam
Modified: 2016-05-23 04:55 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
libinput version, settings, vendor model #, modalias, trackpad dimensions (1.56 KB, text/plain)
2016-05-06 03:31 UTC, liam
Details
evemu-record of jitter from scrolling (118.60 KB, text/plain)
2016-05-06 03:32 UTC, liam
Details
evemu-record of pointer jitter (109.49 KB, text/plain)
2016-05-06 03:32 UTC, liam
Details
evemu recording of still finger (no observable jitter) (65.16 KB, text/plain)
2016-05-07 04:51 UTC, liam
Details
another evemu scrolling jitter recording (118.60 KB, text/plain)
2016-05-10 21:32 UTC, liam
Details
screencast of evemu-play with "another evemu scrolling jitter recording" (3.85 MB, video/webm)
2016-05-18 01:51 UTC, liam
Details
single finger recording (76.00 KB, text/plain)
2016-05-19 17:49 UTC, liam
Details
recording of LIBINPUT_MODEL_WOBBLY_TOUCHPAD (1.44 MB, video/webm)
2016-05-19 18:11 UTC, liam
Details
screencast of evdev override with fuzz=22 (1.43 MB, video/webm)
2016-05-19 18:13 UTC, liam
Details

Description liam 2016-05-06 03:31:27 UTC
Created attachment 123515 [details]
libinput version, settings, vendor model #, modalias, trackpad dimensions

The trackpad passes along movement even when my fingers aren't moving.
Depending on context,this manifests as either a jittery pointer (randomly hops about a, roughly, five square pixel area) or, when I've two fingers on the trackpad, it will randomly scroll by about the same amount as the pointer jitters.

This bug looks a bit simlar to #94097 (https://bugs.freedesktop.org/show_bug.cgi?id=94097), but that patch seems aimed at SEMI_MT synaptics, while mine lacks that property according to evemu-describe.
I tried mtview, but the jitter wasn't visible, and, unfortunately, I couldn't determine how to pipe evemu-play to mtview.
I also tried generating a hwdb entry but that doesn't seem to have worked (I reloaded udev using systemctl, but I haven't yet rebooted).
Comment 1 liam 2016-05-06 03:32:27 UTC
Created attachment 123516 [details]
evemu-record of jitter from scrolling
Comment 2 liam 2016-05-06 03:32:58 UTC
Created attachment 123517 [details]
evemu-record of pointer jitter
Comment 3 Peter Hutterer 2016-05-06 05:13:20 UTC
please record yourself just holding the finger still on the touchpad so I can differentiate it from the actual pointer movement. The two recordings here have two small movements but not the usual pointer wobbling that's caused by jittering touchpads. So either this is already fixed and doesn't happen in my current libinput here or the recording didn't reproduce the jitter well enough.
Comment 4 liam 2016-05-07 04:51:11 UTC
Created attachment 123532 [details]
evemu recording of still finger (no observable jitter)

I ran a live image of fedora 24 pre-beta (composed 30/4) and it produced the same results as I explained in the initial report. Admittedly, I THINK it was running the same version of libinput.
Is there a particular version of libinput I should try?
Comment 5 Peter Hutterer 2016-05-10 08:47:21 UTC
whatever the latest release is, so fedora is usually fine. but libinput doesn't affect the evemu recording anyway, so you don't need to worry about that.

can you explain the jitter in more detail please. because if that's a recording without jitter I don't quite know when you're getting it, and I'll need a recording that reproduces it reliably.
Comment 6 liam 2016-05-10 21:32:31 UTC
Created attachment 123612 [details]
another evemu scrolling jitter recording

The last recording is, as requested in comment 3, an evemu recording of my finger touching the trackpad without movement.

I tried another recording of the scrolling jitter. It seems to playback correctly but the window it plays back on must have a canvas long enough to scroll in both directions.
If you like, I can attach a screencast along with an evemu recording.
Comment 7 Peter Hutterer 2016-05-11 03:45:16 UTC
ok, I still don't know what exactly I'm supposed to be looking at here. Let's make sure we don't clash in terminology terms: jitter means that the pointer keeps moving even when the finger(s) is/are held still. jumps mean that the pointer suddenly moves by a large amount.

I didn't see any jitter in the recording of the still finger, usually we'll see some pointer movement when a touchpad is jittery.

In this recording I can see scroll events and I can see some small ca 1 pixel up down movement after the button click event, but it's hard to tell what the movement is supposed to be given the other movements in the event. Also remember, I can only see the touchpad events, not your finger so it's sometimes hard to tell what is intended and what isn't.

So, I'm sorry but I'll need you to explain in detail what the bug is you're seeing and when. And ideally produce an evemu-recording that isolates this behaviour and has no or hardly any other events in it.
Comment 8 liam 2016-05-18 01:51:12 UTC
Created attachment 123862 [details]
screencast of evemu-play with "another evemu scrolling jitter recording"

(In reply to Peter Hutterer from comment #7)
> ok, I still don't know what exactly I'm supposed to be looking at here.
> Let's make sure we don't clash in terminology terms: jitter means that the
> pointer keeps moving even when the finger(s) is/are held still. jumps mean
> that the pointer suddenly moves by a large amount.
> 
> I didn't see any jitter in the recording of the still finger, usually we'll
> see some pointer movement when a touchpad is jittery.
> 
> In this recording I can see scroll events and I can see some small ca 1
> pixel up down movement after the button click event, but it's hard to tell
> what the movement is supposed to be given the other movements in the event.
> Also remember, I can only see the touchpad events, not your finger so it's
> sometimes hard to tell what is intended and what isn't.
> 
> So, I'm sorry but I'll need you to explain in detail what the bug is you're
> seeing and when. And ideally produce an evemu-recording that isolates this
> behaviour and has no or hardly any other events in it.

I said this in the initial report:

The trackpad passes along movement even when my fingers aren't moving.
Depending on context,this manifests as either a jittery pointer (randomly hops about a, roughly, five square pixel area) or, when I've two fingers on the trackpad, it will randomly scroll by about the same amount as the pointer jitters.

The issue with (two-finger) scrolling is analogous to the pointer jitter: when holding two fingers still on the trackpad, the page will move up and down a bit (again, it looks to be ABOUT -+5 pixels...on both the x and y axis if those freedoms are available).
Now, I'd call that amount of movement jitter rather than jumps.
If that doesn't explain the problem sufficiently, can you please tell me how you'd like it phrased? I spent quite a while reading about this before posting the bug so that: 1. it hadn't yet been reported (similar bugs have been reported, but not for this model trackpad), 2. you had all the information you needed (from https://wayland.freedesktop.org/libinput/doc/latest/reporting_bugs.html).
I'm attaching a screencast which plays back the recording called "another evemu scrolling jitter recording". I use two finger scroll twice. It's after the second scroll ends that you see a pretty substantial jitter (around the 6s mark and lasts for around 2s).
I hope this helps.
Comment 9 Peter Hutterer 2016-05-19 05:07:18 UTC
ok, that's jitter so we talk about the same thing. The problem is that the recordings didn't reproduce this in a useful manner, ideally you could provide me with an evemu-recording that reproduces the jitter on a single-finger movement.

Anyway, save this as /etc/udev/hwdb.d/90-libinput-yoga.hwdb, then run sudo udevadm hwdb --update, then reboot.

libinput:name:*SynPS/2 Synaptics TouchPad*:dmi:*svnLENOVO*pvrLenovoYoga213:*
 LIBINPUT_MODEL_WOBBLY_TOUCHPAD=1

Note the space before the LIBINPUT_.. tag
When successfully applied, udevadm info /sys/class/input/eventX should show the tag applied. If it doesn't show up, make sure I didn't add a typo.
Comment 10 liam 2016-05-19 17:49:36 UTC
Created attachment 123919 [details]
single finger recording
Comment 11 liam 2016-05-19 18:09:31 UTC
Hi Peter,

I applied the hwdb override that you provided, but the problem persisted.

However, working from your matching pattern for udev, I applied an evdev override as follows:

evdev:name:*SynPS/2 Synaptics TouchPad*:dmi:*svnLENOVO*pvrLenovoYoga213:*   
 EVDEV_ABS_00=:::22
 EVDEV_ABS_01=:::22
 EVDEV_ABS_35=:::22
 EVDEV_ABS_36=:::22 


Those fuzz values are far higher than the default values of 8, but I found them with trial and error. IOW, they probably aren't the min. 
I'm going to attach a couple of smaller screencasts which demonstrate the results of LIBINPUT_WOBBLY_MODEL_TOUCHPAD, and the above evdev override.

I wonder if there is an issue with my touchpad's resolution. That would explain, I think, the jumps, and the insanely twitchy scrolling speeds (which I haven't yet reported). I did physically measure the touchpad, and it matched the values from the udev hwdb (though not the far more precise values reported by some other tool...which I cannot recall the name of).
Comment 12 liam 2016-05-19 18:11:19 UTC
Created attachment 123922 [details]
recording of LIBINPUT_MODEL_WOBBLY_TOUCHPAD
Comment 13 liam 2016-05-19 18:13:05 UTC
Created attachment 123923 [details]
screencast of evdev override with fuzz=22
Comment 14 Peter Hutterer 2016-05-20 01:45:01 UTC
did you restart X? oh, and what version of libinput do you have (still 1.2.4?), because you'll need 1.3 for libinput to actually parse that property. I just pushed out libinput-1.2.4-3.fc23, you can test on top of that too.

I replayed the file here, I get jitter without the patch, once the patch is applied the jitter stops and the cursor is rock-solid.
Comment 15 liam 2016-05-20 02:37:10 UTC
Success!

I removed my evdev override (the extra fuzzy one) and replaced it with the libinput hint for wobbly touchpads, installed libinput-1.3.0-2 from koji (I was using 1.2.4-2; I updated my cache but still didn't see an update, so I decided to just go straight to 1.3), and ran the "another evemu scrolling jitter recording". As you said, it was rock solid.

Just curious: it looks like this enables libinput's hysteresis functionality (which itself looks like it halves the resolution, in this case) rather than modifying any of the evdev device properties (like halving the resolution). If that's the case, why not change the resolution directly (since halving might not always work), and it looks like you've already set aside 20 special case evdev device models rather than using the flag?

Regardless, thanks for all the help!
Comment 16 Peter Hutterer 2016-05-20 02:55:52 UTC
the resolution itself is also used for determining the real touchpad size and a bunch of other things hang off that. So we can't really half the resolution without breaking other bits. and the hysteresis also has a moving center which makes some motion a bit more reliable.

what you're looking for is potentially adjusting the fuzz value which is something we could do instead of enabling the hysteresis. I never thought of it that way. But this is where it gets a bit blurry. All the other special device models adjust for size and actual resolution which are definitive hardware properties. The fuzz value is more implementation-dependent as some other implementation may not care about fuzz. so I think I'm more comfortable having this in libinput.

Also note that the wobbly touchpad tag is named like this for a reason. right now it only enables the hysteresis but if we find a better way to deal with this we may change this at any time in the future.

Thanks for testing, patch is on the list
https://lists.freedesktop.org/archives/wayland-devel/2016-May/028987.html
Comment 17 liam 2016-05-20 04:03:49 UTC
That makes sense. 
Thanks for the explanation.
Comment 18 Peter Hutterer 2016-05-23 04:55:37 UTC
commit 595b5f6ae7b5236e0115ce3695eddb6da7552a3d
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu May 19 15:04:24 2016 +1000

    udev: add the Yoga 2 to the wobbly touchpads


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.