summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2012-12-07 11:04:51 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-12-07 11:04:51 -0800
commitd4e706208c99ff1716fb0009ec867ff29ff04a7c (patch)
treef0d1b201b52ead22b6e1791d5ed375f6357cb9a1
parent2d659286b59dc7ff7378fe967f1c425e92155995 (diff)
parent72c3f7d88160b7c279f90f0efe3c1cb12cd140ae (diff)
downloadframeworks_native-d4e706208c99ff1716fb0009ec867ff29ff04a7c.zip
frameworks_native-d4e706208c99ff1716fb0009ec867ff29ff04a7c.tar.gz
frameworks_native-d4e706208c99ff1716fb0009ec867ff29ff04a7c.tar.bz2
am 72c3f7d8: Revert "ConsumerBase: free buffers outside the lock"
* commit '72c3f7d88160b7c279f90f0efe3c1cb12cd140ae': Revert "ConsumerBase: free buffers outside the lock"
-rw-r--r--libs/gui/ConsumerBase.cpp34
1 files changed, 10 insertions, 24 deletions
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index cfc0293..624d7e0 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -109,35 +109,21 @@ void ConsumerBase::onFrameAvailable() {
}
void ConsumerBase::onBuffersReleased() {
- sp<GraphicBuffer> bufRefs[BufferQueue::NUM_BUFFER_SLOTS];
-
- { // Scope for the lock
- Mutex::Autolock lock(mMutex);
-
- CB_LOGV("onBuffersReleased");
-
- if (mAbandoned) {
- // Nothing to do if we're already abandoned.
- return;
- }
+ Mutex::Autolock lock(mMutex);
- uint32_t mask = 0;
- mBufferQueue->getReleasedBuffers(&mask);
- for (int i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) {
- if (mask & (1 << i)) {
- // Grab a local reference to the buffers so that they don't
- // get freed while the lock is held.
- bufRefs[i] = mSlots[i].mGraphicBuffer;
+ CB_LOGV("onBuffersReleased");
- freeBufferLocked(i);
- }
- }
+ if (mAbandoned) {
+ // Nothing to do if we're already abandoned.
+ return;
}
- // Clear the local buffer references. This would happen automatically
- // when the array gets dtor'd, but I'm doing it explicitly for clarity.
+ uint32_t mask = 0;
+ mBufferQueue->getReleasedBuffers(&mask);
for (int i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) {
- bufRefs[i].clear();
+ if (mask & (1 << i)) {
+ freeBufferLocked(i);
+ }
}
}