Loading include/gui/ConsumerBase.h +8 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,14 @@ protected: // it is overridden the derived class's implementation must call // ConsumerBase::acquireBufferLocked. virtual status_t releaseBufferLocked(int buf, EGLDisplay display, EGLSyncKHR eglFence, const sp<Fence>& fence); EGLSyncKHR eglFence); // addReleaseFence adds the sync points associated with a fence to the set // of sync points that must be reached before the buffer in the given slot // may be used after the slot has been released. This should be called by // derived classes each time some asynchronous work is kicked off that // references the buffer. status_t addReleaseFence(int slot, const sp<Fence>& fence); // Slot contains the information and object references that // ConsumerBase maintains about a BufferQueue buffer slot. Loading include/gui/SurfaceTexture.h +1 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ protected: // releaseBufferLocked overrides the ConsumerBase method to update the // mEglSlots array in addition to the ConsumerBase. virtual status_t releaseBufferLocked(int buf, EGLDisplay display, EGLSyncKHR eglFence, const sp<Fence>& fence); EGLSyncKHR eglFence); static bool isExternalFormat(uint32_t format); Loading libs/gui/BufferItemConsumer.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -82,8 +82,10 @@ status_t BufferItemConsumer::releaseBuffer(const BufferItem &item, Mutex::Autolock _l(mMutex); err = addReleaseFence(item.mBuf, releaseFence); err = releaseBufferLocked(item.mBuf, EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, releaseFence); EGL_NO_SYNC_KHR); if (err != OK) { BI_LOGE("Failed to release buffer: %s (%d)", strerror(-err), err); Loading libs/gui/ConsumerBase.cpp +27 −2 Original line number Diff line number Diff line Loading @@ -185,15 +185,40 @@ status_t ConsumerBase::acquireBufferLocked(BufferQueue::BufferItem *item) { mSlots[item->mBuf].mGraphicBuffer = item->mGraphicBuffer; } mSlots[item->mBuf].mFence = item->mFence; CB_LOGV("acquireBufferLocked: -> slot=%d", item->mBuf); return OK; } status_t ConsumerBase::addReleaseFence(int slot, const sp<Fence>& fence) { CB_LOGV("addReleaseFence: slot=%d", slot); if (!mSlots[slot].mFence.get()) { mSlots[slot].mFence = fence; } else { sp<Fence> mergedFence = Fence::merge( String8("ConsumerBase merged release"), mSlots[slot].mFence, fence); if (!mergedFence.get()) { CB_LOGE("failed to merge release fences"); // synchronization is broken, the best we can do is hope fences // signal in order so the new fence will act like a union mSlots[slot].mFence = fence; return BAD_VALUE; } mSlots[slot].mFence = mergedFence; } return OK; } status_t ConsumerBase::releaseBufferLocked(int slot, EGLDisplay display, EGLSyncKHR eglFence, const sp<Fence>& fence) { EGLSyncKHR eglFence) { CB_LOGV("releaseBufferLocked: slot=%d", slot); status_t err = mBufferQueue->releaseBuffer(slot, display, eglFence, fence); status_t err = mBufferQueue->releaseBuffer(slot, display, eglFence, mSlots[slot].mFence); if (err == BufferQueue::STALE_BUFFER_SLOT) { freeBufferLocked(slot); } Loading libs/gui/CpuConsumer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ status_t CpuConsumer::unlockBuffer(const LockedBuffer &nativeBuffer) { CC_LOGE("%s: Unable to unlock graphic buffer %d", __FUNCTION__, slotIndex); return err; } releaseBufferLocked(slotIndex, EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, Fence::NO_FENCE); releaseBufferLocked(slotIndex, EGL_NO_DISPLAY, EGL_NO_SYNC_KHR); mCurrentLockedBuffers--; Loading Loading
include/gui/ConsumerBase.h +8 −1 Original line number Diff line number Diff line Loading @@ -152,7 +152,14 @@ protected: // it is overridden the derived class's implementation must call // ConsumerBase::acquireBufferLocked. virtual status_t releaseBufferLocked(int buf, EGLDisplay display, EGLSyncKHR eglFence, const sp<Fence>& fence); EGLSyncKHR eglFence); // addReleaseFence adds the sync points associated with a fence to the set // of sync points that must be reached before the buffer in the given slot // may be used after the slot has been released. This should be called by // derived classes each time some asynchronous work is kicked off that // references the buffer. status_t addReleaseFence(int slot, const sp<Fence>& fence); // Slot contains the information and object references that // ConsumerBase maintains about a BufferQueue buffer slot. Loading
include/gui/SurfaceTexture.h +1 −1 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ protected: // releaseBufferLocked overrides the ConsumerBase method to update the // mEglSlots array in addition to the ConsumerBase. virtual status_t releaseBufferLocked(int buf, EGLDisplay display, EGLSyncKHR eglFence, const sp<Fence>& fence); EGLSyncKHR eglFence); static bool isExternalFormat(uint32_t format); Loading
libs/gui/BufferItemConsumer.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -82,8 +82,10 @@ status_t BufferItemConsumer::releaseBuffer(const BufferItem &item, Mutex::Autolock _l(mMutex); err = addReleaseFence(item.mBuf, releaseFence); err = releaseBufferLocked(item.mBuf, EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, releaseFence); EGL_NO_SYNC_KHR); if (err != OK) { BI_LOGE("Failed to release buffer: %s (%d)", strerror(-err), err); Loading
libs/gui/ConsumerBase.cpp +27 −2 Original line number Diff line number Diff line Loading @@ -185,15 +185,40 @@ status_t ConsumerBase::acquireBufferLocked(BufferQueue::BufferItem *item) { mSlots[item->mBuf].mGraphicBuffer = item->mGraphicBuffer; } mSlots[item->mBuf].mFence = item->mFence; CB_LOGV("acquireBufferLocked: -> slot=%d", item->mBuf); return OK; } status_t ConsumerBase::addReleaseFence(int slot, const sp<Fence>& fence) { CB_LOGV("addReleaseFence: slot=%d", slot); if (!mSlots[slot].mFence.get()) { mSlots[slot].mFence = fence; } else { sp<Fence> mergedFence = Fence::merge( String8("ConsumerBase merged release"), mSlots[slot].mFence, fence); if (!mergedFence.get()) { CB_LOGE("failed to merge release fences"); // synchronization is broken, the best we can do is hope fences // signal in order so the new fence will act like a union mSlots[slot].mFence = fence; return BAD_VALUE; } mSlots[slot].mFence = mergedFence; } return OK; } status_t ConsumerBase::releaseBufferLocked(int slot, EGLDisplay display, EGLSyncKHR eglFence, const sp<Fence>& fence) { EGLSyncKHR eglFence) { CB_LOGV("releaseBufferLocked: slot=%d", slot); status_t err = mBufferQueue->releaseBuffer(slot, display, eglFence, fence); status_t err = mBufferQueue->releaseBuffer(slot, display, eglFence, mSlots[slot].mFence); if (err == BufferQueue::STALE_BUFFER_SLOT) { freeBufferLocked(slot); } Loading
libs/gui/CpuConsumer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ status_t CpuConsumer::unlockBuffer(const LockedBuffer &nativeBuffer) { CC_LOGE("%s: Unable to unlock graphic buffer %d", __FUNCTION__, slotIndex); return err; } releaseBufferLocked(slotIndex, EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, Fence::NO_FENCE); releaseBufferLocked(slotIndex, EGL_NO_DISPLAY, EGL_NO_SYNC_KHR); mCurrentLockedBuffers--; Loading