Recommended virt-manager GPU configuration

I’m curios to see what is your experience and recommended GPU configuration for virt-manager. My environment is:

  • host: openSUSE LEAP 15.6, XFCE (X11), hw: MSI Cubi 5 12M with “Alder Lake-UP3 GT2 [Iris Xe Graphics]” using KMS (not X11 i915 driver)
  • guest: Fedora 41 Workstation (GNOME)

I tested following GPU configurations in virt-manager:

  1. Virtio + OpenGL
  2. Virtio with disabled OpenGL
  3. QXL

My results are:

  1. Virtio + OpenGL - unusable - serious rendering issues:

  1. Virtio without OpneGL: clear winner: no rendering issues and no font scaling issue:

Unable to publish: new users may embed 1 image only

  1. QXL: font scaling issues (fonts in terminal are blurred when you look at screenshot with 1:1 zoom):

Unable to publish: new users may embed 1 image only

Here are details - output of inxi -Gxx

Host:

Graphics:
  Device-1: Intel Alder Lake-UP3 GT2 [Iris Xe Graphics] vendor: Micro-Star MSI
    driver: i915 v: kernel arch: Gen-12.2 ports: active: HDMI-A-2 empty: DP-1,
    DP-2, DP-3, HDMI-A-1 bus-ID: 00:02.0 chip-ID: 8086:46a8
  Display: x11 server: X.org v: 1.21.1.11 compositor: xfwm v: 4.18.0 driver:
    X: loaded: modesetting unloaded: fbdev,vesa alternate: intel dri: iris
    gpu: i915 display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 1920x1080
  Monitor-1: HDMI-A-2 mapped: HDMI-2 model: VG249Q3A res: 1920x1080 dpi: 93
    diag: 604mm (23.8")
  API: OpenGL v: 4.6 Mesa 23.3.4 renderer: Mesa Intel Graphics (ADL GT2)
    direct-render: Yes
  1. Guest, Virtio + OpenGL:
Graphics:
  Device-1: Red Hat Virtio 1.0 GPU driver: virtio-pci v: 1 ports:
    active: Virtual-1 empty: none bus-ID: 00:01.0 chip-ID: 1af4:1050
  Display: wayland server: Xwayland v: 24.1.4 compositor: gnome-shell
    v: 47.2 driver: N/A display-ID: 0
  Monitor-1: Virtual-1 model: QEMU Monitor res: 1280x800 dpi: 100
    diag: 383mm (15.1")
  API: EGL v: 1.5 platforms: device: 0 drv: virtio_gpu device: 1 drv: swrast
    gbm: drv: virtio_gpu surfaceless: drv: virtio_gpu wayland: drv: virtio_gpu
    x11: drv: virtio_gpu
  API: OpenGL v: 4.5 compat-v: 4.3 vendor: mesa v: 24.3.2 glx-v: 1.4
    direct-render: yes renderer: virgl device-ID: 1af4:1010 display-ID: :0.0

  1. Guest, Virtio without OpenGL:
Graphics:
  Device-1: Red Hat Virtio 1.0 GPU driver: virtio-pci v: 1 ports:
    active: Virtual-1 empty: none bus-ID: 00:01.0 chip-ID: 1af4:1050
  Display: wayland server: Xwayland v: 24.1.4 compositor: gnome-shell
    v: 47.2 driver: N/A display-ID: 0
  Monitor-1: Virtual-1 model: QEMU Monitor res: 1280x800 dpi: 100
    diag: 383mm (15.1")
  API: EGL v: 1.5 platforms: device: 0 drv: kms_swrast device: 1 drv: swrast
    gbm: drv: kms_swrast surfaceless: drv: kms_swrast wayland: drv: swrast x11:
    drv: swrast
  API: OpenGL v: 4.5 vendor: mesa v: 24.3.2 glx-v: 1.4 direct-render: yes
    renderer: llvmpipe (LLVM 19.1.5 256 bits) device-ID: ffffffff:ffffffff
    display-ID: :0.0
  1. Guest, QXL:
Graphics:
  Device-1: Red Hat QXL paravirtual graphic card driver: qxl v: kernel ports:
    active: Virtual-1 empty: Virtual-2,Virtual-3,Virtual-4 bus-ID: 00:01.0
    chip-ID: 1b36:0100
  Display: wayland server: X.Org v: 24.1.4 with: Xwayland v: 24.1.4
    compositor: gnome-shell v: 47.2 driver: dri: swrast gpu: qxl display-ID: :0
    screens: 1
  Screen-1: 0 s-res: 1024x768 s-dpi: 96
  Monitor-1: Virtual-1 res: 1024x768 size: N/A
  API: EGL v: 1.5 platforms: device: 0 drv: swrast surfaceless: drv: swrast
    wayland: drv: swrast x11: drv: swrast inactive: gbm
  API: OpenGL v: 4.5 vendor: mesa v: 24.3.2 glx-v: 1.4 direct-render: yes
    renderer: llvmpipe (LLVM 19.1.5 256 bits) device-ID: ffffffff:ffffffff

Sidenote: RedHat dumped QXL support in RHEL 9, see https://bugzilla.redhat.com/show_bug.cgi?id=2030592

Sidenote2: Phoronix is threatening users that several distributions will be soon Wayland only: https://www.phoronix.com/news/RHEL10-Removing-X.Org

Question: What is your experience using virt-manager and Guests with GPU acceleration?

@hpaluchpe Hi and welcome to the Forum :smile:
What cpu in this system? What is your cpu/memory allocation to the vm? Have you enabled iommu etc? Can you show the output from inxi -Saz

I enabled IOMMU and rebooted, but not sure if it helps - because I have single GPU card (so I may not passthrough it as whole to guest). Here is host output after reboot:

$ inxi -Saz
System:
  Kernel: 6.4.0-150600.23.30-default arch: x86_64 bits: 64 compiler: gcc v: 7.5.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.4.0-150600.23.30-default
    root=UUID=8c8ec473-0e08-4178-b4a9-fbdd78bf7754 systemd.show_status=yes preempt=full
    mitigations=auto security=apparmor rfkill.default_state=0 intel_iommu=on iommu=pt
  Console: pty pts/2 DM: LightDM v: 1.32.0 Distro: openSUSE Leap 15.6

VM uses 2 cores and 4GB (Host has 10 cores and 32GB RAM). Tried assigning 4 cores and 16GB RAM to VM, but problem is same (many rendering artifacts).

Here is full session output from /var/log/libvirt/qemu/fed41-gnome.log

2025-01-13 16:01:15.148+0000: starting up libvirt version: 10.0.0, qemu version: 8.2.7SUSE Linux Enterprise 15, kernel: 6.4.0-150600.23.30-default, hostname: cubi.example.com
LC_ALL=C \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
HOME=/var/lib/libvirt/qemu/domain-1-fed41-gnome \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-1-fed41-gnome/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-1-fed41-gnome/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-1-fed41-gnome/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=fed41-gnome,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-1-fed41-gnome/master-key.aes"}' \
-machine pc-q35-8.2,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram,hpet=off,acpi=on \
-accel kvm \
-cpu host,migratable=on \
-m size=4194304k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":4294967296}' \
-overcommit mem-lock=off \
-smp 2,sockets=2,cores=1,threads=1 \
-uuid 60e1ffb9-c0d3-4e35-9ed8-093db6a3f118 \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=27,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc,driftfix=slew \
-global kvm-pit.lost_tick_policy=delay \
-no-shutdown \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-boot strict=on \
-device '{"driver":"pcie-root-port","port":16,"chassis":1,"id":"pci.1","bus":"pcie.0","multifunction":true,"addr":"0x2"}' \
-device '{"driver":"pcie-root-port","port":17,"chassis":2,"id":"pci.2","bus":"pcie.0","addr":"0x2.0x1"}' \
-device '{"driver":"pcie-root-port","port":18,"chassis":3,"id":"pci.3","bus":"pcie.0","addr":"0x2.0x2"}' \
-device '{"driver":"pcie-root-port","port":19,"chassis":4,"id":"pci.4","bus":"pcie.0","addr":"0x2.0x3"}' \
-device '{"driver":"pcie-root-port","port":20,"chassis":5,"id":"pci.5","bus":"pcie.0","addr":"0x2.0x4"}' \
-device '{"driver":"pcie-root-port","port":21,"chassis":6,"id":"pci.6","bus":"pcie.0","addr":"0x2.0x5"}' \
-device '{"driver":"pcie-root-port","port":22,"chassis":7,"id":"pci.7","bus":"pcie.0","addr":"0x2.0x6"}' \
-device '{"driver":"pcie-root-port","port":23,"chassis":8,"id":"pci.8","bus":"pcie.0","addr":"0x2.0x7"}' \
-device '{"driver":"pcie-root-port","port":24,"chassis":9,"id":"pci.9","bus":"pcie.0","multifunction":true,"addr":"0x3"}' \
-device '{"driver":"pcie-root-port","port":25,"chassis":10,"id":"pci.10","bus":"pcie.0","addr":"0x3.0x1"}' \
-device '{"driver":"pcie-root-port","port":26,"chassis":11,"id":"pci.11","bus":"pcie.0","addr":"0x3.0x2"}' \
-device '{"driver":"pcie-root-port","port":27,"chassis":12,"id":"pci.12","bus":"pcie.0","addr":"0x3.0x3"}' \
-device '{"driver":"pcie-root-port","port":28,"chassis":13,"id":"pci.13","bus":"pcie.0","addr":"0x3.0x4"}' \
-device '{"driver":"pcie-root-port","port":29,"chassis":14,"id":"pci.14","bus":"pcie.0","addr":"0x3.0x5"}' \
-device '{"driver":"qemu-xhci","p2":15,"p3":15,"id":"usb","bus":"pci.2","addr":"0x0"}' \
-device '{"driver":"virtio-serial-pci","id":"virtio-serial0","bus":"pci.3","addr":"0x0"}' \
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/fed41-gnome.qcow2","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-2-format","read-only":false,"discard":"unmap","driver":"qcow2","file":"libvirt-2-storage","backing":null}' \
-device '{"driver":"virtio-blk-pci","bus":"pci.4","addr":"0x0","drive":"libvirt-2-format","id":"virtio-disk0","bootindex":1}' \
-device '{"driver":"ide-cd","bus":"ide.0","id":"sata0-0-0"}' \
-netdev '{"type":"tap","fd":"28","vhost":true,"vhostfd":"30","id":"hostnet0"}' \
-device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:6d:fc:cf","bus":"pci.1","addr":"0x0"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
-chardev socket,id=charchannel0,fd=26,server=on,wait=off \
-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":1,"chardev":"charchannel0","id":"channel0","name":"org.qemu.guest_agent.0"}' \
-chardev spicevmc,id=charchannel1,name=vdagent \
-device '{"driver":"virtserialport","bus":"virtio-serial0.0","nr":2,"chardev":"charchannel1","id":"channel1","name":"com.redhat.spice.0"}' \
-device '{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}' \
-audiodev '{"id":"audio1","driver":"spice"}' \
-spice port=0,disable-ticketing=on,image-compression=off,gl=on,rendernode=/dev/dri/renderD128,seamless-migration=on \
-device '{"driver":"virtio-vga-gl","id":"video0","max_outputs":1,"bus":"pcie.0","addr":"0x1"}' \
-device '{"driver":"ich9-intel-hda","id":"sound0","bus":"pcie.0","addr":"0x1b"}' \
-device '{"driver":"hda-duplex","id":"sound0-codec0","bus":"sound0.0","cad":0,"audiodev":"audio1"}' \
-global ICH9-LPC.noreboot=off \
-watchdog-action reset \
-chardev spicevmc,id=charredir0,name=usbredir \
-device '{"driver":"usb-redir","chardev":"charredir0","id":"redir0","bus":"usb.0","port":"2"}' \
-chardev spicevmc,id=charredir1,name=usbredir \
-device '{"driver":"usb-redir","chardev":"charredir1","id":"redir1","bus":"usb.0","port":"3"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.5","addr":"0x0"}' \
-object '{"qom-type":"rng-random","id":"objrng0","filename":"/dev/urandom"}' \
-device '{"driver":"virtio-rng-pci","rng":"objrng0","id":"rng0","bus":"pci.6","addr":"0x0"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on
char device redirected to /dev/pts/1 (label charserial0)
gl_version 46 - core profile enabled
vrend_renderer_fill_caps: Entering with stale GL error: 1280
GLSL feature level 460
2025-01-13T16:03:26.650495Z qemu-system-x86_64: terminating on signal 15 from pid 1352 (/usr/sbin/virtqemud)
2025-01-13 16:03:26.966+0000: shutting down, reason=shutdown

There are some strange GL messages at the end - not sure how important.

And output of virsh dumpxml fed41-gnome

<domain type='kvm'>
  <name>fed41-gnome</name>
  <uuid>60e1ffb9-c0d3-4e35-9ed8-093db6a3f118</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://fedoraproject.org/fedora/unknown"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-q35-8.2'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <vmport state='off'/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'/>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' discard='unmap'/>
      <source file='/var/lib/libvirt/images/fed41-gnome.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='sda' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='qemu-xhci' ports='15'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x11'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0x15'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x5'/>
    </controller>
    <controller type='pci' index='7' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='7' port='0x16'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x6'/>
    </controller>
    <controller type='pci' index='8' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='8' port='0x17'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x7'/>
    </controller>
    <controller type='pci' index='9' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='9' port='0x18'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='10' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='10' port='0x19'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x1'/>
    </controller>
    <controller type='pci' index='11' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='11' port='0x1a'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x2'/>
    </controller>
    <controller type='pci' index='12' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='12' port='0x1b'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x3'/>
    </controller>
    <controller type='pci' index='13' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='13' port='0x1c'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x4'/>
    </controller>
    <controller type='pci' index='14' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='14' port='0x1d'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x5'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:6d:fc:cf'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice'>
      <listen type='none'/>
      <image compression='off'/>
      <gl enable='yes'/>
    </graphics>
    <sound model='ich9'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1b' function='0x0'/>
    </sound>
    <audio id='1' type='spice'/>
    <video>
      <model type='virtio' heads='1' primary='yes'>
        <acceleration accel3d='yes'/>
      </model>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='2'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='3'/>
    </redirdev>
    <watchdog model='itco' action='reset'/>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </memballoon>
    <rng model='virtio'>
      <backend model='random'>/dev/urandom</backend>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
    </rng>
  </devices>
</domain>

My main issue with Virtio GL is currently correctness (there are many unwanted rendering artifacts that make it unusable).

@hpaluchpe Hi, in the guest have you tried setting qml to enable or disable modesetting I don’t know about the num_heads. If you run systool -v -m qxl to see what it’s set for those parameters, else you might have to do some xorg.cof file.

At least one small step resolved.

I found why I was not able to select OpenGL accelerator card in virt-manager Display → Spice → OpenGL (it was always empty with just one Auto entry).

It is because accelerator card listing depends on virtnodedevd.service (can be tested with command virsh nodedev-list - must return several lines of output, but not error).

So have to run:

sudo zypper in libvirt-daemon-driver-nodedev

And reboot. Finally I was able to select my Intel GPU as OpenGL card in list as shown below:

XML tab now shows in my case this fragment:

<graphics type="spice">
  <listen type="none"/>
  <image compression="off"/>
  <gl enable="yes" rendernode="/dev/dri/by-path/pci-0000:00:02.0-render"/>
</graphics>

However result is same - guest’s (Fedora 41 GNOME Wayland) GTK 4 applications still have rendering artifacts (GTK 3 - including gnome-terminal work fine). And inxi -Gxxx still reports “swrast” (software rasterizer).

Also es2gears_wayland demo from egl-utils package still shows choppy 20fps.