diff options
author | 2019-01-25 02:35:50 -0800 | |
---|---|---|
committer | 2019-02-02 10:14:22 -0800 | |
commit | dcb38bbd32eb96ec46d69658390353a853b3af6d (patch) | |
tree | 78b3424dde3c1eac9969482afaff98462dc48221 /libs/gui/ISurfaceComposer.cpp | |
parent | 8a0222e629b82dda35840aa74eeec55bcc16999d (diff) |
SF: Plumb physical display IDs to libgui
This CL replaces ISurfaceComposer::{eDisplayIdMain,eDisplayIdHdmi} with
the stable 64-bit display IDs generated by SF. Note that the 64-bit IDs
fall back to the old values if the HWC API for display identification is
not supported.
Bug: 74619554
Test: LocalDisplayAdapter and Choreographer receive 64-bit IDs
Test: 64-bit IDs fall back to 0 and 1 on HWC 2.2 and below
Change-Id: I3c08eff6eb8bb179ecce596ab2820a2aa44c8649
Diffstat (limited to 'libs/gui/ISurfaceComposer.cpp')
-rw-r--r-- | libs/gui/ISurfaceComposer.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index bef68ef22f..4357f798df 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -275,12 +275,25 @@ public: remote()->transact(BnSurfaceComposer::DESTROY_DISPLAY, data, &reply); } - virtual sp<IBinder> getBuiltInDisplay(int32_t id) - { + virtual std::vector<PhysicalDisplayId> getPhysicalDisplayIds() const { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); + if (remote()->transact(BnSurfaceComposer::GET_PHYSICAL_DISPLAY_IDS, data, &reply) == + NO_ERROR) { + std::vector<PhysicalDisplayId> displayIds; + if (reply.readUint64Vector(&displayIds) == NO_ERROR) { + return displayIds; + } + } + + return {}; + } + + virtual sp<IBinder> getPhysicalDisplayToken(PhysicalDisplayId displayId) const { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeInt32(id); - remote()->transact(BnSurfaceComposer::GET_BUILT_IN_DISPLAY, data, &reply); + data.writeUint64(displayId); + remote()->transact(BnSurfaceComposer::GET_PHYSICAL_DISPLAY_TOKEN, data, &reply); return reply.readStrongBinder(); } @@ -932,10 +945,10 @@ status_t BnSurfaceComposer::onTransact( destroyDisplay(display); return NO_ERROR; } - case GET_BUILT_IN_DISPLAY: { + case GET_PHYSICAL_DISPLAY_TOKEN: { CHECK_INTERFACE(ISurfaceComposer, data, reply); - int32_t id = data.readInt32(); - sp<IBinder> display(getBuiltInDisplay(id)); + PhysicalDisplayId displayId = data.readUint64(); + sp<IBinder> display = getPhysicalDisplayToken(displayId); reply->writeStrongBinder(display); return NO_ERROR; } @@ -1294,12 +1307,14 @@ status_t BnSurfaceComposer::onTransact( } return error; } + case GET_PHYSICAL_DISPLAY_IDS: { + CHECK_INTERFACE(ISurfaceComposer, data, reply); + return reply->writeUint64Vector(getPhysicalDisplayIds()); + } default: { return BBinder::onTransact(code, data, reply, flags); } } } -// ---------------------------------------------------------------------------- - -}; +} // namespace android |