diff options
author | Aleksei Nikiforov <darktemplar@basealt.ru> | 2020-02-03 11:34:05 +0300 |
---|---|---|
committer | Aleksei Nikiforov <darktemplar@basealt.ru> | 2020-11-07 14:32:43 +0300 |
commit | b5feb28d63f763f1f830af1f7586712aa45ef4be (patch) | |
tree | ad327d2ced10fe2038395e57549eaffcb6263a66 /src | |
parent | f5c7799f59ba53c634906b11e2135190093bf87b (diff) |
xcb: ensure that available glx version is greater than requested one or equal to it
Otherwise xcb plugin may report that it's supported
and later it'd be unable to create opengl context
when requested due to too low xcb protocol version available,
and thus some important xcb functions missing.
Without such change when Qt application is running under
x2go it exits with fatal error due to mismatch in
requested and supported glx protocol versions.
Qt requests glx protocol version 1.4, while x2go currently
reports that it support glx protocol but only version 1.2,
but Qt uses functions such as glXChooseFBConfig and
glXGetVisualFromFBConfig which are available only starting with
glx protocol version 1.3 according to glx documentation.
With this change, when Qt application is running under x2go,
xcb plugin reports that it's not supported and egl plugin
is used instead. And egl plugin successfully allows to work
with opengl, and thus Qt application is running normally.
Pick-to: 5.15
Change-Id: I5c0fb10bd328da68054bfca8e8efde1144789566
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp index 733df7df51..7fba57335c 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp @@ -48,6 +48,7 @@ #include "qxcbscreen.h" #include "qglxintegration.h" +#include <QtCore/QVersionNumber> #include <QtGui/QOpenGLContext> #include <QtGui/private/qopenglcontext_p.h> @@ -60,6 +61,9 @@ QT_BEGIN_NAMESPACE #if QT_CONFIG(xcb_glx) + #define QT_XCB_GLX_REQUIRED_MAJOR 1 + #define QT_XCB_GLX_REQUIRED_MINOR 3 + #if XCB_GLX_MAJOR_VERSION == 1 && XCB_GLX_MINOR_VERSION < 4 #define XCB_GLX_BUFFER_SWAP_COMPLETE 1 typedef struct xcb_glx_buffer_swap_complete_event_t { @@ -114,7 +118,9 @@ bool QXcbGlxIntegration::initialize(QXcbConnection *connection) auto xglx_query = Q_XCB_REPLY(xcb_glx_query_version, m_connection->xcb_connection(), XCB_GLX_MAJOR_VERSION, XCB_GLX_MINOR_VERSION); - if (!xglx_query) { + if ((!xglx_query) + || (QVersionNumber(xglx_query->major_version, xglx_query->minor_version) + < QVersionNumber(QT_XCB_GLX_REQUIRED_MAJOR, QT_XCB_GLX_REQUIRED_MINOR))) { qCWarning(lcQpaGl) << "QXcbConnection: Failed to initialize GLX"; return false; } |