diff --git a/libkwineffects/kwinglutils.h b/libkwineffects/kwinglutils.h --- a/libkwineffects/kwinglutils.h +++ b/libkwineffects/kwinglutils.h @@ -65,7 +65,6 @@ bool KWINGLUTILS_EXPORT hasGLVersion(int major, int minor, int release = 0); -bool KWINGLUTILS_EXPORT hasGLXVersion(int major, int minor, int release = 0); bool KWINGLUTILS_EXPORT hasEGLVersion(int major, int minor, int release = 0); // use for both OpenGL and GLX extensions bool KWINGLUTILS_EXPORT hasGLExtension(const QByteArray &extension); diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -64,8 +64,6 @@ namespace KWin { // Variables -// GLX version, use MAKE_GL_VERSION() macro for comparing with a specific version -static int glXVersion; // EGL version, use MAKE_GL_VERSION() macro for comparing with a specific version static int eglVersion; // List of all supported GL, EGL and GLX extensions @@ -80,10 +78,6 @@ void initGLX() { #if HAVE_EPOXY_GLX - // Get GLX version - int major, minor; - glXQueryVersion(display(), &major, &minor); - glXVersion = MAKE_GL_VERSION(major, minor, 0); // Get list of supported GLX extensions const QByteArray string = (const char *) glXQueryExtensionsString(display(), QX11Info::appScreen()); s_glxExtensions = string.split(' '); @@ -138,7 +132,6 @@ s_glxExtensions.clear(); s_eglExtensions.clear(); - glXVersion = 0; eglVersion = 0; glTextureUnitsCount = 0; } @@ -148,11 +141,6 @@ return GLPlatform::instance()->glVersion() >= kVersionNumber(major, minor, release); } -bool hasGLXVersion(int major, int minor, int release) -{ - return glXVersion >= MAKE_GL_VERSION(major, minor, release); -} - bool hasEGLVersion(int major, int minor, int release) { return eglVersion >= MAKE_GL_VERSION(major, minor, release); diff --git a/plugins/platforms/x11/standalone/glxbackend.h b/plugins/platforms/x11/standalone/glxbackend.h --- a/plugins/platforms/x11/standalone/glxbackend.h +++ b/plugins/platforms/x11/standalone/glxbackend.h @@ -78,6 +78,7 @@ private: bool initBuffer(); + bool checkVersion(); void waitSync(); bool initRenderingContext(); bool initFbConfig(); diff --git a/plugins/platforms/x11/standalone/glxbackend.cpp b/plugins/platforms/x11/standalone/glxbackend.cpp --- a/plugins/platforms/x11/standalone/glxbackend.cpp +++ b/plugins/platforms/x11/standalone/glxbackend.cpp @@ -153,7 +153,7 @@ initGLX(); // Require at least GLX 1.3 - if (!hasGLXVersion(1, 3)) { + if (!checkVersion()) { setFailed(QStringLiteral("Requires at least GLX 1.3")); return; } @@ -246,6 +246,13 @@ qCDebug(KWIN_X11STANDALONE) << "Direct rendering:" << isDirectRendering(); } +bool GlxBackend::checkVersion() +{ + int major, minor; + glXQueryVersion(display(), &major, &minor); + return kVersionNumber(major, minor) >= kVersionNumber(1, 3); +} + bool GlxBackend::initRenderingContext() { const bool direct = true;