An exciting change was just merged into Mesa 25.0 that has been about two years in the making… AMDGPU native context support for VirtIO to allow for using native OpenGL and Vulkan graphics drivers within guest virtual machines for better performance.
VirtIO native context support was talked about back in March 2023 for better VM performance with AMD graphics by allowing the native hardware drivers to be used within supported VirtIO environments, which for now predominantly means QEMU and KVM-based VMs. Using the native hardware drivers can mean much better GPU performance within VMs rather than resorting to the likes of Virgl/Venus as the conventional open-source path for enabling 3D acceleration within guest VMs.
AMD engineer Pierre-Eric Pelloux-Prayer explains in the now-merged MR for this feature:
“This MR implements native context support for amdgpu: this enables to use native drivers (radeonsi, radeonsi_drv_video and radv) in a guest VM (QEMU+kvm is the only supported setup currently).
Besides performance which seems better than virgl/venus (but I only tested 1 Vulkan game and a couple of GL ones so…) the main advantage I see is maintenance: the guest uses the same drivers, except that they don’t speak directly to libdrm(_amdgpu) but instead go through a virtio/qemu transport layer. This can be see for in the enablement patches (last 2 of the series) which are quite small.”
One of the most exciting takeaways from this work:
“With the current protocol Unigine Heaven and Superposition are more or less running at 99% the host speed.”
More details for those interested within this merge enabling the functionality for both the AMD Radeon drivers RadeonSI Gallium3D and RADV Vulkan.