All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: synaptics - disable fuzz when using mt slots
@ 2013-02-01  8:28 Daniel Kurtz
  2013-02-13 21:52 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kurtz @ 2013-02-01  8:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Henrik Rydberg, Seth Forshee, Benjamin Herrenschmidt
  Cc: Chung-Yih Wang, Chase Douglas, linux-input, linux-kernel, Daniel Kurtz

The input fuzz algorithm does a pretty good job filtering out small
jitter on input samples.

However, there is a subtle problem when fuzz is used with mt drivers that
also use input_mt_report_pointer_emulation() to report legacy single
touch coordinates.  The reported single touch coordinates are taken from
the active MT slot with smallest tracking id.  However, since the MT data
is sent first, it has already had FUZZ applied.  Thus, the ST coordinates
actually get FUZZ applied a second time, with the just-fuzzed MT value as
the 'old value'.

It appears that it is non-trivial to fix this in the mt layer/input core,
so, for now, just disable fuzz for the synaptics IMAGE_SENSOR path that
uses input_mt_report_pointer_emulation().

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
---
 drivers/input/mouse/synaptics.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 12d12ca..b6c6838 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -1211,7 +1211,8 @@ static void set_abs_position_params(struct input_dev *dev,
 	int x_max = priv->x_max ?: XMAX_NOMINAL;
 	int y_min = priv->y_min ?: YMIN_NOMINAL;
 	int y_max = priv->y_max ?: YMAX_NOMINAL;
-	int fuzz = SYN_CAP_REDUCED_FILTERING(priv->ext_cap_0c) ?
+	int fuzz = (SYN_CAP_REDUCED_FILTERING(priv->ext_cap_0c) &&
+			!SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) ?
 			SYN_REDUCED_FILTER_FUZZ : 0;
 
 	input_set_abs_params(dev, x_code, x_min, x_max, fuzz, 0);
-- 
1.8.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: synaptics - disable fuzz when using mt slots
  2013-02-01  8:28 [PATCH] Input: synaptics - disable fuzz when using mt slots Daniel Kurtz
@ 2013-02-13 21:52 ` Dmitry Torokhov
  2013-02-14 17:15   ` Daniel Kurtz
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2013-02-13 21:52 UTC (permalink / raw)
  To: Daniel Kurtz
  Cc: Henrik Rydberg, Seth Forshee, Benjamin Herrenschmidt,
	Chung-Yih Wang, Chase Douglas, linux-input, linux-kernel

On Fri, Feb 01, 2013 at 04:28:32PM +0800, Daniel Kurtz wrote:
> The input fuzz algorithm does a pretty good job filtering out small
> jitter on input samples.
> 
> However, there is a subtle problem when fuzz is used with mt drivers that
> also use input_mt_report_pointer_emulation() to report legacy single
> touch coordinates.  The reported single touch coordinates are taken from
> the active MT slot with smallest tracking id.  However, since the MT data
> is sent first, it has already had FUZZ applied.  Thus, the ST coordinates
> actually get FUZZ applied a second time, with the just-fuzzed MT value as
> the 'old value'.
> 
> It appears that it is non-trivial to fix this in the mt layer/input core,
> so, for now, just disable fuzz for the synaptics IMAGE_SENSOR path that
> uses input_mt_report_pointer_emulation().
> 
> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
> ---
>  drivers/input/mouse/synaptics.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index 12d12ca..b6c6838 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -1211,7 +1211,8 @@ static void set_abs_position_params(struct input_dev *dev,
>  	int x_max = priv->x_max ?: XMAX_NOMINAL;
>  	int y_min = priv->y_min ?: YMIN_NOMINAL;
>  	int y_max = priv->y_max ?: YMAX_NOMINAL;
> -	int fuzz = SYN_CAP_REDUCED_FILTERING(priv->ext_cap_0c) ?
> +	int fuzz = (SYN_CAP_REDUCED_FILTERING(priv->ext_cap_0c) &&
> +			!SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) ?
>  			SYN_REDUCED_FILTER_FUZZ : 0;

Hmm, instead of disabling fuzz completely maybe we should disable it
only on the derived axes (ABS_X/ABS_Y) for multitouch devices?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: synaptics - disable fuzz when using mt slots
  2013-02-13 21:52 ` Dmitry Torokhov
@ 2013-02-14 17:15   ` Daniel Kurtz
  2013-02-14 17:22     ` Henrik Rydberg
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kurtz @ 2013-02-14 17:15 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Henrik Rydberg, Seth Forshee, Benjamin Herrenschmidt,
	Chung-Yih Wang, Chase Douglas, linux-input, linux-kernel

On Wed, Feb 13, 2013 at 1:52 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Fri, Feb 01, 2013 at 04:28:32PM +0800, Daniel Kurtz wrote:
>> The input fuzz algorithm does a pretty good job filtering out small
>> jitter on input samples.
>>
>> However, there is a subtle problem when fuzz is used with mt drivers that
>> also use input_mt_report_pointer_emulation() to report legacy single
>> touch coordinates.  The reported single touch coordinates are taken from
>> the active MT slot with smallest tracking id.  However, since the MT data
>> is sent first, it has already had FUZZ applied.  Thus, the ST coordinates
>> actually get FUZZ applied a second time, with the just-fuzzed MT value as
>> the 'old value'.
>>
>> It appears that it is non-trivial to fix this in the mt layer/input core,
>> so, for now, just disable fuzz for the synaptics IMAGE_SENSOR path that
>> uses input_mt_report_pointer_emulation().
>>
>> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
>> ---
>>  drivers/input/mouse/synaptics.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
>> index 12d12ca..b6c6838 100644
>> --- a/drivers/input/mouse/synaptics.c
>> +++ b/drivers/input/mouse/synaptics.c
>> @@ -1211,7 +1211,8 @@ static void set_abs_position_params(struct input_dev *dev,
>>       int x_max = priv->x_max ?: XMAX_NOMINAL;
>>       int y_min = priv->y_min ?: YMIN_NOMINAL;
>>       int y_max = priv->y_max ?: YMAX_NOMINAL;
>> -     int fuzz = SYN_CAP_REDUCED_FILTERING(priv->ext_cap_0c) ?
>> +     int fuzz = (SYN_CAP_REDUCED_FILTERING(priv->ext_cap_0c) &&
>> +                     !SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) ?
>>                       SYN_REDUCED_FILTER_FUZZ : 0;
>
> Hmm, instead of disabling fuzz completely maybe we should disable it
> only on the derived axes (ABS_X/ABS_Y) for multitouch devices?

Yes, that should work...  both would end up fuzzed to the same value,
for a not-so-obvious reason, IMHO :).
It's a bit tricky, and I like it, but is that what you intended by the
suggestion?

-Daniel

>
> Thanks.
>
> --
> Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: synaptics - disable fuzz when using mt slots
  2013-02-14 17:15   ` Daniel Kurtz
@ 2013-02-14 17:22     ` Henrik Rydberg
  0 siblings, 0 replies; 4+ messages in thread
From: Henrik Rydberg @ 2013-02-14 17:22 UTC (permalink / raw)
  To: Daniel Kurtz
  Cc: Dmitry Torokhov, Seth Forshee, Benjamin Herrenschmidt,
	Chung-Yih Wang, Chase Douglas, linux-input, linux-kernel

> > Hmm, instead of disabling fuzz completely maybe we should disable it
> > only on the derived axes (ABS_X/ABS_Y) for multitouch devices?
> 
> Yes, that should work...  both would end up fuzzed to the same value,
> for a not-so-obvious reason, IMHO :).
> It's a bit tricky, and I like it, but is that what you intended by the
> suggestion?

Since this is inherently a problem when using the mt helper functions,
turning fuzz off there ought to solve this problem transparently, and
for all users.

Thanks, Daniel, for reminding me of this year-old glitch. :-)

Henrik

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-14 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-01  8:28 [PATCH] Input: synaptics - disable fuzz when using mt slots Daniel Kurtz
2013-02-13 21:52 ` Dmitry Torokhov
2013-02-14 17:15   ` Daniel Kurtz
2013-02-14 17:22     ` Henrik Rydberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.