[PATCH] qemu: validate: Clarify error messages for unsupported 3d video acceleration

Peter Krempa posted 1 patch 1 year, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/e6c94293bfb3e80e41b84592c91724f5f9a8fc83.1665735484.git.pkrempa@redhat.com
src/qemu/qemu_validate.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
[PATCH] qemu: validate: Clarify error messages for unsupported 3d video acceleration
Posted by Peter Krempa 1 year, 6 months ago
The error message doesn't really convey the information that 3d
acceleration works only for the 'virtio' model and similarly the same
error would be reported if qemu doesn't support acceleration, which is
hard to debug.

Split and clarify the errors.

Noticed in https://gitlab.com/libvirt/libvirt/-/issues/388

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_validate.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index cb4e32c0ff..079009ea4b 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2765,15 +2765,20 @@ qemuValidateDomainDeviceDefVideo(const virDomainVideoDef *video,
             return -1;
         }
     } else if (video->accel) {
-        if (video->accel->accel3d == VIR_TRISTATE_BOOL_YES &&
-            (video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO ||
-             !(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL) ||
-               virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) ||
-               virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL)))) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("%s 3d acceleration is not supported"),
-                           virDomainVideoTypeToString(video->type));
-            return -1;
+        if (video->accel->accel3d == VIR_TRISTATE_BOOL_YES) {
+            if (video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("3d acceleration is supported only with 'virtio' video device"));
+                return -1;
+            }
+
+            if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL) ||
+                  virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_GL_PCI) ||
+                  virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_VGA_GL))) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("3d acceleration is not supported by this QEMU binary"));
+                return -1;
+            }
         }
     }

-- 
2.37.3
Re: [PATCH] qemu: validate: Clarify error messages for unsupported 3d video acceleration
Posted by Pavel Hrdina 1 year, 6 months ago
On Fri, Oct 14, 2022 at 10:18:04AM +0200, Peter Krempa wrote:
> The error message doesn't really convey the information that 3d
> acceleration works only for the 'virtio' model and similarly the same
> error would be reported if qemu doesn't support acceleration, which is
> hard to debug.
> 
> Split and clarify the errors.
> 
> Noticed in https://gitlab.com/libvirt/libvirt/-/issues/388
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  src/qemu/qemu_validate.c | 23 ++++++++++++++---------
>  1 file changed, 14 insertions(+), 9 deletions(-)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>