public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
To: pve-devel@lists.proxmox.com
Subject: [RFC v2 qemu-server 05/13] virtio-gl : add vulkan option
Date: Wed, 26 Aug 2026 09:43:37 +0200	[thread overview]
Message-ID: <20260826074347.1256659-6-alexandre.derumier@groupe-cyllene.com> (raw)
In-Reply-To: <20260826074347.1256659-1-alexandre.derumier@groupe-cyllene.com>

vga: (virtio|kyber)-gl,vulkan=4G

add Vulkan host gpu offloading through Venus,
with the size of host memory it allocate.

Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
---
 src/PVE/QemuServer.pm                        | 22 ++++++++++++--
 src/test/cfg2cmd/kyber-gl-vulkan.conf        |  3 ++
 src/test/cfg2cmd/kyber-gl-vulkan.conf.cmd    | 28 +++++++++++++++++
 src/test/cfg2cmd/virtio-gl-vulkan-error.conf |  4 +++
 src/test/cfg2cmd/virtio-gl-vulkan.conf       |  3 ++
 src/test/cfg2cmd/virtio-gl-vulkan.conf.cmd   | 32 ++++++++++++++++++++
 src/test/run_config2command_tests.pl         |  6 ++++
 7 files changed, 96 insertions(+), 2 deletions(-)
 create mode 100644 src/test/cfg2cmd/kyber-gl-vulkan.conf
 create mode 100644 src/test/cfg2cmd/kyber-gl-vulkan.conf.cmd
 create mode 100644 src/test/cfg2cmd/virtio-gl-vulkan-error.conf
 create mode 100644 src/test/cfg2cmd/virtio-gl-vulkan.conf
 create mode 100644 src/test/cfg2cmd/virtio-gl-vulkan.conf.cmd

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 1e012c8..7035e04 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -190,6 +190,14 @@ my $vga_fmt = {
         enum => ['vnc'],
         optional => 1,
     },
+    vulkan => {
+        description => "Offer Vulkan to the guest through Venus, with this much host memory for"
+            . " the blob resources it allocates. Needs a GL display type.",
+        type => 'string',
+        pattern => '\d+[MG]',
+        format_description => '\d+[MG]',
+        optional => 1,
+    },
 };
 
 my $ivshmem_fmt = {
@@ -1550,6 +1558,14 @@ sub print_vga_device {
         $memory = ",ram_size=67108864,vram_size=33554432";
     }
 
+    my $vulkan = "";
+    if ($vga->{vulkan}) {
+        die "vga: vulkan needs a display with GL - 'kyber-gl' or 'virtio-gl',"
+            . " not '$vga->{type}'\n"
+            if ($vga->{type} // '') !~ /-gl$/;
+        $vulkan = ",blob=on,hostmem=$vga->{vulkan},venus=on";
+    }
+
     my $edidoff = "";
     if ($type eq 'VGA' && windows_version($conf->{ostype})) {
         $edidoff = ",edid=off" if (!defined($conf->{bios}) || $conf->{bios} ne 'ovmf');
@@ -1578,7 +1594,7 @@ sub print_vga_device {
             if !PVE::Tools::dir_glob_regex('/dev/dri/', "renderD.*");
     }
 
-    return "$type,id=${vgaid}${memory}${max_outputs}${pciaddr}${edidoff}";
+    return "$type,id=${vgaid}${memory}${vulkan}${max_outputs}${pciaddr}${edidoff}";
 }
 
 sub vm_is_volid_owner {
@@ -3478,13 +3494,15 @@ sub config_to_command {
 
     my $virtiofs_enabled = PVE::QemuServer::Virtiofs::virtiofs_enabled($conf);
 
+    my $shared_memory = $virtiofs_enabled || $vga->{vulkan};
+
     PVE::QemuServer::Memory::config(
         $conf,
         $vmid,
         $sockets,
         $cores,
         $hotplug_features->{memory},
-        $virtiofs_enabled,
+        $shared_memory,
         $cmd,
         $machineFlags,
     );
diff --git a/src/test/cfg2cmd/kyber-gl-vulkan.conf b/src/test/cfg2cmd/kyber-gl-vulkan.conf
new file mode 100644
index 0000000..0a8a570
--- /dev/null
+++ b/src/test/cfg2cmd/kyber-gl-vulkan.conf
@@ -0,0 +1,3 @@
+# TEST: Vulkan through Venus on the Kyber console's GL display
+memory: 4096
+vga: kyber-gl,vulkan=4G
diff --git a/src/test/cfg2cmd/kyber-gl-vulkan.conf.cmd b/src/test/cfg2cmd/kyber-gl-vulkan.conf.cmd
new file mode 100644
index 0000000..1d4c979
--- /dev/null
+++ b/src/test/cfg2cmd/kyber-gl-vulkan.conf.cmd
@@ -0,0 +1,28 @@
+/usr/bin/kvm
+-id 8006
+-name vm8006
+-no-shutdown
+-chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off'
+-mon 'chardev=qmp,mode=control'
+-chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000'
+-mon 'chardev=qmp-event,mode=control'
+-pidfile /var/run/qemu-server/8006.pid
+-daemonize
+-smp '1,sockets=1,cores=1,maxcpus=1'
+-nodefaults
+-boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg'
+-display 'dbus,addr=unix:path=/var/run/qemu-server/8006.dbusdisplay,gl=on'
+-vnc 'unix:/var/run/qemu-server/8006.vnc,password=on'
+-cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep
+-m 4096
+-object 'memory-backend-memfd,id=virtiofs-mem,size=4096M,share=on'
+-global 'PIIX4_PM.disable_s3=1'
+-global 'PIIX4_PM.disable_s4=1'
+-device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e'
+-device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f'
+-device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2'
+-device 'usb-tablet,id=tablet,bus=uhci.0,port=1'
+-device 'virtio-vga-gl,id=vga,blob=on,hostmem=4G,venus=on,bus=pci.0,addr=0x2'
+-device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on'
+-iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff'
+-machine 'memory-backend=virtiofs-mem,type=pc+pve0'
\ No newline at end of file
diff --git a/src/test/cfg2cmd/virtio-gl-vulkan-error.conf b/src/test/cfg2cmd/virtio-gl-vulkan-error.conf
new file mode 100644
index 0000000..95bb351
--- /dev/null
+++ b/src/test/cfg2cmd/virtio-gl-vulkan-error.conf
@@ -0,0 +1,4 @@
+# TEST: Vulkan asked of a display that has no GL
+# EXPECT_ERROR: vga: vulkan needs a display with GL - 'kyber-gl' or 'virtio-gl', not 'std'
+memory: 4096
+vga: std,vulkan=4G
diff --git a/src/test/cfg2cmd/virtio-gl-vulkan.conf b/src/test/cfg2cmd/virtio-gl-vulkan.conf
new file mode 100644
index 0000000..8fb17a1
--- /dev/null
+++ b/src/test/cfg2cmd/virtio-gl-vulkan.conf
@@ -0,0 +1,3 @@
+# TEST: Vulkan through Venus on a GL display
+memory: 4096
+vga: virtio-gl,vulkan=4G
diff --git a/src/test/cfg2cmd/virtio-gl-vulkan.conf.cmd b/src/test/cfg2cmd/virtio-gl-vulkan.conf.cmd
new file mode 100644
index 0000000..31ac667
--- /dev/null
+++ b/src/test/cfg2cmd/virtio-gl-vulkan.conf.cmd
@@ -0,0 +1,32 @@
+/usr/bin/kvm
+-id 8006
+-name vm8006
+-no-shutdown
+-chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off'
+-mon 'chardev=qmp,mode=control'
+-chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000'
+-mon 'chardev=qmp-event,mode=control'
+-pidfile /var/run/qemu-server/8006.pid
+-daemonize
+-smp '1,sockets=1,cores=1,maxcpus=1'
+-nodefaults
+-boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg'
+-display 'egl-headless,gl=core'
+-vnc 'unix:/var/run/qemu-server/8006.vnc,password=on'
+-cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep
+-m 4096
+-object 'memory-backend-memfd,id=virtiofs-mem,size=4096M,share=on'
+-global 'PIIX4_PM.disable_s3=1'
+-global 'PIIX4_PM.disable_s4=1'
+-device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e'
+-device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f'
+-device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2'
+-device 'usb-tablet,id=tablet,bus=uhci.0,port=1'
+-device 'virtio-vga-gl,id=vga,blob=on,hostmem=4G,venus=on,bus=pci.0,addr=0x2'
+-device 'virtio-serial,id=spice,bus=pci.0,addr=0x9'
+-chardev 'spicevmc,id=vdagent,name=vdagent'
+-device 'virtserialport,chardev=vdagent,name=com.redhat.spice.0'
+-spice 'tls-port=61000,addr=127.0.0.1,tls-ciphers=HIGH,seamless-migration=on'
+-device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on'
+-iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff'
+-machine 'memory-backend=virtiofs-mem,type=pc+pve0'
\ No newline at end of file
diff --git a/src/test/run_config2command_tests.pl b/src/test/run_config2command_tests.pl
index 47250c6..7f3405c 100755
--- a/src/test/run_config2command_tests.pl
+++ b/src/test/run_config2command_tests.pl
@@ -435,6 +435,12 @@ $pve_common_tools->mock(
     get_host_arch => sub {
         return $current_test->{host_arch} // 'x86_64';
     },
+    dir_glob_regex => sub {
+        my ($dir, $regex) = @_;
+
+        return 'renderD128' if $dir eq '/dev/dri/' && $regex eq 'renderD.*';
+        return;
+    },
 );
 
 my $pve_common_file;
-- 
2.55.0




  parent reply	other threads:[~2026-08-26  8:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26  7:43 [RFC v2 pve-http-server/qemu-server/pve-manager/pve-{qemu-kyber, kyberproxy,kyber-web,qemu-rdp,rdpproxy,rdp-web} 00/13] add rdp && kyber consoles for qemu over D-Bus display Alexandre Derumier
2026-08-26  7:43 ` [RFC v2 pve-http-server 01/13] anyevent : proxy a path prefix to a local http proxy Alexandre Derumier
2026-08-26  7:43 ` [RFC v2 qemu-server 02/13] add D-Bus display support Alexandre Derumier
2026-08-26  7:43 ` [RFC v2 qemu-server 03/13] add kyber display Alexandre Derumier
2026-08-26  7:43 ` [RFC v2 qemu-server 04/13] add rdp display Alexandre Derumier
2026-08-26  7:43 ` Alexandre Derumier [this message]
2026-08-26  7:43 ` [RFC v2 pve-manager 06/13] ui: add kyber console Alexandre Derumier
2026-08-26  7:43 ` [RFC v2 pve-manager 07/13] ui: add rdp console Alexandre Derumier
2026-08-26  7:43 ` [RFC v2 pve-qemu-kyber 08/13] Add pve-qemu-kyber: an kyber controller for the qemu console Alexandre Derumier
2026-08-26  7:43 ` [RFC v2 pve-kyberproxy 09/13] Add pve-kyberproxy Alexandre Derumier
2026-08-26  7:43 ` [RFC v2 pve-kyber-web 10/13] add pve-kyber-web: console's webassembly client Alexandre Derumier
2026-08-26  7:43 ` [RFC v2 pve-qemu-rdp 11/13] Add pve-qemu-rdp: an RDP server for the console Alexandre Derumier
2026-08-26  7:43 ` [RFC v2 pve-rdpproxy 12/13] Add pve-rdpproxy Alexandre Derumier
2026-08-26  7:43 ` [RFC v2 pve-rdp-web 13/13] add pve-rdp-web: console's webassembly client Alexandre Derumier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260826074347.1256659-6-alexandre.derumier@groupe-cyllene.com \
    --to=alexandre.derumier@groupe-cyllene.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal