From 6f070e39dec2e6d1cc60718cc022b89c9a2b7355 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 22 Apr 2022 14:28:09 +0200 Subject: [PATCH] vga: add virtio-gl display type for VIRGL Signed-off-by: Thomas Lamprecht --- PVE/QemuServer.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 0be6be90..1d176165 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -181,7 +181,7 @@ my $vga_fmt = { default => 'std', optional => 1, default_key => 1, - enum => [qw(cirrus qxl qxl2 qxl3 qxl4 none serial0 serial1 serial2 serial3 std virtio vmware)], + enum => [qw(cirrus qxl qxl2 qxl3 qxl4 none serial0 serial1 serial2 serial3 std virtio virtio-gl vmware)], }, memory => { description => "Sets the VGA memory (in MiB). Has no effect with serial display.", @@ -1821,6 +1821,7 @@ my $vga_map = { 'std' => 'VGA', 'vmware' => 'vmware-svga', 'virtio' => 'virtio-vga', + 'virtio-gl' => 'virtio-vga-gl', }; sub print_vga_device { @@ -1848,7 +1849,7 @@ sub print_vga_device { my $memory = ""; if ($vgamem_mb) { - if ($vga->{type} eq 'virtio') { + if ($vga->{type} =~ /^virtio/) { my $bytes = PVE::Tools::convert_size($vgamem_mb, "mb" => "b"); $memory = ",max_hostmem=$bytes"; } elsif ($qxlnum) { @@ -3762,6 +3763,9 @@ sub config_to_command { if ($vga->{type} && $vga->{type} !~ m/^serial\d+$/ && $vga->{type} ne 'none'){ push @$devices, '-device', print_vga_device( $conf, $vga, $arch, $machine_version, $machine_type, undef, $qxlnum, $bridges); + + push @$cmd, '-display', 'egl-headless,gl=core' if $vga->{type} eq 'virtio-gl'; # VIRGL + my $socket = PVE::QemuServer::Helpers::vnc_socket($vmid); push @$cmd, '-vnc', "unix:$socket,password=on"; } else {