[PATCH libinput 0/4] some acceleration fixes, mostly for high DPI mice

Peter Hutterer peter.hutterer at who-t.net
Mon Nov 3 19:51:26 PST 2014


On Mon, Nov 03, 2014 at 11:56:59AM +0100, David Herrmann wrote:
> Hi
> 
> On Fri, Oct 31, 2014 at 5:33 AM, Peter Hutterer
> <peter.hutterer at who-t.net> wrote:
> > On Thu, Oct 30, 2014 at 04:34:12PM -0500, Derek Foreman wrote:
> >> The acceleration filter currently isn't particularly pleased with gaming mice.
> >>
> >> They generally have high DPI (can be over 8000 DPI) and can have high update
> >> rates (1000+ per second).  This can result in the accel curve being biased
> >> heavily towards the high points on the accel curve.
> >>
> >> This patch set allows a way to normalize the deltas to 400DPI so when the
> >> DPI setting of the mouse is correct, it should feel much the same as a
> >> normal mouse.
> >>
> >> This is, of course, only a partial solution.  Setting a reasonable default
> >> is a massive problem that needs to be addressed in the future - for now
> >> we just set it to 400 (which may actually not be that prevalent any more
> >> but there doesn't seem to be such thing as a "standard" DPI mouse).
> >
> > Thanks, I've pushed 1 to 3 (with added comments), not quite happy with
> > 4 yet. As a configuration interface, it's mismatched with the usual quartett
> > of hooks that we provide for all other config options.
> >
> > But I think providing a visible API may not be the right approach here
> > anyway. One idea I had here was to have this provided through udev, set
> > as something like:
> >     LIBINPUT_MOUSE_DPI="400 at 80" # dpi @ poll rate
> >
> > over time, the udev hwdb could add those settings, or we ship them as
> > extra rules, or users configure them themselves. this is unfortunately a
> > rather nasty task given the amount of HW out there, but I really can't think
> > of any other way (short of heuristics which will fail in too many ways).
> >
> > Any ideas on feasability or better approaches welcome.
> 
> hwdb can be used easily here, but it's indeed a huge amount to gather
> all that data. HID doesn't have a way to query this information,
> sadly, and I haven't found any generic vendor extensions (maybe
> Benjamin knows more).
> 
> We could use the REL_X/REL_Y MAX values to guess the DPI setting and
> ignore it if it's out of the expected range (sth. like 100-10k).
> 
> I haven't spent much time thinking it through, but so far I'd prefer a
> solid, but basic, heuristic to guess the DPI and then use hwdb for
> anything that doesn't fit. This allows us to change the heuristic at
> any time and we don't have to introduce any APIs. We can even ship the
> hwdb files with libinput.

tbh, I don't think heuristics will work. there is no reference point and
when you're looking at relative motion you can't tell if a delta of
10 means the pointer has moved a large distance at low-res or a small
distance at high-res.
 
Anyway, for some data:
I recorded my Logitech G500s here with three different dpi settings (400,
800, 2000) and a MS Comfort Optical Mouse 3000 (1000 dpi). A couple of
interesting things: regardless of dpi, virtually all events are within [-3,
+3] dx/dy and there's nothing over 10. Exception here is the MS mouse which
goes up to 78 for a delta, for reasons I can't explain yet.

The only heuristics I can come up with here is that on high-dpi setting
there are more 2-8 deltas than the lower-dpi settings. That's true for
dpi2000 and dpi1000 on the MS mouse (not sure how much to trust the
latter). That's not something we can quickly guess or learn, any
prolonged heuristic causes the mouse to change behaviour - not ideal.

And we have a feedback loop anyway. If the mouse is too fast, the users
will move it slower and changing the dx/dy vectors, screwing with any
heuristics. That's true for my recordings as well of course and affects the
data sets.

Honestly, I think the only heuristic that makes sense here is "most mice
have 800/1000dpi" and then we fix up anything that doesn't fall into that
category.

Cheers,
   Peter


One REL_X or REL_Y event->value was treated as one 'vector', max/histogram
calculations were done on abs(value).

g500-dpi2000.events
    number of elements: 12746
    max: 11
    mean: 1.84 (median -2)
g500-dpi400.events
    number of elements: 48201
    max: 10
    mean: 1.42 (median -2)
g500-dpi800.events
    number of elements: 41551
    max: 8
    mean: 1.48 (median -1)
ms-COM3000-dpi1000.events
    number of elements: 19729
    max: 78
    mean: 4.58 (median -5)

Histogram:
# values are in % of nevents
#dx/dy	dpi2000	dpi400	dpi8000	dpi1000
1	59.51	72.41	73.60	30.90	
2	20.15	17.99	15.10	22.68	
3	8.82	6.34	5.60	9.91	
4	5.06	2.25	2.70	6.40	
5	3.40	0.67	1.58	5.28	
6	1.66	0.20	0.96	3.18	
7	0.79	0.07	0.37	3.80	
8	0.36	0.04	0.09	2.18	
9	0.14	0.02	0.00	2.54	
10	0.08	0.01	0.00	1.53	
11	0.04	0.00	0.00	1.84	
12	0.00	0.00	0.00	1.05	
13	0.00	0.00	0.00	1.39	
14	0.00	0.00	0.00	0.79	
15	0.00	0.00	0.00	1.01	
16	0.00	0.00	0.00	0.77	
17	0.00	0.00	0.00	0.58	
18	0.00	0.00	0.00	0.67	
19	0.00	0.00	0.00	0.52	
20	0.00	0.00	0.00	0.44	
21	0.00	0.00	0.00	0.30	
22	0.00	0.00	0.00	0.46	
23	0.00	0.00	0.00	0.24	
24	0.00	0.00	0.00	0.27	
25	0.00	0.00	0.00	0.15	
26	0.00	0.00	0.00	0.18	
27	0.00	0.00	0.00	0.10	
28	0.00	0.00	0.00	0.07	
29	0.00	0.00	0.00	0.11	
30	0.00	0.00	0.00	0.09	
31	0.00	0.00	0.00	0.08	
32	0.00	0.00	0.00	0.06	
33	0.00	0.00	0.00	0.03	
34	0.00	0.00	0.00	0.03	
35	0.00	0.00	0.00	0.06	
36	0.00	0.00	0.00	0.05	
37	0.00	0.00	0.00	0.05	
38	0.00	0.00	0.00	0.06	
39	0.00	0.00	0.00	0.03	
40	0.00	0.00	0.00	0.01	
41	0.00	0.00	0.00	0.02	
42	0.00	0.00	0.00	0.02	
43	0.00	0.00	0.00	0.02	
44	0.00	0.00	0.00	0.01	
45	0.00	0.00	0.00	0.02	
46	0.00	0.00	0.00	0.00	
47	0.00	0.00	0.00	0.01	
48	0.00	0.00	0.00	0.01	
49	0.00	0.00	0.00	0.01	
50	0.00	0.00	0.00	0.00	
51	0.00	0.00	0.00	0.01	
52	0.00	0.00	0.00	0.01	
53	0.00	0.00	0.00	0.00	
54	0.00	0.00	0.00	0.00	
55	0.00	0.00	0.00	0.00	
56	0.00	0.00	0.00	0.00	
57	0.00	0.00	0.00	0.00	
58	0.00	0.00	0.00	0.00	
59	0.00	0.00	0.00	0.00	
60	0.00	0.00	0.00	0.00	
61	0.00	0.00	0.00	0.00	
62	0.00	0.00	0.00	0.00	
63	0.00	0.00	0.00	0.00	
64	0.00	0.00	0.00	0.00	
65	0.00	0.00	0.00	0.00	
66	0.00	0.00	0.00	0.00	
67	0.00	0.00	0.00	0.01	
68	0.00	0.00	0.00	0.01	
69	0.00	0.00	0.00	0.01	
70	0.00	0.00	0.00	0.00	
71	0.00	0.00	0.00	0.00	
72	0.00	0.00	0.00	0.00	
73	0.00	0.00	0.00	0.00	
74	0.00	0.00	0.00	0.01	
75	0.00	0.00	0.00	0.00	
76	0.00	0.00	0.00	0.00	
77	0.00	0.00	0.00	0.00	


For a simple gnuplot visualization drop all but the histogram, then:
set style fill solid 0.4 noborder
set style data histogram
set style histogram cluster gap 1

plot 'histogram.txt' using 2:xtic(1) title 'dpi2000',  \
     '' using 3 title 'dpi400', \
     '' using 4 title 'dpi800', \
     '' using 5 title 'dpi1000'




More information about the wayland-devel mailing list