summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2023-11-08 12:40:40 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2023-12-13 10:13:46 +0000
commit02263f21f5cdd61d71e5e8e08b2e73c05c6c1e76 (patch)
tree4580aef6f378f60e04dce3c7cb479ea2bf2fc1a6
parent59ae054ded4d74db53281d8087576cd05b979cd9 (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.5 6.6 6.7 Fixes: QTBUG-118890 Change-Id: I04f7d2b168726d82c38fe3fafd350dcab928b956 Reviewed-by: David Edmundson <davidedmundson@kde.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)