Re: Possibly -next regression from "Input: allow drivers specify timestamp for input events"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 29, 2019 at 11:22:44AM -0700, Dmitry Torokhov wrote:
> Hi John,
> 
> On Tue, Aug 27, 2019 at 02:54:17PM -0700, John Stultz wrote:
> > Hey Atif,
> >   I was testing today's -next with AOSP on the HiKey board and was
> > seeing some odd mouse behavior and I've bisected the issue down to
> > commit 3b51c44bd693 ("Input: allow drivers specify timestamp for input
> > events").
> > 
> > In the logcat log I'd see a number of:
> >  I InputDispatcher: Dropped event because it is stale.
> > 
> > Usually it would seem like flings weren't really responding right, and
> > then the UI would basically freeze for awhile (even though the mouse
> > cursor could still move around, the UI was just ignoring new input).
> > 
> > Just skimming the patch, It seems like maybe we're hitting:
> > 
> > if (!ktime_compare(dev->timestamp[INPUT_CLK_MONO], invalid_timestamp))
> > 
> > check and the device timestamp (at least occasionally) isn't
> > zero/"invalid" but also isn't actually correct.
> > 
> > If I comment out that check, and always call input_set_timestamp(dev,
> > ktime_get()), the issue seems to go away.
> > 
> > Do you have any suggestions for me to try?
> 
> Ah, of course, once we hit it first time, we set the timestamp, and then
> it will become stale.
> 
> I guess we need zero-out the timestamp on input_sync(). Can you please
> try doing that?

Something like this maybe?

Input: reset device timestamp on sync

From: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>

We need to reset input device's timestamp on input_sync(), otherwise
drivers not using input_set_timestamp() will end up with a stale
timestamp after their clients consume first input event.

Fixes: 3b51c44bd693 ("Input: allow drivers specify timestamp for input events")
Reported-by: John Stultz <john.stultz@xxxxxxxxxx>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
 drivers/input/input.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index 8d75c4098b13..35fcd495df3a 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -400,6 +400,13 @@ static void input_handle_event(struct input_dev *dev,
 		if (dev->num_vals >= 2)
 			input_pass_values(dev, dev->vals, dev->num_vals);
 		dev->num_vals = 0;
+		/*
+		 * Reset the timestamp on flush so we won't end up
+		 * with a stale one. Note we only need to reset the
+		 * monolithic one as we use its presence when deciding
+		 * whether to generate a synthetic timestamp.
+		 */
+		dev->timestamp[INPUT_CLK_MONO] = ktime_set(0, 0);
 	} else if (dev->num_vals >= dev->max_vals - 2) {
 		dev->vals[dev->num_vals++] = input_value_sync;
 		input_pass_values(dev, dev->vals, dev->num_vals);

-- 
Dmitry



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux