summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
diff options
context:
space:
mode:
authorOtto Ryynänen <otto.ryynanen@qt.io>2020-05-20 09:54:44 +0300
committerOtto Ryynänen <otto.ryynanen@qt.io>2020-06-04 13:13:36 +0300
commit765ad803579c09ea5e827c60efbc89c5ac4fcd42 (patch)
tree12e9a97c6ca02290e823845b289f8f73fa3cab17 /src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
parentc65e013527e144028d2d7c03fe1b503fb21aa89d (diff)
Add means for forcing non-blocking buffer swap support
In case of a driver that does not properly indicate its capability of supporting non-blocking eglSwapBuffers() call, the need arises to be able to manually force the resolution of that check. New environment variable QT_WAYLAND_FORCE_NONBLOCKING_SWAP_SUPPORT added. If it is defined to 0 (i.e. false), the non-blocking swap support is forced to behave as if the driver had been detected not to be supported. Equally setting it to 1 causes the non-blocking swap support resolution to remain true (default) even if driver reports it does not support it. [ChangeLog][Client] Added support for environment variable QT_WAYLAND_FORCE_NONBLOCKING_SWAP_SUPPORT, which can be used to force the resolution of detecting if EGL driver supports non-blocking eglSwapBuffers call. If you encounter application freezing while waiting indefinitely for a buffer swap, then try setting variable to 0. Task-number: QTBUG-84226 Pick-to: 5.15 Pick-to: 5.12 Change-Id: I92dc505d12daf4d78dc18e4f85f3a55ecdf109f3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp')
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index ec55bdcd0..bb903cf1f 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -322,9 +322,15 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *dis
if (!eglGetConfigAttrib(m_eglDisplay, m_config, a, &a) ||
!eglGetConfigAttrib(m_eglDisplay, m_config, b, &b) ||
a > 0) {
- mSupportNonBlockingSwap = false;
+ m_supportNonBlockingSwap = false;
}
- if (!mSupportNonBlockingSwap) {
+ {
+ bool ok;
+ int supportNonBlockingSwap = qEnvironmentVariableIntValue("QT_WAYLAND_FORCE_NONBLOCKING_SWAP_SUPPORT", &ok);
+ if (ok)
+ m_supportNonBlockingSwap = supportNonBlockingSwap != 0;
+ }
+ if (!m_supportNonBlockingSwap) {
qWarning(lcQpaWayland) << "Non-blocking swap buffers not supported."
<< "Subsurface rendering can be affected."
<< "It may also cause the event loop to freeze in some situations";
@@ -478,7 +484,7 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
eglMakeCurrent(currentDisplay, currentSurfaceDraw, currentSurfaceRead, currentContext);
}
- int swapInterval = mSupportNonBlockingSwap ? 0 : m_format.swapInterval();
+ int swapInterval = m_supportNonBlockingSwap ? 0 : m_format.swapInterval();
eglSwapInterval(m_eglDisplay, swapInterval);
if (swapInterval == 0 && m_format.swapInterval() > 0) {
// Emulating a blocking swap