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
remotes/origin/bshah/hwcomposer_testing
Martin Gräßlin 9 years ago
parent 3041b871ea
commit 5d39da8427
  1. 12
      libkwineffects/kwinglutils.cpp
  2. 1
      libkwineffects/kwinglutils.h
  3. 9
      plugins/platforms/x11/standalone/glxbackend.cpp
  4. 1
      plugins/platforms/x11/standalone/glxbackend.h

@ -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);

@ -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);

@ -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;

@ -78,6 +78,7 @@ protected:
private:
bool initBuffer();
bool checkVersion();
void waitSync();
bool initRenderingContext();
bool initFbConfig();

Loading…
Cancel
Save