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/SurfaceTextureClient.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libs/gui/SurfaceTextureClient.cpp') diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp index 50cbdb8f3581..ee14ac9006a4 100644 --- a/libs/gui/SurfaceTextureClient.cpp +++ b/libs/gui/SurfaceTextureClient.cpp @@ -25,8 +25,8 @@ namespace android { SurfaceTextureClient::SurfaceTextureClient( const sp& surfaceTexture): - mSurfaceTexture(surfaceTexture), mReqWidth(1), mReqHeight(1), - mReqFormat(DEFAULT_FORMAT), mReqUsage(0), mMutex() { + mSurfaceTexture(surfaceTexture), mAllocator(0), mReqWidth(1), + mReqHeight(1), mReqFormat(DEFAULT_FORMAT), mReqUsage(0), mMutex() { // Initialize the ANativeWindow function pointers. ANativeWindow::setSwapInterval = setSwapInterval; ANativeWindow::dequeueBuffer = dequeueBuffer; @@ -35,6 +35,9 @@ SurfaceTextureClient::SurfaceTextureClient( ANativeWindow::queueBuffer = queueBuffer; ANativeWindow::query = query; ANativeWindow::perform = perform; + + // Get a reference to the allocator. + mAllocator = mSurfaceTexture->getAllocator(); } int SurfaceTextureClient::setSwapInterval(ANativeWindow* window, int interval) { -- cgit v1.2.3-59-g8ed1b