[PATCH 04/15] Introduce POLL_MS for packet frequency
Peter Hutterer
peter.hutterer at who-t.net
Mon Jun 13 21:15:36 PDT 2011
On Thu, Jun 09, 2011 at 08:57:25PM +0100, Daniel Stone wrote:
> We expect to be receiving a steady 80 packets/sec (which gives 40
> reports/sec with more than one finger on the pad, as Advanced Gesture
> Mode requires two PS/2 packets per report). Instead of a random
> scattering of magic 13 and 20ms numbers scattered throughout the driver,
> introduce POLL_MS as 14ms.
>
> Having this here allows us to call back at a steady frequency to ensure
> that the finger motion remains steady.
>
> Signed-off-by: Daniel Stone <daniel at fooishbar.org>
> ---
> src/synaptics.c | 8 +++++---
> 1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/synaptics.c b/src/synaptics.c
> index caf0528..8a7c6d1 100644
> --- a/src/synaptics.c
> +++ b/src/synaptics.c
> @@ -92,6 +92,8 @@ typedef enum {
> LEFT_TOP_EDGE = TOP_EDGE | LEFT_EDGE
> } edge_type;
>
> +#define POLL_MS 14
please add a comment for this define, the commit message is a good template
here.
also, why 14, not 13?
13ms * 80 packets/sec is closer to 1 than 14 * 80.
Cheers,
Peter
> +
> #define MAX(a, b) (((a)>(b))?(a):(b))
> #define MIN(a, b) (((a)<(b))?(a):(b))
> #define TIME_DIFF(a, b) ((int)((a)-(b)))
> @@ -1849,7 +1851,7 @@ ComputeDeltas(SynapticsPrivate *priv, const struct SynapticsHwState *hw,
>
> /* to create fluid edge motion, call back 'soon'
> * even in the absence of new hardware events */
> - delay = MIN(delay, 13);
> + delay = MIN(delay, POLL_MS);
>
> if (priv->count_packet_finger <= 3) /* min. 3 packets, see get_delta() */
> goto skip; /* skip the lot */
> @@ -2191,7 +2193,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
> double dtime = (hw->millis - HIST(0).millis) / 1000.0;
> double ddy = para->coasting_friction * dtime;
> priv->autoscroll_y += priv->autoscroll_yspd * dtime;
> - delay = MIN(delay, 20);
> + delay = MIN(delay, POLL_MS);
> while (priv->autoscroll_y > 1.0) {
> sd->down++;
> priv->autoscroll_y -= 1.0;
> @@ -2212,7 +2214,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
> double dtime = (hw->millis - HIST(0).millis) / 1000.0;
> double ddx = para->coasting_friction * dtime;
> priv->autoscroll_x += priv->autoscroll_xspd * dtime;
> - delay = MIN(delay, 20);
> + delay = MIN(delay, POLL_MS);
> while (priv->autoscroll_x > 1.0) {
> sd->right++;
> priv->autoscroll_x -= 1.0;
> --
> 1.7.5.3
More information about the xorg-devel
mailing list