diff --git a/debug_console.cpp b/debug_console.cpp
index 9656754b36..48e152919e 100644
--- a/debug_console.cpp
+++ b/debug_console.cpp
@@ -18,9 +18,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*********************************************************************/
#include "debug_console.h"
+#include "composite.h"
#include "client.h"
#include "input_event.h"
#include "main.h"
+#include "scene_opengl.h"
#include "shell_client.h"
#include "unmanaged.h"
#include "wayland_server.h"
@@ -548,7 +550,7 @@ void DebugConsole::initGLTab()
m_ui->eglExtensionsBox->setVisible(false);
m_ui->glxExtensionsBox->setVisible(true);
- m_ui->glxExtensionsLabel->setText(extensionsString(glxExtensions()));
+ m_ui->glxExtensionsLabel->setText(extensionsString(static_cast(Compositor::self()->scene())->backend()->extensions()));
}
m_ui->openGLExtensionsLabel->setText(extensionsString(openGLExtensions()));
diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp
index 584aadb761..eead483e96 100644
--- a/libkwineffects/kwinglutils.cpp
+++ b/libkwineffects/kwinglutils.cpp
@@ -156,11 +156,6 @@ QList eglExtensions()
return s_eglExtensions;
}
-QList glxExtensions()
-{
- return s_glxExtensions;
-}
-
QList openGLExtensions()
{
return glExtensions;
diff --git a/libkwineffects/kwinglutils.h b/libkwineffects/kwinglutils.h
index e8e236784c..9f5290c64c 100644
--- a/libkwineffects/kwinglutils.h
+++ b/libkwineffects/kwinglutils.h
@@ -84,7 +84,6 @@ inline bool KWINGLUTILS_EXPORT isPowerOfTwo(int x)
int KWINGLUTILS_EXPORT nearestPowerOfTwo(int x);
QList KWINGLUTILS_EXPORT eglExtensions();
-QList KWINGLUTILS_EXPORT glxExtensions();
QList KWINGLUTILS_EXPORT openGLExtensions();
class KWINGLUTILS_EXPORT GLShader
diff --git a/plugins/platforms/x11/standalone/glxbackend.cpp b/plugins/platforms/x11/standalone/glxbackend.cpp
index 1acbecfe64..58fd4a9ddc 100644
--- a/plugins/platforms/x11/standalone/glxbackend.cpp
+++ b/plugins/platforms/x11/standalone/glxbackend.cpp
@@ -158,6 +158,8 @@ void GlxBackend::init()
return;
}
+ initExtensions();
+
initVisualDepthHashTable();
if (!initBuffer()) {
@@ -180,12 +182,12 @@ void GlxBackend::init()
initGL(GlxPlatformInterface);
// Check whether certain features are supported
- m_haveMESACopySubBuffer = hasGLExtension(QByteArrayLiteral("GLX_MESA_copy_sub_buffer"));
- m_haveMESASwapControl = hasGLExtension(QByteArrayLiteral("GLX_MESA_swap_control"));
- m_haveEXTSwapControl = hasGLExtension(QByteArrayLiteral("GLX_EXT_swap_control"));
- m_haveSGISwapControl = hasGLExtension(QByteArrayLiteral("GLX_SGI_swap_control"));
+ m_haveMESACopySubBuffer = hasExtension(QByteArrayLiteral("GLX_MESA_copy_sub_buffer"));
+ m_haveMESASwapControl = hasExtension(QByteArrayLiteral("GLX_MESA_swap_control"));
+ m_haveEXTSwapControl = hasExtension(QByteArrayLiteral("GLX_EXT_swap_control"));
+ m_haveSGISwapControl = hasExtension(QByteArrayLiteral("GLX_SGI_swap_control"));
// only enable Intel swap event if env variable is set, see BUG 342582
- m_haveINTELSwapEvent = hasGLExtension(QByteArrayLiteral("GLX_INTEL_swap_event"))
+ m_haveINTELSwapEvent = hasExtension(QByteArrayLiteral("GLX_INTEL_swap_event"))
&& qgetenv("KWIN_USE_INTEL_SWAP_EVENT") == QByteArrayLiteral("1");
if (m_haveINTELSwapEvent) {
@@ -197,7 +199,7 @@ void GlxBackend::init()
setSupportsBufferAge(false);
- if (hasGLExtension(QByteArrayLiteral("GLX_EXT_buffer_age"))) {
+ if (hasExtension(QByteArrayLiteral("GLX_EXT_buffer_age"))) {
const QByteArray useBufferAge = qgetenv("KWIN_USE_BUFFER_AGE");
if (useBufferAge != "0")
@@ -220,7 +222,7 @@ void GlxBackend::init()
gs_tripleBufferUndetected = false;
}
gs_tripleBufferNeedsDetection = gs_tripleBufferUndetected;
- } else if (hasGLExtension(QByteArrayLiteral("GLX_SGI_video_sync"))) {
+ } else if (hasExtension(QByteArrayLiteral("GLX_SGI_video_sync"))) {
unsigned int sync;
if (glXGetVideoSyncSGI(&sync) == 0 && glXWaitVideoSyncSGI(1, 0, &sync) == 0) {
setSyncsToVBlank(true);
@@ -253,12 +255,18 @@ bool GlxBackend::checkVersion()
return kVersionNumber(major, minor) >= kVersionNumber(1, 3);
}
+void GlxBackend::initExtensions()
+{
+ const QByteArray string = (const char *) glXQueryExtensionsString(display(), QX11Info::appScreen());
+ setExtensions(string.split(' '));
+}
+
bool GlxBackend::initRenderingContext()
{
const bool direct = true;
// Use glXCreateContextAttribsARB() when it's available
- if (hasGLExtension(QByteArrayLiteral("GLX_ARB_create_context"))) {
+ if (hasExtension(QByteArrayLiteral("GLX_ARB_create_context"))) {
const int attribs_31_core_robustness[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
@@ -285,7 +293,7 @@ bool GlxBackend::initRenderingContext()
0
};
- const bool have_robustness = hasGLExtension(QByteArrayLiteral("GLX_ARB_create_context_robustness"));
+ const bool have_robustness = hasExtension(QByteArrayLiteral("GLX_ARB_create_context_robustness"));
// Try to create a 3.1 context first
if (options->glCoreProfile()) {
diff --git a/plugins/platforms/x11/standalone/glxbackend.h b/plugins/platforms/x11/standalone/glxbackend.h
index d31a1b67ee..5c6c351d31 100644
--- a/plugins/platforms/x11/standalone/glxbackend.h
+++ b/plugins/platforms/x11/standalone/glxbackend.h
@@ -79,6 +79,7 @@ protected:
private:
bool initBuffer();
bool checkVersion();
+ void initExtensions();
void waitSync();
bool initRenderingContext();
bool initFbConfig();
diff --git a/scene_opengl.h b/scene_opengl.h
index 1fe20912c0..218e1a09e1 100644
--- a/scene_opengl.h
+++ b/scene_opengl.h
@@ -507,6 +507,22 @@ public:
*/
void addToDamageHistory(const QRegion ®ion);
+ /**
+ * The backend specific extensions (e.g. EGL/GLX extensions).
+ *
+ * Not the OpenGL (ES) extension!
+ **/
+ QList extensions() const {
+ return m_extensions;
+ }
+
+ /**
+ * @returns whether the backend specific extensions contains @p extension.
+ **/
+ bool hasExtension(const QByteArray &extension) const {
+ return m_extensions.contains(extension);
+ }
+
protected:
/**
* @brief Backend specific flushing of frame to screen.
@@ -583,6 +599,15 @@ protected:
m_surfaceLessContext = set;
}
+ /**
+ * Sets the platform-specific @p extensions.
+ *
+ * These are the EGL/GLX extensions, not the OpenGL extensions
+ **/
+ void setExtensions(const QList &extensions) {
+ m_extensions = extensions;
+ }
+
SwapProfiler m_swapProfiler;
private:
@@ -619,6 +644,8 @@ private:
**/
QElapsedTimer m_renderTimer;
bool m_surfaceLessContext = false;
+
+ QList m_extensions;
};
class SceneOpenGLDecorationRenderer : public Decoration::Renderer