summaryrefslogtreecommitdiff
path: root/libs/androidfw/DisplayEventDispatcher.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 /libs/androidfw/DisplayEventDispatcher.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 'libs/androidfw/DisplayEventDispatcher.cpp')
-rw-r--r--libs/androidfw/DisplayEventDispatcher.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/libs/androidfw/DisplayEventDispatcher.cpp b/libs/androidfw/DisplayEventDispatcher.cpp
index 7708e4340397..3b9a348047ba 100644
--- a/libs/androidfw/DisplayEventDispatcher.cpp
+++ b/libs/androidfw/DisplayEventDispatcher.cpp
@@ -68,7 +68,7 @@ status_t DisplayEventDispatcher::scheduleVsync() {
// Drain all pending events.
nsecs_t vsyncTimestamp;
- int32_t vsyncDisplayId;
+ PhysicalDisplayId vsyncDisplayId;
uint32_t vsyncCount;
if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount)) {
ALOGE("dispatcher %p ~ last event processed while scheduling was for %" PRId64 "",
@@ -101,10 +101,11 @@ int DisplayEventDispatcher::handleEvent(int, int events, void*) {
// Drain all pending events, keep the last vsync.
nsecs_t vsyncTimestamp;
- int32_t vsyncDisplayId;
+ PhysicalDisplayId vsyncDisplayId;
uint32_t vsyncCount;
if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount)) {
- ALOGV("dispatcher %p ~ Vsync pulse: timestamp=%" PRId64 ", id=%d, count=%d",
+ ALOGV("dispatcher %p ~ Vsync pulse: timestamp=%" PRId64 ", displayId=%"
+ ANDROID_PHYSICAL_DISPLAY_ID_FORMAT ", count=%d",
this, ns2ms(vsyncTimestamp), vsyncDisplayId, vsyncCount);
mWaitingForVsync = false;
dispatchVsync(vsyncTimestamp, vsyncDisplayId, vsyncCount);
@@ -114,7 +115,7 @@ int DisplayEventDispatcher::handleEvent(int, int events, void*) {
}
bool DisplayEventDispatcher::processPendingEvents(
- nsecs_t* outTimestamp, int32_t* outId, uint32_t* outCount) {
+ nsecs_t* outTimestamp, PhysicalDisplayId* outDisplayId, uint32_t* outCount) {
bool gotVsync = false;
DisplayEventReceiver::Event buf[EVENT_BUFFER_SIZE];
ssize_t n;
@@ -128,11 +129,11 @@ bool DisplayEventDispatcher::processPendingEvents(
// ones. That's fine, we only care about the most recent.
gotVsync = true;
*outTimestamp = ev.header.timestamp;
- *outId = ev.header.id;
+ *outDisplayId = ev.header.displayId;
*outCount = ev.vsync.count;
break;
case DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG:
- dispatchHotplug(ev.header.timestamp, ev.header.id, ev.hotplug.connected);
+ dispatchHotplug(ev.header.timestamp, ev.header.displayId, ev.hotplug.connected);
break;
default:
ALOGW("dispatcher %p ~ ignoring unknown event type %#x", this, ev.header.type);