SurfaceFlinger: Add touch events to Scheduler
Add the notion of Touch Events to Scheduler to enhance the algorithm
to move to Performance refresh rate.
Scheduler selects Performance when:
- There is a touch event
- There is a buffer to HWC
This change also removes the behavior of Scheduler to move to Performance
on Choreographer callbacks.
Test: Switch between apps using gesture navigation
Bug: 131906818
Change-Id: I588cfc32449e87744e829dc7c5261a2e4151a8f8
diff --git a/services/surfaceflinger/Scheduler/EventThread.cpp b/services/surfaceflinger/Scheduler/EventThread.cpp
index a6c7e6c..05bad4d 100644
--- a/services/surfaceflinger/Scheduler/EventThread.cpp
+++ b/services/surfaceflinger/Scheduler/EventThread.cpp
@@ -107,10 +107,8 @@
} // namespace
EventThreadConnection::EventThreadConnection(EventThread* eventThread,
- ResyncCallback resyncCallback,
- ResetIdleTimerCallback resetIdleTimerCallback)
+ ResyncCallback resyncCallback)
: resyncCallback(std::move(resyncCallback)),
- resetIdleTimerCallback(std::move(resetIdleTimerCallback)),
mEventThread(eventThread),
mChannel(gui::BitTube::DefaultSize) {}
@@ -136,12 +134,7 @@
void EventThreadConnection::requestNextVsync() {
ATRACE_NAME("requestNextVsync");
- mEventThread->requestNextVsync(this, true);
-}
-
-void EventThreadConnection::requestNextVsyncForHWC() {
- ATRACE_NAME("requestNextVsyncForHWC");
- mEventThread->requestNextVsync(this, false);
+ mEventThread->requestNextVsync(this);
}
status_t EventThreadConnection::postEvent(const DisplayEventReceiver::Event& event) {
@@ -210,10 +203,8 @@
mVSyncSource->setPhaseOffset(phaseOffset);
}
-sp<EventThreadConnection> EventThread::createEventConnection(
- ResyncCallback resyncCallback, ResetIdleTimerCallback resetIdleTimerCallback) const {
- return new EventThreadConnection(const_cast<EventThread*>(this), std::move(resyncCallback),
- std::move(resetIdleTimerCallback));
+sp<EventThreadConnection> EventThread::createEventConnection(ResyncCallback resyncCallback) const {
+ return new EventThreadConnection(const_cast<EventThread*>(this), std::move(resyncCallback));
}
status_t EventThread::registerDisplayEventConnection(const sp<EventThreadConnection>& connection) {
@@ -255,12 +246,7 @@
}
}
-void EventThread::requestNextVsync(const sp<EventThreadConnection>& connection, bool reset) {
- if (connection->resetIdleTimerCallback && reset) {
- ATRACE_NAME("resetIdleTimer");
- connection->resetIdleTimerCallback();
- }
-
+void EventThread::requestNextVsync(const sp<EventThreadConnection>& connection) {
if (connection->resyncCallback) {
connection->resyncCallback();
}