linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] input: Sizing the evdev ring buffer for MT devices and reporting overruns.
@ 2011-03-23  1:04 Jeff Brown
  2011-03-23  1:04 ` [PATCH 1/4] input: Set default events per packet Jeff Brown
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Jeff Brown @ 2011-03-23  1:04 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel

In recent kernels, input device drivers can specify a hint for the number of input events per packet.  However, most drivers don't do this.  There is some code in hid/hid-input.c that attempts to choose a larger default for MT devices but it does not apply to all input devices.  In particular, it does not apply to embedded touchscreens in phones and the like.

Currently, when the evdev ring buffer overflows, all old events are dropped.  (See input/evdev.c: evdev_pass_event)

Unfortunately, the reader has no idea that this has occurred.  The next event that the reader receives will likely be in the middle of a new packet.  This can cause the reader getting confused about which fingers are down or which slots are in use.

There are also problems on SMP systems where an evdev client may end up in a degenerate case where it reads events one at a time at the same rate they are produced instead of reading the entire packet all at once when it is ready.  This causes high CPU usage, particularly when reading from MT devices.  Ideally, evdev should only wake up poll() when the packet is complete.  (Assuming all input drivers call input_sync after they are finished writing events.  Some drivers seem to be broken in this regard.)

As a point of departure for further discussion, here are four patches.

1. During input device registration, choose a default size for the buffer based on the number of slots or tracking ids that a device reports and the number of axes it has.

2. Remove a redundant hardcoded default from hid-input.c.

3. Add a new SYN_DROPPED code that is used by evdev to indicate that some input events were dropped from the ring buffer and are missing.  The client can use this event as a hint that it should reset its state or ignore all following events until the next packet begins.

4. Only wake evdev clients from poll() when an EV_SYN is enqueued, excluding SYN_MT_REPORT.

Thanks,
Jeff.

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2011-03-28  8:55 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-23  1:04 [PATCH 0/4] input: Sizing the evdev ring buffer for MT devices and reporting overruns Jeff Brown
2011-03-23  1:04 ` [PATCH 1/4] input: Set default events per packet Jeff Brown
2011-03-25  8:20   ` Henrik Rydberg
2011-03-25 23:30     ` Jeffrey Brown
2011-03-28  7:10       ` Henrik Rydberg
2011-03-23  1:04 ` [PATCH 2/4] hid: hid-input: Remove obsolete default events per packet setting Jeff Brown
2011-03-23  1:04 ` [PATCH 3/4] input: evdev: Indicate buffer overrun with SYN_DROPPED Jeff Brown
2011-03-25  7:47   ` Dmitry Torokhov
2011-03-25  8:14   ` Henrik Rydberg
2011-03-25  9:02   ` Henrik Rydberg
     [not found]     ` <AANLkTike4c7SaeAm5JVWcLyZYt1K59OUEk94rnPeRkMy@mail.gmail.com>
2011-03-25 23:10       ` Jeffrey Brown
2011-03-25 23:12     ` Jeffrey Brown
2011-03-23  1:04 ` [PATCH 4/4] input: evdev: only wake poll on EV_SYN Jeff Brown
2011-03-25  7:49   ` Dmitry Torokhov
2011-03-25 23:03     ` Jeffrey Brown
2011-03-28  6:12       ` Dmitry Torokhov
2011-03-28  8:54         ` Jeffrey Brown
2011-03-25  8:34   ` Henrik Rydberg
2011-03-25 23:07     ` Jeffrey Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).