summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2023-11-08 12:40:40 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-12-13 14:24:08 +0000
commitb0f96ca63ee89f06254d65a8aca780c0d61933b4 (patch)
tree2905d2165a03a27d9f1a71d324b0bb53407fc777
parent186d1bfdee113a955b64c86c51f999562acd4217 (diff)
Don't lock render thread when blocking swap is used
By default, Qt will use a non-blocking eglSwapBuffers() and implement our own frame event mechanism with a time-out. When the blocking version of eglSwapBuffers() is in use (either because it's manually enabled or because the driver does not support the alternative), it depends on the main thread to poll events, as it will wait indefinitely for a frame callback. This is incompatible with our locking of the surface for the duration of the frame, since we may end up locking the main thread in QWaylandWindow::reset() during shutdown while the render thread is simultaneously locked in eglSwapBuffers(). The lock was implemented to work around a bug in one family of graphics drivers, so we simply disable it when blocking eglSwapBuffers() is used. If we need to put this back, we would need a more advanced approach and make sure we continue to poll events even while we're waiting for access to the surface. Pick-to: 6.6 6.5 Fixes: QTBUG-118890 Change-Id: I04f7d2b168726d82c38fe3fafd350dcab928b956 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 02263f21f5cdd61d71e5e8e08b2e73c05c6c1e76) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index e10b89813..039ec1a6a 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -274,13 +274,15 @@ QWaylandGLContext::~QWaylandGLContext()
void QWaylandGLContext::beginFrame()
{
Q_ASSERT(m_currentWindow != nullptr);
- m_currentWindow->beginFrame();
+ if (m_supportNonBlockingSwap)
+ m_currentWindow->beginFrame();
}
void QWaylandGLContext::endFrame()
{
Q_ASSERT(m_currentWindow != nullptr);
- m_currentWindow->endFrame();
+ if (m_supportNonBlockingSwap)
+ m_currentWindow->endFrame();
}
bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)