From 3546a3f08ad84099db4006d651c656d58d2ed566 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 14 Jul 2016 11:51:14 -0700 Subject: Fix FenceTracker releaseFence This patch: * Fixes the release fence when GPU compositing. * Stores the final release fence in ConsumerBase just before releasing the Buffer, which helps ensure sync points aren't added unknowningly. * Makes HWC2 release pending buffers as the first step of postCompostion, rather than the last, which should allow dequeue to unblock a little earlier and helps make sure the previous buffer's release fence has been finalized before FenceTracker::addFrame is called. * Fence tracker only sets the release fence once it has been finalized so it does not report a release fence for a buffer that is still latched. Test: adb shell /data/nativetest/libgui_test/libgui_test --gtest_filter=*GetFrameTimestamps* Change-Id: I27d484bfd48f730bdcea2628f96795c6f4b4df7b --- include/gui/ConsumerBase.h | 6 +++++- include/gui/GLConsumer.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'include/gui') diff --git a/include/gui/ConsumerBase.h b/include/gui/ConsumerBase.h index 9f8b638a3a..ce85fc3e8d 100644 --- a/include/gui/ConsumerBase.h +++ b/include/gui/ConsumerBase.h @@ -180,7 +180,7 @@ protected: // Derived classes should override this method to perform any cleanup that // must take place when a buffer is released back to the BufferQueue. If // it is overridden the derived class's implementation must call - // ConsumerBase::releaseBufferLocked.e + // ConsumerBase::releaseBufferLocked. virtual status_t releaseBufferLocked(int slot, const sp graphicBuffer, EGLDisplay display, EGLSyncKHR eglFence); @@ -244,6 +244,10 @@ protected: // if none is supplied sp mConsumer; + // The final release fence of the most recent buffer released by + // releaseBufferLocked. + sp mPrevFinalReleaseFence; + // mMutex is the mutex used to prevent concurrent access to the member // variables of ConsumerBase objects. It must be locked whenever the // member variables are accessed or when any of the *Locked methods are diff --git a/include/gui/GLConsumer.h b/include/gui/GLConsumer.h index 6267625e96..6ff130364b 100644 --- a/include/gui/GLConsumer.h +++ b/include/gui/GLConsumer.h @@ -250,7 +250,7 @@ protected: // mEglSlots array in addition to the ConsumerBase. virtual status_t releaseBufferLocked(int slot, const sp graphicBuffer, - EGLDisplay display, EGLSyncKHR eglFence); + EGLDisplay display, EGLSyncKHR eglFence) override; status_t releaseBufferLocked(int slot, const sp graphicBuffer, EGLSyncKHR eglFence) { -- cgit v1.2.3-59-g8ed1b