summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-04-07 11:38:09 -0700
committerJeff Brown <jeffbrown@google.com>2011-04-07 13:11:16 -0700
commit4e91a180be46c0c7c3bf398d4df4cbe2404216b5 (patch)
tree2e96b54a039a917cb0b4b13f318500e3b5f39396 /libs
parentf6989da7c7727ad433b75ad2c8d8d23c2651f70b (diff)
downloadframeworks_base-4e91a180be46c0c7c3bf398d4df4cbe2404216b5.zip
frameworks_base-4e91a180be46c0c7c3bf398d4df4cbe2404216b5.tar.gz
frameworks_base-4e91a180be46c0c7c3bf398d4df4cbe2404216b5.tar.bz2
Coalesce input events that arrive faster than 333Hz.
Some drivers report individual finger updates one at a time instead of all at once. When 10 fingers are down, this can cause the framework to have to handle 10 times as many events each with 10 times as much data. Applications like PointerLocation would get significantly bogged down by all of the redundant samples. This change coalesces samples that are closely spaced in time, before they are dispatched, as part of the motion event batching protocol. Increased the size of the InputChannel shared memory buffer so that applications can catch up faster if they accumulate a backlog of samples. Added logging code to help measure input dispatch and drawing latency issues in the view hierarchy. See ViewDebug.DEBUG_LATENCY. Change-Id: Ia5898f781f19901d2225c529a910c32bdf4f504f
Diffstat (limited to 'libs')
-rw-r--r--libs/ui/InputTransport.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/ui/InputTransport.cpp b/libs/ui/InputTransport.cpp
index 9d1b8b9..93d0d1f 100644
--- a/libs/ui/InputTransport.cpp
+++ b/libs/ui/InputTransport.cpp
@@ -27,8 +27,14 @@
namespace android {
+#define ROUND_UP(value, boundary) (((value) + (boundary) - 1) & ~((boundary) - 1))
+#define MIN_HISTORY_DEPTH 20
+
// Must be at least sizeof(InputMessage) + sufficient space for pointer data
-static const int DEFAULT_MESSAGE_BUFFER_SIZE = 16384;
+static const int DEFAULT_MESSAGE_BUFFER_SIZE = ROUND_UP(
+ sizeof(InputMessage) + MIN_HISTORY_DEPTH
+ * (sizeof(InputMessage::SampleData) + MAX_POINTERS * sizeof(PointerCoords)),
+ 4096);
// Signal sent by the producer to the consumer to inform it that a new message is
// available to be consumed in the shared memory buffer.