From 1dd614ee4b7be065a137a2f9a3b5fec62f0e7432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 6 May 2011 18:13:54 +0200 Subject: [PATCH] Improved detection of OpenGL software emulation Adding a new method to retrieve whether the OpenGL implementation uses any kind of software emulation and no software emulation can provide GLSL support, even if it claims so. Thanks to Maurel for testing again and again proposed patches. BUG: 271166 --- libkwineffects/kwinglplatform.cpp | 21 ++++++++++++++++++--- libkwineffects/kwinglplatform.h | 6 ++++++ scene_opengl_glx.cpp | 2 +- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/libkwineffects/kwinglplatform.cpp b/libkwineffects/kwinglplatform.cpp index a169efaa65..951fc6790a 100644 --- a/libkwineffects/kwinglplatform.cpp +++ b/libkwineffects/kwinglplatform.cpp @@ -632,9 +632,14 @@ void GLPlatform::detect() m_driver = Driver_Nouveau; } - else if (m_chipset == "softpipe" || m_chipset == "llvmpipe") { - // Vendor: VMware, Inc. - // TODO + // softpipe + else if (m_vendor == "VMware, Inc." && m_chipset == "softpipe" ) { + m_driver = Driver_Softpipe; + } + + // llvmpipe + else if (m_vendor == "VMware, Inc." && m_chipset == "llvmpipe") { + m_driver = Driver_Llvmpipe; } } @@ -712,6 +717,11 @@ void GLPlatform::detect() // Loose binding is broken with Gallium drivers in Mesa 7.10 if (isGalliumDriver() && mesaVersion() >= kVersionNumber(7, 10)) m_looseBinding = false; + + if (isSoftwareEmulation()) { + // Software emulation does not provide GLSL + m_limitedGLSL = m_supportsGLSL = false; + } } static void print(const QString &label, const QString &setting) @@ -851,6 +861,11 @@ bool GLPlatform::isIntel() const return m_chipClass >= I8XX && m_chipClass <= UnknownIntel; } +bool GLPlatform::isSoftwareEmulation() const +{ + return m_driver == Driver_Softpipe || m_driver == Driver_Swrast || m_driver == Driver_Llvmpipe; +} + } // namespace KWin #endif // KWIN_HAVE_OPENGL diff --git a/libkwineffects/kwinglplatform.h b/libkwineffects/kwinglplatform.h index fa2528d1b6..714dc43c3c 100644 --- a/libkwineffects/kwinglplatform.h +++ b/libkwineffects/kwinglplatform.h @@ -238,6 +238,12 @@ public: */ bool isIntel() const; + /** + * @returns @c true if OpenGL is emulated in software. + * @since 4.7 + **/ + bool isSoftwareEmulation() const; + private: GLPlatform(); diff --git a/scene_opengl_glx.cpp b/scene_opengl_glx.cpp index 221ba20fbe..edfff07cc9 100644 --- a/scene_opengl_glx.cpp +++ b/scene_opengl_glx.cpp @@ -61,7 +61,7 @@ SceneOpenGL::SceneOpenGL(Workspace* ws) // Initialize OpenGL initGL(); GLPlatform *glPlatform = GLPlatform::instance(); - if (glPlatform->driver() == Driver_Swrast || glPlatform->driver() == Driver_Softpipe) { + if (glPlatform->isSoftwareEmulation()) { kError(1212) << "OpenGL Software Rasterizer detected. Falling back to XRender."; QTimer::singleShot(0, Workspace::self(), SLOT(fallbackToXRenderCompositing())); return;