Commit 68c0b7b4 authored by Volker Krause's avatar Volker Krause

Improve normalization of OpenGL renderer strings for AMD GPUs

parent 751db983
......@@ -192,6 +192,8 @@ private slots:
QTest::newRow("nvidia macos") << QStringLiteral("NVIDIA GeForce GT 750M OpenGL Engine") << QStringLiteral("GeForce GT 750M");
QTest::newRow("angle") << QStringLiteral("ANGLE (VirtualBox Graphics Adapter for Windows 8+ Direct3D9Ex vs_3_0 ps_3_0)") << QStringLiteral("ANGLE");
QTest::newRow("gallium") << QStringLiteral("Gallium 0.4 on AMD BARTS (DRM 2.49.0 / 4.11.1-1-default, LLVM 4.0.0)") << QStringLiteral("Gallium 0.4 on AMD BARTS");
QTest::newRow("AMD 1") << QStringLiteral("AMD BARTS (DRM 2.50.0 / 4.17.2-1-default, LLVM 6.0.0)") << QStringLiteral("AMD BARTS");
QTest::newRow("AMD 2") << QStringLiteral("AMD Radeon (TM) RX 480 Graphics (POLARIS10 / DRM 3.19.0 / 4.14.50-gentoo, LLVM 6.0.0)") << QStringLiteral("AMD Radeon RX 480 Graphics");
}
void testNormalizeRenderer()
......
......@@ -111,25 +111,27 @@ public:
static inline QString normalizeRenderer(const char *renderer)
{
auto r = QString::fromLocal8Bit(renderer);
// remove trademark indicators
r.remove(QLatin1String("(R)"), Qt::CaseInsensitive);
r.remove(QLatin1String("(TM)"), Qt::CaseInsensitive);
// remove vendor prefixes, we already have that in the vendor field
if (r.startsWith(QLatin1String("Mesa DRI ")))
r = r.mid(9);
if (r.startsWith(QLatin1String("Intel(R) ")))
r = r.mid(9);
if (r.startsWith(QLatin1String("Intel ")))
r = r.mid(6);
if (r.startsWith(QLatin1String("NVIDIA ")))
r = r.mid(7);
// remove excessive details that could enable fingerprinting
if (r.startsWith(QLatin1String("ANGLE ")) || r.startsWith(QLatin1String("Gallium ")))
if (r.startsWith(QLatin1String("ANGLE ")) || r.startsWith(QLatin1String("Gallium ")) || r.startsWith(QLatin1String("AMD ")))
r = stripDetails(r);
// strip macOS adding " OpenGL Engine" at the end
if (r.endsWith(QLatin1String(" OpenGL Engine")))
r = r.left(r.size() - 14);
return r;
return r.simplified();
}
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment