diff options
Diffstat (limited to 'src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp')
-rw-r--r-- | src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp index 0cbbe5389..a8ee9a43a 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp @@ -315,9 +315,7 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, QWaylandDisplay *dis mSupportNonBlockingSwap = false; } if (!mSupportNonBlockingSwap) { - 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"; + qWarning() << "Non-blocking swap buffers not supported. Subsurface rendering can be affected."; } updateGLFormat(); @@ -401,8 +399,13 @@ bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface) QWaylandEglWindow *window = static_cast<QWaylandEglWindow *>(surface); EGLSurface eglSurface = window->eglSurface(); - if (!window->needToUpdateContentFBO() && (eglSurface != EGL_NO_SURFACE && eglGetCurrentContext() == m_context && eglGetCurrentSurface(EGL_DRAW) == eglSurface)) + if (!window->needToUpdateContentFBO() && (eglSurface != EGL_NO_SURFACE)) { + if (!eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) { + qWarning("QWaylandGLContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this); + return false; + } return true; + } if (window->isExposed()) window->setCanResize(false); @@ -552,10 +555,20 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface) m_blitter->blit(window); } - window->handleUpdate(); - int swapInterval = mSupportNonBlockingSwap ? 0 : m_format.swapInterval(); - eglSwapInterval(m_eglDisplay, swapInterval); - eglSwapBuffers(m_eglDisplay, eglSurface); + + 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); + } + window->setCanResize(true); } |