diff --git a/debug_console.cpp b/debug_console.cpp --- a/debug_console.cpp +++ b/debug_console.cpp @@ -18,9 +18,11 @@ 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 @@ 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.h b/libkwineffects/kwinglutils.h --- a/libkwineffects/kwinglutils.h +++ b/libkwineffects/kwinglutils.h @@ -84,7 +84,6 @@ 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/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -156,11 +156,6 @@ return s_eglExtensions; } -QList glxExtensions() -{ - return s_glxExtensions; -} - QList openGLExtensions() { return glExtensions; 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 @@ -79,6 +79,7 @@ private: bool initBuffer(); bool checkVersion(); + void initExtensions(); 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 @@ -158,6 +158,8 @@ return; } + initExtensions(); + initVisualDepthHashTable(); if (!initBuffer()) { @@ -180,12 +182,12 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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/scene_opengl.h b/scene_opengl.h --- a/scene_opengl.h +++ b/scene_opengl.h @@ -507,6 +507,22 @@ */ 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 @@ 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 @@ **/ QElapsedTimer m_renderTimer; bool m_surfaceLessContext = false; + + QList m_extensions; }; class SceneOpenGLDecorationRenderer : public Decoration::Renderer