diff options
author | 2022-10-06 20:34:10 +0000 | |
---|---|---|
committer | 2022-10-07 23:00:08 +0000 | |
commit | a361de6e3b7bac5a47f6098d49c5a1acb5baf476 (patch) | |
tree | 08a81a299df00b54e737f668d992b257621a048c /libs/gui/SurfaceControl.cpp | |
parent | 1d2b5a4f82eb00d3f980fe5eb6ac14c48f059a60 (diff) |
Add layer name to layer_state_t and SurfaceControl
This information will be used in subsequent CLs to trace layer cache events.
Bug: 244218818
Test: presubmits
Change-Id: I98bcd97310e3a2f061994481911073e8a1545cab
Diffstat (limited to 'libs/gui/SurfaceControl.cpp')
-rw-r--r-- | libs/gui/SurfaceControl.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index 84257dee9b..7aee882422 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -49,11 +49,12 @@ namespace android { // ============================================================================ SurfaceControl::SurfaceControl(const sp<SurfaceComposerClient>& client, const sp<IBinder>& handle, - int32_t layerId, uint32_t w, uint32_t h, PixelFormat format, - uint32_t transform, uint32_t flags) + int32_t layerId, const std::string& name, uint32_t w, uint32_t h, + PixelFormat format, uint32_t transform, uint32_t flags) : mClient(client), mHandle(handle), mLayerId(layerId), + mName(name), mTransformHint(transform), mWidth(w), mHeight(h), @@ -65,6 +66,7 @@ SurfaceControl::SurfaceControl(const sp<SurfaceControl>& other) { mHandle = other->mHandle; mTransformHint = other->mTransformHint; mLayerId = other->mLayerId; + mName = other->mName; mWidth = other->mWidth; mHeight = other->mHeight; mFormat = other->mFormat; @@ -185,6 +187,10 @@ int32_t SurfaceControl::getLayerId() const { return mLayerId; } +const std::string& SurfaceControl::getName() const { + return mName; +} + sp<IGraphicBufferProducer> SurfaceControl::getIGraphicBufferProducer() { getSurface(); @@ -212,6 +218,7 @@ status_t SurfaceControl::writeToParcel(Parcel& parcel) { SAFE_PARCEL(parcel.writeStrongBinder, ISurfaceComposerClient::asBinder(mClient->getClient())); SAFE_PARCEL(parcel.writeStrongBinder, mHandle); SAFE_PARCEL(parcel.writeInt32, mLayerId); + SAFE_PARCEL(parcel.writeUtf8AsUtf16, mName); SAFE_PARCEL(parcel.writeUint32, mTransformHint); SAFE_PARCEL(parcel.writeUint32, mWidth); SAFE_PARCEL(parcel.writeUint32, mHeight); @@ -225,6 +232,7 @@ status_t SurfaceControl::readFromParcel(const Parcel& parcel, sp<IBinder> client; sp<IBinder> handle; int32_t layerId; + std::string layerName; uint32_t transformHint; uint32_t width; uint32_t height; @@ -233,16 +241,17 @@ status_t SurfaceControl::readFromParcel(const Parcel& parcel, SAFE_PARCEL(parcel.readStrongBinder, &client); SAFE_PARCEL(parcel.readStrongBinder, &handle); SAFE_PARCEL(parcel.readInt32, &layerId); + SAFE_PARCEL(parcel.readUtf8FromUtf16, &layerName); SAFE_PARCEL(parcel.readUint32, &transformHint); SAFE_PARCEL(parcel.readUint32, &width); SAFE_PARCEL(parcel.readUint32, &height); SAFE_PARCEL(parcel.readUint32, &format); // We aren't the original owner of the surface. - *outSurfaceControl = - new SurfaceControl(new SurfaceComposerClient( - interface_cast<ISurfaceComposerClient>(client)), - handle.get(), layerId, width, height, format, transformHint); + *outSurfaceControl = new SurfaceControl(new SurfaceComposerClient( + interface_cast<ISurfaceComposerClient>(client)), + handle.get(), layerId, layerName, width, height, format, + transformHint); return NO_ERROR; } |