diff --git a/.no-release-yet b/.no-release-yet index b7dafe9..6edd1d4 100644 --- a/.no-release-yet +++ b/.no-release-yet @@ -1,4 +1,4 @@ This branch is not ready to be released: do not merge it into the release branch. When the feature is complete and tested, ask the user whether it may be released; on a yes, delete this file, then open the pull request into the release branch. -Open work and how to pick it up: TODO-nvidia.md. +Open work and how to pick it up: TODO-nvidia.md. Research notes: NVIDIA-RESEARCH.md. diff --git a/NVIDIA-RESEARCH.md b/NVIDIA-RESEARCH.md new file mode 100644 index 0000000..eb53c29 --- /dev/null +++ b/NVIDIA-RESEARCH.md @@ -0,0 +1,63 @@ +# NVIDIA and gamescope: research notes (branch `feature/nvidia-gaming-fix`) + +Written 2026-10-01 for the NVIDIA fix (`lib/nvidia.sh`). Delete with `TODO-nvidia.md` and +`.no-release-yet` when the feature is released, or move what is still useful to `TECHNICAL.md`. +"Verified" means seen in this session (a VM run or a fetched page); the rest is from search results or memory. + +## The user's PC +RTX 5080 (Blackwell). Blackwell only works with NVIDIA's open kernel modules (`nvidia-open`), driver 570+. +The corrupted picture at gaming mode start is not diagnosed yet: the fix adds kernel parameters, the real cause +may be the gamescope/driver combination. `tests/nvidia-hardware-test.sh` collects the facts. + +## What the fix changes and why (reasoning, not proven for gamescope) +- gamescope runs the display itself through DRM/KMS. With NVIDIA that needs `nvidia-drm.modeset=1`; `nvidia-drm.fbdev=1` + gives the console a framebuffer from `nvidia-drm`, so the hand-off from the console to gamescope is clean. +- Loading the NVIDIA modules in the initramfs (early KMS) only changes how early boot looks (native resolution, + splash, passphrase prompt), not speed. It is not needed for gamescope, which starts after login (believed, not proven). +- No source found that mentions these parameters for gamescope; the fix is a standard NVIDIA/Wayland setup, applied + automatically. Whether it cures the 5080's picture is only known after `tests/nvidia-hardware-test.sh`. + +## Which cards (the user hopes older than RTX 2000 work) +- Open kernel modules: Turing (RTX 20, GTX 16) and newer only; they need the GSP processor first built into Turing. + Maxwell, Pascal and Volta (GTX 900/10 series, Titan V) only work with the proprietary driver, whose legacy branch + is 580. Source: [NVIDIA README, open kernel modules](https://download.nvidia.com/XFree86/Linux-x86_64/560.35.03/README/kernel_open.html), + [NVIDIA datacenter driver guide, kernel modules](https://docs.nvidia.com/datacenter/tesla/driver-installation-guide/kernel-modules.html). +- `nvidia-drm.modeset` and `fbdev` are options of the `nvidia-drm` module in both flavours, so the fix applies to + any card whose driver provides `nvidia_drm` (what `nvidia_present` tests: GPU vendor 0x10de + `modinfo nvidia_drm`). + Whether gamescope then works on an older card is a different question, and no source says the fix helps there. +- Not NVIDIA's proprietary driver: nouveau has no `nvidia_drm`, so the fix does nothing. The CachyOS handheld ISO boots + GTX 10xx and older with nouveau until the NVIDIA driver is installed + ([CachyOS forum](https://discuss.cachyos.org/t/information-experimental-cachyos-handheld-edition/203)). + +## Known gamescope problems that are not this fix +- **GTX 1050 Ti (Pascal), driver 580.119.02, gamescope newer than 3.16.16:** the CachyOS handheld session fails to start when + a display is on the GPU's HDMI port (back to the TTY, loop). Workarounds: downgrade `gamescope` and `lib32-gamescope` + to 3.16.16, or use the motherboard's video port. Fixed upstream? unknown. + [CachyOS forum](https://discuss.cachyos.org/t/no-display-on-cachyos-handheld-edition-on-nvidia-with-gamescope-3-16-16/20935) +- **VRS on PCs:** CachyOS' gamescope-session enables variable rate shading (`STEAM_USE_DYNAMIC_VRS=1`, + `RADV_FORCE_VRS_CONFIG_FILE`, `echo 1x1 > ...` in `/usr/lib/steamos/gamescope-session`). It broke rendering (missing + floors/lighting, bad post-processing) on a PC with an AMD RX 6800 XT. RADV is AMD's driver: not the NVIDIA corruption. + Workaround: comment those three lines, or per game `env -u RADV_FORCE_VRS_CONFIG_FILE STEAM_USE_DYNAMIC_VRS=0 %command%`. + [CachyOS forum](https://discuss.cachyos.org/t/cachyos-gamescope-session-asset-missing-vrs-fix/34971) +- gamescope's DRM backend needs Vulkan DRM format modifiers; with the open Mesa driver NVK that came in Mesa 24.1 + ([GamingOnLinux](https://www.gamingonlinux.com/2024/05/nvk-driver-gets-drm-format-modifiers-to-work-with-gamescope-in-mesa-24-1)). + The proprietary driver had format-modifier trouble with gamescope too (GitHub issues + [ValveSoftware/gamescope#1662](https://github.com/ValveSoftware/gamescope/issues/1662), + [#1516](https://github.com/ValveSoftware/gamescope/issues/1516): titles seen only, not read). + +## What was verified in VMs (QEMU/KVM, CachyOS ISO 260809) +- Kernel parameters land and survive a reboot on Limine, systemd-boot and GRUB; disable restores the original. +- Limine's tool is a compiled program: an appended `KERNEL_CMDLINE[default]+=" ..."` line was pasted into the kernel + command line as text; the fix edits the existing `KERNEL_CMDLINE[default]="..."` line. +- `mkinitcpio` fails on a MODULES entry a kernel lacks; `limine-mkinitcpio` then skips that kernel's initramfs and boot + entry (parameters included); systemd-boot/GRUB image: "may not be complete" (not run with failing modules). +- Real CachyOS/Limine pacman hooks: `10-limine-snapper-lock`, `60-limine-mkinitcpio-remove-pre`, `60-mkinitcpio-remove`, + `80-limine-efi-deploy`, `90-limine-mkinitcpio-remove-post`, `90-mkinitcpio-install`; Steamify's hook is `85-` + (DKMS's is `71-dkms-install`, not installed in the VM). A mirror older than the ISO "downgrades" kernels on reinstall. +- The hook keeps the early-load drop-in right across kernel changes (see `TODO-nvidia.md`). + +## Still unknown (needs the hardware) +- Does the fix cure the 5080's corrupted picture? Which gamescope/driver versions does the PC have? +- Does it help, harm or do nothing on Maxwell/Pascal/Volta cards? No older card available yet. +- Real NVIDIA modules in the initramfs (VMs only had renamed fake modules); DKMS hook order on a PC with + `nvidia-open-dkms`. diff --git a/TODO-nvidia.md b/TODO-nvidia.md index dbad4c2..570749a 100644 --- a/TODO-nvidia.md +++ b/TODO-nvidia.md @@ -1,6 +1,6 @@ # TODO: NVIDIA fix for gaming mode (branch `feature/nvidia-gaming-fix`) -Delete this file together with `.no-release-yet` when the feature is released. +Delete this file, `NVIDIA-RESEARCH.md` and `.no-release-yet` when the feature is released. Written 2026-10-01 so a new session can pick this up. ## Problem @@ -28,12 +28,43 @@ missing, or a gamescope/driver mismatch. Limine pasted an appended `+=` line as text into the cmdline; a kernel without the NVIDIA modules made limine-mkinitcpio skip its boot entry. -## In progress (2026-10-01) -- Kernel changes: the early-load drop-in is now kept right by a pacman hook - (`patches/steamify-nvidia-initramfs.{sh,hook}`, installed by `nvidia_enable`). Unit-tested - (29 checks). **Not yet VM-tested with a real pacman transaction**: hook order (85- after - 71-dkms-install, before the mkinitcpio/limine hooks: check the real hook names in - /usr/share/libalpm/hooks), a kernel reinstall with and without modules. +## Kernel changes (done, VM-tested 2026-10-01, Limine) +The early-load drop-in is kept right by a pacman hook (`patches/steamify-nvidia-initramfs.{sh,hook}`, +installed by `nvidia_enable`, `/etc/pacman.d/hooks/85-steamify-nvidia-initramfs.hook`). Real pacman +transactions in a Limine VM: the hook runs between "Updating module dependencies" and "Updating +linux initcpios" (real hook names there: 60-*-remove, 80-limine-efi-deploy, 90-limine-mkinitcpio-remove-post, +90-mkinitcpio-install; DKMS would be 71-): the drop-in is present while every kernel has the modules, removed +when the LTS kernel loses them, back when they return; initramfs nvidia files 1 -> 5 -> 1 -> 5 -> 1 +(1 = baseline, 4 modules added); no ERROR/skipping in any rebuild; cmdline kept the parameters after a reboot; +disable removes hook, script and drop-in. Found on the way: an empty hook/script was installed when +`patch_file` failed (now an error). Only tested with fake modules (renamed copies of a small module), on +Limine; systemd-boot and GRUB use the same hook but were not run with pacman transactions. + +## Opt-out toggle (new request, 2026-10-01: not built yet) +When a compatible NVIDIA card is listed there should be a menu option, on by default (opt-out), named +"NVIDIA compatibility", as a sub-option of the SteamOS conversion, directly under "Boot into" (`boot`). +Today the fix runs unconditionally inside `gaming_enable`/`gaming_disable`. +- [ ] New component `nvidia` in `lib/menu.sh`: `COMPONENTS` right after `boot`, `PARENT[nvidia]=gaming`, `LABEL`, + `FEATURE_VERSION[nvidia]`, `component_available` -> `nvidia_available` (= `nvidia_present`); not in + `NO_PRESELECT` (ticked by default, `feature_new` ticks it for installs that already have the conversion). + `nvidia_status` from the system (hook + parameters present), `nvidia_enable`/`nvidia_disable` = the code now + called from `gaming_enable`/`gaming_disable` (remove those calls). Check `toggle_component` dependencies, + `feature_record_unticked`, the plan texts ("This will: ..."). +- [ ] The app: `ui/qml/Texts.qml` item texts, `AppState.qml`, the screen rows, `lib/backend.sh` if it lists ids; + `--defaults [--options ]` (the Steam Machine ISO's installer pages: it names the ids) and `--skip`. +- [ ] README rows/screenshot rule (a release that adds a menu row retakes `assets/screenshot-menu.png`), TECHNICAL.md, + CHANGELOG, `tests/nvidia-test.sh` (status/enable/disable through the component), VM menu test in + steamify-cachyos-dev (`share/vmtest/menu`, TESTPLAN.md row). +- [ ] What "compatible" means: see the research below. The parameters themselves apply to any card whose driver + provides `nvidia_drm` (what `nvidia_present` tests); whether gamescope works on a card is a separate question. + +## Older cards and other research +The user hopes the fix also works for GPUs older than RTX 2000. Full notes with sources: **`NVIDIA-RESEARCH.md`**. +Short version: open kernel modules need Turing+, Maxwell/Pascal/Volta need the proprietary driver (580 legacy branch); +`nvidia-drm.modeset/fbdev` exist in both, so the fix applies to any card with `nvidia_drm`, but nothing found says gamescope +works better or worse there (a GTX 1050 Ti has a known gamescope>3.16.16 start problem on HDMI, not ours). Cannot be promised: +needs a test on a real older card. Design for the toggle: on by default for any card with `nvidia_drm`, the label says +what it does, `tests/nvidia-hardware-test.sh` reports GPU and driver so results can be compared. ## Still to do 1. [ ] **On the NVIDIA PC** (only place the real fix can be judged), from this checkout: @@ -45,10 +76,11 @@ missing, or a gamescope/driver mismatch. gamescope/NVIDIA log lines and the versions (`nvidia-open`, `nvidia-utils`, `gamescope`, `gamescope-session-cachyos`); the cause is then probably a gamescope/driver mismatch for Blackwell, not this fix. -3. [ ] Not covered by any test: the early-load drop-in on a machine that has the modules - (the VMs have none), and a boot loader other than the three. +3. [ ] Not covered by any test: the early-load drop-in with the REAL NVIDIA modules (the VMs only have renamed + fake ones), and systemd-boot/GRUB with a pacman transaction (only Limine was run). 4. [ ] Changelog: fill in the commit hashes of this feature's lines (next commit, per AGENTS.md). -5. [ ] When complete and tested: ask the user whether it may be released. On a yes delete +5. [ ] Build the opt-out toggle (section above) before release. +6. [ ] When complete and tested: ask the user whether it may be released. On a yes delete `.no-release-yet` and this file, open the PR into `release/2.9.7` (local branch only so far, one commit `chore: Version 2.9.7`; push it then) and merge it. The user merges `release/2.9.7` into `main`.