Commit e9fcd958 authored by Tomasz Gajc's avatar Tomasz Gajc
Browse files

effects: add support Panfrost Mali driver

parent 17a585b5
[Driver]
Vendor=Panfrost
Renderer=Mali T860 (Panfrost)
Version=3.0 Mesa 19.1
ShadingLanguageVersion=1.30
[Settings]
LooseBinding=true
GLSL=true
TextureNPOT=true
Mesa=true
Panfrost=true
GLVersion=3,0
GLSLVersion=1,30
MesaVersion=19,1
DriverVersion=19,1
Driver=18
ChipClass=4001
Compositor=9
......@@ -68,6 +68,7 @@ void GLPlatformTest::testDriverToString_data()
QTest::newRow("VMware") << Driver_VMware << QStringLiteral("VMware (SVGA3D)");
QTest::newRow("Qualcomm") << Driver_Qualcomm << QStringLiteral("Qualcomm");
QTest::newRow("Virgl") << Driver_Virgl << QStringLiteral("Virgl (virtio-gpu, Qemu/KVM guest)");
QTest::newRow("Panfrost") << Driver_Panfrost << QStringLiteral("Panfrost");
QTest::newRow("Unknown") << Driver_Unknown << QStringLiteral("Unknown");
}
......@@ -116,7 +117,11 @@ void GLPlatformTest::testChipClassToString_data()
QTest::newRow("Adreno3XX") << Adreno3XX << QStringLiteral("Adreno 3xx series");
QTest::newRow("Adreno4XX") << Adreno4XX << QStringLiteral("Adreno 4xx series");
QTest::newRow("Adreno5XX") << Adreno5XX << QStringLiteral("Adreno 5xx series");
QTest::newRow("UnknwonAdreno") << UnknownAdreno << QStringLiteral("Unknown");
QTest::newRow("UnknownAdreno") << UnknownAdreno << QStringLiteral("Unknown");
QTest::newRow("MaliT7XX") << MaliT7XX << QStringLiteral("Mali T7xx series");
QTest::newRow("MaliT8XX") << MaliT7XX << QStringLiteral("Mali T8xx series");
QTest::newRow("MaliGXX") << MaliT7XX << QStringLiteral("Mali Gxx series");
QTest::newRow("UnknownPanfrost") << UnknownAdreno << QStringLiteral("Unknown");
QTest::newRow("UnknownChipClass") << UnknownChipClass << QStringLiteral("Unknown");
}
......@@ -152,6 +157,7 @@ void GLPlatformTest::testPriorDetect()
QCOMPARE(gl->isRadeon(), false);
QCOMPARE(gl->isNvidia(), false);
QCOMPARE(gl->isIntel(), false);
QCOMPARE(gl->isPanfrost(), false);
QCOMPARE(gl->isVirtualBox(), false);
QCOMPARE(gl->isVMware(), false);
......@@ -252,6 +258,7 @@ void GLPlatformTest::testDetect()
QCOMPARE(gl->isVirtualBox(), settingsGroup.readEntry("VirtualBox", false));
QCOMPARE(gl->isVMware(), settingsGroup.readEntry("VMware", false));
QCOMPARE(gl->isAdreno(), settingsGroup.readEntry("Adreno", false));
QCOMPARE(gl->isPanfrost(), settingsGroup.readEntry("Panfrost", false));
QCOMPARE(gl->isVirgl(), settingsGroup.readEntry("Virgl", false));
QCOMPARE(gl->isSoftwareEmulation(), settingsGroup.readEntry("SoftwareEmulation", false));
......
......@@ -256,6 +256,8 @@ bool ContrastEffect::enabledByDefault()
if (gl->isIntel() && gl->chipClass() < SandyBridge)
return false;
if (gl->isPanfrost() && gl->chipClass() <= MaliT8XX)
return false;
if (gl->isSoftwareEmulation()) {
return false;
}
......
......@@ -356,6 +356,9 @@ bool BlurEffect::enabledByDefault()
if (gl->isIntel() && gl->chipClass() < SandyBridge)
return false;
if (gl->isPanfrost() && gl->chipClass() <= MaliT8XX) {
return false;
}
if (gl->isSoftwareEmulation()) {
return false;
}
......
......@@ -499,6 +499,25 @@ static ChipClass detectQualcommClass(const QByteArray &chipClass)
return UnknownAdreno;
}
static ChipClass detectPanfrostClass(const QByteArray &chipClass)
{
if (chipClass.contains("T720") ||
chipClass.contains("T760"))
return MaliT7XX;
if (chipClass.contains("T820") ||
chipClass.contains("T860"))
return MaliT8XX;
if (chipClass.contains("G31") ||
chipClass.contains("G52") ||
chipClass.contains("G72"))
return MaliGXX;
return UnknownPanfrost;
}
QString GLPlatform::versionToString(qint64 version)
{
return QString::fromLatin1(versionToString8(version));
......@@ -559,6 +578,8 @@ QByteArray GLPlatform::driverToString8(Driver driver)
return QByteArrayLiteral("Qualcomm");
case Driver_Virgl:
return QByteArrayLiteral("Virgl (virtio-gpu, Qemu/KVM guest)");
case Driver_Panfrost:
return QByteArrayLiteral("Panfrost");
default:
return QByteArrayLiteral("Unknown");
......@@ -666,6 +687,13 @@ QByteArray GLPlatform::chipClassToString8(ChipClass chipClass)
case Adreno5XX:
return QByteArrayLiteral("Adreno 5xx series");
case MaliT7XX:
return QByteArrayLiteral("Mali T7xx series");
case MaliT8XX:
return QByteArrayLiteral("Mali T8xx series");
case MaliGXX:
return QByteArrayLiteral("Mali Gxx series");
default:
return QByteArrayLiteral("Unknown");
}
......@@ -849,6 +877,11 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
m_chipClass = detectQualcommClass(m_renderer);
}
else if (m_renderer.contains("Panfrost")) {
m_driver = Driver_Panfrost;
m_chipClass = detectPanfrostClass(m_renderer);
}
else if (m_renderer == "Software Rasterizer") {
m_driver = Driver_Swrast;
}
......@@ -1046,6 +1079,10 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
}
}
if (isPanfrost()) {
m_recommendedCompositor = OpenGL2Compositing;
}
if (isMesaDriver() && platformInterface == EglPlatformInterface) {
// According to the reference implementation in
// mesa/demos/src/egl/opengles1/texture_from_pixmap
......@@ -1266,6 +1303,11 @@ bool GLPlatform::isAdreno() const
return m_chipClass >= Adreno1XX && m_chipClass <= UnknownAdreno;
}
bool GLPlatform::isPanfrost() const
{
return m_chipClass >= MaliT7XX && m_chipClass <= UnknownPanfrost;
}
const QByteArray &GLPlatform::glRendererString() const
{
return m_renderer;
......
......@@ -93,6 +93,7 @@ enum Driver {
Driver_Qualcomm,
Driver_RadeonSI,
Driver_Virgl,
Driver_Panfrost,
Driver_Unknown,
};
......@@ -156,6 +157,13 @@ enum ChipClass {
Adreno5XX, // GLES3.1 CL2.0 DX11.2
UnknownAdreno = 3999,
// Panfrost Mali
// from https://docs.mesa3d.org/drivers/panfrost.html
MaliT7XX = 4000, // GLES2.0/GLES3.0
MaliT8XX, // GLES3.0
MaliGXX, // GLES3.0
UnknownPanfrost = 4999,
UnknownChipClass = 99999,
};
// clang-format on
......@@ -301,6 +309,12 @@ public:
**/
bool isVirgl() const;
/**
* @returns @c true if the "GPU" is a Panfrost Mali GPU
* @since 5.21.5
**/
bool isPanfrost() const;
/**
* @returns the GL_VERSION string as provided by the driver.
* @since 4.9
......
Supports Markdown
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