Metadata-Version: 2.4
Name: nvidia-legacy-nouveau
Version: 0.2.0
Summary: Use nouveau for NVIDIA GPUs below the proprietary-support boundary
Author-email: Ajrat Makhmutov <rauty@altlinux.org>
License: GPL-2.0-or-later
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# nvidia-legacy-nouveau

ALT p11 has no nvidia 340 branch, while the ALT Education image
blacklists nouveau. `nvidia-legacy-nouveau` switches systems whose
NVIDIA GPUs are all below the proprietary-support boundary to nouveau.
The current boundary value is derived from the 340/390 ID split
recommended in bug 56688.

If every PCI device with vendor `0x10de` and class `0x030000` or
`0x030200` has a device ID below `0x11c0`, nouveau is used; if any is
`0x11c0` or above, the proprietary driver is kept; with no NVIDIA GPU
nothing is done. The current boundary value is the first ID in the
nvidia 390 list above the highest ID supported by 340 but absent from 390.

## Usage

```sh
nvidia-legacy-nouveau check
nvidia-legacy-nouveau [-r DIR] [-n] [--no-initrd] apply
```

The installer hook `installer/preinstall.d/40-nvidia-legacy-nouveau.sh`
runs `apply --root "$destdir" --no-initrd` for the system being
installed. The choice is made only there, once: systems that are not
installed from the ISO (VM images, alt-rootfs-installer) and systems
whose video card is replaced later need `nvidia-legacy-nouveau apply`
run by hand.

Kernel parameters such as `nomodeset` do not change the choice. With
them nouveau leaves the display to the firmware framebuffer, which still
gives a desktop, and works fully once the parameter is removed. The
proprietary driver ignores `nomodeset` and would keep failing.

## Switching back to the proprietary driver

To use a supported proprietary branch on a card that got nouveau:

1. remove `/etc/modprobe.d/nvidia-legacy-nouveau.conf` and
   `/etc/modules-load.d/nvidia-legacy-nouveau.conf`;
2. uncomment `blacklist nouveau` in
   `/etc/modprobe.d/blacklist-nouveau.conf`;
3. run `make-initrd` and reboot.

The driver preset then sets the proprietary driver up on boot. Do not
run `apply` afterwards: it would switch to nouveau again.

## Development

```sh
python3 -m unittest discover -s tests -v
python3 -m nvidia_legacy_nouveau check
```

See `DEVELOPING.md` for the tests and the rules for changes, and
`doc/rationale.md` for why the rule and every step are the way they are.

## License

GPL-2.0-or-later, see `LICENSE`.
