summaryrefslogtreecommitdiff
path: root/libs/gui/DisplayEventDispatcher.cpp
diff options
context:
space:
mode:
author Ady Abraham <adyabr@google.com> 2020-10-13 19:07:23 -0700
committer Ady Abraham <adyabr@google.com> 2020-11-18 13:30:27 -0800
commit62f216c62edbe4c997e959cfb28c8609664978df (patch)
treea5f22b610a460033ef656e58df3f3575ffa69d85 /libs/gui/DisplayEventDispatcher.cpp
parent939739b86288069814cf73b37133119983779278 (diff)
SurfaceFlinger: Add DISPLAY_EVENT_FRAME_RATE_OVERRIDE
Add a new event to DisplayEventReceiver that conveys a list of apps whose frame rates have been overriden. This event is processed by the DisplayManager to advertise the new frame rate to the overridden app. Change-Id: I89fce8b5b4d9db65ec5db7dd2393c384c0fcfd82 Bug: 169271059 Bug: 169271062 Bug: 170503758 Test: manual test using SF backdoor
Diffstat (limited to 'libs/gui/DisplayEventDispatcher.cpp')
-rw-r--r--libs/gui/DisplayEventDispatcher.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/libs/gui/DisplayEventDispatcher.cpp b/libs/gui/DisplayEventDispatcher.cpp
index abfee61685..c6c9a8f7a7 100644
--- a/libs/gui/DisplayEventDispatcher.cpp
+++ b/libs/gui/DisplayEventDispatcher.cpp
@@ -33,10 +33,10 @@ namespace android {
// using just a few large reads.
static const size_t EVENT_BUFFER_SIZE = 100;
-DisplayEventDispatcher::DisplayEventDispatcher(const sp<Looper>& looper,
- ISurfaceComposer::VsyncSource vsyncSource,
- ISurfaceComposer::ConfigChanged configChanged)
- : mLooper(looper), mReceiver(vsyncSource, configChanged), mWaitingForVsync(false) {
+DisplayEventDispatcher::DisplayEventDispatcher(
+ const sp<Looper>& looper, ISurfaceComposer::VsyncSource vsyncSource,
+ ISurfaceComposer::EventRegistrationFlags eventRegistration)
+ : mLooper(looper), mReceiver(vsyncSource, eventRegistration), mWaitingForVsync(false) {
ALOGV("dispatcher %p ~ Initializing display event dispatcher.", this);
}
@@ -139,6 +139,7 @@ bool DisplayEventDispatcher::processPendingEvents(nsecs_t* outTimestamp,
ssize_t n;
while ((n = mReceiver.getEvents(buf, EVENT_BUFFER_SIZE)) > 0) {
ALOGV("dispatcher %p ~ Read %d events.", this, int(n));
+ mFrameRateOverrides.reserve(n);
for (ssize_t i = 0; i < n; i++) {
const DisplayEventReceiver::Event& ev = buf[i];
switch (ev.header.type) {
@@ -162,6 +163,13 @@ bool DisplayEventDispatcher::processPendingEvents(nsecs_t* outTimestamp,
case DisplayEventReceiver::DISPLAY_EVENT_NULL:
dispatchNullEvent(ev.header.timestamp, ev.header.displayId);
break;
+ case DisplayEventReceiver::DISPLAY_EVENT_FRAME_RATE_OVERRIDE:
+ mFrameRateOverrides.emplace_back(ev.frameRateOverride);
+ break;
+ case DisplayEventReceiver::DISPLAY_EVENT_FRAME_RATE_OVERRIDE_FLUSH:
+ dispatchFrameRateOverrides(ev.header.timestamp, ev.header.displayId,
+ std::move(mFrameRateOverrides));
+ break;
default:
ALOGW("dispatcher %p ~ ignoring unknown event type %#x", this, ev.header.type);
break;