workaround a deadlock when taking screenshots into a surface
When disconnecting from BufferQueue, we now drain the queue except the head (which means in the screenshot case we won't have to block, but we might not have a buffer to show, this will appear as an error in the log). Bug: 8362363 Change-Id: If80989aac3c917beea2ebddf3cbb502849d394da
This commit is contained in:
parent
dbca4a0ee5
commit
d2d5a64aa2
@ -995,7 +995,7 @@ void BufferQueue::freeAllBuffersExceptHeadLocked() {
|
||||
}
|
||||
|
||||
status_t BufferQueue::drainQueueLocked() {
|
||||
while (mSynchronousMode && !mQueue.isEmpty()) {
|
||||
while (mSynchronousMode && mQueue.size() > 1) {
|
||||
mDequeueCondition.wait(mMutex);
|
||||
if (mAbandoned) {
|
||||
ST_LOGE("drainQueueLocked: BufferQueue has been abandoned!");
|
||||
@ -1012,7 +1012,7 @@ status_t BufferQueue::drainQueueLocked() {
|
||||
status_t BufferQueue::drainQueueAndFreeBuffersLocked() {
|
||||
status_t err = drainQueueLocked();
|
||||
if (err == NO_ERROR) {
|
||||
if (mSynchronousMode) {
|
||||
if (mQueue.empty()) {
|
||||
freeAllBuffersLocked();
|
||||
} else {
|
||||
freeAllBuffersExceptHeadLocked();
|
||||
|
Loading…
Reference in New Issue
Block a user