From a1c6e2584adbe95b0ac0b0818ef182826134cc2f Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 3 Jul 2021 14:12:16 +0300 Subject: [PATCH] x11: Re-use Qt's EGLDisplay This is to ensure that both kwin and Qt use the same EGLDisplay. Note that the native context handle can have no display, however it's very unlikely to happen. --- src/plugins/platforms/x11/standalone/eglbackend.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/x11/standalone/eglbackend.cpp b/src/plugins/platforms/x11/standalone/eglbackend.cpp index f0855e0c9e..259e26720c 100644 --- a/src/plugins/platforms/x11/standalone/eglbackend.cpp +++ b/src/plugins/platforms/x11/standalone/eglbackend.cpp @@ -55,6 +55,7 @@ PlatformSurfaceTexture *EglBackend::createPlatformSurfaceTextureX11(SurfacePixma void EglBackend::init() { QOpenGLContext *qtShareContext = QOpenGLContext::globalShareContext(); + EGLDisplay shareDisplay = EGL_NO_DISPLAY; EGLContext shareContext = EGL_NO_CONTEXT; if (qtShareContext) { qDebug(KWIN_X11STANDALONE) << "Global share context format:" << qtShareContext->format(); @@ -65,6 +66,7 @@ void EglBackend::init() } else { QEGLNativeContext handle = qvariant_cast(nativeHandle); shareContext = handle.context(); + shareDisplay = handle.display(); } } if (shareContext == EGL_NO_CONTEXT) { @@ -72,6 +74,7 @@ void EglBackend::init() return; } + kwinApp()->platform()->setSceneEglDisplay(shareDisplay); kwinApp()->platform()->setSceneEglGlobalShareContext(shareContext); EglOnXBackend::init(); }