Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_command.c | 5 +++++
tests/qemuxml2argvdata/qemuxml2argv-video-virtio-vga.args | 2 +-
tests/qemuxml2argvtest.c | 3 ++-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 68fc137069a5..636058b01606 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4484,6 +4484,11 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
if (video->heads)
virBufferAsprintf(&buf, ",max_outputs=%u",
video->heads);
}
+ } else if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS)) {
+ if (video->heads)
+ virBufferAsprintf(&buf, ",max_outputs=%u",
video->heads);
+ }
} else if (video->vram &&
((video->type == VIR_DOMAIN_VIDEO_TYPE_VGA &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) ||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-vga.args
b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-vga.args
index 1aa38bbeec2e..b526ac95956d 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-vga.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-vga.args
@@ -22,5 +22,5 @@ server,nowait \
-drive file=/var/lib/libvirt/images/QEMUGuest1,format=qcow2,if=none,\
id=drive-ide0-0-0,cache=none \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--device virtio-vga,id=video0,bus=pci.0,addr=0x2 \
+-device virtio-vga,id=video0,max_outputs=1,bus=pci.0,addr=0x2 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 5cdbc78eb808..7b0778844f51 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1872,7 +1872,8 @@ mymain(void)
DO_TEST("video-virtio-vga",
QEMU_CAPS_DEVICE_VIRTIO_GPU,
QEMU_CAPS_DEVICE_VIRTIO_VGA,
- QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS);
DO_TEST_PARSE_ERROR("video-invalid", NONE);
DO_TEST("virtio-rng-default",
--
2.14.1