[PATCH xf86-input-synaptics 11/12] Don't use linear regression when calculating touchpad motion deltas

Chase Douglas chase.douglas at canonical.com
Thu Feb 23 10:56:29 PST 2012


On 02/22/2012 10:08 PM, Peter Hutterer wrote:
> On Wed, Feb 22, 2012 at 08:11:58PM -0800, Chase Douglas wrote:
>> On 02/22/2012 07:59 PM, Peter Hutterer wrote:
>>> On Thu, Feb 09, 2012 at 06:53:05PM -0800, Chase Douglas wrote:
>>>> The results depend on the data rate of the device. A device with a
>>>> higher data rate, and thus lower individual deltas, will behave
>>>> differently with the regression calculation.
>>>>
>>>> This can be verified on Synaptics semi-mt clickpads. The data rate is
>>>> halved when two or more touches are on the device. When trying to press
>>>> a button and drag the cursor with another touch, the motion will feel
>>>> faster than dragging with only one touch on the device.
>>>>
>>>> Signed-off-by: Chase Douglas<chase.douglas at canonical.com>
>>>> ---
>>>>   src/synaptics.c |    7 +++----
>>>>   1 files changed, 3 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/src/synaptics.c b/src/synaptics.c
>>>> index dd138ea..9d8f3ee 100644
>>>> --- a/src/synaptics.c
>>>> +++ b/src/synaptics.c
>>>> @@ -2046,9 +2046,8 @@ get_delta(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
>>>>       int x_edge_speed = 0;
>>>>       int y_edge_speed = 0;
>>>>
>>>> -    /* HIST is full enough: priv->count_packet_finger>   3 */
>>>> -    *dx = estimate_delta(hw->x, HIST(0).x, HIST(1).x, HIST(2).x);
>>>> -    *dy = estimate_delta(hw->y, HIST(0).y, HIST(1).y, HIST(2).y);
>>>> +    *dx = hw->x - HIST(0).x;
>>>> +    *dy = hw->y - HIST(0).y;
>>>>
>>>>       if ((priv->tap_state == TS_DRAG) || para->edge_motion_use_always)
>>>>           get_edge_speed(priv, hw, edge,&x_edge_speed,&y_edge_speed);
>>>> @@ -2118,7 +2117,7 @@ ComputeDeltas(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
>>>>        * POLL_MS declaration. */
>>>>       delay = MIN(delay, POLL_MS);
>>>>
>>>> -    if (priv->count_packet_finger<= 3) /* min. 3 packets, see get_delta() */
>>>> +    if (priv->count_packet_finger<= 1)
>>>>           goto out; /* skip the lot */
>>>>
>>>>       if (priv->moving_state == MS_TRACKSTICK)
>>>> --
>>>> 1.7.8.3
>>>>
>>>
>>> uhm, that commit seems a bit too simple. how does this affect other devices?
>>
>> It doesn't feel any different to me, to be honest. It should affect
>> all devices equally, too. Many people have been testing it and no
>> one has mentioned a change in motion behavior.
>>
>> I think estimate_delta() is mainly used for smoothing out the data
>> using interpolation. It's used in other parts of the driver too. I
>> think having the smoothing for pointer motion is unnecessary,
>> though, since we have acceleration profiles. In other words, there's
>> too much smoothing going on already, and dropping this doesn't cause
>> a material difference in the feel of motion.
>
> ok. However that brings up the question - why not remove estimate_delta
> altogether then?

estimate_delta is still used for scroll coasting. While we have 
smoothing for pointer motion provided by the X.org server, we don't have 
smoothing for scrolling. I haven't really thought any deeper about it, 
though. That rationalization was good enough for me.

-- Chase


More information about the xorg-devel mailing list