summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceControl.cpp
diff options
context:
space:
mode:
author Pablo Gamito <pablogamito@google.com> 2020-09-01 18:28:58 +0000
committer Pablo Gamito <pablogamito@google.com> 2020-09-25 12:33:30 +0000
commitdbc31672ea7e7b8e8847db8ef70447de918d5b27 (patch)
tree3384e13cede47e1920cd31dbb7c548319b638472 /libs/gui/SurfaceControl.cpp
parent91512a00615042c9e80ec3f907339389a53a9810 (diff)
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
Diffstat (limited to 'libs/gui/SurfaceControl.cpp')
-rw-r--r--libs/gui/SurfaceControl.cpp13
1 files changed, 11 insertions, 2 deletions
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<SurfaceComposerClient>& client, const sp<IBinder>& handle,
- const sp<IGraphicBufferProducer>& gbp,
+ const sp<IGraphicBufferProducer>& gbp, int32_t layerId,
uint32_t transform)
: mClient(client),
mHandle(handle),
mGraphicBufferProducer(gbp),
+ mLayerId(layerId),
mTransformHint(transform) {}
SurfaceControl::SurfaceControl(const sp<SurfaceControl>& other) {
@@ -58,6 +59,7 @@ SurfaceControl::SurfaceControl(const sp<SurfaceControl>& other) {
mHandle = other->mHandle;
mGraphicBufferProducer = other->mGraphicBufferProducer;
mTransformHint = other->mTransformHint;
+ mLayerId = other->mLayerId;
}
SurfaceControl::~SurfaceControl()
@@ -148,6 +150,10 @@ sp<IBinder> SurfaceControl::getHandle() const
return mHandle;
}
+int32_t SurfaceControl::getLayerId() const {
+ return mLayerId;
+}
+
sp<IGraphicBufferProducer> 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<IBinder> client;
sp<IBinder> handle;
sp<IBinder> 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<ISurfaceComposerClient>(client)),
- handle.get(), interface_cast<IGraphicBufferProducer>(gbp),
+ handle.get(), interface_cast<IGraphicBufferProducer>(gbp), layerId,
transformHint);
return NO_ERROR;