summaryrefslogtreecommitdiff
path: root/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-05-02 16:52:15 +0200
committerLiang Qi <liang.qi@qt.io>2019-05-02 16:52:15 +0200
commit8831c9139e42e6357bf1ee84cba3b3b8041da502 (patch)
tree73e918b8b28cef74152e1ec32d9dc869e56c7490 /src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
parent8b69d52db792c3910be53321df44b5c57baa694c (diff)
parentc1b65146f6b9ad98edea424742f7594712758377 (diff)
downloadqtwayland-8831c9139e42e6357bf1ee84cba3b3b8041da502.tar.gz
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts: src/client/qwaylandwindow_p.h Change-Id: Ic4104c48267d1682bb58d6b38afc833c39515eae
Diffstat (limited to 'src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp')
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index 99a0f646..bc1f74af 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -325,7 +325,9 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *dis
mSupportNonBlockingSwap = false;
}
if (!mSupportNonBlockingSwap) {
- qWarning() << "Non-blocking swap buffers not supported. Subsurface rendering can be affected.";
+ 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";
}
updateGLFormat();
@@ -472,20 +474,15 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
eglMakeCurrent(currentDisplay, currentSurfaceDraw, currentSurfaceRead, currentContext);
}
-
- QWaylandSubSurface *sub = window->subSurfaceWindow();
- if (sub) {
- QMutexLocker l(sub->syncMutex());
-
- int si = (sub->isSync() && mSupportNonBlockingSwap) ? 0 : m_format.swapInterval();
-
- eglSwapInterval(m_eglDisplay, si);
- eglSwapBuffers(m_eglDisplay, eglSurface);
- } else {
- eglSwapInterval(m_eglDisplay, m_format.swapInterval());
- eglSwapBuffers(m_eglDisplay, eglSurface);
+ int swapInterval = mSupportNonBlockingSwap ? 0 : m_format.swapInterval();
+ eglSwapInterval(m_eglDisplay, swapInterval);
+ if (swapInterval == 0 && m_format.swapInterval() > 0) {
+ // Emulating a blocking swap
+ glFlush(); // Flush before waiting so we can swap more quickly when the frame event arrives
+ window->waitForFrameSync(100);
}
-
+ window->handleUpdate();
+ eglSwapBuffers(m_eglDisplay, eglSurface);
window->setCanResize(true);
}