[PATCH synaptics] Ensure hw millis are monotonic (#48777)

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 18 23:46:11 PDT 2012


The eventcomm backend takes the timestamp from the kernel, but the timer
uses the timer's "now". This timestamp may be later than the one from the
next event we read from the kernel, causing a negative dtime in get_delta()
and a cursor jump by (unsigned int)(eventtime - timer_time).

Ensure that the new event's timestamp is at least the last used one.

X.Org Bug 48777 <http://bugs.freedesktop.org/show_bug.cgi?id=48777>

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/synaptics.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/synaptics.c b/src/synaptics.c
index 350567d..3309e90 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1635,6 +1635,10 @@ ReadInput(InputInfoPtr pInfo)
 	    hw->cumulative_dy = priv->hwState->cumulative_dy;
 	}
 
+        /* timer may cause actual events to lag behind (#48777) */
+        if (priv->hwState->millis > hw->millis)
+            hw->millis = priv->hwState->millis;
+
 	SynapticsCopyHwState(priv->hwState, hw);
 	delay = HandleState(pInfo, hw, hw->millis, FALSE);
 	newDelay = TRUE;
-- 
1.7.10



More information about the xorg-devel mailing list