From: Jeff Brown <jeffbrown@android.com>
To: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 0/4] input: Sizing the evdev ring buffer for MT devices and reporting overruns.
Date: Tue, 22 Mar 2011 18:04:00 -0700 [thread overview]
Message-ID: <1300842244-42723-1-git-send-email-jeffbrown@android.com> (raw)
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.
next reply other threads:[~2011-03-23 1:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-23 1:04 Jeff Brown [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1300842244-42723-1-git-send-email-jeffbrown@android.com \
--to=jeffbrown@android.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox