dix: simplified debugging helper for pointer acceleration

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Simon Thum 2008-08-06 09:42:32 +02:00 committed by Peter Hutterer
parent d95136e151
commit e1b286d495

View File

@ -77,6 +77,15 @@ SimpleSmoothProfile(DeviceVelocityPtr pVel, float velocity,
float threshold, float acc); float threshold, float acc);
/*#define PTRACCEL_DEBUGGING*/
#ifdef PTRACCEL_DEBUGGING
#define DebugAccelF ErrorF
#else
#define DebugAccelF(...) /* */
#endif
/******************************** /********************************
* Init/Uninit etc * Init/Uninit etc
*******************************/ *******************************/
@ -276,15 +285,13 @@ QueryFilterChain(
result = cur; result = cur;
rfn = fn + 1; /*remember result determining filter */ rfn = fn + 1; /*remember result determining filter */
} else if(cfn == -1){ } else if(cfn == -1){
cfn = fn; /* rememeber first mismatching filter */ cfn = fn; /* remember first mismatching filter */
} }
} }
s->statistics.filter_usecount[rfn]++; s->statistics.filter_usecount[rfn]++;
#ifdef PTRACCEL_DEBUGGING DebugAccelF("(dix ptracc) result from stage %i, input %.2f, output %.2f\n",
ErrorF("(dix ptraccel) result from stage %i, input %.2f, output %.2f\n",
rfn, value, result); rfn, value, result);
#endif
/* override first mismatching current (coupling) so the filter /* override first mismatching current (coupling) so the filter
* catches up quickly. */ * catches up quickly. */
@ -347,9 +354,7 @@ ProcessVelocityData(
dy += s->last_dy; dy += s->last_dy;
diff += s->last_diff; diff += s->last_diff;
s->last_diff = time - s->lrm_time; /* prevent repeating add-up */ s->last_diff = time - s->lrm_time; /* prevent repeating add-up */
#ifdef PTRACCEL_DEBUGGING DebugAccelF("(dix ptracc) axial correction\n");
ErrorF("(dix ptracc) axial correction\n");
#endif
}else{ }else{
s->last_diff = diff; s->last_diff = diff;
} }
@ -387,9 +392,7 @@ ProcessVelocityData(
StuffFilterChain(s, cvelocity); StuffFilterChain(s, cvelocity);
s->velocity = s->last_velocity = cvelocity; s->velocity = s->last_velocity = cvelocity;
s->last_reset = TRUE; s->last_reset = TRUE;
#ifdef PTRACCEL_DEBUGGING DebugAccelF("(dix ptracc) non-visible state reset\n");
ErrorF("(dix ptracc) non-visible state reset\n");
#endif
return TRUE; return TRUE;
} }
@ -401,9 +404,7 @@ ProcessVelocityData(
* stuff that into the filter chain. * stuff that into the filter chain.
*/ */
s->last_reset = FALSE; s->last_reset = FALSE;
#ifdef PTRACCEL_DEBUGGING DebugAccelF("(dix ptracc) after-reset vel:%.3f\n", cvelocity);
ErrorF("(dix ptracc) after-reset vel:%.3f\n", cvelocity);
#endif
StuffFilterChain(s, cvelocity); StuffFilterChain(s, cvelocity);
s->velocity = cvelocity; s->velocity = cvelocity;
return FALSE; return FALSE;
@ -415,12 +416,13 @@ ProcessVelocityData(
/* perform coupling and decide final value */ /* perform coupling and decide final value */
s->velocity = QueryFilterChain(s, cvelocity); s->velocity = QueryFilterChain(s, cvelocity);
#ifdef PTRACCEL_DEBUGGING DebugAccelF("(dix ptracc) guess: vel=%.3f diff=%d %i|%i|%i|%i|%i|%i|%i|%i|%i\n",
ErrorF("(dix ptracc) guess: vel=%.3f diff=%d |%i|%i|%i|%i|\n",
s->velocity, diff, s->velocity, diff,
s->statistics.filter_usecount[0], s->statistics.filter_usecount[1], s->statistics.filter_usecount[0], s->statistics.filter_usecount[1],
s->statistics.filter_usecount[2], s->statistics.filter_usecount[3]); s->statistics.filter_usecount[2], s->statistics.filter_usecount[3],
#endif 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; return FALSE;
} }
@ -494,9 +496,7 @@ ComputeAcceleration(
float res; float res;
if(vel->last_reset){ if(vel->last_reset){
#ifdef PTRACCEL_DEBUGGING DebugAccelF("(dix ptracc) profile skipped\n");
ErrorF("(dix ptracc) profile skipped\n");
#endif
/* /*
* This is intended to override the first estimate of a stroke, * This is intended to override the first estimate of a stroke,
* which is too low (see ProcessVelocityData). 1 should make sure * which is too low (see ProcessVelocityData). 1 should make sure
@ -516,17 +516,13 @@ ComputeAcceleration(
(vel->last_velocity + vel->velocity) / 2, (vel->last_velocity + vel->velocity) / 2,
threshold, acc); threshold, acc);
res /= 6.0f; res /= 6.0f;
#ifdef PTRACCEL_DEBUGGING DebugAccelF("(dix ptracc) profile average [%.2f ... %.2f] is %.3f\n",
ErrorF("(dix ptracc) profile average [%.2f ... %.2f] is %.3f\n", vel->velocity, vel->last_velocity, res);
vel->velocity, vel->last_velocity, res);
#endif
return res; return res;
}else{ }else{
res = BasicComputeAcceleration(vel, vel->velocity, threshold, acc); res = BasicComputeAcceleration(vel, vel->velocity, threshold, acc);
#ifdef PTRACCEL_DEBUGGING DebugAccelF("(dix ptracc) profile sample [%.2f] is %.3f\n",
ErrorF("(dix ptracc) profile sample [%.2f] is %.3f\n",
vel->velocity, res); vel->velocity, res);
#endif
return res; return res;
} }
} }