Grafik/Video Performance in KVM/QEMU VM - OpenGL not availlable

Hi,

I use F39 and have some qemu/kvm VMs which basically work fine.
However anything which needs some graphic performance runs really bad in these VMs. I.e. if I try to play a youtube video in the VM I get like maximum one frame per second.
Video model ist set to “Virtio” in VM settings but I cannot enable the checkbox “3D accelleration”.
If I do enable the checkbox I get the following error and the VM does not boot anymore:

Fehler beim Starten der Domain: Interner Fehler: QEMU unexpectedly closed the monitor (vm='Internet-Untrust'): 2023-12-16T17:03:25.049815Z qemu-system-x86_64: -device {"driver":"virtio-vga-gl","id":"video0","max_outputs":1,"bus":"pcie.0","addr":"0x1"}: opengl is not available

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 108, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1402, in startup
    self._backend.create()
  File "/usr/lib64/python3.12/site-packages/libvirt.py", line 1373, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: Interner Fehler: QEMU unexpectedly closed the monitor (vm='Internet-Untrust'): 2023-12-16T17:03:25.049815Z qemu-system-x86_64: -device {"driver":"virtio-vga-gl","id":"video0","max_outputs":1,"bus":"pcie.0","addr":"0x1"}: opengl is not available

So I guess the issue is based on the error that OpenGL does not seem to be available for some reason.
However the PC has a powerful AMD Radeon RX 6900 XT GPU.
So any idea how to use the GPU power inside the VMs would be appreciated.

Cheers,
Martin

The error is rather that libvirt does not directly support hardware acceleration on the gpu since it uses a virtual gpu for graphics. The cpu for the VM is tasked with all graphics rendering.

The fix would be to either run the graphics intensive app /display on the host system or to use a discrete gpu that you could pass directly to the VM so the vm properly uses the drivers for that gpu and is able to take advantage of the hardware capabilities of the gpu.

There have been several related threads regarding graphics performance in a VM.