diff options
| author | 2016-08-22 17:26:41 -0700 | |
|---|---|---|
| committer | 2016-08-25 13:13:08 -0700 | |
| commit | a1d24b45ccb6f68448f478e2a847a5544276002b (patch) | |
| tree | e794c6350eb475c1ecdcf891ad19ea0981ca8a4a /libs/gui/IGraphicBufferAlloc.cpp | |
| parent | b10cd89507e8c492b2f5bb346d7839c8e04ffdfa (diff) | |
Add requestor name to GraphicBuffer alloc metadata
Adds a requestor name (usually the BufferQueue consumer's name) to the
metadata that GraphicBufferAllocator stores on allocation so that
`dumpsys SurfaceFlinger` can attempt to attribute buffer usage to the
correct client.
Bug: 30776557
Change-Id: I6e0f346584c871bb3b9d5481f82b697b0475a916
Diffstat (limited to 'libs/gui/IGraphicBufferAlloc.cpp')
| -rw-r--r-- | libs/gui/IGraphicBufferAlloc.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libs/gui/IGraphicBufferAlloc.cpp b/libs/gui/IGraphicBufferAlloc.cpp index 3009989964..7b3b7c1dc5 100644 --- a/libs/gui/IGraphicBufferAlloc.cpp +++ b/libs/gui/IGraphicBufferAlloc.cpp @@ -46,13 +46,19 @@ public: virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t width, uint32_t height, PixelFormat format, uint32_t usage, - status_t* error) { + std::string requestorName, status_t* error) { Parcel data, reply; data.writeInterfaceToken(IGraphicBufferAlloc::getInterfaceDescriptor()); data.writeUint32(width); data.writeUint32(height); data.writeInt32(static_cast<int32_t>(format)); data.writeUint32(usage); + if (requestorName.empty()) { + requestorName += "[PID "; + requestorName += std::to_string(getpid()); + requestorName += ']'; + } + data.writeUtf8AsUtf16(requestorName); remote()->transact(CREATE_GRAPHIC_BUFFER, data, &reply); sp<GraphicBuffer> graphicBuffer; status_t result = reply.readInt32(); @@ -101,9 +107,11 @@ status_t BnGraphicBufferAlloc::onTransact( uint32_t height = data.readUint32(); PixelFormat format = static_cast<PixelFormat>(data.readInt32()); uint32_t usage = data.readUint32(); - status_t error; - sp<GraphicBuffer> result = - createGraphicBuffer(width, height, format, usage, &error); + status_t error = NO_ERROR; + std::string requestorName; + data.readUtf8FromUtf16(&requestorName); + sp<GraphicBuffer> result = createGraphicBuffer(width, height, + format, usage, requestorName, &error); reply->writeInt32(error); if (result != 0) { reply->write(*result); |