Skip to content

Commit

Permalink
feat: Deprecate looking-glass shm in favor of kvmfr
Browse files Browse the repository at this point in the history
  • Loading branch information
HikariKnight committed Apr 24, 2024
1 parent 3cbdd39 commit 3ce2452
Showing 1 changed file with 33 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ setup-virtualization ACTION="":
echo " Use 'group' to select Add $USER to libvirt group"
echo " Use 'vfio-on' to select Enable VFIO drivers"
echo " Use 'vfio-off' to select Disable VFIO drivers"
echo " Use 'shm' to select Autocreate Looking-Glass shm"
echo " Use 'kvmfr' to select Autocreate Looking-Glass shm"
exit 0
elif [ "$OPTION" == "" ]; then
echo "${bold}Virtualization Setup${normal}"
Expand All @@ -37,7 +37,7 @@ setup-virtualization ACTION="":
"Add $USER to libvirt group" \
"Enable VFIO drivers" \
"Disable VFIO drivers" \
"Autocreate Looking-Glass shm" \
"Enable kvmfr module" \
)
fi
if [[ "${OPTION,,}" =~ (^enable[[:space:]]virtualization|virt-on) ]]; then
Expand Down Expand Up @@ -129,29 +129,47 @@ setup-virtualization ACTION="":
--delete-if-present="vfio_pci.disable_vga=0" \
$VFIO_IDS_KARG
fi
elif [[ "${OPTION,,}" =~ shm ]]; then
elif [[ "${OPTION,,}" =~ kvmfr ]]; then
# Check if we are running on a Steam Deck
if /usr/libexec/hwsupport/valve-hardware; then
echo "IOMMU is not supported on Steam Deck"
exit 0
fi
echo "Bazzite currently uses a deprecated implementation of the Looking Glass shm."
echo "This implementation will not be supported in the future and we are in the process"
echo "of moving over to the KVMFR kernel module."
echo "Until this is done please open any Looking Glass issues you have in Bazzite"
echo "in the $(Urllink "https://discord.bazzite.gg/" "Bazzite Discord") or the $(Urllink "https://github.com/ublue-os/bazzite/issues" "Bazzite Github issue tracker")"
echo "This module along with $(URllink "https://looking-glass.io" "Looking Glass") is very experimental and not recommended for production use!"
echo "The ublue team packages the kvmfr module only because it has to be supplied with the system image while using an atomic desktop."
echo "If you do plan to use Looking Glass, please $(Urllink "https://universal-blue.discourse.group/docs?topic=956" "follow the guide here") on how to compile it for your system."
echo "Please open any Looking Glass issues you have in Bazzite"
echo "in the $(Urllink "https://discord.bazzite.gg/" "Bazzite Discord") or the $(Urllink "https://github.com/ublue-os/bazzite/issues" "Bazzite Github issue tracker")."
echo "~ @HikariKnight"
CONFIRM=$(Choose Ok Cancel)
if [ "$CONFIRM" == "Cancel" ]; then
exit 0
fi
echo "Creating tmpfile definition for shm file in /etc/tmpfiles.d/"
sudo bash -c "cat << LOOKING_GLASS_TMP > /etc/tmpfiles.d/10-looking-glass.conf
# Type Path Mode UID GID Age Argument
f /dev/shm/looking-glass 0660 1000 qemu -
LOOKING_GLASS_TMP"
echo "Adding SELinux context record for /dev/shm/looking-glass"
sudo semanage fcontext -a -t svirt_tmpfs_t /dev/shm/looking-glass
echo "Setting up kvmfr module so it loads next boot"
sudo bash -c "cat << KVMFR_DRACUT > /etc/dracut.conf.d/kvmfr.conf
install_items+=" /etc/modprobe.d/kvmfr.conf "
KVMFR_DRACUT"
sudo bash -c "cat << KVMFR_MODPROBE > /etc/modprobe.d/kvmfr.conf
options kvmfr static_size_mb=128
KVMFR_MODPROBE"
echo "Adding SELinux context record for /dev/kvmfr0"
sudo semanage fcontext -a -t svirt_tmpfs_t /dev/kvmfr0
echo "Adding udev rule for /dev/kvmfr0"
sudo bash -c "cat << KVMFR_UDEV > /etc/udev/rules.d/99-kvmfr.rules
SUBSYSTEM=="kvmfr", OWNER="$USER", GROUP="qemu", MODE="0660"
KVMFR_UDEV
echo "Kvmfr0 $(Urllink "https://looking-glass.io/docs/B7-rc1/install_libvirt/#determining-memory" "static size is set to 128mb by default")"
echo "this will work with up to 4K SDR resolutiion, as most dummy plugs go up to 4K"
echo "so some games will try use 4k resolution on first boot and crash looking-glass if the value is too low."
echo ""
echo "If you need to change it to a different value"
echo "you can do that in /etc/modprobe.d/kvmfr.conf"
echo "$(Urllink "https://looking-glass.io/docs/rc/ivshmem_kvmfr/#libvirt" "Please read official documentation for kvmfr for how to use it")"
echo ""
echo "Press OK to start the process of regenerating your initramfs, this will take a long time"
echo "and there is no good way to track progress for it, if anything is wrong it will error out."
CONFIRM=$(Choose OK)
rpm-ostree initramfs --enable
elif [[ "${OPTION,,}" =~ group ]]; then
if ! grep -q "^libvirt" /etc/group; then
grep '^libvirt' /usr/lib/group | sudo tee -a /etc/group > /dev/null
Expand Down

0 comments on commit 3ce2452

Please sign in to comment.