diff mbox series

[v2,07/16] qemu: validate virtio-gpu with vhost-user

Message ID 96949c1e9b5df8c986a9b36f640dd3dec8dcb0c9.1566576129.git.crobinso@redhat.com
State New
Headers show
Series Add vhost-user-gpu support | expand

Commit Message

Cole Robinson Aug. 23, 2019, 4:21 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Check qemu capability, and accept 3d acceleration. 3d acceleration
support is checked when looking for a suitable vhost-user helper.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 src/qemu/qemu_process.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c9921646e9..c439f17011 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5274,8 +5274,10 @@  qemuProcessStartValidateVideo(virDomainObjPtr vm,
              !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) ||
             (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL &&
              !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) ||
-            (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
+            (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO && !video->vhostuser &&
              !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) ||
+            (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO && video->vhostuser &&
+             !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU)) ||
             (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
              video->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
              !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW))) {
@@ -5285,7 +5287,15 @@  qemuProcessStartValidateVideo(virDomainObjPtr vm,
             return -1;
         }
 
-        if (video->accel) {
+        if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
+            video->vhostuser &&
+            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("this QEMU does not support vhost-user backed video device"));
+            return -1;
+        }
+
+        if (!video->vhostuser && video->accel) {
             if (video->accel->accel3d == VIR_TRISTATE_SWITCH_ON &&
                 (video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO ||
                  !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL))) {