diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 53b79ac9763cb8aa980dd204b1bac6bf6341a91e..9a27987d4aae6c2249513a99544522cde4f515eb 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 1aa38bbeec2e3c663bd2e3442de631ff004f1178..b526ac95956d5d43355821f85d5f623e36bab338 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 39f8d66c04e1d7f313075bcebbfa111363d57430..0c0bd16f948e3282d411016850cda666f1cd6235 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1883,7 +1883,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",