aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gräßlin <[email protected]>2016-11-10 15:07:15 +0100
committerMartin Gräßlin <[email protected]>2016-11-16 07:47:01 +0100
commit5d39da84277fd677f96d1b51df93571abd160c45 (patch)
tree18dc79085578437f185e158f76acc52424ee65ec
parent3041b871ea2cd94997dafcb4c1f72364be655b06 (diff)
Move glx version check functionality to platform plugin
Summary: Glx version is only required once in the standalone x11 platform. No need to have that in the shared kwinglutils library. Removes one xlib usage from shared kwin. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D3329
-rw-r--r--libkwineffects/kwinglutils.cpp12
-rw-r--r--libkwineffects/kwinglutils.h1
-rw-r--r--plugins/platforms/x11/standalone/glxbackend.cpp9
-rw-r--r--plugins/platforms/x11/standalone/glxbackend.h1
4 files changed, 9 insertions, 14 deletions
diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp
index 029bcf8..584aadb 100644
--- a/libkwineffects/kwinglutils.cpp
+++ b/libkwineffects/kwinglutils.cpp
@@ -64,8 +64,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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 @@ int glTextureUnitsCount;
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 @@ void cleanupGL()
s_glxExtensions.clear();
s_eglExtensions.clear();
- glXVersion = 0;
eglVersion = 0;
glTextureUnitsCount = 0;
}
@@ -148,11 +141,6 @@ bool hasGLVersion(int major, int minor, int release)
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/libkwineffects/kwinglutils.h b/libkwineffects/kwinglutils.h
index 8226380..e8e2367 100644
--- a/libkwineffects/kwinglutils.h
+++ b/libkwineffects/kwinglutils.h
@@ -65,7 +65,6 @@ extern KWINGLUTILS_EXPORT int glTextureUnitsCount;
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/plugins/platforms/x11/standalone/glxbackend.cpp b/plugins/platforms/x11/standalone/glxbackend.cpp
index abe6f83..1acbecf 100644
--- a/plugins/platforms/x11/standalone/glxbackend.cpp
+++ b/plugins/platforms/x11/standalone/glxbackend.cpp
@@ -153,7 +153,7 @@ void GlxBackend::init()
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 @@ void GlxBackend::init()
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;
diff --git a/plugins/platforms/x11/standalone/glxbackend.h b/plugins/platforms/x11/standalone/glxbackend.h
index 77a4a7f..d31a1b6 100644
--- a/plugins/platforms/x11/standalone/glxbackend.h
+++ b/plugins/platforms/x11/standalone/glxbackend.h
@@ -78,6 +78,7 @@ protected:
private:
bool initBuffer();
+ bool checkVersion();
void waitSync();
bool initRenderingContext();
bool initFbConfig();