diff options
author | Dominik Laskowski <domlaskowski@google.com> | 2019-01-25 02:56:41 -0800 |
---|---|---|
committer | Dominik Laskowski <domlaskowski@google.com> | 2019-02-04 10:06:15 -0800 |
commit | 3316a0a08e79739b0508087232efcb3f2803dafe (patch) | |
tree | 90ae4e9f996c661ed2ec25b4ba2fa9075a877b8a /native/android/surface_control.cpp | |
parent | 1ba86936a955ef4e3206d8e862ce4f1b4550c2e5 (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/surface_control.cpp')
-rw-r--r-- | native/android/surface_control.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp index 3156732ef02b..d68d3499cc1e 100644 --- a/native/android/surface_control.cpp +++ b/native/android/surface_control.cpp @@ -46,7 +46,13 @@ using Transaction = SurfaceComposerClient::Transaction; static bool getWideColorSupport(const sp<SurfaceControl>& surfaceControl) { sp<SurfaceComposerClient> client = surfaceControl->getClient(); - sp<IBinder> display(client->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain)); + + const sp<IBinder> display = client->getInternalDisplayToken(); + if (display == nullptr) { + ALOGE("unable to get wide color support for disconnected internal display"); + return false; + } + bool isWideColorDisplay = false; status_t err = client->isWideColorDisplay(display, &isWideColorDisplay); if (err) { @@ -58,7 +64,12 @@ static bool getWideColorSupport(const sp<SurfaceControl>& surfaceControl) { static bool getHdrSupport(const sp<SurfaceControl>& surfaceControl) { sp<SurfaceComposerClient> client = surfaceControl->getClient(); - sp<IBinder> display(client->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain)); + + const sp<IBinder> display = client->getInternalDisplayToken(); + if (display == nullptr) { + ALOGE("unable to get hdr capabilities for disconnected internal display"); + return false; + } HdrCapabilities hdrCapabilities; status_t err = client->getHdrCapabilities(display, &hdrCapabilities); |