On Fri, Jun 11, 2021 at 4:55 PM Michal Prívozník <mprivozn@redhat.com> wrote:
On 6/9/21 10:32 AM, Han Han wrote:
> QEMU 6.1 will replace the virgl property of virtio-vga device to
> virtio-vga-gl device. Adapt to that update.
>
> Resolves: https://gitlab.com/libvirt/libvirt/-/issues/167
>
> Signed-off-by: Han Han <hhan@redhat.com>
> ---
>  src/qemu/qemu_command.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 6b9f13b219..56bc4b87eb 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -4239,6 +4239,9 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
>          }
>      } else {
>          virBufferAsprintf(&buf, "%s", model);
> +        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL) &&
> +            STREQ(model, "virtio-vga"))
> +            virBufferAddLit(&buf, "-gl");

This enables -gl unconditionally, which is not desired. What we should
do instead is:

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c5275fe0ee..9f44c76d28 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4244,6 +4244,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
     } else {
         virBufferAsprintf(&buf, "%s", model);
         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL) &&
+            accel3d == VIR_TRISTATE_SWITCH_ON &&
Good catch. The condition for accel3d was missing in my code. 
             STREQ(model, "virtio-vga"))
             virBufferAddLit(&buf, "-gl");
     }


Michal