diff options
author | Jeff Brown <jeffbrown@google.com> | 2011-03-18 18:14:26 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@android.com> | 2011-05-24 15:21:21 -0700 |
commit | dbf8d27f4c32e20e132e90ad713c6ebaf71d7756 (patch) | |
tree | a7dbe3db8501916c9b564c12bd997b59335c9182 /services/input/InputReader.h | |
parent | 68d6075b4ad2205c10064c78cde552e3210cca91 (diff) | |
download | frameworks_base-dbf8d27f4c32e20e132e90ad713c6ebaf71d7756.zip frameworks_base-dbf8d27f4c32e20e132e90ad713c6ebaf71d7756.tar.gz frameworks_base-dbf8d27f4c32e20e132e90ad713c6ebaf71d7756.tar.bz2 |
Optimize EventHub to process events in big chunks. (DO NOT MERGE)
When 10 fingers are down, reduces the CPU time spent by the InputReader
thread from ~30% to ~5% on Stingray.
Change-Id: I42ee5c67b8521af715cbab43e763a4af4eb1f914
Diffstat (limited to 'services/input/InputReader.h')
-rw-r--r-- | services/input/InputReader.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/services/input/InputReader.h b/services/input/InputReader.h index fdb4cfc..cf9b13d 100644 --- a/services/input/InputReader.h +++ b/services/input/InputReader.h @@ -216,6 +216,10 @@ private: virtual InputDispatcherInterface* getDispatcher() { return mDispatcher.get(); } virtual EventHubInterface* getEventHub() { return mEventHub.get(); } + // The event queue. + static const int EVENT_BUFFER_SIZE = 256; + RawEvent mEventBuffer[EVENT_BUFFER_SIZE]; + // This reader/writer lock guards the list of input devices. // The writer lock must be held whenever the list of input devices is modified // and then promptly released. @@ -228,16 +232,15 @@ private: KeyedVector<int32_t, InputDevice*> mDevices; // low-level input event decoding and device management - void process(const RawEvent* rawEvent); + void processEvents(const RawEvent* rawEvents, size_t count); void addDevice(int32_t deviceId); void removeDevice(int32_t deviceId); - void configureExcludedDevices(); - - void consumeEvent(const RawEvent* rawEvent); + void processEventsForDevice(int32_t deviceId, const RawEvent* rawEvents, size_t count); void timeoutExpired(nsecs_t when); void handleConfigurationChanged(nsecs_t when); + void configureExcludedDevices(); // state management for all devices Mutex mStateLock; @@ -251,12 +254,12 @@ private: InputConfiguration mInputConfiguration; void updateInputConfiguration(); - nsecs_t mDisableVirtualKeysTimeout; + nsecs_t mDisableVirtualKeysTimeout; // only accessed by reader thread virtual void disableVirtualKeysUntil(nsecs_t time); virtual bool shouldDropVirtualKey(nsecs_t now, InputDevice* device, int32_t keyCode, int32_t scanCode); - nsecs_t mNextTimeout; + nsecs_t mNextTimeout; // only accessed by reader thread virtual void requestTimeoutAtTime(nsecs_t when); // state queries @@ -301,7 +304,7 @@ public: void addMapper(InputMapper* mapper); void configure(); void reset(); - void process(const RawEvent* rawEvent); + void process(const RawEvent* rawEvents, size_t count); void timeoutExpired(nsecs_t when); void getDeviceInfo(InputDeviceInfo* outDeviceInfo); |