From dbc31672ea7e7b8e8847db8ef70447de918d5b27 Mon Sep 17 00:00:00 2001 From: Pablo Gamito Date: Tue, 1 Sep 2020 18:28:58 +0000 Subject: Add LayerId to SurfaceControl and LayerState when created Allows us to then dump the LayerState on transaction merges and have an id to associate the LayerState with a layer Test: Check if layer id is available in the LayerState when we dump the LayerState on merges Change-Id: I5046835d6a82574110125c7dbdf2098bd10ac296 --- libs/gui/SurfaceControl.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'libs/gui/SurfaceControl.cpp') diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index 6e153d9acc..e37ff890b0 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -46,11 +46,12 @@ namespace android { // ============================================================================ SurfaceControl::SurfaceControl(const sp& client, const sp& handle, - const sp& gbp, + const sp& gbp, int32_t layerId, uint32_t transform) : mClient(client), mHandle(handle), mGraphicBufferProducer(gbp), + mLayerId(layerId), mTransformHint(transform) {} SurfaceControl::SurfaceControl(const sp& other) { @@ -58,6 +59,7 @@ SurfaceControl::SurfaceControl(const sp& other) { mHandle = other->mHandle; mGraphicBufferProducer = other->mGraphicBufferProducer; mTransformHint = other->mTransformHint; + mLayerId = other->mLayerId; } SurfaceControl::~SurfaceControl() @@ -148,6 +150,10 @@ sp SurfaceControl::getHandle() const return mHandle; } +int32_t SurfaceControl::getLayerId() const { + return mLayerId; +} + sp SurfaceControl::getIGraphicBufferProducer() const { Mutex::Autolock _l(mLock); @@ -173,6 +179,7 @@ status_t SurfaceControl::writeToParcel(Parcel& parcel) { SAFE_PARCEL(parcel.writeStrongBinder, ISurfaceComposerClient::asBinder(mClient->getClient())); SAFE_PARCEL(parcel.writeStrongBinder, mHandle); SAFE_PARCEL(parcel.writeStrongBinder, IGraphicBufferProducer::asBinder(mGraphicBufferProducer)); + SAFE_PARCEL(parcel.writeInt32, mLayerId); SAFE_PARCEL(parcel.writeUint32, mTransformHint); return NO_ERROR; @@ -183,18 +190,20 @@ status_t SurfaceControl::readFromParcel(const Parcel& parcel, sp client; sp handle; sp gbp; + int32_t layerId; uint32_t transformHint; SAFE_PARCEL(parcel.readStrongBinder, &client); SAFE_PARCEL(parcel.readStrongBinder, &handle); SAFE_PARCEL(parcel.readNullableStrongBinder, &gbp); + SAFE_PARCEL(parcel.readInt32, &layerId); SAFE_PARCEL(parcel.readUint32, &transformHint); // We aren't the original owner of the surface. *outSurfaceControl = new SurfaceControl(new SurfaceComposerClient( interface_cast(client)), - handle.get(), interface_cast(gbp), + handle.get(), interface_cast(gbp), layerId, transformHint); return NO_ERROR; -- cgit v1.2.3-59-g8ed1b