diff options
author | Mathias Agopian <mathias@google.com> | 2011-04-08 19:10:43 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-04-08 19:28:04 -0700 |
commit | 5f05f99aaedaba18c426fac287bcb18d56dbe881 (patch) | |
tree | 791dab7fb51fb0e49663e9af9f8ac9f44f9242ec /include/surfaceflinger | |
parent | 7797e647fc8fcd5091b9449c0044f5cb70db5b47 (diff) | |
download | frameworks_base-5f05f99aaedaba18c426fac287bcb18d56dbe881.zip frameworks_base-5f05f99aaedaba18c426fac287bcb18d56dbe881.tar.gz frameworks_base-5f05f99aaedaba18c426fac287bcb18d56dbe881.tar.bz2 |
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
Diffstat (limited to 'include/surfaceflinger')
-rw-r--r-- | include/surfaceflinger/IGraphicBufferAlloc.h | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/include/surfaceflinger/IGraphicBufferAlloc.h b/include/surfaceflinger/IGraphicBufferAlloc.h index d996af7..01e4bd9 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<GraphicBuffer> 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; }; // ---------------------------------------------------------------------------- |