Add support for virgl in GLPlatform

Summary:
This change adds detection support for virgl (Mesa gallium virtio guest driver).
Results in proper detection in supportInformation and debug console.

Test Plan: Modified test passes, run KWin_Wayland in kvm with virgl and verified supportInformation

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25056
master
Martin Flöser 5 years ago
parent affd444507
commit 92197242ce

@ -0,0 +1,22 @@
[Driver]
Vendor=Red Hat
Renderer=virgl
Version=3.1 Mesa 19.0.8
ShadingLanguageVersion=1.40
[Settings]
LooseBinding=true
GLSL=true
TextureNPOT=true
Mesa=true
Gallium=true
Virgl=true
VirtualMachine=true
GLVersion=3,1
GLSLVersion=1,40
MesaVersion=19,0,8
GalliumVersion=0,4
DriverVersion=19,0,8
Driver=17
ChipClass=99999
Compositor=9

@ -78,6 +78,7 @@ void GLPlatformTest::testDriverToString_data()
QTest::newRow("VirtualBox") << Driver_VirtualBox << QStringLiteral("VirtualBox (Chromium)");
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("Unknown") << Driver_Unknown << QStringLiteral("Unknown");
}
@ -262,6 +263,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->isVirgl(), settingsGroup.readEntry("Virgl", false));
QCOMPARE(gl->isSoftwareEmulation(), settingsGroup.readEntry("SoftwareEmulation", false));
QCOMPARE(gl->isVirtualMachine(), settingsGroup.readEntry("VirtualMachine", false));

@ -524,6 +524,8 @@ QByteArray GLPlatform::driverToString8(Driver driver)
return QByteArrayLiteral("VMware (SVGA3D)");
case Driver_Qualcomm:
return QByteArrayLiteral("Qualcomm");
case Driver_Virgl:
return QByteArrayLiteral("Virgl (virtio-gpu, Qemu/KVM guest)");
default:
return QByteArrayLiteral("Unknown");
@ -899,6 +901,11 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
else if (m_vendor == "VMware, Inc." && m_chipset.contains("SVGA3D")) {
m_driver = Driver_VMware;
}
// virgl
else if (m_renderer == "virgl") {
m_driver = Driver_Virgl;
}
}
// Driver/GPU specific features
@ -1017,6 +1024,11 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
m_recommendedCompositor = OpenGL2Compositing;
}
if (m_driver == Driver_Virgl) {
m_virtualMachine = true;
m_recommendedCompositor = OpenGL2Compositing;
}
// and force back to shader supported on gles, we wouldn't have got a context if not supported
if (isGLES()) {
m_supportsGLSL = true;
@ -1171,6 +1183,11 @@ bool GLPlatform::isVMware() const
return m_driver == Driver_VMware;
}
bool GLPlatform::isVirgl() const
{
return m_driver == Driver_Virgl;
}
bool GLPlatform::isSoftwareEmulation() const
{
return m_driver == Driver_Softpipe || m_driver == Driver_Swrast || m_driver == Driver_Llvmpipe;

@ -103,6 +103,7 @@ enum Driver {
Driver_VMware,
Driver_Qualcomm,
Driver_RadeonSI,
Driver_Virgl,
Driver_Unknown
};
@ -289,6 +290,12 @@ public:
*/
bool isAdreno() const;
/**
* @returns @c true if the "GPU" is a virtio-gpu (Qemu/KVM)
* @since 5.18
**/
bool isVirgl() const;
/**
* @returns the GL_VERSION string as provided by the driver.
* @since 4.9

Loading…
Cancel
Save