You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -31,6 +31,8 @@ Make sure you have the proper version installed on the host:
- linux kernel >= 6.13 built with CONFIG_UDMABUF
- working Vulkan and kvm setup
- qemu >= 9.2.0
- virglrenderer with enabled venus support
- mesa >= 24.2.0
You can verify this like so:
```
@@ -45,14 +47,15 @@ QEMU emulator version 9.2.0
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
```
For Vulkan to work you need the proper drivers to be installed for your graphics card. To verfiy your setup, install `vulkan-tools`:
```
$ vulkaninfo --summary
==========
VULKANINFO
==========
Check your distros package sources how they build virglrenderer.
For Vulkan to work you need the proper drivers to be installed for your graphics card.
Vulkan Instance Version: ...
To verfiy your setup, install `vulkan-tools`. Make sure mesa >= 24.2.0 and test vkcube:
```
$ vulkaninfo --summary | grep driverInfo
driverInfo = Mesa 24.2.3-1ubuntu1
driverInfo = Mesa 24.2.3-1ubuntu1 (LLVM 19.1.0)
...
$ vkcube
Selected GPU x: ..., type: ...
@@ -76,7 +79,8 @@ mkdir build && cd build
make -j4
```
The configuration step will throgh errors if packages are missing. Check the qemu wiki for further info what to install: https://wiki.qemu.org/Hosts/Linux
The configuration step will throgh errors if packages are missing.
Check the qemu wiki for further info what to install: https://wiki.qemu.org/Hosts/Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
With its latest reales qemu added the Venus patches so that virtio-gpu now support venus encapsulation for vulkan. This is one more piece to the puzzle towards full Vulkan support.
An outdated blog post on [clollabora](https://www.collabora.com/news-and-blog/blog/2021/11/26/venus-on-qemu-enabling-new-virtual-vulkan-driver/) described in 2021 how to enable 3D acceleration of Vulkan applications in QEMU through the Venus experimental Vulkan driver for VirtIO-GPU with a local development environment. Following up on the outdated write up, this is how its done today.
## Definitions
Let's start with the brief description of the projects mentioned in the post & extend them:
- QEMU is a machine emulator
- VirGL is an OpenGL driver for VirtIO-GPU, available in Mesa.
- Venus is an experimental Vulkan driver for VirtIO-GPU, also available in Mesa.
- Virglrenderer is a library that enables hardware acceleration to VM guests, effectively translating commands from the two drivers just mentioned to either OpenGL or Vulkan.
- libvirt is an API for managing platform virtualization
- virt-manager is a desktop user interface for managing virtual machines through libvirt
Merged Patches:
- 2024-08-14 [venus: make cross-device optional](https://gitlab.freedesktop.org/mesa/mesa/-/commit/087e9a96d13155e26987befae78b6ccbb7ae242b) merged in [mesa 24.2](https://www.phoronix.com/news/Mesa-24.2-Released)
- 2024-11-25 [KVM: Stop grabbing references to PFNMAP'd pages](https://lore.kernel.org/all/[email protected]/) merged in [linux 6.13](https://www.phoronix.com/news/Linux-6.13-KVM)
- 2024-11-12 [Support blob memory and venus on qemu](https://lists.gnu.org/archive/html/qemu-devel/2024-08/msg03288.html) merged in [qemu 9.2.0](https://www.phoronix.com/news/QEMU-9.2-Released)
Work in progress:
- libvirt [Add support for more virtio-vga-gl arguments #638](https://gitlab.com/libvirt/libvirt/-/issues/638)
- virt-manager [Add support for Venus / Vulkan VirtIO-GPU driver #362](https://github.com/virt-manager/virt-manager/issues/362)
## Prerequisites
Make sure you have the proper version installed on the host:
- linux kernel >= 6.13 built with CONFIG_UDMABUF
- working Vulkan and kvm setup
- qemu >= 9.2.0
You can verify this like 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 developers
```
For Vulkan to work you need the proper drivers to be installed for your graphics card. To verfiy your setup, install `vulkan-tools`:
```
$ vulkaninfo --summary
==========
VULKANINFO
==========
Vulkan Instance Version: ...
...
$ vkcube
Selected GPU x: ..., type: ...
```
#### Building qemu
If your distro doesn't (yet) ship and updated version of qemu, you can build 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 build && cd build
../configure --target-list=x86_64-softmmu \
--enable-kvm \
--enable-opengl \
--enable-virglrenderer \
--enable-gtk \
--enable-sdl
make -j4
```
The configuration step will throgh errors if packages are missing. Check the qemu wiki for further info what to install: https://wiki.qemu.org/Hosts/Linux
## Create and run an image for QEMU
Create an image & fetch the distro of your choice:
Install ```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 (...)```.
#### Troubleshooting
- (host) add ```-d guest_errors``` to show error messages from the guest
- (guest) try installing vulkan virtio drivers and mesa
- check the original [blog post](https://www.collabora.com/news-and-blog/blog/2021/11/26/venus-on-qemu-enabling-new-virtual-vulkan-driver/)
## virt-manager
-- work in progress --
Currently this is work in progress, so there is no option to add vulkan support in virt-manager. There are no fields to configure this. Also xml doesnt work, because libvirt doesn't know about these options either, so xml validation fails. There is however an option for [QEMU command-line passthrough](https://libvirt.org/kbase/qemu-passthrough-security.html) which bypasses the validation.
If you setup a default machine with 4G of memory, you can do this: