diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2010-06-10 12:05:24 -0700 |
---|---|---|
committer | Leann Ogasawara <leann.ogasawara@canonical.com> | 2010-07-23 11:41:45 +0200 |
commit | 6706dac6687e2fd06cc1769ec9b87792e30630c5 (patch) | |
tree | 9f9f3edd6c1f3aa7c7f3b9d1da5efe139263e789 /drivers | |
parent | e5360f526b960c805b30af669b40b500da12f0ad (diff) |
UBUNTU: [Upstream] Input: evdev - use driver hint to compute size of event buffer
Some devices, in particular MT devices, produce a lot of data. This
may lead to overflowing of the event queues in evdev driver, which
by default are fairly small. Let the drivers hint the average number
of events per packet generated by the device, and use that information
when computing the buffer size evdev should use for the device.
Currently in upstream maintainer's input tree and queued for v2.6.36:
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
commit 63a6404d8ae693e71ab27c4f9c4032aa29113e92
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/evdev.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index cff7bf9351a..30836c05edd 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -10,7 +10,8 @@ #define EVDEV_MINOR_BASE 64 #define EVDEV_MINORS 32 -#define EVDEV_MIN_BUFFER_SIZE 64 +#define EVDEV_MIN_BUFFER_SIZE 64U +#define EVDEV_BUF_PACKETS 8 #include <linux/poll.h> #include <linux/sched.h> @@ -245,7 +246,11 @@ static int evdev_release(struct inode *inode, struct file *file) static unsigned int evdev_compute_buffer_size(struct input_dev *dev) { - return EVDEV_MIN_BUFFER_SIZE; + unsigned int n_events = + max(dev->hint_events_per_packet * EVDEV_BUF_PACKETS, + EVDEV_MIN_BUFFER_SIZE); + + return roundup_pow_of_two(n_events); } static int evdev_open(struct inode *inode, struct file *file) |