Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d58c304c authored by Jesse Hall's avatar Jesse Hall
Browse files

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
parent f9783af2
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -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;
        }