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-14 00:25:02 +0000
commit7df7c28e4ae415df1469be9a156c4b1190362163 (patch)
tree9dc84a4bfc84c454ea4cee2769e5fe5c695b3cd1
parentaa73e840ce300ee228f50c4497622ce6168e43d1 (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 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> (cherry picked from commit b0f96ca63ee89f06254d65a8aca780c0d61933b4)
-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)