summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2015-05-01 16:42:55 -0700
committerDan Stoza <stoza@google.com>2015-05-01 16:42:55 -0700
commit52937cd9a543fe66696c38ae50ec141aa70ec1e4 (patch)
tree1dc19d6d406934847bd99c994bdccabbec174fcf
parent7b2fc930077b1e6ca5946cae6834902318209474 (diff)
downloadframeworks_native-52937cd9a543fe66696c38ae50ec141aa70ec1e4.zip
frameworks_native-52937cd9a543fe66696c38ae50ec141aa70ec1e4.tar.gz
frameworks_native-52937cd9a543fe66696c38ae50ec141aa70ec1e4.tar.bz2
libgui: Clear frame number while freeing slot
Clears the frame number of a slot when it is freed, since it is used to determine if a released buffer is stale. Bug: 20445852 Change-Id: I02415e7b25a1eafe7414d6eb1cedf62ac5543cd9
-rw-r--r--libs/gui/BufferQueueConsumer.cpp4
-rw-r--r--libs/gui/BufferQueueCore.cpp1
2 files changed, 4 insertions, 1 deletions
diff --git a/libs/gui/BufferQueueConsumer.cpp b/libs/gui/BufferQueueConsumer.cpp
index c7d5e00..c3e1019 100644
--- a/libs/gui/BufferQueueConsumer.cpp
+++ b/libs/gui/BufferQueueConsumer.cpp
@@ -292,6 +292,8 @@ status_t BufferQueueConsumer::releaseBuffer(int slot, uint64_t frameNumber,
if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS ||
releaseFence == NULL) {
+ BQ_LOGE("releaseBuffer: slot %d out of range or fence %p NULL", slot,
+ releaseFence.get());
return BAD_VALUE;
}
@@ -330,7 +332,7 @@ status_t BufferQueueConsumer::releaseBuffer(int slot, uint64_t frameNumber,
mSlots[slot].mNeedsCleanupOnRelease = false;
return STALE_BUFFER_SLOT;
} else {
- BQ_LOGV("releaseBuffer: attempted to release buffer slot %d "
+ BQ_LOGE("releaseBuffer: attempted to release buffer slot %d "
"but its state was %d", slot, mSlots[slot].mBufferState);
return BAD_VALUE;
}
diff --git a/libs/gui/BufferQueueCore.cpp b/libs/gui/BufferQueueCore.cpp
index 887f2cb..e784644 100644
--- a/libs/gui/BufferQueueCore.cpp
+++ b/libs/gui/BufferQueueCore.cpp
@@ -212,6 +212,7 @@ void BufferQueueCore::freeBufferLocked(int slot) {
}
mSlots[slot].mBufferState = BufferSlot::FREE;
mSlots[slot].mAcquireCalled = false;
+ mSlots[slot].mFrameNumber = 0;
// Destroy fence as BufferQueue now takes ownership
if (mSlots[slot].mEglFence != EGL_NO_SYNC_KHR) {