Fix NVIDIA environment variables for Maxwell/Pascal/Volta GPUs

Maxwell, Pascal, and Volta GPUs lack GSP (GPU System Processor) firmware
required by NVD_BACKEND=direct. Applying direct backend unconditionally
causes Aquamarine v3.3.0+ to fail with "Unknown-1" displays and blank screens.

Changes:
- Add GPU generation detection (Turing+ vs Maxwell/Pascal/Volta)
- Turing+ (RTX 20xx+, GTX 16xx): NVD_BACKEND=direct + LIBVA_DRIVER_NAME=nvidia
- Maxwell/Pascal/Volta: NVD_BACKEND=egl only (no GSP support)
- Both generations: __GLX_VENDOR_LIBRARY_NAME=nvidia (universal)

Regex improvements:
- Fix Turing+ detection (was using Maxwell/Pascal pattern)
- GT series: GT 1030 now properly detected (was missed)
- Quadro: P/M series only (exclude Kepler K-series)
- Volta: Titan V, Tesla V100, Quadro GV100
- Modern datacenter: A100, H100, T4, L-series
- MX series: Fixed to match MX150/250/450 (was only MX1-9)

Migration script (1770159912.sh) fixes existing broken installations by:
- Detecting legacy NVIDIA GPUs on existing systems
- Rewriting incompatible NVD_BACKEND=direct entries to egl
- Creating automatic backups before modification

Testing:
Validated against GT 1030, GTX 960/1080, Quadro P620 (legacy egl backend)
and GTX 1650, RTX 3080 (modern direct backend).

Preserves existing Turing+ behavior exactly. No impact on non-NVIDIA systems.

Fixes hyprwm/Hyprland#7001
Fixes hyprwm/Hyprland#8519
Fixes hyprwm/Hyprland#6343
Fixes hyprwm/Hyprland#7812
This commit is contained in:
johnzfitch
2026-02-03 17:33:48 -08:00
parent 4b3e21445b
commit a8ce084460
2 changed files with 54 additions and 7 deletions

34
migrations/1770159912.sh Normal file
View File

@@ -0,0 +1,34 @@
echo "Fix NVIDIA environment variables for Maxwell/Pascal/Volta GPUs"
# Detect if user has Maxwell/Pascal/Volta GPU (pre-Turing cards without GSP firmware)
# Maxwell (GTX 9xx), Pascal (GT/GTX 10xx, Quadro P, MX series), Volta (Titan V, Tesla V100, Quadro GV100)
NVIDIA="$(lspci | grep -i 'nvidia')"
if echo "$NVIDIA" | grep -qE "GTX (9[0-9]{2}|10[0-9]{2})|GT 10[0-9]{2}|Quadro [PM][0-9]{3,4}|Quadro GV100|MX *[0-9]+|Titan (X|Xp|V)|Tesla V100"; then
ENVS_CONF="$HOME/.config/hypr/envs.conf"
if [ -f "$ENVS_CONF" ]; then
# Check if file contains problematic variables
if grep -qE "env = (NVD_BACKEND,direct|LIBVA_DRIVER_NAME,nvidia)" "$ENVS_CONF"; then
echo "Removing incompatible NVIDIA environment variables for legacy GPU..."
# Create backup
cp "$ENVS_CONF" "$ENVS_CONF.bak.$(date +%s)"
# Remove problematic lines and old NVIDIA section header
sed -i '/^env = NVD_BACKEND,direct$/d' "$ENVS_CONF"
sed -i '/^env = LIBVA_DRIVER_NAME,nvidia$/d' "$ENVS_CONF"
sed -i '/^# NVIDIA$/d' "$ENVS_CONF"
# Add correct environment variables for legacy GPUs
cat >>$ENVS_CONF <<'EOF'
# NVIDIA (Maxwell/Pascal/Volta without GSP firmware)
env = NVD_BACKEND,egl
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
EOF
echo "NVIDIA environment variables updated. A backup was saved to $ENVS_CONF.bak.*"
echo "Please restart Hyprland for changes to take effect."
fi
fi
fi