SF: Adding callback to Scheduler for setting refresh rate to 60 and 90.
When device is idle, refresh rate is set to 60. When not it's set to 90.
See go/surface-flinger-scheduler for more info.
Test: All SF tests pass.
Bug: 113612090
Bug: 122347908
Change-Id: Ica6e483118db276f72d3cb4e79535303c76f99d7
diff --git a/services/surfaceflinger/Scheduler/EventThread.cpp b/services/surfaceflinger/Scheduler/EventThread.cpp
index 1683982..bf925b2 100644
--- a/services/surfaceflinger/Scheduler/EventThread.cpp
+++ b/services/surfaceflinger/Scheduler/EventThread.cpp
@@ -67,7 +67,13 @@
}
void EventThreadConnection::requestNextVsync() {
- mEventThread->requestNextVsync(this);
+ ATRACE_NAME("requestNextVsync");
+ mEventThread->requestNextVsync(this, true);
+}
+
+void EventThreadConnection::requestNextVsyncForHWC() {
+ ATRACE_NAME("requestNextVsyncForHWC");
+ mEventThread->requestNextVsync(this, false);
}
status_t EventThreadConnection::postEvent(const DisplayEventReceiver::Event& event) {
@@ -184,16 +190,17 @@
}
}
-void EventThread::requestNextVsync(const sp<EventThreadConnection>& connection) {
- std::lock_guard<std::mutex> lock(mMutex);
- if (mResetIdleTimer) {
+void EventThread::requestNextVsync(const sp<EventThreadConnection>& connection, bool reset) {
+ if (mResetIdleTimer && reset) {
+ ATRACE_NAME("resetIdleTimer");
mResetIdleTimer();
}
-
if (mResyncWithRateLimitCallback) {
mResyncWithRateLimitCallback();
}
+ std::lock_guard<std::mutex> lock(mMutex);
+
if (connection->count < 0) {
connection->count = 0;
mCondition.notify_all();