SF: Creating a basic Scheduler class.
Added a flag that can be turned on at runtime, and turns on the new path.
Added a basic Scheduler that encapsulates SF and App thread.
This is part of the go/surfce-flinger-scheduler move.
Test: All SF tests pass. Adding a Scheduler test in the next CL.
Change-Id: Ic45b662f82d60da1172bf64485c838344082b306
diff --git a/services/surfaceflinger/Scheduler/EventThread.cpp b/services/surfaceflinger/Scheduler/EventThread.cpp
index b84177c..fa2b0a6 100644
--- a/services/surfaceflinger/Scheduler/EventThread.cpp
+++ b/services/surfaceflinger/Scheduler/EventThread.cpp
@@ -45,11 +45,27 @@
namespace impl {
+EventThread::EventThread(std::unique_ptr<VSyncSource> src,
+ ResyncWithRateLimitCallback resyncWithRateLimitCallback,
+ InterceptVSyncsCallback interceptVSyncsCallback, const char* threadName)
+ : EventThread(nullptr, std::move(src), resyncWithRateLimitCallback, interceptVSyncsCallback,
+ threadName) {}
+
EventThread::EventThread(VSyncSource* src, ResyncWithRateLimitCallback resyncWithRateLimitCallback,
InterceptVSyncsCallback interceptVSyncsCallback, const char* threadName)
+ : EventThread(src, nullptr, resyncWithRateLimitCallback, interceptVSyncsCallback,
+ threadName) {}
+
+EventThread::EventThread(VSyncSource* src, std::unique_ptr<VSyncSource> uniqueSrc,
+ ResyncWithRateLimitCallback resyncWithRateLimitCallback,
+ InterceptVSyncsCallback interceptVSyncsCallback, const char* threadName)
: mVSyncSource(src),
+ mVSyncSourceUnique(std::move(uniqueSrc)),
mResyncWithRateLimitCallback(resyncWithRateLimitCallback),
mInterceptVSyncsCallback(interceptVSyncsCallback) {
+ if (src == nullptr) {
+ mVSyncSource = mVSyncSourceUnique.get();
+ }
for (auto& event : mVSyncEvent) {
event.header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC;
event.header.id = 0;