diff options
author | Ilya Fedin <fedin-ilja2010@ya.ru> | 2023-03-24 17:41:24 +0400 |
---|---|---|
committer | Ilya Fedin <fedin-ilja2010@ya.ru> | 2023-09-19 00:13:30 +0400 |
commit | 12d6fc5229196038af8d42cb0edec91766c1a1d4 (patch) | |
tree | 9f43531abb0729c5de0f1825dd0cc49b491932d9 /src/plugins/platforms/xcb/gl_integrations | |
parent | 6f5136ef6661150046b64992fb78b23f02da0ef2 (diff) |
xcb_egl: Prefer eglCreatePlatformWindowSurfaceEXT to eglCreateWindowSurface
Change-Id: I32de5b241cce786318434e7653ff979cf8e82f0e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/gl_integrations')
3 files changed, 17 insertions, 7 deletions
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 fc211c4470..133b992cd9 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp @@ -58,6 +58,7 @@ std::optional<VisualInfo> getVisualInfo(xcb_screen_t *screen, QXcbEglIntegration::QXcbEglIntegration() : m_connection(nullptr) , m_egl_display(EGL_NO_DISPLAY) + , m_using_platform_display(false) { qCDebug(lcQpaGl) << "Xcb EGL gl-integration created"; } @@ -80,6 +81,7 @@ bool QXcbEglIntegration::initialize(QXcbConnection *connection) m_egl_display = streamFuncs.get_platform_display(EGL_PLATFORM_X11_KHR, m_connection->xlib_display(), nullptr); + m_using_platform_display = true; } #if QT_CONFIG(egl_x11) @@ -92,6 +94,7 @@ bool QXcbEglIntegration::initialize(QXcbConnection *connection) m_egl_display = streamFuncs.get_platform_display(EGL_PLATFORM_XCB_KHR, reinterpret_cast<void *>(connection->xcb_connection()), nullptr); + m_using_platform_display = true; } #endif 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 ff0804678f..7caf4304bc 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.h @@ -39,10 +39,13 @@ public: EGLDisplay eglDisplay() const { return m_egl_display; } + bool usingPlatformDisplay() const { return m_using_platform_display; } + xcb_visualid_t getCompatibleVisualId(xcb_screen_t *screen, EGLConfig config) const; private: QXcbConnection *m_connection; EGLDisplay m_egl_display; + bool m_using_platform_display; QScopedPointer<QXcbEglNativeInterfaceHandler> m_native_interface_handler; }; diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp index 2bff6b3950..bf2ceb96f4 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp @@ -46,15 +46,19 @@ void QXcbEglWindow::create() { QXcbWindow::create(); + // this is always true without egl_x11 + if (m_glIntegration->usingPlatformDisplay()) { + auto createPlatformWindowSurface = reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>( + eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT")); + m_surface = createPlatformWindowSurface(m_glIntegration->eglDisplay(), + m_config, + reinterpret_cast<void *>(&m_window), + nullptr); + return; + } + #if QT_CONFIG(egl_x11) m_surface = eglCreateWindowSurface(m_glIntegration->eglDisplay(), m_config, m_window, nullptr); -#else - auto createPlatformWindowSurface = reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>( - eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT")); - m_surface = createPlatformWindowSurface(m_glIntegration->eglDisplay(), - m_config, - reinterpret_cast<void *>(m_window), - nullptr); #endif } |