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
This commit is contained in:
Fabian Vogt 2017-12-23 23:30:07 +01:00
parent f597615fa4
commit e302f87598
2 changed files with 82 additions and 54 deletions

View file

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

View file

@ -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()) {