From d58c304cc60be46a363fdcdce6da06e4ecb589b6 Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Thu, 28 Jun 2012 15:06:53 -0700 Subject: Clarify aborted updateTexImage use of fences When updateTexImage acquires a buffer but then aborts (due to an error or the buffer being rejected), it releases the newly-acquired buffer. It was passing the buffer slot's fences to releaseBuffer, even though they hadn't been created after the acquire yet. This wasn't a bug, since the fences would be cleared just after the buffer slot was last released, but explicitly passing null fences makes this clearer. Change-Id: I087f2ec3fd02c40f57782c1fca24eb9567e2943d --- libs/gui/SurfaceTexture.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp index 8ef885b3ef..9a36bf9740 100644 --- a/libs/gui/SurfaceTexture.cpp +++ b/libs/gui/SurfaceTexture.cpp @@ -236,10 +236,8 @@ status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) { // not accept this buffer. this is used by SurfaceFlinger to // reject buffers which have the wrong size if (rejecter && rejecter->reject(mEGLSlots[buf].mGraphicBuffer, item)) { - mBufferQueue->releaseBuffer(buf, dpy, mEGLSlots[buf].mFence, - mEGLSlots[buf].mReleaseFence); - mEGLSlots[buf].mFence = EGL_NO_SYNC_KHR; - mEGLSlots[buf].mReleaseFence.clear(); + mBufferQueue->releaseBuffer(buf, dpy, EGL_NO_SYNC_KHR, + Fence::NO_FENCE); glBindTexture(mTexTarget, mTexName); return NO_ERROR; } @@ -286,10 +284,8 @@ status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) { if (err != NO_ERROR) { // Release the buffer we just acquired. It's not safe to // release the old buffer, so instead we just drop the new frame. - mBufferQueue->releaseBuffer(buf, dpy, mEGLSlots[buf].mFence, - mEGLSlots[buf].mReleaseFence); - mEGLSlots[buf].mFence = EGL_NO_SYNC_KHR; - mEGLSlots[buf].mReleaseFence.clear(); + mBufferQueue->releaseBuffer(buf, dpy, EGL_NO_SYNC_KHR, + Fence::NO_FENCE); return err; } -- cgit v1.2.3-59-g8ed1b