More in-depth setup-guide for usage of kvmfr (see https://looking-glass.io/docs/B6/module/)
This setup was done on EndeavourOs (Arch) on Kernel 6.1.12-arch1-1.
QEMU-version 7.2 and libvirt version 9.0.0 .
Running cGroups Policy (if you have AppArmor, some things are different)
Check respective sections in looking-glass docs for other versions (specifcally QEMU <6.2 and libvirt <7.9)
You need a VM which is fully set-up with graphics-driver and the looking-glass host-program.
Documentation about that can be found here: https://looking-glass.io/docs/B6/install/
You need the following packages
sudo
(or do things as root)git
dkms
linux-headers
(same version as kernel, probably already installed)
This guide uses the default 32MB size, which is fine for 1080p.
For 1440p or 2160p you need to use 64MB.
See this section to determine how much you need.
Formula
pixel size for SDR is 4
pixel size for HDR is 8
width x height x pixel size x 2 = frame bytes
frame bytes / 1024 / 1024 = frame megabytes
frame megabytes + 10 MiB = total megabytes
Round up to nearest power of 2. (32, 64, 128, ..)
Clone repository and enter module folder
git clone https://github.com/gnif/LookingGlass
cd LookingGlass/module
Compile and install module with dmks
sudo dkms install "."
Setup udev-rule for module to set permissions
Deviate from docs to make user-independent
sudo cat > /etc/udev/rules.d/99-kvmfr.rules <<EOF
SUBSYSTEM=="kvmfr", OWNER="libvirt-qemu", GROUP="kvm", MODE="0666"
EOF
Setup auto-load of module
sudo cat > /etc/modules-load.d/kvmfr.conf <<EOF
# 3. KVMFR Looking Glass module
kvmfr
EOF
sudo cat > /etc/modprobe.d/kvmfr.conf <<EOF
#KVMFR Looking Glass module
options kvmfr static_size_mb=32
EOF
- Open
/etc/libvirt/qemu.conf
- Find
cgroup_device_acl
- Uncomment everything in that block and add
"/dev/kvmfr0"
Looks something like this:
# 4. This is the basic set of devices allowed / required by
# 5. all virtual machines.
#
# 6. As well as this, any configured block backed disks,
# 7. all sound device, and all PTY devices are allowed.
#
# 1. This will only need setting if newer QEMU suddenly
# 2. wants some device we don't already know about.
#
cgroup_device_acl = [
"/dev/null", "/dev/full", "/dev/zero",
"/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm",
"/dev/kvmfr0"
]
- Save file and restart libvirtd
sudo systemctl restart libvirtd
-
Open virtual machine manager
-
Your VM -> Details -> XML
-
First line has to be
<domain xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" type="kvm">
- Go to the bottom and add this block
<qemu:commandline>
<qemu:arg value='-device'/>
<qemu:arg value='{"driver":"ivshmem-plain","id":"shmem0","memdev":"looking-glass"}'/>
<qemu:arg value='-object'/>
<qemu:arg value='{"qom-type":"memory-backend-file","id":"looking-glass","mem-path":"/dev/kvmfr0","size":33554432,"share":true}'/>
</qemu:commandline>
size
is your MEM-size in bytes (looking-glass docs)
Formula: MEM-size x 1024 x 1024
- Save and check if everything is still there
libvirt might replace"
with"
, thats fine
You might not have to specify the mem-device as it already detects the correct one
Feels free to add a config-file or manually add the -f
Option if not
- Load module manually
sudo modprobe kvmfr static_size_mb=32
- Check kernel-log for output of module
sudo dmesg | grep kvmfr
Should return this:
kvmfr: creating 1 static devices
- Check created node and permissions
ls -la /dev/kvmfr*
Should return this:
crw-rw-rw- 1 libvirt-qemu kvm 510, 0 23. Feb 10:00 /dev/kvmfr0
- Now try to start the VM and then looking-glass