summaryrefslogtreecommitdiff
path: root/native/android/choreographer.cpp
diff options
context:
space:
mode:
authorDominik Laskowski <domlaskowski@google.com>2019-01-25 02:56:41 -0800
committerDominik Laskowski <domlaskowski@google.com>2019-02-04 10:06:15 -0800
commit3316a0a08e79739b0508087232efcb3f2803dafe (patch)
tree90ae4e9f996c661ed2ec25b4ba2fa9075a877b8a /native/android/choreographer.cpp
parent1ba86936a955ef4e3206d8e862ce4f1b4550c2e5 (diff)
Generalize physical display management
This CL enables the framework to manage an arbitrary number of physical displays. It also surfaces physical display IDs, which are stable across reboots and encode (model, port) information that will be propagated further up in a follow-up CL. Bug: 116025192 Test: Boot with more than two displays Test: Hotplug works with any number of displays Test: Verify stable display IDs with "dumpsys display" Change-Id: Idb2eaff66b2e0873be6ad27d337ff18b730d1331
Diffstat (limited to 'native/android/choreographer.cpp')
-rw-r--r--native/android/choreographer.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/native/android/choreographer.cpp b/native/android/choreographer.cpp
index c3629da1cb12..2db575bf5a13 100644
--- a/native/android/choreographer.cpp
+++ b/native/android/choreographer.cpp
@@ -24,6 +24,7 @@
#include <android/choreographer.h>
#include <androidfw/DisplayEventDispatcher.h>
#include <gui/ISurfaceComposer.h>
+#include <gui/SurfaceComposerClient.h>
#include <utils/Looper.h>
#include <utils/Mutex.h>
#include <utils/Timers.h>
@@ -67,8 +68,8 @@ private:
explicit Choreographer(const sp<Looper>& looper);
Choreographer(const Choreographer&) = delete;
- virtual void dispatchVsync(nsecs_t timestamp, int32_t id, uint32_t count);
- virtual void dispatchHotplug(nsecs_t timestamp, int32_t id, bool connected);
+ void dispatchVsync(nsecs_t timestamp, PhysicalDisplayId displayId, uint32_t count) override;
+ void dispatchHotplug(nsecs_t timestamp, PhysicalDisplayId displayId, bool connected) override;
void scheduleCallbacks();
@@ -139,13 +140,10 @@ void Choreographer::scheduleCallbacks() {
}
}
-
-void Choreographer::dispatchVsync(nsecs_t timestamp, int32_t id, uint32_t) {
- if (id != ISurfaceComposer::eDisplayIdMain) {
- ALOGV("choreographer %p ~ ignoring vsync signal for non-main display (id=%d)", this, id);
- scheduleVsync();
- return;
- }
+// TODO(b/74619554): The PhysicalDisplayId is ignored because SF only emits VSYNC events for the
+// internal display and DisplayEventReceiver::requestNextVsync only allows requesting VSYNC for
+// the internal display implicitly.
+void Choreographer::dispatchVsync(nsecs_t timestamp, PhysicalDisplayId, uint32_t) {
std::vector<FrameCallback> callbacks{};
{
AutoMutex _l{mLock};
@@ -160,9 +158,10 @@ void Choreographer::dispatchVsync(nsecs_t timestamp, int32_t id, uint32_t) {
}
}
-void Choreographer::dispatchHotplug(nsecs_t, int32_t id, bool connected) {
- ALOGV("choreographer %p ~ received hotplug event (id=%" PRId32 ", connected=%s), ignoring.",
- this, id, toString(connected));
+void Choreographer::dispatchHotplug(nsecs_t, PhysicalDisplayId displayId, bool connected) {
+ ALOGV("choreographer %p ~ received hotplug event (displayId=%"
+ ANDROID_PHYSICAL_DISPLAY_ID_FORMAT ", connected=%s), ignoring.",
+ this, displayId, toString(connected));
}
void Choreographer::handleMessage(const Message& message) {