3D acceleration with virt-manager

I am using a NixOS unstable as a virt-manager/Qemu VM on NixOS unstable using the same flake config see here. I set the Video to “virtio” and set “3D Acceleration” checkbox in the GUI, enabled the guest tools in the guest and rebooted the guest, . However “glxinfo” on the guest still reports llvmpipe as the renderer. I expected “virgl” or similar.

Does anybody has a setup with working guest 3D acceleration? If yes, how do you configured it?

The proper setup for 3D accelerated guests requires configuring the Display properly as well. Configure the VM settings as follows, in addition to what you configured already:

  • In the display settings the display type should be “Spice server”.
    • The listen type should be “None”.
    • The password checkbox must not be selected.
    • OpenGL checkbox needs to be selected and if you have multiple video output sources you need to select the correct one in the drop-down.

@bzLem0n Thanks for your suggestions! I changed the display settings accordingly. Unfortunately the guest still falls back to llvmpipe. (Tested both sway and Gnome).

For reference:

Display settings:

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

Video settings:

<video>
  <model type="virtio" heads="1" primary="yes" device="virtio-vga">
    <acceleration accel3d="yes"/>
  </model>
  <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
</video>

Edit: hardware-configuration.nix of the guest:

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/profiles/qemu-guest.nix")
    ];

  boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_blk" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/4261fd84-1a17-429d-94d1-c3c8f4e27db8";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/7424-8B23";
      fsType = "vfat";
      options = [ "fmask=0022" "dmask=0022" ];
    };

  swapDevices =
    [ { device = "/dev/disk/by-uuid/3efc919f-4726-4cad-b0f5-1fd79395cec6"; }
    ];

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

That xml matches what I see on a working VM so there’s some other issue. Look through the VM’s logs in /var/log/libvirt/qemu/<VM NAME>.log and see if anything stands out as nothing else in the configs stands out. What video driver is the host using?

The guest’s hardware-configuration.nix was empty on github, because I haven’t set up github push access. This has been corrected, now. It always imported the profiles/qemu-guest.nix.

@bzLem0n Would you provide your working guest’s hardware-configuration.nix and the output of glxinfo | grep -w renderer?

The host’s output:

$ glxinfo | grep -w renderer
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: AMD Radeon RX 5600 XT (radeonsi, navi10, ACO, DRM 3.64, 7.3.0)

The log looks uninteresting to me:

2026-10-28 22:20:20.237+0000: starting up libvirt version: 12.8.0, qemu version: 11.1.2, kernel: 7.3.0, hostname: johannes-pc
LC_ALL=C \
PATH=/run/libvirt/nix-emulators:/nix/store/nas27x2sgs0127pfmk0wcmwd5d439mni-dnsmasq-2.93/bin:/nix/store/4w74vbkj6kng5sq5fld0ivcvcasnb8a6-bridge-utils-1.7.1/bin:/nix/store/9qrill6vi39yh9k728wn0i05jzqfdyic-dmidecode-3.7/bin:/nix/store/x1pwsbz5cm23hk58b7fcpn3hhg9j7gwh-iproute2-7.2.0/bin:/nix/store/f7kbjq8pbvjjdzx10nw81m5vs6ifik4p-iptables-1.8.13/bin:/nix/store/d03jsfz5lq08cc8s9f4bdnnxs91bb40r-kmod-31/bin:/nix/store/jnkhxljrvdq914dcxjdyq6x982zy8qcr-lvm2-2.03.41-bin/bin:/nix/store/nwhaqj3i1lwvangwrfa3c7xswr3b79n1-nftables-1.1.7/bin:/nix/store/vbmxpq22lm0hhb37mhykinj45aa0ljc3-numactl-2.0.18/bin:/nix/store/5nfscz5r1kn6ykrrj2m4q2m1g85230nc-numad-0.5-unstable-2023-09-06/bin:/nix/store/gksybc3b64irpkf84k30qphb44yjwqiw-openssh-10.6p1/bin:/nix/store/icvmqd9f8m3s8msrby6ha2wd17gzjd1z-passt-2026_07_16.090d739/bin:/nix/store/3727fyh9gydbn2rb720mb257vvkjdxsf-pm-utils-1.4.1/bin:/nix/store/avshcbcrykiffn4vlhmz848ab69wbp9n-systemd-262/bin:/nix/store/8nj0sraxv0n1gpdwgc8bcws6pwgxis4l-zfs-user-2.4.4/bin:/nix/store/cnwc2zbiwjn3mw9ds7bkr0f8vyyswj01-qemu-11.1.2/bin:/nix/store/mqlr3n6ip4vsz7dnjkbdgphzwgaq82sp-libressl-4.3.2-nc/bin:/nix/store/cb987zkxvsv0490753ilrvn5yk7ylgxi-coreutils-9.12/bin:/nix/store/99v13ig4382mngi6ggf0csqi7rfa04j5-findutils-4.11.0/bin:/nix/store/c3f45pxlb81gzz4w1nym7lpznfypva7s-gnugrep-3.12/bin:/nix/store/9wc73n5izv0m7ppjbibi4hbr68rba1lj-gnused-4.10/bin:/nix/store/6qqq5prql4952z0wfm5ymjfr7cx4ab7z-systemd-262/bin:/nix/store/cnwc2zbiwjn3mw9ds7bkr0f8vyyswj01-qemu-11.1.2/sbin:/nix/store/mqlr3n6ip4vsz7dnjkbdgphzwgaq82sp-libressl-4.3.2-nc/sbin:/nix/store/cb987zkxvsv0490753ilrvn5yk7ylgxi-coreutils-9.12/sbin:/nix/store/99v13ig4382mngi6ggf0csqi7rfa04j5-findutils-4.11.0/sbin:/nix/store/c3f45pxlb81gzz4w1nym7lpznfypva7s-gnugrep-3.12/sbin:/nix/store/9wc73n5izv0m7ppjbibi4hbr68rba1lj-gnused-4.10/sbin:/nix/store/6qqq5prql4952z0wfm5ymjfr7cx4ab7z-systemd-262/sbin \
USER=root \
HOME=/var/lib/libvirt/qemu/domain-3-nixos-26.05 \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-3-nixos-26.05/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-3-nixos-26.05/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-3-nixos-26.05/.config \
/run/libvirt/nix-emulators/qemu-system-x86_64 \
-name guest=nixos-26.05,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-3-nixos-26.05/master-key.aes"}' \
-blockdev '{"driver":"file","filename":"/run/libvirt/nix-ovmf/edk2-x86_64-secure-code.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/nixos-26.05_VARS.fd","node-name":"libvirt-pflash1-storage","read-only":false}' \
-machine pc-q35-11.1,usb=off,vmport=off,smm=on,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-storage,hpet=off,acpi=on \
-accel kvm \
-cpu host,migratable=on \
-global driver=cfi.pflash01,property=secure,value=on \
-m size=4292608k \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":4395630592}' \
-overcommit mem-lock=off \
-smp 2,sockets=2,cores=1,threads=1 \
-uuid d2815d83-eca1-4754-8a8d-faa2d8b02d0c \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=33,server=on,wait=off \
-object '{"qom-type":"monitor-qmp","id":"monitor","chardev":"charmonitor"}' \
-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/nixos-26.05.qcow2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage","backing":null}' \
-device '{"driver":"virtio-blk-pci","bus":"pci.4","addr":"0x0","drive":"libvirt-1-format","id":"virtio-disk0","bootindex":1}' \
-netdev '{"type":"tap","fd":"34","vhost":true,"vhostfd":"36","id":"hostnet0"}' \
-device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:fe:5c:53","bus":"pci.1","addr":"0x0"}' \
-chardev pty,id=charserial0 \
-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}' \
-chardev socket,id=charchannel0,fd=32,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/by-path/pci-0000:28:00.0-render,seamless-migration=on \
-device '{"driver":"virtio-vga","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
2026-10-28 22:20:20.237+0000: Domain id=3 is tainted: high-privileges
char device redirected to /dev/pts/0 (label charserial0)
2026-10-28T23:08:21.545664Z qemu-system-x86_64: terminating on signal 15 from pid 1224 (/nix/store/2pafyx7pb2g3zj5lmz664ir9a73vjz3s-libvirt-12.8.0/sbin/libvirtd)
2026-10-28T23:08:21.573504Z qemu-system-x86_64: warning: Spice: ../server/display-channel.cpp:2357:display_channel_validate_surface: surface 0 is NULL
2026-10-28T23:08:21.573524Z qemu-system-x86_64: warning: Spice: ../server/red-worker.cpp:442:destroy_primary_surface: double destroy of primary surface
2026-10-28T23:08:21.574636Z qemu-system-x86_64: warning: Spice: ../server/reds.cpp:3390:spice_server_remove_interface: VD_INTERFACE_REMOVING unsupported
2026-10-28T23:08:21.574645Z qemu-system-x86_64: warning: Spice: ../server/reds.cpp:3390:spice_server_remove_interface: VD_INTERFACE_REMOVING unsupported
2026-10-28 23:08:21.773+0000: shutting down, reason=shutdown

Edit the VM’s “Video Virtio” xml manually and change the virtio-vga line to virtio-vga-gl, I just tested it on another NixOS VM that was defined as virtio-vga and it was the only thing I had to change to get it working there as well.

<video>
  <model type='virtio' heads='1' primary='yes' device='virtio-vga-gl'>
    <acceleration accel3d='yes'/>
  </model>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</video>

________________________________________

VM’s glxinfo:

[user@nixos_vm:~]$ nix shell nixpkgs#mesa-demos
[user@nixos_vm:~]$ glxinfo | grep -w renderer
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: virgl (AMD Radeon RX 6700 XT (radeonsi, navi22, ACO, DRM 3....)

Host’s glxinfo:

[user@nixos_host:~]$ nix shell nixpkgs#mesa-demos                                                  
[user@nixos_host:~]$ glxinfo | grep -w renderer                                                    
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: AMD Radeon RX 6700 XT (radeonsi, navi22, ACO, DRM 3.64, 7.2.12)

VM’s hardware-configuration.nix:

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{
  config,
  lib,
  pkgs,
  modulesPath,
  ...
}:

{
  imports = [
    (modulesPath + "/profiles/qemu-guest.nix")
  ];

  boot.initrd.availableKernelModules = [
    "ahci"
    "xhci_pci"
    "virtio_pci"
    "sr_mod"
    "virtio_blk"
  ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" = {
    device = "/dev/disk/by-uuid/512579d2-e070-4c07-9d01-6ee0b6ad8e3a";
    fsType = "btrfs";
  };

  fileSystems."/home" = {
    device = "/dev/disk/by-uuid/512579d2-e070-4c07-9d01-6ee0b6ad8e3a";
    fsType = "btrfs";
    options = [ "subvol=home" ];
  };

  fileSystems."/nix" = {
    device = "/dev/disk/by-uuid/512579d2-e070-4c07-9d01-6ee0b6ad8e3a";
    fsType = "btrfs";
    options = [ "subvol=nix" ];
  };

  fileSystems."/boot" = {
    device = "/dev/disk/by-uuid/44A5-CE5A";
    fsType = "vfat";
    options = [
      "fmask=0077"
      "dmask=0077"
    ];
  };

  swapDevices = [
    { device = "/dev/disk/by-uuid/34bbbc47-5fec-40d3-9fd1-3deeb25a6bc4"; }
  ];

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

You can see my flake and the host’s config but all I declare for libvirt is in the libvirt module. I don’t specifically recall why I added OVMF, qemu, and usbutils to systemPackages in that module, so you may want to test adding them to your host.

Edit: The install on the VM is a little older so I’m testing with a more current build to see if I can reproduce this. Update: No change, still works fine for me.

Another edit:
I noticed that my logs show a different virtio-vga driver in use for the VM.

Mine uses virtio-vga-gl.

-device '{"driver":"virtio-vga-gl","id":"video0","max_outputs":1,"bus":"pcie.0","addr":"0x1"}' \

Yours uses virtio-vga.

-device '{"driver":"virtio-vga","id":"video0","max_outputs":1,"bus":"pcie.0","addr":"0x1"}' \

Confirm that you’re using the amdgpu driver on the host, check by running the following as the differing virtio-vga drivers suggest something related to the host video drivers and OpenGL.

[user@nixos_host:~]$ lspci -k | grep -A 3 -E 'VGA|Display'                                         
03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 22 [Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT] (rev c5)
        Subsystem: ASRock Incorporation Radeon RX 6700 XT Challenger D
        Kernel driver in use: amdgpu
        Kernel modules: amdgpu
--
0e:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] (rev c9)
        Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Device 1636
        Kernel driver in use: amdgpu
        Kernel modules: amdgpu

Yes, changing the video device in the XML to virio-vga-gl did the trick. Thank you very much.