attempt to fix a deadlock in SurfaceTextureClient::disconnect
- condition wasn't signaled if an error happened between acquire and release - also replace signal with broadcasts Bug: 6109450 Change-Id: I8ac03c7eca35c9cc04a00ef7fad36bb9cb3fcef6
This commit is contained in:
parent
2f8fa855d3
commit
74ff8c23f4
@ -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;
|
||||
}
|
||||
|
||||
@ -491,7 +491,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;
|
||||
}
|
||||
@ -559,7 +559,7 @@ status_t BufferQueue::queueBuffer(int buf, int64_t timestamp,
|
||||
mSlots[buf].mFrameNumber = mFrameCounter;
|
||||
|
||||
mBufferHasBeenQueued = true;
|
||||
mDequeueCondition.signal();
|
||||
mDequeueCondition.broadcast();
|
||||
|
||||
*outWidth = mDefaultWidth;
|
||||
*outHeight = mDefaultHeight;
|
||||
@ -596,7 +596,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) {
|
||||
@ -704,7 +704,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);
|
||||
@ -841,6 +841,7 @@ status_t BufferQueue::acquire(BufferItem *buffer) {
|
||||
|
||||
mSlots[buf].mBufferState = BufferSlot::ACQUIRED;
|
||||
mQueue.erase(front);
|
||||
mDequeueCondition.broadcast();
|
||||
|
||||
ATRACE_INT(mConsumerName.string(), mQueue.size());
|
||||
}
|
||||
@ -872,7 +873,7 @@ status_t BufferQueue::releaseBuffer(int buf, EGLDisplay display,
|
||||
|| mSlots[buf].mBufferState == BufferSlot::ACQUIRED) {
|
||||
mSlots[buf].mBufferState = BufferSlot::FREE;
|
||||
}
|
||||
mDequeueCondition.signal();
|
||||
mDequeueCondition.broadcast();
|
||||
|
||||
return OK;
|
||||
}
|
||||
@ -883,7 +884,7 @@ status_t BufferQueue::consumerDisconnect() {
|
||||
// is considered abandoned
|
||||
mAbandoned = true;
|
||||
freeAllBuffersLocked();
|
||||
mDequeueCondition.signal();
|
||||
mDequeueCondition.broadcast();
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user