Hi,

I would like to see the first of the attached patches in the server before 1.7 is branched. This is to have the accel API be sensible enough to finally solve the synaptics-and-acceleration problem hiding in its corner since the jura, approximately. The synaptics accel code (or the driver as a whole) could be depending on 1.7 then, so this has my priority.

The second patch applies X_INTERNAL to a few functions in ptrveloc.h (a SDK header) which were X_EXPORT previously. This is just because calling them from a driver doesn't make sense, but we need them across the server. This has low priority, and I'm a bit unsure how to handle it. Comments welcome.

In any case, I'm unaware of current users of ptrveloc.h, so changes are breaking.

Cheers,

Simon
>From db032cde079725e7f650776fc110a6edcb8c9bf2 Mon Sep 17 00:00:00 2001
From: Simon Thum <[email protected]>
Date: Sat, 6 Jun 2009 14:49:43 +0200
Subject: [PATCH] dix: improve pointer acceleration API

This makes the ptr accel api actually sensible from a driver
perspective, since the device is now a parameter of the
device-specific accel callback.
---
 dix/ptrveloc.c     |   40 +++++++++++++++++++++++++++-------------
 include/ptrveloc.h |   14 ++++++++++++--
 2 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index dd26477..8b9b065 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -63,7 +63,7 @@
 int
 SetAccelerationProfile(DeviceVelocityPtr s, int profile_num);
 static float
-SimpleSmoothProfile(DeviceVelocityPtr pVel, float velocity,
+SimpleSmoothProfile(DeviceIntPtr pDev, DeviceVelocityPtr pVel, float velocity,
                     float threshold, float acc);
 static PointerAccelerationProfileFunc
 GetAccelerationProfile(DeviceVelocityPtr s, int profile_num);
@@ -108,7 +108,7 @@ InitVelocityData(DeviceVelocityPtr s)
 /**
  * Clean up
  */
-static void
+void
 FreeVelocityData(DeviceVelocityPtr s){
     xfree(s->tracker);
     SetAccelerationProfile(s, PROFILE_UNINITIALIZE);
@@ -555,7 +555,7 @@ QueryTrackers(DeviceVelocityPtr s, int cur_t){
  * Perform velocity approximation based on 2D 'mickeys' (mouse motion delta).
  * return true if non-visible state reset is suggested
  */
-static short
+short
 ProcessVelocityData2D(
     DeviceVelocityPtr s,
     int dx,
@@ -616,15 +616,16 @@ ApplySofteningAndConstantDeceleration(
 /*
  * compute the acceleration for given velocity and enforce min_acceleartion
  */
-static float
+float
 BasicComputeAcceleration(
+    DeviceIntPtr pDev,
     DeviceVelocityPtr pVel,
     float velocity,
     float threshold,
     float acc){
 
     float result;
-    result = pVel->Profile(pVel, velocity, threshold, acc);
+    result = pVel->Profile(pDev, pVel, velocity, threshold, acc);
 
     /* enforce min_acceleration */
     if (result < pVel->min_acceleration)
@@ -637,6 +638,7 @@ BasicComputeAcceleration(
  */
 static float
 ComputeAcceleration(
+    DeviceIntPtr pDev,
     DeviceVelocityPtr vel,
     float threshold,
     float acc){
@@ -655,9 +657,11 @@ ComputeAcceleration(
         * current and previous velocity.
         * Though being the more natural choice, it causes a minor delay
         * in comparison, so it can be disabled. */
-       res = BasicComputeAcceleration(vel, vel->velocity, threshold, acc);
-       res += BasicComputeAcceleration(vel, vel->last_velocity, threshold, 
acc);
-       res += 4.0f * BasicComputeAcceleration(vel,
+       res = BasicComputeAcceleration(
+                 pDev, vel, vel->velocity, threshold, acc);
+       res += BasicComputeAcceleration(
+                 pDev, vel, vel->last_velocity, threshold, acc);
+       res += 4.0f * BasicComputeAcceleration(pDev, vel,
                           (vel->last_velocity + vel->velocity) / 2,
                           threshold, acc);
        res /= 6.0f;
@@ -665,7 +669,8 @@ ComputeAcceleration(
                    vel->velocity, vel->last_velocity, res);
         return res;
     }else{
-       res = BasicComputeAcceleration(vel, vel->velocity, threshold, acc);
+       res = BasicComputeAcceleration(pDev, vel,
+                                      vel->velocity, threshold, acc);
        DebugAccelF("(dix ptracc) profile sample [%.2f] is %.3f\n",
                vel->velocity, res);
        return res;
@@ -682,6 +687,7 @@ ComputeAcceleration(
  */
 static float
 PolynomialAccelerationProfile(
+    DeviceIntPtr pDev,
     DeviceVelocityPtr pVel,
     float velocity,
     float ignored,
@@ -697,18 +703,21 @@ PolynomialAccelerationProfile(
  */
 static float
 ClassicProfile(
+    DeviceIntPtr pDev,
     DeviceVelocityPtr pVel,
     float velocity,
     float threshold,
     float acc)
 {
-    if (threshold) {
-       return SimpleSmoothProfile (pVel,
+    if (threshold > 0) {
+       return SimpleSmoothProfile (pDev,
+                                   pVel,
                                    velocity,
                                     threshold,
                                     acc);
     } else {
-       return PolynomialAccelerationProfile (pVel,
+       return PolynomialAccelerationProfile (pDev,
+                                             pVel,
                                              velocity,
                                               0,
                                               acc);
@@ -726,6 +735,7 @@ ClassicProfile(
  */
 static float
 PowerProfile(
+    DeviceIntPtr pDev,
     DeviceVelocityPtr pVel,
     float velocity,
     float threshold,
@@ -763,6 +773,7 @@ CalcPenumbralGradient(float x){
  */
 static float
 SimpleSmoothProfile(
+    DeviceIntPtr pDev,
     DeviceVelocityPtr pVel,
     float velocity,
     float threshold,
@@ -788,6 +799,7 @@ SimpleSmoothProfile(
  */
 static float
 SmoothLinearProfile(
+    DeviceIntPtr pDev,
     DeviceVelocityPtr pVel,
     float velocity,
     float threshold,
@@ -818,6 +830,7 @@ SmoothLinearProfile(
 
 static float
 LinearProfile(
+    DeviceIntPtr pDev,
     DeviceVelocityPtr pVel,
     float velocity,
     float threshold,
@@ -829,6 +842,7 @@ LinearProfile(
 
 static float
 NoProfile(
+    DeviceIntPtr pDev,
     DeviceVelocityPtr pVel,
     float velocity,
     float threshold,
@@ -992,7 +1006,7 @@ acceleratePointerPredictable(
 
         if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) {
             /* invoke acceleration profile to determine acceleration */
-            mult = ComputeAcceleration (velocitydata,
+            mult = ComputeAcceleration (pDev, velocitydata,
                                        pDev->ptrfeed->ctrl.threshold,
                                        (float)pDev->ptrfeed->ctrl.num /
                                        (float)pDev->ptrfeed->ctrl.den);
diff --git a/include/ptrveloc.h b/include/ptrveloc.h
index 83d188c..97badd9 100644
--- a/include/ptrveloc.h
+++ b/include/ptrveloc.h
@@ -47,8 +47,8 @@ struct _DeviceVelocityRec;
  * returns actual acceleration depending on velocity, acceleration control,...
  */
 typedef float (*PointerAccelerationProfileFunc)
-              (struct _DeviceVelocityRec* /*pVel*/,
-               float /*velocity*/, float /*threshold*/, float /*acc*/);
+              (DeviceIntPtr pDev, struct _DeviceVelocityRec* pVel,
+               float velocity, float threshold, float accelCoeff);
 
 /**
  * a motion history, with just enough information to
@@ -96,6 +96,16 @@ InitVelocityData(DeviceVelocityPtr s);
 extern _X_EXPORT void
 InitTrackers(DeviceVelocityPtr s, int ntracker);
 
+extern _X_EXPORT short
+ProcessVelocityData2D(DeviceVelocityPtr s, int dx, int dy, int time);
+
+extern _X_EXPORT float
+BasicComputeAcceleration(DeviceIntPtr pDev, DeviceVelocityPtr pVel,
+    float velocity, float threshold, float acc);
+
+extern _X_EXPORT void
+FreeVelocityData(DeviceVelocityPtr s);
+
 extern _X_EXPORT BOOL
 InitializePredictableAccelerationProperties(DeviceIntPtr pDev);
 
-- 
1.6.0.6

>From 3d4553ee9cde4dd8d7b0efa22fe6d969c7b418fe Mon Sep 17 00:00:00 2001
From: Simon Thum <[email protected]>
Date: Sat, 6 Jun 2009 15:13:01 +0200
Subject: [PATCH] dix: make part of ptrveloc.h internal

Though this is a SDK header, some functions are intended solely
for the server.
---
 include/ptrveloc.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/ptrveloc.h b/include/ptrveloc.h
index 97badd9..896ad6b 100644
--- a/include/ptrveloc.h
+++ b/include/ptrveloc.h
@@ -106,7 +106,7 @@ BasicComputeAcceleration(DeviceIntPtr pDev, 
DeviceVelocityPtr pVel,
 extern _X_EXPORT void
 FreeVelocityData(DeviceVelocityPtr s);
 
-extern _X_EXPORT BOOL
+extern _X_INTERNAL BOOL
 InitializePredictableAccelerationProperties(DeviceIntPtr pDev);
 
 extern _X_EXPORT int
@@ -119,14 +119,14 @@ extern _X_EXPORT void
 SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr s,
                                      PointerAccelerationProfileFunc profile);
 
-extern _X_EXPORT void
+extern _X_INTERNAL void
 AccelerationDefaultCleanup(DeviceIntPtr pDev);
 
-extern _X_EXPORT void
+extern _X_INTERNAL void
 acceleratePointerPredictable(DeviceIntPtr pDev, int first_valuator,
                              int num_valuators, int *valuators, int evtime);
 
-extern _X_EXPORT void
+extern _X_INTERNAL void
 acceleratePointerLightweight(DeviceIntPtr pDev, int first_valuator,
                          int num_valuators, int *valuators, int ignore);
 
-- 
1.6.0.6

_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to