Bug 105303 - Kernel absfuzz handling is inconsistent
Summary: Kernel absfuzz handling is inconsistent
Status: RESOLVED FIXED
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:
Blocks: 104828 105108
  Show dependency treegraph
 
Reported: 2018-03-01 06:02 UTC by Peter Hutterer
Modified: 2018-03-09 04:11 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Python program to illustrate the kernel defuzz issue (1.06 KB, text/plain)
2018-03-01 06:02 UTC, Peter Hutterer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Hutterer 2018-03-01 06:02:24 UTC
Created attachment 137711 [details]
Python program to illustrate the kernel defuzz issue

This is mostly for archiving purposes only but:
The kernel has absfuzz handling for axes with a fuzz != 9, see input_defuzz_abs_event() in drivers/input/input.c. The output of that function is nonlinear and can generate 'jumps' in deltas especially around the fuzz * 2 range.

These jumps are visible when the finger moves by a given delta and the resulting defuzzed deltas are largely different despite the almost constant speed. The output of the attached python script:

* 'value' is the new device coordinate
* 'old_val' is the previous device coordinate
* fuzz is 8 in this output
* defuzzed is the value delivered to userspace (would become old_val but not in this script)
* delta are the delta between the userspace-visible values vs the real delta in device values 
* error is the difference between the deltas

value  76 old_val 100: defuzzed:  76 delta -24|-24 error:   0 
value  77 old_val 100: defuzzed:  77 delta -23|-23 error:   0 
value  78 old_val 100: defuzzed:  78 delta -22|-22 error:   0 
value  79 old_val 100: defuzzed:  79 delta -21|-21 error:   0 
value  80 old_val 100: defuzzed:  80 delta -20|-20 error:   0 
value  81 old_val 100: defuzzed:  81 delta -19|-19 error:   0 
value  82 old_val 100: defuzzed:  82 delta -18|-18 error:   0 
value  83 old_val 100: defuzzed:  83 delta -17|-17 error:   0 
value  84 old_val 100: defuzzed:  84 delta -16|-16 error:   0 
value  85 old_val 100: defuzzed:  92 delta  -8|-15 error:  -7 
value  86 old_val 100: defuzzed:  93 delta  -7|-14 error:  -7 
value  87 old_val 100: defuzzed:  93 delta  -7|-13 error:  -6 
value  88 old_val 100: defuzzed:  94 delta  -6|-12 error:  -6 
value  89 old_val 100: defuzzed:  94 delta  -6|-11 error:  -5 
value  90 old_val 100: defuzzed:  95 delta  -5|-10 error:  -5 
value  91 old_val 100: defuzzed:  95 delta  -5| -9 error:  -4 
value  92 old_val 100: defuzzed:  96 delta  -4| -8 error:  -4 
value  93 old_val 100: defuzzed:  98 delta  -2| -7 error:  -5 
value  94 old_val 100: defuzzed:  98 delta  -2| -6 error:  -4 
value  95 old_val 100: defuzzed:  98 delta  -2| -5 error:  -3 
value  96 old_val 100: defuzzed:  99 delta  -1| -4 error:  -3 
value  97 old_val 100: defuzzed: 100 delta   0| -3 error:  -3 
value  98 old_val 100: defuzzed: 100 delta   0| -2 error:  -2 
value  99 old_val 100: defuzzed: 100 delta   0| -1 error:  -1 
value 100 old_val 100: defuzzed: 100 delta   0|  0 error:   0 
value 101 old_val 100: defuzzed: 100 delta   0|  1 error:   1 
value 102 old_val 100: defuzzed: 100 delta   0|  2 error:   2 
value 103 old_val 100: defuzzed: 100 delta   0|  3 error:   3 
value 104 old_val 100: defuzzed: 101 delta   1|  4 error:   3 
value 105 old_val 100: defuzzed: 101 delta   1|  5 error:   4 
value 106 old_val 100: defuzzed: 101 delta   1|  6 error:   5 
value 107 old_val 100: defuzzed: 101 delta   1|  7 error:   6 
value 108 old_val 100: defuzzed: 104 delta   4|  8 error:   4 
value 109 old_val 100: defuzzed: 104 delta   4|  9 error:   5 
value 110 old_val 100: defuzzed: 105 delta   5| 10 error:   5 
value 111 old_val 100: defuzzed: 105 delta   5| 11 error:   6 
value 112 old_val 100: defuzzed: 106 delta   6| 12 error:   6 
value 113 old_val 100: defuzzed: 106 delta   6| 13 error:   7 
value 114 old_val 100: defuzzed: 107 delta   7| 14 error:   7 
value 115 old_val 100: defuzzed: 107 delta   7| 15 error:   8 
value 116 old_val 100: defuzzed: 116 delta  16| 16 error:   0 
value 117 old_val 100: defuzzed: 117 delta  17| 17 error:   0 
value 118 old_val 100: defuzzed: 118 delta  18| 18 error:   0 
value 119 old_val 100: defuzzed: 119 delta  19| 19 error:   0 
value 120 old_val 100: defuzzed: 120 delta  20| 20 error:   0 
value 121 old_val 100: defuzzed: 121 delta  21| 21 error:   0 
value 122 old_val 100: defuzzed: 122 delta  22| 22 error:   0 
value 123 old_val 100: defuzzed: 123 delta  23| 23 error:   0 

Note how a device delta of -15 generates a delta of -8 but a device delta of -16 generates a delta of -16. Likewise for deltas +15 and +16. A finger moving at that speed will likely see jumps. The output is even weirder when we have negative values, but let's ignore that for now.

Given that libinput's hysteresis goes on top of what the kernel does, it's possible that we have those jumps as well. It is unclear if that is an issue though.
Comment 1 Peter Hutterer 2018-03-01 06:54:05 UTC
Ok, correction, I can definitely see this in the evemu output when moving the finger at the right speed. 

 0.203628: ↖←   -6/  -1 |  *********** | 
 0.214089: ↖←   -6/  -1 |  *********** | 
 0.224535: ↖←   -7/  -1 |  *********** | 
 0.235977: ↖←  -16/  -1 |  *********** | 
 0.246466: ↖←   -4/  -1 |  *********** | 
 0.256877: ↖←   -8/  -1 |  *********** | 
 0.267404: ↖←  -18/  -1 |  *********** | 
 0.278001: ↙←   -5/   1 |  *********** | 
 0.288391: ↙←   -8/   1 |  *********** | 
 0.299927: ↙←   -7/   1 |  *********** | 

 1.023105: ↙←   -5/   1 |  *********** | 
 1.034596: ↙←   -6/   1 |  *********** | 
 1.045008: ↙←   -8/   1 |  *********** | 
 1.055571: ↙←  -17/   1 |  *********** | 
 1.065956: ↙←   -4/   1 |  *********** | 
 1.077443: ↙←   -6/   1 |  *********** | 

 1.764681: ↙←   -8/   1 |  *********** | 
 1.775162: ↙←   -7/   1 |  *********** | 
 1.785659: ↙←   -7/   1 |  *********** | 
 1.796078: ↙←  -16/   1 |  *********** | 
 1.807551: ↙←   -6/   1 |  *********** | 
 1.818055: ↙←   -8/   1 |  *********** | 
 1.828526: ↙←   -8/   1 |  *********** | 
 1.839002: ↙←   -8/   1 |  *********** | 
 1.849412: ↙←  -16/   1 |  *********** | 
 1.859886: ↙←   -4/   1 |  *********** | 
 1.870399: ↙←   -4/   1 |  *********** | 
 1.881919: ↙←   -5/   1 |  *********** | 


Note how the values are all close together but we have that jump from -8 to -16 and similar. This needs to be fixed and may be the reason for the cursor jumps at a slow (but not super-slow) motion speed.
Comment 2 Peter Hutterer 2018-03-09 04:11:41 UTC
commit 1523d8bb2e066bec297f7a03ce4a0d8cada8f383
Author: Peter Hutterer <>
Date:   Mon Mar 5 13:17:43 2018 +1000

     Extract and reset the abs fuzz value for the x/y axes


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.