On Tue, Jun 8, 2021 at 10:14 PM Michal Prívozník <mprivozn@redhat.com> wrote:
On 6/8/21 3:15 AM, Han Han wrote:
> QEMU 6.1 will add virtio-gpu-gl-pci device to replace the virgl property
> of virtio-gpu-pci device. Adapt to that change.
>
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1967356
>
> Signed-off-by: Han Han <hhan@redhat.com>
> ---
>  src/qemu/qemu_command.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 4ed82ed570..a79e96a121 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -546,7 +546,11 @@ qemuBuildVirtioDevStr(virBuffer *buf,
>          return -1;
>      }

> -    virBufferAsprintf(buf, "%s-%s", baseName, implName);
> +    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
> +        STREQ(baseName, "virtio-gpu"))
> +        virBufferAsprintf(buf, "%s-gl-%s", baseName, implName);
> +    else
> +        virBufferAsprintf(buf, "%s-%s", baseName, implName);

This doesn't look right. What if domain has:

 <acceleration accel3d='no'/>

This will still pick virtio-gpu-gl-pci, wouldn't it? I think we need to
Yes. I forget to add the boolean of acceleration@accel3d here.
pick the correct model beforehand and leave qemuBuildVirtioDevStr()
unmodified.
I will try the unmodified qemuBuildVirtioDevStr() next


>      switch (devtype) {
>          case VIR_DOMAIN_DEVICE_DISK:
> @@ -4242,6 +4246,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
>          video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
>          if (video->accel &&
>              virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL) &&
> +            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) &&
>              (video->accel->accel3d == VIR_TRISTATE_SWITCH_ON ||
>               video->accel->accel3d == VIR_TRISTATE_SWITCH_OFF)) {
>              virBufferAsprintf(&buf, ",virgl=%s",
>

Michal