summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Burtsev <kirill.burtsev@qt.io>2021-10-19 22:32:59 +0200
committerKirill Burtsev <kirill.burtsev@qt.io>2021-10-20 12:48:21 +0200
commit0c0d78a6abf68418ae81c202c5576206bd4e5f47 (patch)
treed7305fed8f1434c810ce7b623f0bfce7adafc79d
parent7edc32918687e13c257e5b01de9069121636388f (diff)
Fix rendering deadlock for software compositing
With software compositing render thread of Qt's scene graph and Viz's thread may hit the same mutex inside output surface during frame update. Pick-to: 6.2 Fixes: QTBUG-97598 Change-Id: Ic02e161f7b16b22c9099b93f2b1a91e78347975f Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r--src/core/compositor/display_software_output_surface.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/compositor/display_software_output_surface.cpp b/src/core/compositor/display_software_output_surface.cpp
index 98c104dd..b811449c 100644
--- a/src/core/compositor/display_software_output_surface.cpp
+++ b/src/core/compositor/display_software_output_surface.cpp
@@ -99,9 +99,12 @@ void DisplaySoftwareOutputSurface::Device::Resize(const gfx::Size &sizeInPixels,
void DisplaySoftwareOutputSurface::Device::OnSwapBuffers(SwapBuffersCallback swap_ack_callback)
{
- QMutexLocker locker(&m_mutex);
- m_taskRunner = base::ThreadTaskRunnerHandle::Get();
- m_swapCompletionCallback = std::move(swap_ack_callback);
+ { // MEMO don't hold a lock together with an 'observer', as the call from Qt's scene graph may come at the same time
+ QMutexLocker locker(&m_mutex);
+ m_taskRunner = base::ThreadTaskRunnerHandle::Get();
+ m_swapCompletionCallback = std::move(swap_ack_callback);
+ }
+
if (auto obs = observer())
obs->readyToSwap();
}