[PATCH v3 1/4] filter: break out accel_profile_linear from pointer_accel_profile_linear

Peter Hutterer peter.hutterer at who-t.net
Thu Apr 16 22:48:19 PDT 2015


On Thu, Apr 16, 2015 at 02:41:33PM -0400, Benjamin Tissoires wrote:
> No functional code. Allows to reuse the linear filtering in other
> acceleration profiles.
> 
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
> ---
> no changes since v1
> 
>  src/filter.c |   20 +++++++++++++++-----
>  1 files changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/src/filter.c b/src/filter.c
> index 962d74d..f7ff426 100644
> --- a/src/filter.c
> +++ b/src/filter.c
> @@ -305,6 +305,20 @@ create_pointer_accelerator_filter(accel_profile_func_t profile)
>  	return &filter->base;
>  }
>  
> +static double
> +accel_profile_linear(double speed_in,
> +		     const double max_accel,
> +		     const double threshold,
> +		     const double incline)
> +{
> +	double s1, s2;
> +
> +	s1 = min(1, speed_in * 5);
> +	s2 = 1 + (speed_in - threshold) * incline;
> +
> +	return min(max_accel, s2 > 1 ? s2 : s1);
> +}
> +

thinking about this again, I'm not sure we should do this. for the
archives, we had a couple of meetings where we agreed on that if we need
model specific pointer acceleration we will write it once, get it to work
and then leave it untouched for eternity. while we may tweak pointer
acceleration over time, model-specific ones will stay static to avoid an
explosion of the test matrix or accidentally breaking a device that we don't
have access to (anymore).

With that in mind, I think we should just drop this patch and copy the code
for the x230 acceleration method. 

Cheers,
   Peter

>  double
>  pointer_accel_profile_linear(struct motion_filter *filter,
>  			     void *data,
> @@ -314,15 +328,11 @@ pointer_accel_profile_linear(struct motion_filter *filter,
>  	struct pointer_accelerator *accel_filter =
>  		(struct pointer_accelerator *)filter;
>  
> -	double s1, s2;
>  	const double max_accel = accel_filter->accel; /* unitless factor */
>  	const double threshold = accel_filter->threshold; /* units/ms */
>  	const double incline = accel_filter->incline;
>  
> -	s1 = min(1, speed_in * 5);
> -	s2 = 1 + (speed_in - threshold) * incline;
> -
> -	return min(max_accel, s2 > 1 ? s2 : s1);
> +	return accel_profile_linear(speed_in, max_accel, threshold, incline);
>  }
>  
>  double
> -- 
> 1.7.1


More information about the wayland-devel mailing list