From 83bac216a7ba8493a7916e40b2555e73c3a5cc1a Mon Sep 17 00:00:00 2001 From: Jamie Gennis Date: Wed, 2 Feb 2011 15:31:47 -0800 Subject: Pass the IGraphicBufferAlloc to SurfaceTextureClient. This change passes a reference to the IGraphicBufferAlloc binder object to SurfaceTextureClient objects. When STC objects are created they query their associated ISurfaceTexture object for the IGraphicBufferAlloc that the SurfaceTexture uses to allocate buffers. Having the SurfaceTextureClient hold this reference prevents the GraphicBufferAlloc in SurfaceFlinger from freeing the allocated buffers before the SurfaceTextureClient is done with them. Change-Id: Ib8e30e8b37fdd60438cbb4cb7e9174d0ba6d661c related-bug: 3362519 --- libs/gui/ISurfaceTexture.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libs/gui/ISurfaceTexture.cpp') diff --git a/libs/gui/ISurfaceTexture.cpp b/libs/gui/ISurfaceTexture.cpp index 90bca3ca4bad..d661fd57914e 100644 --- a/libs/gui/ISurfaceTexture.cpp +++ b/libs/gui/ISurfaceTexture.cpp @@ -38,6 +38,7 @@ enum { CANCEL_BUFFER, SET_CROP, SET_TRANSFORM, + GET_ALLOCATOR, }; @@ -123,6 +124,13 @@ public: status_t result = reply.readInt32(); return result; } + + virtual sp getAllocator() { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + remote()->transact(GET_ALLOCATOR, data, &reply); + return reply.readStrongBinder(); + } }; IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture"); @@ -195,6 +203,12 @@ status_t BnSurfaceTexture::onTransact( reply->writeInt32(result); return NO_ERROR; } break; + case GET_ALLOCATOR: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + sp result = getAllocator(); + reply->writeStrongBinder(result); + return NO_ERROR; + } break; } return BBinder::onTransact(code, data, reply, flags); } -- cgit v1.2.3-59-g8ed1b