summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-03-07 14:18:54 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-07 14:18:54 -0800
commitfc004c13501962a0ca552560fa79ede1e1ecbc4c (patch)
tree198fd09119d54080673ffb7c0e1ece5f1ba17e8c /libs
parent28ae199eee06e57b5fc3fd173344a7c91ebb5d06 (diff)
parent3e964c55ac324a867d2efe7cee61eacb511309d1 (diff)
downloadframeworks_base-fc004c13501962a0ca552560fa79ede1e1ecbc4c.zip
frameworks_base-fc004c13501962a0ca552560fa79ede1e1ecbc4c.tar.gz
frameworks_base-fc004c13501962a0ca552560fa79ede1e1ecbc4c.tar.bz2
Merge "attempt to fix a deadlock in SurfaceTextureClient::disconnect"
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/BufferQueue.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index 25a4c22..7d64105 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -111,7 +111,7 @@ status_t BufferQueue::setBufferCountServerLocked(int bufferCount) {
// easy, we just have more buffers
mBufferCount = bufferCount;
mServerBufferCount = bufferCount;
- mDequeueCondition.signal();
+ mDequeueCondition.broadcast();
} else {
// we're here because we're either
// - reducing the number of available buffers
@@ -192,7 +192,7 @@ status_t BufferQueue::setBufferCount(int bufferCount) {
mClientBufferCount = bufferCount;
mBufferHasBeenQueued = false;
mQueue.clear();
- mDequeueCondition.signal();
+ mDequeueCondition.broadcast();
return OK;
}
@@ -306,6 +306,7 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
if (numberOfBuffersNeedsToChange) {
// here we're guaranteed that mQueue is empty
freeAllBuffersLocked();
+ // XXX: signal?
mBufferCount = mServerBufferCount;
if (mBufferCount < minBufferCountNeeded)
mBufferCount = minBufferCountNeeded;
@@ -496,7 +497,7 @@ status_t BufferQueue::setSynchronousMode(bool enabled) {
// - if the client set the number of buffers, we're guaranteed that
// we have at least 3 (because we don't allow less)
mSynchronousMode = enabled;
- mDequeueCondition.signal();
+ mDequeueCondition.broadcast();
}
return err;
}
@@ -564,7 +565,7 @@ status_t BufferQueue::queueBuffer(int buf, int64_t timestamp,
mSlots[buf].mFrameNumber = mFrameCounter;
mBufferHasBeenQueued = true;
- mDequeueCondition.signal();
+ mDequeueCondition.broadcast();
*outWidth = mDefaultWidth;
*outHeight = mDefaultHeight;
@@ -601,7 +602,7 @@ void BufferQueue::cancelBuffer(int buf) {
}
mSlots[buf].mBufferState = BufferSlot::FREE;
mSlots[buf].mFrameNumber = 0;
- mDequeueCondition.signal();
+ mDequeueCondition.broadcast();
}
status_t BufferQueue::setCrop(const Rect& crop) {
@@ -709,7 +710,7 @@ status_t BufferQueue::disconnect(int api) {
mNextCrop.makeInvalid();
mNextScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
mNextTransform = 0;
- mDequeueCondition.signal();
+ mDequeueCondition.broadcast();
} else {
ST_LOGE("disconnect: connected to another api (cur=%d, req=%d)",
mConnectedApi, api);
@@ -846,6 +847,7 @@ status_t BufferQueue::acquire(BufferItem *buffer) {
mSlots[buf].mBufferState = BufferSlot::ACQUIRED;
mQueue.erase(front);
+ mDequeueCondition.broadcast();
ATRACE_INT(mConsumerName.string(), mQueue.size());
}
@@ -877,7 +879,8 @@ status_t BufferQueue::releaseBuffer(int buf, EGLDisplay display,
|| mSlots[buf].mBufferState == BufferSlot::ACQUIRED) {
mSlots[buf].mBufferState = BufferSlot::FREE;
}
- mDequeueCondition.signal();
+
+ mDequeueCondition.broadcast();
return OK;
}
@@ -888,7 +891,7 @@ status_t BufferQueue::consumerDisconnect() {
// is considered abandoned
mAbandoned = true;
freeAllBuffersLocked();
- mDequeueCondition.signal();
+ mDequeueCondition.broadcast();
return OK;
}