mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-03 17:41:58 +02:00
test: NVIDIA fix against a fake RTX 5080, stub modinfo and temp boot loader files
Sync git.upriser.nl mirror / sync (push) Skipped
Sync git.upriser.nl mirror / sync (push) Skipped
This commit is contained in:
1 parent
1f28cb3f4b
commit
24b517b4ad
3 files changed
+56
-5
No files matched your search
@@ -8,6 +8,7 @@ one per merged pull request.
|
|||||||
## 2.9.7 - 2026-10-01
|
## 2.9.7 - 2026-10-01
|
||||||
|
|
||||||
- **feat: the SteamOS conversion fixes a corrupted gaming mode screen with an NVIDIA GPU: nvidia-drm.modeset=1 and fbdev=1 on the kernel command line, NVIDIA modules in the initramfs (lib/nvidia.sh)**
|
- **feat: the SteamOS conversion fixes a corrupted gaming mode screen with an NVIDIA GPU: nvidia-drm.modeset=1 and fbdev=1 on the kernel command line, NVIDIA modules in the initramfs (lib/nvidia.sh)**
|
||||||
|
- **test: tests/nvidia-test.sh runs the NVIDIA fix against a fake RTX 5080 beside an iGPU, a stub modinfo and temp copies of the Limine, systemd-boot and GRUB files (no root, VM or hardware); NVIDIA_DRM_DIR points detection at a fake sysfs tree**
|
||||||
|
|
||||||
## 2.9.6 - 2026-09-30
|
## 2.9.6 - 2026-09-30
|
||||||
|
|
||||||
|
|||||||
+7
-5
@@ -10,11 +10,13 @@
|
|||||||
NVIDIA_PARAMS="nvidia-drm.modeset=1 nvidia-drm.fbdev=1"
|
NVIDIA_PARAMS="nvidia-drm.modeset=1 nvidia-drm.fbdev=1"
|
||||||
NVIDIA_INITRAMFS_CONF=/etc/mkinitcpio.conf.d/90-steamify-nvidia.conf
|
NVIDIA_INITRAMFS_CONF=/etc/mkinitcpio.conf.d/90-steamify-nvidia.conf
|
||||||
NVIDIA_MARK="# steamify-nvidia"
|
NVIDIA_MARK="# steamify-nvidia"
|
||||||
|
# The DRM devices in sysfs; the tests point this at a fake tree.
|
||||||
|
NVIDIA_DRM_DIR=${NVIDIA_DRM_DIR:-/sys/class/drm}
|
||||||
|
|
||||||
nvidia_present() {
|
nvidia_present() {
|
||||||
# An NVIDIA GPU (PCI vendor 0x10de, display class) and its kernel driver.
|
# An NVIDIA GPU (PCI vendor 0x10de, display class) and its kernel driver.
|
||||||
local d
|
local d
|
||||||
for d in /sys/class/drm/card[0-9]*/device; do
|
for d in "$NVIDIA_DRM_DIR"/card[0-9]*/device; do
|
||||||
[[ "$(cat "$d/vendor" 2>/dev/null)" == 0x10de ]] || continue
|
[[ "$(cat "$d/vendor" 2>/dev/null)" == 0x10de ]] || continue
|
||||||
[[ "$(cat "$d/class" 2>/dev/null)" == 0x03* ]] && modinfo nvidia_drm >/dev/null 2>&1 && return 0
|
[[ "$(cat "$d/class" 2>/dev/null)" == 0x03* ]] && modinfo nvidia_drm >/dev/null 2>&1 && return 0
|
||||||
done
|
done
|
||||||
@@ -65,11 +67,11 @@ nvidia_enable() {
|
|||||||
info "NVIDIA GPU found: adding $NVIDIA_PARAMS to the kernel command line (fixes a corrupted screen in gaming mode)..."
|
info "NVIDIA GPU found: adding $NVIDIA_PARAMS to the kernel command line (fixes a corrupted screen in gaming mode)..."
|
||||||
backup_file "$f"
|
backup_file "$f"
|
||||||
case "$f" in
|
case "$f" in
|
||||||
/etc/default/limine)
|
*/limine)
|
||||||
printf 'KERNEL_CMDLINE[default]+=" %s" %s\n' "$NVIDIA_PARAMS" "$NVIDIA_MARK" | sudo tee -a "$f" >/dev/null ;;
|
printf 'KERNEL_CMDLINE[default]+=" %s" %s\n' "$NVIDIA_PARAMS" "$NVIDIA_MARK" | sudo tee -a "$f" >/dev/null ;;
|
||||||
/etc/sdboot-manage.conf)
|
*/sdboot-manage.conf)
|
||||||
sudo sed -i -E "s/^(LINUX_OPTIONS=\"[^\"]*)\"/\1 $NVIDIA_PARAMS\"/" "$f" ;;
|
sudo sed -i -E "s/^(LINUX_OPTIONS=\"[^\"]*)\"/\1 $NVIDIA_PARAMS\"/" "$f" ;;
|
||||||
/etc/default/grub)
|
*/grub)
|
||||||
sudo sed -i -E "s/^(GRUB_CMDLINE_LINUX_DEFAULT=\"[^\"]*)\"/\1 $NVIDIA_PARAMS\"/" "$f" ;;
|
sudo sed -i -E "s/^(GRUB_CMDLINE_LINUX_DEFAULT=\"[^\"]*)\"/\1 $NVIDIA_PARAMS\"/" "$f" ;;
|
||||||
esac
|
esac
|
||||||
changed=1
|
changed=1
|
||||||
@@ -91,7 +93,7 @@ nvidia_disable() {
|
|||||||
local f changed=0; f="$(nvidia_boot_file)"
|
local f changed=0; f="$(nvidia_boot_file)"
|
||||||
if [[ -n "$f" ]] && grep -q "$NVIDIA_PARAMS" "$f" 2>/dev/null; then
|
if [[ -n "$f" ]] && grep -q "$NVIDIA_PARAMS" "$f" 2>/dev/null; then
|
||||||
case "$f" in
|
case "$f" in
|
||||||
/etc/default/limine) sudo sed -i "/$NVIDIA_MARK\$/d" "$f" ;;
|
*/limine) sudo sed -i "/$NVIDIA_MARK\$/d" "$f" ;;
|
||||||
*) sudo sed -i "s/ \?$NVIDIA_PARAMS//" "$f" ;;
|
*) sudo sed -i "s/ \?$NVIDIA_PARAMS//" "$f" ;;
|
||||||
esac
|
esac
|
||||||
changed=1
|
changed=1
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Tests lib/nvidia.sh against a fake RTX 5080 (PCI 10de:2c02) beside an
|
||||||
|
# Intel iGPU, a stub modinfo, and temp copies of the boot loader files. No
|
||||||
|
# root, VM or NVIDIA hardware needed: bash tests/nvidia-test.sh
|
||||||
|
cd "$(dirname "$0")/.." || exit 1
|
||||||
|
T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT
|
||||||
|
fail=0
|
||||||
|
check() { if eval "$2"; then echo "ok $1"; else echo "FAIL $1"; fail=1; fi; }
|
||||||
|
|
||||||
|
source lib/common.sh; source lib/hdmi-refresh.sh; source lib/nvidia.sh
|
||||||
|
sudo() { "$@"; }
|
||||||
|
info() { :; }; ok() { :; }; warn() { :; }; err() { echo "ERR $*"; }
|
||||||
|
backup_file() { [[ -f "$1.bak" ]] || cp "$1" "$1.bak"; }
|
||||||
|
modinfo() { [[ "$FAKE_DRIVER" == 1 ]]; }
|
||||||
|
REBUILDS=0; nvidia_rebuild_boot() { REBUILDS=$((REBUILDS + 1)); }
|
||||||
|
NVIDIA_INITRAMFS_CONF="$T/90-steamify-nvidia.conf"
|
||||||
|
mkdir -p "$T/drm/card0/device" "$T/drm/card1/device"
|
||||||
|
echo 0x8086 > "$T/drm/card0/device/vendor"; echo 0x030000 > "$T/drm/card0/device/class"
|
||||||
|
echo 0x10de > "$T/drm/card1/device/vendor"; echo 0x030000 > "$T/drm/card1/device/class"
|
||||||
|
echo 0x2c02 > "$T/drm/card1/device/device"
|
||||||
|
NVIDIA_DRM_DIR="$T/drm"
|
||||||
|
|
||||||
|
FAKE_DRIVER=1; check "finds the NVIDIA card as card1 beside an iGPU" nvidia_present
|
||||||
|
FAKE_DRIVER=0; check "skips when the driver isn't installed" '! nvidia_present'
|
||||||
|
FAKE_DRIVER=1; NVIDIA_DRM_DIR="$T/none"; check "skips without an NVIDIA GPU" '! nvidia_present'
|
||||||
|
NVIDIA_DRM_DIR="$T/drm"
|
||||||
|
|
||||||
|
for loader in limine sdboot grub; do
|
||||||
|
case $loader in
|
||||||
|
limine) F="$T/limine"; printf 'KERNEL_CMDLINE[default]="quiet splash"\n' > "$F" ;;
|
||||||
|
sdboot) F="$T/sdboot-manage.conf"; printf 'LINUX_OPTIONS="quiet splash"\n' > "$F" ;;
|
||||||
|
grub) F="$T/grub"; printf 'GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"\n' > "$F" ;;
|
||||||
|
esac
|
||||||
|
nvidia_boot_file() { echo "$F"; }
|
||||||
|
rm -f "$NVIDIA_INITRAMFS_CONF"; REBUILDS=0; ORIG="$(cat "$F")"
|
||||||
|
nvidia_enable
|
||||||
|
check "$loader: parameters added" 'grep -q "nvidia-drm.modeset=1" "$F" && grep -q "nvidia-drm.fbdev=1" "$F"'
|
||||||
|
check "$loader: initramfs drop-in written" 'grep -q nvidia_drm "$NVIDIA_INITRAMFS_CONF"'
|
||||||
|
check "$loader: backup made, rebuilt once" '[[ -f "$F.bak" && $REBUILDS == 1 ]]'
|
||||||
|
SUM="$(cat "$F")"; nvidia_enable
|
||||||
|
check "$loader: second run changes nothing" '[[ "$(cat "$F")" == "$SUM" && $REBUILDS == 1 ]]'
|
||||||
|
nvidia_disable
|
||||||
|
check "$loader: disable restores the file and drops the drop-in" '[[ "$(cat "$F")" == "$ORIG" && ! -f "$NVIDIA_INITRAMFS_CONF" ]]'
|
||||||
|
done
|
||||||
|
|
||||||
|
FAKE_DRIVER=0; printf 'LINUX_OPTIONS="quiet"\n' > "$T/sdboot"; F="$T/sdboot"; REBUILDS=0; nvidia_enable
|
||||||
|
check "no NVIDIA driver: nothing touched" '[[ "$(cat "$F")" == "LINUX_OPTIONS=\"quiet\"" && $REBUILDS == 0 ]]'
|
||||||
|
exit $fail
|
||||||
Reference in new issue
Block a user