On Wed, Oct 26, 2016 at 06:24:48PM -0700, Ping Cheng wrote:
> On Fri, Oct 7, 2016 at 10:25 AM, Jason Gerecke <killert...@gmail.com> wrote:
> > The driver has historically normalized the pressure range of all kernel
> > devices to 0..2047 rather than using their native range to keep things
> > like the application of the pressure curve simple. Pens that report more
> > than 2048 pressure levels are also normalized down to this range though,
> > reducing their precision. In order to accomodate the new 8K pen (and any
> > future pens with even higher precision), this patch bumps up the full-
> > scale range to be 0..65535. This number was chosen both because it far
> > exceeds anything currently known about, and also because it matches the
> > normalization range used over the wire by the Wayland tablet protocol.
> >
> > Note that the WACOM_PROP_PRESSURE_THRESHOLD value has been tied to the
> > normalized (2048-level) pressure range for some time, meaning that we
> > cannot simply change the range without causing a change in the perceived
> > threshold for users. To ensure compatibility, the value is interpreted
> > as a fraction of 2048 and then scaled to the actual normalization range.
> >
> > Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
> 
> Reviewed-by: Ping Cheng <pi...@wacom.com> for the set of 2 patches.
> 
> Thank you for considering backward compatibility. That's a bonus for
> many system admins who use xsetwacom/xinput to configure the driver.
> 
> Please update this patch as Peter suggested though.

uhm, just something else I noticed. we precalculate the pressure curve, so
we now have 256 KB in the driver allocated just for the values. We should
probably split this out to be allocated on demand (not everyone needs the
pressure curve) and to avoid blowing up our struct sizes even more.

Or, event better would be to have the pressure curve calculated based on the
device's actual min/max, so we only carry around as much as we need.

Cheers,
   Peter
 
> >  src/wcmXCommand.c   | 6 +++++-
> >  src/xf86WacomDefs.h | 2 +-
> >  2 files changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
> > index 02278ba..403bc84 100644
> > --- a/src/wcmXCommand.c
> > +++ b/src/wcmXCommand.c
> > @@ -256,6 +256,7 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo)
> >         }
> >
> >         values[0] = (!common->wcmMaxZ) ? 0 : common->wcmThreshold;
> > +       values[0] /= (FILTER_PRESSURE_RES / 2048); /* backwards 
> > compatibility */
> >         prop_threshold = InitWcmAtom(pInfo->dev, 
> > WACOM_PROP_PRESSURE_THRESHOLD, XA_INTEGER, 32, 1, values);
> >
> >         values[0] = common->wcmSuppress;
> > @@ -827,6 +828,7 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
> > XIPropertyValuePtr prop,
> >                         common->wcmCursorProxoutDist = value;
> >         } else if (property == prop_threshold)
> >         {
> > +               const INT32 MAXIMUM = 2048; /* backwards compatibility */
> >                 INT32 value;
> >
> >                 if (prop->size != 1 || prop->format != 32)
> > @@ -836,8 +838,10 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
> > XIPropertyValuePtr prop,
> >
> >                 if (value == -1)
> >                         value = DEFAULT_THRESHOLD;
> > -               else if ((value < 1) || (value > FILTER_PRESSURE_RES))
> > +               else if ((value < 1) || (value > MAXIMUM))
> >                         return BadValue;
> > +               else
> > +                       value *= (FILTER_PRESSURE_RES / MAXIMUM);
> >
> >                 if (!checkonly)
> >                         common->wcmThreshold = value;
> > diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
> > index 1575960..9de9cab 100644
> > --- a/src/xf86WacomDefs.h
> > +++ b/src/xf86WacomDefs.h
> > @@ -183,7 +183,7 @@ struct _WacomModel
> >
> >  #define IsUSBDevice(common) ((common)->wcmDevCls == &gWacomUSBDevice)
> >
> > -#define FILTER_PRESSURE_RES    2048    /* maximum points in pressure curve 
> > */
> > +#define FILTER_PRESSURE_RES    65536   /* maximum points in pressure curve 
> > */
> >  /* Tested result for setting the pressure threshold to a reasonable value 
> > */
> >  #define THRESHOLD_TOLERANCE (FILTER_PRESSURE_RES / 125)
> >  #define DEFAULT_THRESHOLD (FILTER_PRESSURE_RES / 75)
> > --
> > 2.10.0
> >

------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to