From 5f05f99aaedaba18c426fac287bcb18d56dbe881 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 8 Apr 2011 19:10:43 -0700 Subject: Fix a GraphicBuffer leak in SurfaceTexture This leak was intentional, it was there to deal with the fact that some gralloc implementations don't track buffer handles with file-descriptors so buffers needed to stay alive until there were registered, which is not guaranteed by binder transactions. In this new implementation, we use a small BBinder holding a reference to the buffer, which with tuck into the parcel. This forces the reference to stay alive until the parcel is destroyed, which is guaranteed (by construction) to happen after the buffer is registered. this allows the public facing API to not expose the previous hack. Change-Id: I1dd6cd83679a2b7457ad628169e2851acc027143 --- include/surfaceflinger/IGraphicBufferAlloc.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'include/surfaceflinger') diff --git a/include/surfaceflinger/IGraphicBufferAlloc.h b/include/surfaceflinger/IGraphicBufferAlloc.h index d996af75a478..01e4bd9ff052 100644 --- a/include/surfaceflinger/IGraphicBufferAlloc.h +++ b/include/surfaceflinger/IGraphicBufferAlloc.h @@ -32,18 +32,10 @@ class IGraphicBufferAlloc : public IInterface public: DECLARE_META_INTERFACE(GraphicBufferAlloc); - /* Create a new GraphicBuffer for the client to use. The server will - * maintain a reference to the newly created GraphicBuffer until - * freeAllGraphicBuffers is called. + /* Create a new GraphicBuffer for the client to use. */ virtual sp createGraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) = 0; - - /* Free all but one of the GraphicBuffer objects that the server is - * currently referencing. If bufIndex is not a valid index of the buffers - * the server is referencing, then all buffers are freed. - */ - virtual void freeAllGraphicBuffersExcept(int bufIndex) = 0; }; // ---------------------------------------------------------------------------- -- cgit v1.2.3-59-g8ed1b