SF: Register resync callback per event connection
This CL ties the resync callback to an EventThreadConnection instead
of an EventThread. This is a step towards having IDisplayEventConnection
subscribe to a given display rather than the primary display implicitly.
Each display will then have SurfaceFlinger::VsyncState that resyncs
independently at potentially different rates. Callbacks have weak
references to the per-display VsyncState owned by SurfaceFlinger.
Bug: 74619554
Test: Boot and turn display on/off repeatedly
Change-Id: Ic7cc64e2004fa07a5d54431fc330995048a4ed20
diff --git a/services/surfaceflinger/Scheduler/MessageQueue.h b/services/surfaceflinger/Scheduler/MessageQueue.h
index 0bf00b0..56a00c0 100644
--- a/services/surfaceflinger/Scheduler/MessageQueue.h
+++ b/services/surfaceflinger/Scheduler/MessageQueue.h
@@ -29,12 +29,12 @@
#include <private/gui/BitTube.h>
#include "Barrier.h"
+#include "EventThread.h"
#include <functional>
namespace android {
-class EventThread;
class SurfaceFlinger;
// ---------------------------------------------------------------------------
@@ -86,7 +86,7 @@
virtual void init(const sp<SurfaceFlinger>& flinger) = 0;
// TODO(akrulec): Remove this function once everything is migrated to Scheduler.
- virtual void setEventThread(EventThread* events) = 0;
+ virtual void setEventThread(EventThread* events, ResyncCallback resyncCallback) = 0;
virtual void setEventConnection(const sp<EventThreadConnection>& connection) = 0;
virtual void waitMessage() = 0;
virtual status_t postMessage(const sp<MessageBase>& message, nsecs_t reltime = 0) = 0;
@@ -127,7 +127,7 @@
public:
~MessageQueue() override = default;
void init(const sp<SurfaceFlinger>& flinger) override;
- void setEventThread(android::EventThread* events) override;
+ void setEventThread(android::EventThread* events, ResyncCallback resyncCallback) override;
void setEventConnection(const sp<EventThreadConnection>& connection) override;
void waitMessage() override;