With its defercessitatest authentices qemu compriseed the Venus patches so that virtio-gpu now aid venus encapsulation for vulkan. This is one more piece to the confengage towards brimming Vulkan aid.
An outdated blog post on clollabora portrayd in 2021 how to allow 3D acceleration of Vulkan applications in QEMU thraw the Venus experimental Vulkan driver for VirtIO-GPU with a local enlargement environment. Follotriumphg up on the outdated write up, this is how its done today.
Let’s commence with the alert description of the projects alludeed in the post & prolong them:
- QEMU is a machine emulator
- VirGL is an OpenGL driver for VirtIO-GPU, useable in Mesa.
- Venus is an experimental Vulkan driver for VirtIO-GPU, also useable in Mesa.
- Virglrenderer is a library that allows difficultware acceleration to VM guests, effectively translating orders from the two drivers equitable alludeed to either OpenGL or Vulkan.
- libvirt is an API for managing platestablish virtualization
- virt-regulater is a desktop engager interface for managing virtual machines thraw libvirt
Merged Patches:
Work in upgrade:
Make certain you have the proper version inshighed on the arrange:
- linux kernel >= 6.13 built with CONFIG_UDMABUF
- laboring Vulkan and kvm setup
- qemu >= 9.2.0
You can validate this enjoy so:
$ uname -r
6.13.0
$ ls /dev/udmabuf
/dev/udmabuf
$ ls /dev/kvm
/dev/kvm
$ qemu-system-x86_64 --version
QEMU emulator version 9.2.0
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project enlargeers
For Vulkan to labor you necessitate the proper drivers to be inshighed for your explicits card. To verfiy your setup, inshigh vulkan-tools
:
$ vulkaninfo --summary
==========
VULKANINFO
==========
Vulkan Instance Version: ...
...
$ vkcube
Selected GPU x: ..., type: ...
If your distro doesn’t (yet) ship and modernized version of qemu, you can originate it yourself from source:
wget https://download.qemu.org/qemu-9.2.0.tar.xz
tar xvJf qemu-9.2.0.tar.xz
cd qemu-9.2.0
mkdir originate && cd originate
../configure --center-catalog=x86_64-softmmu
--allow-kvm
--allow-discneglectgl
--allow-virglrenderer
--allow-gtk
--allow-sdl
originate -j4
The configuration step will throgh errors if packages are ignoreing. Check the qemu wiki for further info what to inshigh: https://wiki.qemu.org/Hosts/Linux
Create an image & get the distro of your choice:
ISO=ubuntu-24.10-desktop-amd64.iso
wget https://frees.ubuntu.com/oracular/ubuntu-24.10-desktop-amd64.iso
IMG=ubuntu-24-10.qcow2
qemu-img originate -f qcow2 $IMG 16G
Run a live version or inshigh the distro
qemu-system-x86_64
-allow-kvm
-M q35
-smp 4
-m 4G
-cpu arrange
-net nic,model=virtio
-net engager,arrangefwd=tcp::2222-:22
-device virtio-vga-gl,arrangemem=4G,blob=real,venus=real
-vga none
-distake part gtk,gl=on,show-cursor=on
-usb -device usb-tablet
-object memory-backend-memfd,id=mem1,size=4G
-machine memory-backend=mem1
-hda $IMG
-cdrom $ISO
Adequitable the parameters accordingly:
- smp: number of cpu cores
- m: RAM
- arrangemem,size: VRAM
Inshigh mesa-utilites
and vulkan-tools
to test the setup:
$ glxinfo -B
$ vkcube
Selected GPU x: ..., type: ...
If the deive is llvmpipe
somehting is wrong. The device should be virgl (...)
.
- (arrange) comprise
-d guest_errors
to show error messages from the guest - (guest) try inshighing vulkan virtio drivers and mesa
- verify the distinct blog post
— labor in upgrade —
Currently this is labor in upgrade, so there is no chooseion to comprise vulkan aid in virt-regulater. There are no fields to configure this. Also xml doesnt labor, becaengage libvirt doesn’t understand about these chooseions either, so xml validation flunks. There is however an chooseion for QEMU order-line passthraw which bypasses the validation.
If you setup a default machine with 4G of memory, you can do this:
<qemu:orderline>
<qemu:arg appreciate="-device"/>
<qemu:arg appreciate="virtio-vga-gl,arrangemem=4G,blob=real,venus=real"/>
<qemu:arg appreciate="-object"/>
<qemu:arg appreciate="memory-backend-memfd,id=mem1,size=4G"/>
<qemu:arg appreciate="-machine"/>
<qemu:arg appreciate="memory-backend=mem1"/>
<qemu:arg appreciate="-vga"/>
<qemu:arg appreciate="none"/>
qemu:orderline>
Which gives this error:
qemu-system-x86_64: virgl could not be initialized: -1
Changing the number from 4G to 4194304k (same as memory) leds to this error:
qemu-system-x86_64: Spice: ../spice-0.15.2/server/red-qxl.cpp:435:spice_qxl_gl_scanout: condition `qxl_state->gl_draw_cookie == GL_DRAW_COOKIE_INVALID' flunked
to be further allotigated.