diff options
author | Simon Thum <simon.thum@gmx.de> | 2009-02-28 22:17:47 +0100 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-20 14:48:57 +1000 |
commit | 1a71862d333282e2d251ff0036866cec22bcce85 (patch) | |
tree | a48b3a2c8b6ae22069b489722b5ce1268b4b372b /hw | |
parent | 5ae129baef85b47590c02e4cf61b23904d8f7aa9 (diff) |
dix/xfree86: simplified velocity approximation algorithm
Replace multi-stage filtering with simple linear velocity,
tracked several instances backwards. A heuristic ensures
only approximately linear motion is considered, so velocity
remains valid in any case. Numerical stability is much
better, and nothing changes to people who didn't tune the
advanced features of the previous algorithm.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/common/xf86Xinput.c | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index d260570cd..3a56b49b2 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -104,8 +104,8 @@ static void ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list, DeviceVelocityPtr s) { - int tempi, i; - float tempf, tempf2; + int tempi; + float tempf; Atom float_prop = XIGetKnownProperty(XATOM_FLOAT); Atom prop; @@ -150,10 +150,6 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list, tempf = xf86SetRealOption(list, "ExpectedRate", 0); prop = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING); if(tempf > 0){ - if(tempf > 300){ - xf86Msg(X_WARNING, "%s: (accel) Using ExpectedRate > 300 may not " - "yield good controllability!\n", devname); - } tempf = 1000.0 / tempf; XIChangeDeviceProperty(pDev, prop, float_prop, 32, PropModeReplace, 1, &tempf, FALSE); @@ -163,38 +159,21 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list, PropModeReplace, 1, &tempf, FALSE); } - /* advanced stuff, best kept in .fdi's */ - tempf = xf86SetRealOption(list, "FilterHalflife", -1); - if(tempf > 0) - tempf = 1.0 / tempf; /* set reciprocal if possible */ - - tempf2 = xf86SetRealOption(list, "FilterChainProgression", 2.0); - xf86Msg(X_CONFIG, "%s: (accel) filter chain progression: %.2f\n", - devname, tempf2); - if(tempf2 < 1) - tempf2 = 2; - - tempi = xf86SetIntOption(list, "FilterChainLength", 1); - if(tempi < 1 || tempi > MAX_VELOCITY_FILTERS) - tempi = 1; - - if(tempf > 0.0f && tempi >= 1 && tempf2 >= 1.0f) - InitFilterChain(s, tempf, tempf2, tempi, 40); + tempi = xf86SetIntOption(list, "VelocityTrackerCount", -1); + if(tempi > 1){ + InitTrackers(s, tempi); + } - /* dump filter setup to log */ - for(i = 0; i < MAX_VELOCITY_FILTERS; i++){ - if(s->filters[i].rdecay <= 0) - break; + s->initial_range = xf86SetIntOption(list, "VelocityInitialRange", + s->initial_range); - xf86Msg(X_CONFIG, "%s: (accel) filter stage %i: %.2f ms\n", - devname, i, 1.0f / (s->filters[i].rdecay)); - } + s->max_diff = xf86SetRealOption(list, "VelocityAbsDiff", s->max_diff); - tempf = xf86SetRealOption(list, "VelocityCoupling", -1); + tempf = xf86SetRealOption(list, "VelocityRelDiff", -1); if(tempf >= 0){ - xf86Msg(X_CONFIG, "%s: (accel) velocity coupling is %.1f%%\n", devname, - tempf*100.0); - s->coupling = tempf; + xf86Msg(X_CONFIG, "%s: (accel) max rel. velocity difference: %.1f%%\n", + devname, tempf*100.0); + s->max_rel_diff = tempf; } /* Configure softening. If const deceleration is used, this is expected |