[PATCH 07/15] Replace the motion estimator

Daniel Stone daniel at fooishbar.org
Fri Jun 10 02:05:14 PDT 2011


Hi,

On Fri, Jun 10, 2011 at 10:17:42AM +0200, walter harms wrote:
> Am 09.06.2011 21:57, schrieb Daniel Stone:
> > From: Derek Foreman <derek.foreman at collabora.co.uk>
> > 
> > Use a smarter motion estimator that attempts to draw a best-fit line
> > through the history where possible, including taking acceleration into
> > account.
> > 
> > Signed-off-by: Derek Foreman <derek.foreman at collabora.co.uk>
> > Reviewed-by: Daniel Stone <daniel at fooishbar.org>
> > ---
> 
> 
> I guess the buffer is priv->move_hist[SYNAPTICS_MOVE_HISTORY].
> Then you will get an off-by-one.
> 
> Depending on your overflow strategie:
> 
> either (priv->count_packet_finger < SYNAPTICS_MOVE_HISTORY-1)
> or
> 	priv->count_packet_finger++;
> 	priv->count_packet_finger %= SYNAPTICS_MOVE_HISTORY;

Hmm? No, count_packet_finger is only ever used as a counter of the
number of packets in the history, not as an index.  If you look at all
the usage, it's like this:

> > +    /* Determine the best fit line through the 3 most recent history entries */
> > +    for (i = 0; i < MIN(priv->count_packet_finger, 3); i++) {
> > +	ym += HIST(i).y;
> > +	xm += HIST(i).x;
> > +	tm += HIST_DELTA(i, 0, millis);
> > +    }

So I can't see how this would cause an overflow.

Cheers,
Daniel


More information about the xorg-devel mailing list