summaryrefslogtreecommitdiff
path: root/dix/ptrveloc.c
diff options
context:
space:
mode:
authorSimon Thum <simon.thum@gmx.de>2008-08-06 09:42:32 +0200
committerPeter Hutterer <peter.hutterer@redhat.com>2008-08-08 16:19:20 +0930
commite1b286d495b760cf67ddf936eca11da50fba847a (patch)
tree253ad089ddff1b9d6f583fa331c1ae54b7790128 /dix/ptrveloc.c
parentd95136e1510a48cc3ad066d880d56061fc6a42ee (diff)
dix: simplified debugging helper for pointer acceleration
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/ptrveloc.c')
-rw-r--r--dix/ptrveloc.c50
1 files changed, 23 insertions, 27 deletions
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index 56ce71ba6..330ab39a7 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -77,6 +77,15 @@ SimpleSmoothProfile(DeviceVelocityPtr pVel, float velocity,
float threshold, float acc);
+
+/*#define PTRACCEL_DEBUGGING*/
+
+#ifdef PTRACCEL_DEBUGGING
+#define DebugAccelF ErrorF
+#else
+#define DebugAccelF(...) /* */
+#endif
+
/********************************
* Init/Uninit etc
*******************************/
@@ -276,15 +285,13 @@ QueryFilterChain(
result = cur;
rfn = fn + 1; /*remember result determining filter */
} else if(cfn == -1){
- cfn = fn; /* rememeber first mismatching filter */
+ cfn = fn; /* remember first mismatching filter */
}
}
s->statistics.filter_usecount[rfn]++;
-#ifdef PTRACCEL_DEBUGGING
- ErrorF("(dix ptraccel) result from stage %i, input %.2f, output %.2f\n",
+ DebugAccelF("(dix ptracc) result from stage %i, input %.2f, output %.2f\n",
rfn, value, result);
-#endif
/* override first mismatching current (coupling) so the filter
* catches up quickly. */
@@ -347,9 +354,7 @@ ProcessVelocityData(
dy += s->last_dy;
diff += s->last_diff;
s->last_diff = time - s->lrm_time; /* prevent repeating add-up */
-#ifdef PTRACCEL_DEBUGGING
- ErrorF("(dix ptracc) axial correction\n");
-#endif
+ DebugAccelF("(dix ptracc) axial correction\n");
}else{
s->last_diff = diff;
}
@@ -387,9 +392,7 @@ ProcessVelocityData(
StuffFilterChain(s, cvelocity);
s->velocity = s->last_velocity = cvelocity;
s->last_reset = TRUE;
-#ifdef PTRACCEL_DEBUGGING
- ErrorF("(dix ptracc) non-visible state reset\n");
-#endif
+ DebugAccelF("(dix ptracc) non-visible state reset\n");
return TRUE;
}
@@ -401,9 +404,7 @@ ProcessVelocityData(
* stuff that into the filter chain.
*/
s->last_reset = FALSE;
-#ifdef PTRACCEL_DEBUGGING
- ErrorF("(dix ptracc) after-reset vel:%.3f\n", cvelocity);
-#endif
+ DebugAccelF("(dix ptracc) after-reset vel:%.3f\n", cvelocity);
StuffFilterChain(s, cvelocity);
s->velocity = cvelocity;
return FALSE;
@@ -415,12 +416,13 @@ ProcessVelocityData(
/* perform coupling and decide final value */
s->velocity = QueryFilterChain(s, cvelocity);
-#ifdef PTRACCEL_DEBUGGING
- ErrorF("(dix ptracc) guess: vel=%.3f diff=%d |%i|%i|%i|%i|\n",
+ DebugAccelF("(dix ptracc) guess: vel=%.3f diff=%d %i|%i|%i|%i|%i|%i|%i|%i|%i\n",
s->velocity, diff,
s->statistics.filter_usecount[0], s->statistics.filter_usecount[1],
- s->statistics.filter_usecount[2], s->statistics.filter_usecount[3]);
-#endif
+ s->statistics.filter_usecount[2], s->statistics.filter_usecount[3],
+ s->statistics.filter_usecount[4], s->statistics.filter_usecount[5],
+ s->statistics.filter_usecount[6], s->statistics.filter_usecount[7],
+ s->statistics.filter_usecount[8]);
return FALSE;
}
@@ -494,9 +496,7 @@ ComputeAcceleration(
float res;
if(vel->last_reset){
-#ifdef PTRACCEL_DEBUGGING
- ErrorF("(dix ptracc) profile skipped\n");
-#endif
+ DebugAccelF("(dix ptracc) profile skipped\n");
/*
* This is intended to override the first estimate of a stroke,
* which is too low (see ProcessVelocityData). 1 should make sure
@@ -516,17 +516,13 @@ ComputeAcceleration(
(vel->last_velocity + vel->velocity) / 2,
threshold, acc);
res /= 6.0f;
-#ifdef PTRACCEL_DEBUGGING
- ErrorF("(dix ptracc) profile average [%.2f ... %.2f] is %.3f\n",
- vel->velocity, vel->last_velocity, res);
-#endif
+ DebugAccelF("(dix ptracc) profile average [%.2f ... %.2f] is %.3f\n",
+ vel->velocity, vel->last_velocity, res);
return res;
}else{
res = BasicComputeAcceleration(vel, vel->velocity, threshold, acc);
-#ifdef PTRACCEL_DEBUGGING
- ErrorF("(dix ptracc) profile sample [%.2f] is %.3f\n",
+ DebugAccelF("(dix ptracc) profile sample [%.2f] is %.3f\n",
vel->velocity, res);
-#endif
return res;
}
}