I am playing around with these features at home, but I am not really sure if they are working or how to verify?
I created a new Impish VM using:
lxc launch --vm images:ubuntu/impish/desktop impish-desktop --console=vga
The virgl GPU is definitely present in the VM:
ubuntu@impish-desktop:~$ lspci | grep VGA 04:00.0 VGA compatible controller: Red Hat, Inc. Virtio GPU (rev 01)
Checking the renderer using
ubuntu@impish-desktop:~$ glxinfo | grep 'OpenGL renderer' OpenGL renderer string: llvmpipe (LLVM 12.0.1, 256 bits)
If I am not mistaken llvmpipe means software right? Isn’t it supposed to say ‘virgl’ if the Virtio GPU is being used?
I decided to also try adding a mediated (mdev) GPU to the VM instead. After getting all BIOS, kernel modules and module parameters set correctly I can see the mdev types on the host:
anderson@anderson-nzxt:/sys/class/mdev_bus/0000:00:02.0/mdev_supported_types$ ls i915-GVTg_V5_4 i915-GVTg_V5_8
They are showing as resources in LXD also:
anderson@anderson-nzxt:~$ lxc info --resources GPUs: Card 0: NUMA node: 0 Vendor: Intel Corporation (8086) Product: UHD Graphics 630 (Desktop) (3e92) PCI address: 0000:00:02.0 Driver: i915 (5.4.0-89-generic) DRM: ID: 0 Card: card0 (226:0) Control: controlD64 (226:0) Render: renderD128 (226:128) Mdev profiles: - i915-GVTg_V5_4 (1 available) low_gm_size: 128MB high_gm_size: 512MB fence: 4 resolution: 1920x1200 weight: 4 - i915-GVTg_V5_8 (2 available) low_gm_size: 64MB high_gm_size: 384MB fence: 4 resolution: 1024x768 weight: 2
Adding the mdev GPU works:
anderson@anderson-nzxt:~$ lxc config device add impish-desktop i915 gpu gputype=mdev mdev=i915-GVTg_V5_8 Device i915 added to impish-desktop
However, I get the following error when I try to start the VM again:
anderson@anderson-nzxt:~$ lxc start --console=vga impish-desktop Error: Failed to start device "i915": VMs cannot match multiple GPUs per device Try `lxc info --show-log impish-desktop` for more info
Not sure what that means other than the hunch that virgl and mdev are mutually exclusive when they both want to use the same GPU?
I am trying to understand how virgl and/or mdev GPUs work and so far don’t get the impression that I have GPU acceleration correctly enabled in the Impish VM?
Any help clarifying what is happening here would be much appreciated!