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 --- libs/gui/ConsumerBase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libs/gui/ConsumerBase.cpp') diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp index 3cf3078345..be2b1afd36 100644 --- a/libs/gui/ConsumerBase.cpp +++ b/libs/gui/ConsumerBase.cpp @@ -56,7 +56,8 @@ static int32_t createProcessUniqueId() { ConsumerBase::ConsumerBase(const sp& bufferQueue, bool controlledByApp) : mAbandoned(false), - mConsumer(bufferQueue) { + mConsumer(bufferQueue), + mPrevFinalReleaseFence(Fence::NO_FENCE) { // Choose a name using the PID and a process-unique ID. mName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId()); @@ -366,6 +367,7 @@ status_t ConsumerBase::releaseBufferLocked( freeBufferLocked(slot); } + mPrevFinalReleaseFence = mSlots[slot].mFence; mSlots[slot].mFence = Fence::NO_FENCE; return err; -- cgit v1.2.3-59-g8ed1b