Ticket #1194 (closed defect: fixed)

Opened 7 years ago

Last modified 5 years ago

Touchscreen Jitter

Reported by: mickey@… Owned by: openmoko-kernel
Priority: high Milestone:
Component: kernel Version: unspecified
Severity: normal Keywords:
Cc: buglog@…, andy@…, joerg@… Blocked By:
Blocking: Estimated Completion (week):
HasPatchForReview: no PatchReviewResult:
Reproducible:

Description

There's still a lot of jitter coming from the touchscreen. Apparantly the tslib
dejitter plugin is uneffective -- perhaps the data from the kernel are too bad
to make the tslib plugins do their job. This needs an optimization session as it
ruins the user interface when scrolling through lists.

Attachments

sdltest-bb+src.tar.bz2 (78.4 KB) - added by thebohemian@… 6 years ago.
sdl test app embedded in its OE recipe
lowpass.c (3.1 KB) - added by Batchyx 6 years ago.
stupid lowpass filter plugin for tslib

Change History

comment:1 Changed 6 years ago by andy@…

  • Cc andy@… added

How can I see this jitter to evaluate it?

Is there a sketchbook type application, for example?

comment:2 Changed 6 years ago by cwixon@…

  • Status changed from new to assigned

On my GTA01, jitter is fairly limited to bouncing back and forth between
adjacent pixel values. It's easy to see this by SSH-ing in and running

DISPLAY=:0 xev

and watching the values oscillate as you hold a stylus as still as possible on
the touchscreen.

This jitter doesn't really affect scrolling or drawing (using xournal, for
example) in my case, but it DOES cause the on-screen keyboard, which should
repeat indefinitely if you hold a key down, to STOP repeating after a short
unpredictable interval.

comment:3 Changed 6 years ago by cwixon@…

Actually, I forgot about ts_print and ts_print_raw, which are command-line
programs that just spit out time-stamped touchscreen coordinates.

The _raw version gives you the unprocessed 10-bit values before they are mapped
into screen coordinates.

Just for amusement's sake, here's a short segment of ts_print_raw output with my
stylus held as stationary as possible near the center of the screen:

1201910359.402200: 509 493 1
1201910359.447114: 507 493 1
1201910359.462275: 508 493 1
1201910359.477234: 510 494 1
1201910359.492121: 506 494 1
1201910359.507215: 508 494 1
1201910359.582220: 508 493 1
1201910359.597139: 509 494 1
1201910359.612217: 508 494 1
1201910359.657124: 507 493 1
1201910359.672120: 507 494 1
1201910359.687227: 508 493 1
1201910359.732117: 509 494 1
1201910359.747130: 509 493 1
1201910359.762235: 508 494 1
1201910359.777138: 508 493 1
1201910359.792180: 507 494 1
1201910359.807220: 507 493 1
1201910359.822221: 508 493 1
1201910359.837121: 508 494 1
1201910359.882126: 507 493 1
1201910359.897226: 509 494 1
1201910359.912226: 508 493 1
1201910359.927135: 510 493 1
1201910359.942229: 507 494 1
1201910359.957128: 508 494 1
1201910359.972235: 507 493 1
1201910359.987216: 507 494 1
1201910360.002224: 508 494 1
1201910360.017245: 507 495 1
1201910360.032191: 509 494 1
1201910360.047166: 506 493 1
1201910360.062231: 508 494 1
1201910360.077140: 509 493 1
1201910360.092198: 507 493 1
1201910360.107140: 506 493 1
1201910360.122227: 507 493 1
1201910360.137170: 508 494 1
1201910360.152229: 509 493 1
1201910360.182216: 508 493 1
1201910360.197135: 507 494 1
1201910360.212218: 507 493 1
1201910360.227218: 508 493 1
1201910360.272225: 509 493 1
1201910360.287131: 508 494 1
1201910360.302224: 510 493 1
1201910360.317185: 506 494 1
1201910360.332227: 507 493 1
1201910360.347122: 507 494 1
1201910360.362195: 508 494 1

I'm not sure (without looking at the code) whether dejitter has been applied at
this point or not.

comment:4 Changed 6 years ago by mickey@…

Clarke: According to tslib this is already dejittered *cough*. Which makes it
clear that either the dejittering plugin for tslib does not work or the kernel
provides data that is too variadic for this plugin.

Andy: the package tslib-tests contains testing applications. ts_test for graphic
testing, ts_print and ts_print_raw for numeric testing.

comment:5 Changed 6 years ago by balrogg@…

May be worth playing with the tslib parameters - I don't know where a full
reference of the plugin parameters is documented but the iPaq H3600 uses this
for tslib.conf:

module_raw input
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear

So at least these few should exist.

However, it may be just a result of the typical touchscreen noise. The
super-high resolution of the Neo screen for sure makes the noise seem more
severe than on other devices.

comment:6 Changed 6 years ago by cwixon@…

The file /etc/ts.conf contains exactly the same parameters and values on my Neo.

And a quick browse through the tslib source suggests that the dejitter plugin

isn't very tunable -- that "delta" figure is only used to temporarily stop
dejittering when quick stylus movement is detected.

Dejitter performs a smoothing function by taking a weighted average of the four
most recent samples, and unless that "delta" square-of-distance threshold is
crossed between successive samples, outputs the smoothed value.

I'm thinking that this four-sample smoothing might not be aggressive enough for
our hardware -- I think we could benefit from even more smoothing plus some
hysteresis, for example. Maybe I'll cobble together some attempts at this, if I
have time over the next week or so.

It will be interesting to see -- I haven't looked -- how bad the tslib data are
when using a finger rather than stylus. Quite ugly, I suspect.

comment:7 Changed 6 years ago by thebohemian@…

This is probably related if not I will open a new PR:

If I have a fullscreen SDL application and use the stylus to click near the
screen borders SDL's internal mouse pointer variables go nuts. What happens is
that if you click near the right/left border, the y coordinate gets a big offset
(from the real location) vice versa for the up/bottom border. Now you might say,
that this is a SDL issue but I think it has to do with the values reported by
the touchscreen. If run tsprint I get negative values for the top/left border
and values equal or bigger than the display width/height for the right/bottom
border.

If SDL - for some reason - does not expect this to happen it might choke on it.
I am looking forward to provide a test application.

Changed 6 years ago by thebohemian@…

sdl test app embedded in its OE recipe

comment:8 Changed 6 years ago by mickey@…

Interestingly, the jitter is much less on the GTA02 -- could that be because the
display is actually attached to the Glamo? If so, what can we learn from that to
improve the experience for our existing GTA01 customers?

comment:9 Changed 6 years ago by mickey@…

  • Owner changed from willie_chen@… to openmoko-kernel@…
  • Status changed from assigned to new

ADMIN: Reassigning to default owner.

comment:10 Changed 6 years ago by joerg@…

  • Cc joerg@… added

comment:11 Changed 6 years ago by thebohemian@…

Please ignore my comment (comment 8). I think my problem is different from what
is discussed here and opened #1357 for it.

comment:12 Changed 6 years ago by andy

I studied this some weeks ago and also found the jitter is only present on the "tall" axis of the LCM, same as can be seen from cwixon's dump. I cranked up the sample rate in ts platform and it didn't help. So it's still a real problem, not helped to a solution by the ts pins being so hard to probe with a 'scope.

comment:13 Changed 6 years ago by roh

  • Owner changed from openmoko-kernel@… to openmoko-kernel

comment:14 Changed 6 years ago by Batchyx

I've implemented a simple-but-working dejittering tslib plugin that's a bit more aggressive. It's basically a stupid lowpass filter and then a filter that ignore small movements.

But one of the problems that still remain is when the touchpad reported a release event followed by a press event while dragging.

Before (with a stylus) :
1223807388.426237: 351 344 1
1223807388.451233: 351 344 1
1223807388.471196: 351 345 1
1223807388.496021: 351 345 1
1223807388.526362: 351 345 1
1223807388.551225: 351 345 1
1223807388.576265: 352 345 1
1223807388.606316: 352 345 1
1223807388.631304: 352 345 1
1223807388.656241: 352 344 1
1223807388.681232: 352 345 1

After :
1223807524.541163: 395 346 1
1223807524.566154: 395 346 1
1223807524.596249: 395 346 1
1223807524.621214: 395 346 1
1223807524.646169: 395 346 1
1223807524.676269: 395 346 1
1223807524.701218: 395 346 1
1223807524.726160: 395 346 1
1223807524.746146: 395 346 1
1223807524.776189: 395 346 1
1223807524.806265: 395 346 1
1223807524.836228: 395 346 1
1223807524.861160: 395 346 1
1223807524.881208: 395 346 1
1223807524.911142: 395 346 1
1223807524.946203: 395 346 1
1223807524.971223: 395 346 1
1223807524.996176: 395 346 1

Before (with a finger) :
1223807468.901233: 246 541 1
1223807468.936273: 247 541 1
1223807468.966163: 247 541 1
1223807468.996255: 247 541 1
1223807469.026267: 247 541 1
1223807469.056241: 247 541 1
1223807469.091309: 246 541 1
1223807469.121207: 246 541 1
1223807469.151334: 246 542 1
1223807469.181235: 245 542 1
1223807469.211325: 245 542 1
1223807469.241233: 245 543 1
1223807469.271311: 244 544 1
1223807469.301354: 244 543 1
1223807469.326284: 244 544 1
1223807469.356265: 244 544 1
1223807469.386287: 244 544 1
1223807469.416234: 244 544 1
1223807469.441288: 244 544 1
1223807469.466151: 243 544 1
1223807469.491217: 243 545 1
1223807469.516293: 242 545 1

After (with a finger) :
1223807767.166412: 162 550 1
1223807767.186402: 162 550 1
1223807767.206402: 161 551 1
1223807767.226347: 160 551 1
1223807767.251349: 160 551 1
1223807767.276379: 160 551 1
1223807767.296340: 160 551 1
1223807767.321160: 160 551 1
1223807767.341332: 159 551 1
1223807767.366164: 159 551 1
1223807767.391349: 159 551 1
1223807767.416355: 159 551 1
1223807767.436323: 159 551 1
1223807767.461164: 159 551 1
1223807767.486411: 159 551 1
1223807767.516417: 159 551 1
1223807767.541325: 159 551 1

One problem that still remain is when the touchscreen report a release then a press when we are dragging ...

Changed 6 years ago by Batchyx

stupid lowpass filter plugin for tslib

comment:15 Changed 6 years ago by tick

  • HasPatchForReview unset

wow.. Cool Batchyx.

I was dealing with mouse up/down jitter last week.
http://git.openmoko.org/?p=kernel.git;a=commit;h=abe8f448547d1bd69ac2963e07e2657f27b79691
I think this may help palliating your last problem.

Actually in kernel driver, it calculate the average of some samples within threshold and the send to user space.

If the touch pressure is very light, the data came out from device will be very unstable.

comment:16 Changed 6 years ago by john_lee

  • Status changed from new to in_testing

let's see if tick's patch is going to improve this.

comment:17 Changed 6 years ago by TimoJyrinki

Tick's patch really helped a lot with the usability of the touchscreen. Much less erronous "clicks"/selections.

However, I just created a ticket #2137 about the fact the functionality is not there anymore with the stable-tracking kernel. The code has changed, and something similar to tick's patch should be done there, too.

comment:18 Changed 6 years ago by andy

Tick updated his patch for stable-tracking and it is on there since thismorning.

comment:19 Changed 6 years ago by safire

I tested the lowpass module with Debian, and find that it helps quite a bit. In my testing, I got the best results putting the lowpass module after dejitter. This is despite seeing no effect of changing the delta parameters for the variance and dejitter modules.

For others that may want to try with Debian:

apt-get install libtool automake g++
apt-get source tslib

After building tslib I copied lowpass.so and lowpass.la to /usr/lib/ts and added "module lowpass" after dejitter in /etc/ts.conf.

comment:20 follow-up: ↓ 21 Changed 6 years ago by arhuaco

Safire:

We just added a commit that improves the filter a lot. I hope you can try the latest version of the andy-tracking kernel (or stable tracking if you were using it).

I'm in the middle of a tslib filter that removes the first N and the last M points in a DOWN-POINTS-UP event. I think it's useful with N=1 and M=1 (we are already removing the first event in the kernel driver but I think it should be done in user-space).

I will update this ticket as soon as I'm done to see if it also helps.

Regards.

comment:21 in reply to: ↑ 20 ; follow-up: ↓ 22 Changed 6 years ago by arhuaco

Replying to arhuaco:

I will update this ticket as soon as I'm done to see if it also helps.

Mmm. The filter is ready. It helps ignoring the last point.

http://lists.openmoko.org/pipermail/openmoko-kernel/2008-November/006954.html

PS: This message I'm sending seems off-topic in this bug report.

comment:22 in reply to: ↑ 21 ; follow-up: ↓ 23 Changed 6 years ago by safire

Replying to arhuaco:

I will update this ticket as soon as I'm done to see if it also helps.

Mmm. The filter is ready. It helps ignoring the last point.

I tested the "skip" filter, but *not* with any modified kernel.

What I find is that the combination of the lowpass and the skip filters makes for a nice click input event and stable hold. I agree that using nhead=1 is better than 0.

Here's my ts.conf:

module_raw input
module pthres pmin=1
module skip nhead=1 ntail=1
module variance delta=30
module dejitter delta=100
module lowpass
module linear

Haven't been playing with different kernels with Debian yet...not sure the compatibility there.

comment:23 in reply to: ↑ 22 Changed 6 years ago by arhuaco

Replying to safire:

What I find is that the combination of the lowpass and the skip filters makes for a nice click input event and stable hold. I agree that using nhead=1 is better than 0.

I just wanted to let you know that I updated the skip filter patch. It had some bugs.
It should be much better now.

I'm about to send a patch for the andy-tracking kernel that includes a similar filter since we will need it anyway. Thus this filter might be useful just for the actual stable kernel.

Regards.

comment:24 follow-up: ↓ 26 Changed 6 years ago by safire

Any update on this? I just reinstalled Debian from scratch, and I again see significant jitter with the touchscreen. The "skip" and "lowpass" filters are a nice combo. I also don't see them in the Om2008.12 update.

comment:25 Changed 6 years ago by andy

This should be solved on the 2.6.28 kernels using in-kernel filtering.

comment:26 in reply to: ↑ 24 Changed 6 years ago by arhuaco

Replying to safire:

As andy said this should be fixed now. The skip filter is no longer needed. In fact, with the latest kernel you can get away with no filtering using just the input and the calibration module like this:

ts.conf:

module_raw input
module linear

comment:27 Changed 5 years ago by andy

  • Status changed from in_testing to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.