diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2020-04-13 15:12:43 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2020-05-13 06:21:27 +0000 |
commit | bd7b91065b138760201e8454c4559f2023f3cde1 (patch) | |
tree | 217ab1a22f3330c9f1c06b6ded0594d6af617ad2 /src/libinput.c | |
parent | 2ff0c3427d470b9f29f891306c6084089eeebc18 (diff) | |
download | libinput-bd7b91065b138760201e8454c4559f2023f3cde1.tar.gz |
evdev: warn if our event processing lags by 10ms or more
Take a snapshot of the time every 10 libinput_dispatch() calls. During event
processing, check if the event timestamp is more than 10ms in the past and
warn if it is. This should provide a warning to users when the compositor is
too slow to processes events but events aren't coming in fast enough to
trigger SYN_DROPPED.
Because we check the device event time against the dispatch time we may get
warnings for multiple devices on delayed processing. This is intended, it's
good to know which devices were affected.
In the test suite we need to ignore the warning though, since we compose the
events in very specific ways it's common to exceed that threshold
(particularly when calling litest_touch_move_to).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/libinput.c')
-rw-r--r-- | src/libinput.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libinput.c b/src/libinput.c index e764375b..7a535986 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -2100,10 +2100,19 @@ libinput_get_fd(struct libinput *libinput) LIBINPUT_EXPORT int libinput_dispatch(struct libinput *libinput) { + static uint8_t take_time_snapshot; struct libinput_source *source; struct epoll_event ep[32]; int i, count; + /* Every 10 calls to libinput_dispatch() we take the current time so + * we can check the delay between our current time and the event + * timestamps */ + if ((++take_time_snapshot % 10) == 0) + libinput->dispatch_time = libinput_now(libinput); + else if (libinput->dispatch_time) + libinput->dispatch_time = 0; + count = epoll_wait(libinput->epoll_fd, ep, ARRAY_LENGTH(ep), 0); if (count < 0) return -errno; |