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
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 8ef885b..9a36bf9 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -236,10 +236,8 @@
// 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 @@
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;
}