linux-surface / iptsd

Userspace daemon for Intel Precise Touch & Stylus
GNU General Public License v2.0
86 stars 39 forks source link

Contacts Jittery [SP6] #127

Open OmegaRogue opened 1 year ago

OmegaRogue commented 1 year ago

Contacts seem to be jittery (version: iptsd-1.2.0-1.fc38.x86_64, kernel: 6.2.10-1.surface.fc38.x86_64). See this video: Screencast from 2023-04-26 11-54-42.webm This makes using press and hold gestures in some apps near impossible. I've played around with the stability config values and haven't been able to fix it yet.

StollD commented 1 year ago

The stability config option only changes in how many frames the contact has to appear before it is marked as stable. The tracking algorithm this is based on uses relative distances, so it won't really be affected by jitter.

What you could try is increasing the value of PositionThresholdMin, so that the low, jittery movements are marked as unstable. The ellipse in iptsd-show should turn yellow in that case. The daemon will ignore unstable contacts and the last stable value will stay in effect.

We might be able to better fix this by dropping down the resolution of the touchscreen which right now is honestly a bit ridiculous (9600 x 7200, about 3 to 4 times the screen resolution).

OmegaRogue commented 1 year ago

The stability config option only changes in how many frames the contact has to appear before it is marked as stable. The tracking algorithm this is based on uses relative distances, so it won't really be affected by jitter.

What you could try is increasing the value of PositionThresholdMin, so that the low, jittery movements are marked as unstable. The ellipse in iptsd-show should turn yellow in that case. The daemon will ignore unstable contacts and the last stable value will stay in effect.

We might be able to better fix this by dropping down the resolution of the touchscreen which right now is honestly a bit ridiculous (9600 x 7200, about 3 to 4 times the screen resolution).

Increasing PositionThresholdMin seems to do nothing at all, it seems like the position is stable, but the size/aspect ratio is where the jitter is. I increased it even to 1, still no change

StollD commented 1 year ago

In your video you can clearly see the position (the number in the middle of the ellipse) jitter. Also, press and hold gestures should not depend on the aspect ratio or the size of the contacts, because it is near impossible to keep this stable with a reasonably precise touchscreen.

What value did you set it to? How does the result look in iptsd-show? Every time the position changes, the ellipse should turn yellow.

You could also capture a binary log with iptsd-dump and upload that, so that I can make some tests myself (I can somewhat reproduce this, but I would prefer data from your device just to be sure).

OmegaRogue commented 1 year ago

Changing the value to various values between 0.2 and 1 changed exactly nothing in iptsd-show

StollD commented 1 year ago

I took a closer look at the stability checking code, and wow. I don't know what I thought when I wrote that code, because its not just broken, it is logically completely wrong. xD

None of the stability checks were really working. I have now reworked that part of the code, and the options for limiting position and size should be working now. In my testing they appear to.

If you want to give the changes a try, you can download a development build here: https://github.com/linux-surface/iptsd/actions/runs/5028319406. Scroll down and download the artifact called <your distro>-latest. You will get a zip file with a package inside that you can install through your package manager.