diff options
author | Liang Qi <liang.qi@qt.io> | 2019-05-02 16:52:15 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-05-02 16:52:15 +0200 |
commit | 8831c9139e42e6357bf1ee84cba3b3b8041da502 (patch) | |
tree | 73e918b8b28cef74152e1ec32d9dc869e56c7490 /src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp | |
parent | 8b69d52db792c3910be53321df44b5c57baa694c (diff) | |
parent | c1b65146f6b9ad98edea424742f7594712758377 (diff) | |
download | qtwayland-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.cpp | 25 |
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); } |