[libvirt PATCH] qemu: explicitly disable virgl when requested

Jonathon Jongsma posted 1 patch 4 years, 2 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200124231226.29326-1-jjongsma@redhat.com
src/qemu/qemu_command.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[libvirt PATCH] qemu: explicitly disable virgl when requested
Posted by Jonathon Jongsma 4 years, 2 months ago
If a domain is configured to have an egl-headless display and a virtio
video device, virgl will be enabled automatically within the guest, even
if the video device is configured with accel3d='no'.

In this case we should explicitly pass 'virgl=off' to qemu.

See https://bugzilla.redhat.com/show_bug.cgi?id=1791236 for more
information.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
 src/qemu/qemu_command.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 46680fd829..3378413ee1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4429,7 +4429,10 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
 
     if (video->backend != VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER &&
         video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
-        if (video->accel && video->accel->accel3d == VIR_TRISTATE_SWITCH_ON) {
+        if (video->accel &&
+            virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL) &&
+            (video->accel->accel3d == VIR_TRISTATE_SWITCH_ON ||
+             video->accel->accel3d == VIR_TRISTATE_SWITCH_OFF)) {
             virBufferAsprintf(&buf, ",virgl=%s",
                               virTristateSwitchTypeToString(video->accel->accel3d));
         }
-- 
2.21.0

Re: [libvirt PATCH] qemu: explicitly disable virgl when requested
Posted by Michal Prívozník 4 years, 2 months ago
On 1/25/20 12:12 AM, Jonathon Jongsma wrote:
> If a domain is configured to have an egl-headless display and a virtio
> video device, virgl will be enabled automatically within the guest, even
> if the video device is configured with accel3d='no'.
> 
> In this case we should explicitly pass 'virgl=off' to qemu.
> 
> See https://bugzilla.redhat.com/show_bug.cgi?id=1791236 for more
> information.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
> ---
>  src/qemu/qemu_command.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com> and pushed. Even
though I still don't understand what good it is to use egl-headless with
accel3d='no'. Can it be used for when I'm passing two video cards? For
instance, one <video/> (primary) and then <hostdev/> (secondary) and I
want the secondary card (which is a physical card, hence more powerful)
to do the rendering?

Michal