diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake index 2c009cbc41..0ba763f2d9 100644 --- a/src/gui/configure.cmake +++ b/src/gui/configure.cmake @@ -924,7 +924,7 @@ qt_feature("xcb-glx" PRIVATE ) qt_feature("xcb-egl-plugin" PRIVATE LABEL "EGL-X11 Plugin" - CONDITION QT_FEATURE_egl_x11 AND QT_FEATURE_opengl + CONDITION QT_FEATURE_opengl EMIT_IF QT_FEATURE_xcb ) qt_feature("xcb-native-painting" PRIVATE diff --git a/src/gui/opengl/platform/egl/qeglstreamconvenience_p.h b/src/gui/opengl/platform/egl/qeglstreamconvenience_p.h index d7c9012feb..edf73fe981 100644 --- a/src/gui/opengl/platform/egl/qeglstreamconvenience_p.h +++ b/src/gui/opengl/platform/egl/qeglstreamconvenience_p.h @@ -113,6 +113,10 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay #define EGL_PLATFORM_X11_KHR 0x31D5 #endif +#ifndef EGL_PLATFORM_XCB_KHR +#define EGL_PLATFORM_XCB_KHR 0x31DC +#endif + #ifndef EGL_NV_stream_attrib typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBNVPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp index 08c34cc495..1e93ea6805 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp @@ -74,15 +74,26 @@ bool QXcbEglIntegration::initialize(QXcbConnection *connection) const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); +#if QT_CONFIG(xcb_xlib) if (extensions && strstr(extensions, "EGL_EXT_platform_x11")) { QEGLStreamConvenience streamFuncs; m_egl_display = streamFuncs.get_platform_display(EGL_PLATFORM_X11_KHR, - xlib_display(), + m_connection->xlib_display(), nullptr); } +#if QT_CONFIG(egl_x11) if (!m_egl_display) - m_egl_display = eglGetDisplay(reinterpret_cast(xlib_display())); + m_egl_display = eglGetDisplay(reinterpret_cast(m_connection->xlib_display())); +#endif +#else + if (extensions && (strstr(extensions, "EGL_EXT_platform_xcb") || strstr(extensions, "EGL_MESA_platform_xcb"))) { + QEGLStreamConvenience streamFuncs; + m_egl_display = streamFuncs.get_platform_display(EGL_PLATFORM_XCB_KHR, + reinterpret_cast(connection->xcb_connection()), + nullptr); + } +#endif EGLint major, minor; bool success = eglInitialize(m_egl_display, &major, &minor); @@ -127,15 +138,6 @@ QPlatformOffscreenSurface *QXcbEglIntegration::createPlatformOffscreenSurface(QO return new QEGLPbuffer(eglDisplay(), screen->surfaceFormatFor(surface->requestedFormat()), surface); } -void *QXcbEglIntegration::xlib_display() const -{ -#if QT_CONFIG(xcb_xlib) - return m_connection->xlib_display(); -#else - return EGL_DEFAULT_DISPLAY; -#endif -} - xcb_visualid_t QXcbEglIntegration::getCompatibleVisualId(xcb_screen_t *screen, EGLConfig config) const { xcb_visualid_t visualId = 0; diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h index 194b6d6e77..ff0804678f 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h @@ -38,7 +38,6 @@ public: bool supportsThreadedOpenGL() const override { return true; } EGLDisplay eglDisplay() const { return m_egl_display; } - void *xlib_display() const; xcb_visualid_t getCompatibleVisualId(xcb_screen_t *screen, EGLConfig config) const; private: