summaryrefslogtreecommitdiffstats
path: root/services/input/InputDispatcher.h
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 /services/input/InputDispatcher.h
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 'services/input/InputDispatcher.h')
-rw-r--r--services/input/InputDispatcher.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/services/input/InputDispatcher.h b/services/input/InputDispatcher.h
index 162e606..af0153b 100644
--- a/services/input/InputDispatcher.h
+++ b/services/input/InputDispatcher.h
@@ -409,7 +409,7 @@ private:
bool dispatchInProgress; // initially false, set to true while dispatching
- inline bool isInjected() { return injectionState != NULL; }
+ inline bool isInjected() const { return injectionState != NULL; }
};
struct ConfigurationChangedEntry : EventEntry {
@@ -439,7 +439,8 @@ private:
struct MotionSample {
MotionSample* next;
- nsecs_t eventTime;
+ nsecs_t eventTime; // may be updated during coalescing
+ nsecs_t eventTimeBeforeCoalescing; // not updated during coalescing
PointerCoords pointerCoords[MAX_POINTERS];
};
@@ -461,6 +462,10 @@ private:
MotionSample* lastSample;
uint32_t countSamples() const;
+
+ // Checks whether we can append samples, assuming the device id and source are the same.
+ bool canAppendSamples(int32_t action, uint32_t pointerCount,
+ const int32_t* pointerIds) const;
};
// Tracks the progress of dispatching a particular event to a particular connection.
@@ -802,6 +807,11 @@ private:
void dispatchOnceInnerLocked(nsecs_t keyRepeatTimeout, nsecs_t keyRepeatDelay,
nsecs_t* nextWakeupTime);
+ // Batches a new sample onto a motion entry.
+ // Assumes that the we have already checked that we can append samples.
+ void batchMotionLocked(MotionEntry* entry, nsecs_t eventTime, int32_t metaState,
+ const PointerCoords* pointerCoords, const char* eventDescription);
+
// Enqueues an inbound event. Returns true if mLooper->wake() should be called.
bool enqueueInboundEventLocked(EventEntry* entry);