fix #7525: vga: allow setting the number of outputs for VirtIO GPU

With SPICE and QXL, Linux guests get 'max_outputs=4' on the display
device, so they can use up to four displays with a single device. For
the VirtIO GPU, there is no way to change QEMU's default of a single
output, so using multiple displays requires passing the whole device
via custom arguments.

Add a 'max-outputs' option to the 'vga' property, which sets the
'max_outputs' property of the VirtIO GPU, for both 'virtio' and
'virtio-gl'. QEMU supports up to 16 outputs. Other display types
reject the option, as QXL handles multiple displays on its own.

Signed-off-by: Michal Fox <me@dualfroz.com>
This commit is contained in:
dualfroz committed 2026-10-03 01:53:20 +02:00
1 parent 1b6f27e716
commit 5f10cfd754
4 files changed
+71

No files matched your search

+15
View File
@@ -187,6 +187,15 @@ my $vga_fmt = {
enum => ['vnc'],
optional => 1,
},
'max-outputs' => {
description => "Sets the maximum number of displays the guest can use. Only supported"
. " with 'virtio' and 'virtio-gl'.",
type => 'integer',
optional => 1,
minimum => 1,
maximum => 16,
default => 1,
},
};
my $ivshmem_fmt = {
@@ -1513,6 +1522,12 @@ sub print_vga_device {
}
}
if (my $outputs = $vga->{'max-outputs'}) {
die "'max-outputs' is only supported with VGA type 'virtio' or 'virtio-gl'\n"
if $vga->{type} !~ m/^virtio/;
$max_outputs = ",max_outputs=$outputs";
}
die "no device-type for $vga->{type}\n" if !$type;
my $memory = "";