summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2020-04-25 13:46:09 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-10-07 11:38:43 +0000
commit98aea22d839000a377d0fc646133f76e08b44f6e (patch)
tree2c9b60a5ee74c3550340588b4617916c715afed6 /tests
parentccfebb67f427dbbc2dc887044f906591fc313b39 (diff)
downloadqtwayland-98aea22d839000a377d0fc646133f76e08b44f6e.tar.gz
Fix race condition on frame callback
If the frame listener callback is moved to a different queue while the frame event is being processed, the event will not get delivered. (It will not even show up in the WAYLAND_DEBUG output.) This will cause waitForFrameSync() to hang until it times out. To avoid this, perform the move just after the callback has been created. This exposed an issue with single-threaded rendering, where a new update would be started from inside the callback, resetting mWaitingForFrameCallback before waitForFrameSync could react to it. This caused all rendering to freeze. To avoid that problem, do not deliver update requests directly from the frame callback. With the callback always on a separate queue, we then have to make sure that queue is also dispatched during the main event loop, otherwise the events may not be processed. To do this, we need a mutex lock. But it turns out that we no longer need a global mutex lock as long as the frame events are being dispatched on their own queues, but can manage with per-window locks instead. A final thing needed is to make sure the frame callback does not request additional updates while we are already waiting for the main thread to process the last one. This is to avoid flooding the main event loop with events, when the main thread is processing them at a slower pace than the frame rate. Fixes: QTBUG-83263 Pick-to: 5.15 Done-with: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Change-Id: I0db9da64fc8ced147177391c2a7999c4cc7a0d58 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/client/surface/tst_surface.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/tests/auto/client/surface/tst_surface.cpp b/tests/auto/client/surface/tst_surface.cpp
index 289fbd62..c7b02e2c 100644
--- a/tests/auto/client/surface/tst_surface.cpp
+++ b/tests/auto/client/surface/tst_surface.cpp
@@ -64,7 +64,6 @@ void tst_surface::createDestroySurface()
void tst_surface::waitForFrameCallbackRaster()
{
- QSKIP("TODO: This currently fails, needs a fix");
class TestWindow : public QRasterWindow {
public:
explicit TestWindow() { resize(40, 40); }
@@ -100,7 +99,6 @@ void tst_surface::waitForFrameCallbackRaster()
#if QT_CONFIG(opengl)
void tst_surface::waitForFrameCallbackGl()
{
- QSKIP("TODO: This currently fails, needs a fix");
class TestWindow : public QOpenGLWindow {
public:
explicit TestWindow()