summaryrefslogtreecommitdiff
path: root/libs/gui/BLASTBufferQueue.cpp
diff options
context:
space:
mode:
author Leon Scroggins III <scroggo@google.com> 2023-03-16 12:13:28 -0400
committer Leon Scroggins III <scroggo@google.com> 2023-03-24 11:40:03 -0400
commit6fc45193c591c124c59bbd2263618bc8b518d9c4 (patch)
tree32d81e5f7aff10b0250b2b093dba18c1a7893adc /libs/gui/BLASTBufferQueue.cpp
parent3b8613e5b75bf0e6d2581fb1be04770dd0e034e8 (diff)
Avoid deadlock in EventThread::onNewVsyncSchedule
EventThread::onNewVsyncSchedule attempts to lock mMutex, but it is currently called while Scheduler::mDisplayLock is held. But shouldConsumeEvent is called while mMutex is locked, and shouldConsumeEvent's call to mThrottleVsyncCallback results calls Scheduler::isVsyncValid, which then calls multiple methods that require locking mDisplayLock, resulting in deadlock. MessageQueue::onNewVsyncSchedule runs into a similar problem. It is also called while mDisplayLock is held. Split up the calls to onNewVsyncSchedule into a separate method, which is called after mDisplayLock is released. Create promotePacesetterDisplayLocked, which returns the new pacesetter's VsyncSchedule so it can be applied afterwards. This avoids the deadlock. In addition, handle the connections the same as other calls: lock mConnectionsLock, store a pointer to the EventThread, and call the method after releasing the lock. This is safe because Scheduler never deletes its EventThreads (until its own teardown). Bug: 272943830 Test: manual (see b/272234280) Change-Id: Ieb05fc3abcf4fc20f04ea5d3595da70155de2df5
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
0 files changed, 0 insertions, 0 deletions