summaryrefslogblamecommitdiff
path: root/user/kwin/kwin-backport-gallium-version-detection.patch
blob: 8c021c4e615a7f86c9da89bb317963c5bf4eb287 (plain) (tree)






























































































































































































                                                                                                                          
From e302f87598de6853147c872b631e9a1fe4864f42 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Sat, 23 Dec 2017 23:30:07 +0100
Subject: Properly detect Gallium drivers with newer Mesa

Summary:
The renderer string does not contain "Gallium 0.4 on" anymore,
instead it directly contains the gallium driver's name.
So assume that every unknown renderer is a gallium driver.

Test Plan: Added a testcase, it succeeds only with this patch.

Reviewers: #plasma, graesslin

Subscribers: kwin, plasma-devel, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D9495
---
 .../libkwineffects/data/glplatform/llvmpipe-5.0    |  22 ++++
 libkwineffects/kwinglplatform.cpp                  | 114 +++++++++++----------
 2 files changed, 82 insertions(+), 54 deletions(-)
 create mode 100644 autotests/libkwineffects/data/glplatform/llvmpipe-5.0

diff --git a/autotests/libkwineffects/data/glplatform/llvmpipe-5.0 b/autotests/libkwineffects/data/glplatform/llvmpipe-5.0
new file mode 100644
index 0000000..56aa352
--- /dev/null
+++ b/autotests/libkwineffects/data/glplatform/llvmpipe-5.0
@@ -0,0 +1,22 @@
+[Driver]
+Vendor=VMware, Inc.
+Renderer=llvmpipe (LLVM 5.0, 256 bits)
+Version=3.0 Mesa 17.2.6
+ShadingLanguageVersion=1.30
+
+[Settings]
+LooseBinding=true
+GLSL=true
+TextureNPOT=true
+Mesa=true
+Gallium=true
+SoftwareEmulation=true
+GLVersion=3,0
+GLSLVersion=1,30
+MesaVersion=17,2,6
+GalliumVersion=0,4
+DriverVersion=17,2,6
+Driver=12
+ChipClass=99999
+Compositor=9
+
diff --git a/libkwineffects/kwinglplatform.cpp b/libkwineffects/kwinglplatform.cpp
index 2b7b9a4..f5febc0 100644
--- a/libkwineffects/kwinglplatform.cpp
+++ b/libkwineffects/kwinglplatform.cpp
@@ -702,14 +702,69 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
         m_chipClass = detectIntelClass(chipset);
     }
 
+    // Properietary drivers
+    // ====================================================
+    else if (m_vendor == "ATI Technologies Inc.") {
+        m_chipClass = detectRadeonClass(m_renderer);
+        m_driver = Driver_Catalyst;
+
+        if (versionTokens.count() > 1 && versionTokens.at(2)[0] == '(')
+            m_driverVersion = parseVersionString(versionTokens.at(1));
+        else if (versionTokens.count() > 0)
+            m_driverVersion = parseVersionString(versionTokens.at(0));
+        else
+            m_driverVersion = 0;
+    }
+
+    else if (m_vendor == "NVIDIA Corporation") {
+        m_chipClass = detectNVidiaClass(m_renderer);
+        m_driver = Driver_NVidia;
+
+        int index = versionTokens.indexOf("NVIDIA");
+        if (versionTokens.count() > index)
+            m_driverVersion = parseVersionString(versionTokens.at(index + 1));
+        else
+            m_driverVersion = 0;
+    }
+
+    else if (m_vendor == "Qualcomm") {
+        m_driver = Driver_Qualcomm;
+        m_chipClass = detectQualcommClass(m_renderer);
+    }
+
+    else if (m_renderer == "Software Rasterizer") {
+        m_driver = Driver_Swrast;
+    }
+
+    // Virtual Hardware
+    // ====================================================
+    else if (m_vendor == "Humper" && m_renderer == "Chromium") {
+        // Virtual Box
+        m_driver = Driver_VirtualBox;
+
+        const int index = versionTokens.indexOf("Chromium");
+        if (versionTokens.count() > index)
+            m_driverVersion = parseVersionString(versionTokens.at(index + 1));
+        else
+            m_driverVersion = 0;
+    }
+
     // Gallium drivers
     // ====================================================
-    else if (m_renderer.contains("Gallium")) {
-        // Sample renderer string: Gallium 0.4 on AMD RV740
+    else {
         const QList<QByteArray> tokens = m_renderer.split(' ');
-        m_galliumVersion = parseVersionString(tokens.at(1));
-        m_chipset = (tokens.at(3) == "AMD" || tokens.at(3) == "ATI") ?
-                    tokens.at(4) : tokens.at(3);
+        if (m_renderer.contains("Gallium")) {
+            // Sample renderer string: Gallium 0.4 on AMD RV740
+            m_galliumVersion = parseVersionString(tokens.at(1));
+            m_chipset = (tokens.at(3) == "AMD" || tokens.at(3) == "ATI") ?
+                        tokens.at(4) : tokens.at(3);
+        }
+        else {
+            // The renderer string does not contain "Gallium" anymore.
+            m_chipset = tokens.at(0);
+            // We don't know the actual version anymore, but it's at least 0.4.
+            m_galliumVersion = kVersionNumber(0, 4, 0);
+        }
 
         // R300G
         if (m_vendor == QByteArrayLiteral("X.Org R300 Project")) {
@@ -764,55 +819,6 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
         }
     }
 
-
-    // Properietary drivers
-    // ====================================================
-    else if (m_vendor == "ATI Technologies Inc.") {
-        m_chipClass = detectRadeonClass(m_renderer);
-        m_driver = Driver_Catalyst;
-
-        if (versionTokens.count() > 1 && versionTokens.at(2)[0] == '(')
-            m_driverVersion = parseVersionString(versionTokens.at(1));
-        else if (versionTokens.count() > 0)
-            m_driverVersion = parseVersionString(versionTokens.at(0));
-        else
-            m_driverVersion = 0;
-    }
-
-    else if (m_vendor == "NVIDIA Corporation") {
-        m_chipClass = detectNVidiaClass(m_renderer);
-        m_driver = Driver_NVidia;
-
-        int index = versionTokens.indexOf("NVIDIA");
-        if (versionTokens.count() > index)
-            m_driverVersion = parseVersionString(versionTokens.at(index + 1));
-        else
-            m_driverVersion = 0;
-    }
-
-    else if (m_vendor == "Qualcomm") {
-        m_driver = Driver_Qualcomm;
-        m_chipClass = detectQualcommClass(m_renderer);
-    }
-
-    else if (m_renderer == "Software Rasterizer") {
-        m_driver = Driver_Swrast;
-    }
-
-    // Virtual Hardware
-    // ====================================================
-    else if (m_vendor == "Humper" && m_renderer == "Chromium") {
-        // Virtual Box
-        m_driver = Driver_VirtualBox;
-
-        const int index = versionTokens.indexOf("Chromium");
-        if (versionTokens.count() > index)
-            m_driverVersion = parseVersionString(versionTokens.at(index + 1));
-        else
-            m_driverVersion = 0;
-    }
-
-
     // Driver/GPU specific features
     // ====================================================
     if (isRadeon()) {
-- 
cgit v0.11.2