[libkwineffects] Detect modern Radeon GPUs

Summary:
Currently, KWin is not able to detect Radeon GPUs with GCN architecture.
This patch tries to address that.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17715
This commit is contained in:
Vlad Zagorodniy 2018-12-20 16:29:42 +02:00
parent 7dec4643f7
commit 9b9d97db2b
12 changed files with 225 additions and 17 deletions

View file

@ -16,6 +16,6 @@ GLSLVersion=1,30
MesaVersion=11,2,2
GalliumVersion=0,4
DriverVersion=11,2,2
Driver=5
ChipClass=999
Driver=16
ChipClass=10
Compositor=9

View file

@ -16,6 +16,6 @@ GLSLVersion=1,30
MesaVersion=11,1,2
GalliumVersion=0,4
DriverVersion=11,1,2
Driver=5
ChipClass=999
Driver=16
ChipClass=10
Compositor=9

View file

@ -0,0 +1,21 @@
[Driver]
Vendor=X.Org
Renderer=AMD Radeon R9 200 Series (HAWAII DRM 3.26.0 4.18.9-92.current LLVM 6.0.1)
Version=4.5 Mesa 18.1.6
ShadingLanguageVersion=4.50
[Settings]
LooseBinding=true
GLSL=true
TextureNPOT=true
Mesa=true
Gallium=true
Radeon=true
GLVersion=4,5
GLSLVersion=4,50
MesaVersion=18,1,6
GalliumVersion=0,4
DriverVersion=18,1,6
Driver=16
ChipClass=10
Compositor=9

View file

@ -0,0 +1,21 @@
[Driver]
Vendor=X.Org
Renderer=AMD Radeon (TM) RX 480 Graphics (POLARIS10 / DRM 3.23.0 / 4.15.0-rc1-g516fb7f2e73d, LLVM 6.0.0)
Version=4.5 (Core Profile) Mesa 17.4.0-devel (git-b6b4b2c6d8)
ShadingLanguageVersion=4.50
[Settings]
LooseBinding=true
GLSL=true
TextureNPOT=true
Mesa=true
Gallium=true
Radeon=true
GLVersion=4,5
GLSLVersion=4,50
MesaVersion=17,4,0
GalliumVersion=0,4
DriverVersion=17,4,0
Driver=16
ChipClass=12
Compositor=9

View file

@ -0,0 +1,21 @@
[Driver]
Vendor=X.Org
Renderer=Radeon RX 550 Series (POLARIS12, DRM 3.25.0, 4.17.0-rc6-GTW1+, LLVM 6.0.0)
Version=3.1 Mesa 18.1.0
ShadingLanguageVersion=1.40
[Settings]
LooseBinding=true
GLSL=true
TextureNPOT=true
Mesa=true
Gallium=true
Radeon=true
GLVersion=3,1
GLSLVersion=1,40
MesaVersion=18,1,0
GalliumVersion=0,4
DriverVersion=18,1,0
Driver=16
ChipClass=12
Compositor=9

View file

@ -0,0 +1,21 @@
[Driver]
Vendor=X.Org
Renderer=Radeon RX 580 Series (POLARIS10, DRM 3.27.0, 4.19.10-arch1-1-ARCH, LLVM 7.0.0)
Version=4.5 (Compatibility Profile) Mesa 18.3.1
ShadingLanguageVersion=4.50
[Settings]
LooseBinding=true
GLSL=true
TextureNPOT=true
Mesa=true
Gallium=true
Radeon=true
GLVersion=4,5
GLSLVersion=4,50
MesaVersion=18,3,1
GalliumVersion=0,4
DriverVersion=18,3,1
Driver=16
ChipClass=12
Compositor=9

View file

@ -0,0 +1,21 @@
[Driver]
Vendor=X.Org
Renderer=Radeon RX Vega (VEGA10, DRM 3.25.0, 4.17.0-trunk-amd64, LLVM 6.0.0)
Version=4.5 (Core Profile) Mesa 18.1.2
ShadingLanguageVersion=4.50
[Settings]
LooseBinding=true
GLSL=true
TextureNPOT=true
Mesa=true
Gallium=true
Radeon=true
GLVersion=4,5
GLSLVersion=4,50
MesaVersion=18,1,2
GalliumVersion=0,4
DriverVersion=18,1,2
Driver=16
ChipClass=13
Compositor=9

View file

@ -0,0 +1,21 @@
[Driver]
Vendor=X.Org
Renderer=Radeon RX Vega (VEGA10 / DRM 3.23.0 / 4.16.16-300.fc28.x86_64, LLVM 6.0.0)
Version=4.5 (Core Profile) Mesa 18.0.5
ShadingLanguageVersion=4.50
[Settings]
LooseBinding=true
GLSL=true
TextureNPOT=true
Mesa=true
Gallium=true
Radeon=true
GLVersion=4,5
GLSLVersion=4,50
MesaVersion=18,0,5
GalliumVersion=0,4
DriverVersion=18,0,5
Driver=16
ChipClass=13
Compositor=9

View file

@ -16,6 +16,6 @@ GLSLVersion=4,10
MesaVersion=12,0,1
GalliumVersion=0,4
DriverVersion=12,0,1
Driver=5
ChipClass=999
Driver=16
ChipClass=11
Compositor=9

View file

@ -67,6 +67,7 @@ void GLPlatformTest::testDriverToString_data()
QTest::newRow("R300G") << Driver_R300G << QStringLiteral("R300G");
QTest::newRow("R600C") << Driver_R600C << QStringLiteral("R600C");
QTest::newRow("R600G") << Driver_R600G << QStringLiteral("R600G");
QTest::newRow("RadeonSI") << Driver_RadeonSI << QStringLiteral("RadeonSI");
QTest::newRow("Nouveau") << Driver_Nouveau << QStringLiteral("Nouveau");
QTest::newRow("Intel") << Driver_Intel << QStringLiteral("Intel");
QTest::newRow("NVidia") << Driver_NVidia << QStringLiteral("NVIDIA");
@ -99,7 +100,12 @@ void GLPlatformTest::testChipClassToString_data()
QTest::newRow("R600") << R600 << QStringLiteral("R600");
QTest::newRow("R700") << R700 << QStringLiteral("R700");
QTest::newRow("Evergreen") << Evergreen << QStringLiteral("EVERGREEN");
QTest::newRow("NorthernIslands") << NorthernIslands << QStringLiteral("NI");
QTest::newRow("NorthernIslands") << NorthernIslands << QStringLiteral("Northern Islands");
QTest::newRow("SouthernIslands") << SouthernIslands << QStringLiteral("Southern Islands");
QTest::newRow("SeaIslands") << SeaIslands << QStringLiteral("Sea Islands");
QTest::newRow("VolcanicIslands") << VolcanicIslands << QStringLiteral("Volcanic Islands");
QTest::newRow("Arctic Islands") << ArcticIslands << QStringLiteral("Arctic Islands");
QTest::newRow("Vega") << Vega << QStringLiteral("Vega");
QTest::newRow("UnknownRadeon") << UnknownRadeon << QStringLiteral("Unknown");
QTest::newRow("NV10") << NV10 << QStringLiteral("NV10");
QTest::newRow("NV20") << NV20 << QStringLiteral("NV20");
@ -245,20 +251,11 @@ void GLPlatformTest::testDetect()
QEXPECT_FAIL("amd-catalyst-radeonhd-7700M-3.1.13399", "Detects GL version instead of driver version", Continue);
QCOMPARE(gl->driverVersion(), readVersion(settingsGroup, "DriverVersion"));
QEXPECT_FAIL("amd-gallium-bonaire-3.0", "Not detected as a radeon driver", Continue);
QEXPECT_FAIL("amd-gallium-hawaii-3.0", "Not detected as a radeon driver", Continue);
QEXPECT_FAIL("amd-gallium-tonga-4.1", "Not detected as a radeon driver", Continue);
QCOMPARE(gl->driver(), Driver(settingsGroup.readEntry("Driver", int(Driver_Unknown))));
QEXPECT_FAIL("amd-gallium-bonaire-3.0", "Not detected as a radeon driver", Continue);
QEXPECT_FAIL("amd-gallium-hawaii-3.0", "Not detected as a radeon driver", Continue);
QEXPECT_FAIL("amd-gallium-tonga-4.1", "Not detected as a radeon driver", Continue);
QCOMPARE(gl->chipClass(), ChipClass(settingsGroup.readEntry("ChipClass", int(UnknownChipClass))));
QCOMPARE(gl->isMesaDriver(), settingsGroup.readEntry("Mesa", false));
QCOMPARE(gl->isGalliumDriver(), settingsGroup.readEntry("Gallium", false));
QEXPECT_FAIL("amd-gallium-bonaire-3.0", "Not detected as a radeon driver", Continue);
QEXPECT_FAIL("amd-gallium-hawaii-3.0", "Not detected as a radeon driver", Continue);
QEXPECT_FAIL("amd-gallium-tonga-4.1", "Not detected as a radeon driver", Continue);
QCOMPARE(gl->isRadeon(), settingsGroup.readEntry("Radeon", false));
QCOMPARE(gl->isNvidia(), settingsGroup.readEntry("Nvidia", false));
QCOMPARE(gl->isIntel(), settingsGroup.readEntry("Intel", false));

View file

@ -187,6 +187,44 @@ static ChipClass detectRadeonClass(const QByteArray &chipset)
chipset.contains("CAYMAN"))
return NorthernIslands;
if (chipset.contains("TAHITI") ||
chipset.contains("PITCAIRN") ||
chipset.contains("VERDE") ||
chipset.contains("OLAND") ||
chipset.contains("HAINAN")) {
return SouthernIslands;
}
if (chipset.contains("BONAIRE") ||
chipset.contains("KAVERI") ||
chipset.contains("KABINI") ||
chipset.contains("HAWAII") ||
chipset.contains("MULLINS")) {
return SeaIslands;
}
if (chipset.contains("TONGA") ||
chipset.contains("TOPAZ") ||
chipset.contains("FIJI") ||
chipset.contains("CARRIZO") ||
chipset.contains("STONEY")) {
return VolcanicIslands;
}
if (chipset.contains("POLARIS10") ||
chipset.contains("POLARIS11") ||
chipset.contains("POLARIS12") ||
chipset.contains("VEGAM")) {
return ArcticIslands;
}
if (chipset.contains("VEGA10") ||
chipset.contains("VEGA12") ||
chipset.contains("VEGA20") ||
chipset.contains("RAVEN")) {
return Vega;
}
const QString chipset16 = QString::fromLatin1(chipset);
QString name = extract(chipset16, QStringLiteral("HD [0-9]{4}")); // HD followed by a space and 4 digits
if (!name.isEmpty()) {
@ -464,6 +502,8 @@ QByteArray GLPlatform::driverToString8(Driver driver)
return QByteArrayLiteral("R600C");
case Driver_R600G:
return QByteArrayLiteral("R600G");
case Driver_RadeonSI:
return QByteArrayLiteral("RadeonSI");
case Driver_Nouveau:
return QByteArrayLiteral("Nouveau");
case Driver_Intel:
@ -514,7 +554,17 @@ QByteArray GLPlatform::chipClassToString8(ChipClass chipClass)
case Evergreen:
return QByteArrayLiteral("EVERGREEN");
case NorthernIslands:
return QByteArrayLiteral("NI");
return QByteArrayLiteral("Northern Islands");
case SouthernIslands:
return QByteArrayLiteral("Southern Islands");
case SeaIslands:
return QByteArrayLiteral("Sea Islands");
case VolcanicIslands:
return QByteArrayLiteral("Volcanic Islands");
case ArcticIslands:
return QByteArrayLiteral("Arctic Islands");
case Vega:
return QByteArrayLiteral("Vega");
case NV10:
return QByteArrayLiteral("NV10");
@ -800,6 +850,35 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
m_driver = Driver_R600G;
}
// RadeonSI
else if (m_vendor == "X.Org" &&
(m_renderer.contains("TAHITI") ||
m_renderer.contains("PITCAIRN") ||
m_renderer.contains("VERDE") ||
m_renderer.contains("OLAND") ||
m_renderer.contains("HAINAN") ||
m_renderer.contains("BONAIRE") ||
m_renderer.contains("KAVERI") ||
m_renderer.contains("KABINI") ||
m_renderer.contains("HAWAII") ||
m_renderer.contains("MULLINS") ||
m_renderer.contains("TOPAZ") ||
m_renderer.contains("TONGA") ||
m_renderer.contains("FIJI") ||
m_renderer.contains("CARRIZO") ||
m_renderer.contains("STONEY") ||
m_renderer.contains("POLARIS10") ||
m_renderer.contains("POLARIS11") ||
m_renderer.contains("POLARIS12") ||
m_renderer.contains("VEGAM") ||
m_renderer.contains("VEGA10") ||
m_renderer.contains("VEGA12") ||
m_renderer.contains("VEGA20") ||
m_renderer.contains("RAVEN"))) {
m_chipClass = detectRadeonClass(m_renderer);
m_driver = Driver_RadeonSI;
}
// Nouveau
else if (m_vendor == "nouveau") {
m_chipClass = detectNVidiaClass(m_chipset);

View file

@ -102,6 +102,7 @@ enum Driver {
Driver_VirtualBox,
Driver_VMware,
Driver_Qualcomm,
Driver_RadeonSI,
Driver_Unknown
};
@ -116,6 +117,11 @@ enum ChipClass {
R700, // GL3.3 DX10.1 SM 4.1 2008
Evergreen, // GL4.0 CL1.0 DX11 SM 5.0 2009
NorthernIslands, // GL4.0 CL1.1 DX11 SM 5.0 2010
SouthernIslands, // GL4.5 CL1.2 DX11.1 SM 5.1 2012
SeaIslands, // GL4.5 CL2.0 DX12 SM 6.0 2013
VolcanicIslands, // GL4.5 CL2.0 DX12 SM 6.0 2015
ArcticIslands, // GL4.5 CL2.0 DX12 SM 6.0 2016
Vega, // GL4.6 CL2.0 DX12 SM 6.0 2017
UnknownRadeon = 999,
// NVIDIA