From a8ce08446009b9f98968ac6f368f69f4c0010d10 Mon Sep 17 00:00:00 2001 From: johnzfitch Date: Tue, 3 Feb 2026 17:33:48 -0800 Subject: [PATCH 1/2] 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 --- install/config/hardware/nvidia.sh | 27 +++++++++++++++++------- migrations/1770159912.sh | 34 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 migrations/1770159912.sh diff --git a/install/config/hardware/nvidia.sh b/install/config/hardware/nvidia.sh index d159dd6c..a9b33dc0 100644 --- a/install/config/hardware/nvidia.sh +++ b/install/config/hardware/nvidia.sh @@ -4,12 +4,14 @@ if [ -n "$NVIDIA" ]; then # Check which kernel is installed and set appropriate headers package KERNEL_HEADERS="$(pacman -Qqs '^linux(-zen|-lts|-hardened)?$' | head -1)-headers" - if echo "$NVIDIA" | grep -qE "RTX [2-9][0-9]|GTX 16"; then - # Turing (16xx, 20xx), Ampere (30xx), Ada (40xx), and newer recommend the open-source kernel modules + # Turing+ (GTX 16xx, RTX 20xx-50xx, Quadro RTX, datacenter A/H/T/L series) have GSP firmware + if echo "$NVIDIA" | grep -qE "GTX 16[0-9]{2}|RTX [2-5][0-9]{3}|Quadro RTX|RTX A[0-9]{4}|A[1-9][0-9]{2}|H[1-9][0-9]{2}|T4|L[0-9]+"; then PACKAGES=(nvidia-open-dkms nvidia-utils lib32-nvidia-utils libva-nvidia-driver) - elif echo "$NVIDIA" | grep -qE "GTX 9|GTX 10|Quadro P|MX1|MX2|MX3"; then - # Pascal (10xx, Quadro Pxxx, MX150, MX2xx, and MX3xx) and Maxwell (9xx, MX110, and MX130) use legacy branch that can only be installed from AUR + GPU_ARCH="turing_plus" + # Maxwell (GTX 9xx), Pascal (GT/GTX 10xx, Quadro P, MX series), Volta (Titan V, Tesla V100, Quadro GV100) lack GSP + elif 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 PACKAGES=(nvidia-580xx-dkms nvidia-580xx-utils lib32-nvidia-580xx-utils) + GPU_ARCH="maxwell_pascal_volta" fi # Bail if no supported GPU if [ -z "${PACKAGES+x}" ]; then @@ -29,12 +31,23 @@ EOF MODULES+=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) EOF - # Add NVIDIA environment variables - cat >>$HOME/.config/hypr/envs.conf <<'EOF' + # Add NVIDIA environment variables based on GPU architecture + if [ "$GPU_ARCH" = "turing_plus" ]; then + # Turing+ (RTX 20xx, GTX 16xx, and newer) with GSP firmware support + cat >>$HOME/.config/hypr/envs.conf <<'EOF' -# NVIDIA +# NVIDIA (Turing+ with GSP firmware) env = NVD_BACKEND,direct env = LIBVA_DRIVER_NAME,nvidia env = __GLX_VENDOR_LIBRARY_NAME,nvidia EOF + elif [ "$GPU_ARCH" = "maxwell_pascal_volta" ]; then + # Maxwell/Pascal/Volta (GTX 9xx/10xx, GT 10xx, Quadro P/M/GV, MX series, Titan X/Xp/V) lack GSP firmware + cat >>$HOME/.config/hypr/envs.conf <<'EOF' + +# NVIDIA (Maxwell/Pascal/Volta without GSP firmware) +env = NVD_BACKEND,egl +env = __GLX_VENDOR_LIBRARY_NAME,nvidia +EOF + fi fi diff --git a/migrations/1770159912.sh b/migrations/1770159912.sh new file mode 100644 index 00000000..7003c2d8 --- /dev/null +++ b/migrations/1770159912.sh @@ -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 From ebfcefa5538d6e47683925c1df16ba3ea645b91c Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Sat, 7 Feb 2026 00:34:13 -0500 Subject: [PATCH 2/2] Consolidate migration sed cleanup and quote heredoc paths --- install/config/hardware/nvidia.sh | 4 ++-- migrations/1770159912.sh | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/install/config/hardware/nvidia.sh b/install/config/hardware/nvidia.sh index a9b33dc0..da2ba180 100644 --- a/install/config/hardware/nvidia.sh +++ b/install/config/hardware/nvidia.sh @@ -34,7 +34,7 @@ EOF # Add NVIDIA environment variables based on GPU architecture if [ "$GPU_ARCH" = "turing_plus" ]; then # Turing+ (RTX 20xx, GTX 16xx, and newer) with GSP firmware support - cat >>$HOME/.config/hypr/envs.conf <<'EOF' + cat >>"$HOME/.config/hypr/envs.conf" <<'EOF' # NVIDIA (Turing+ with GSP firmware) env = NVD_BACKEND,direct @@ -43,7 +43,7 @@ env = __GLX_VENDOR_LIBRARY_NAME,nvidia EOF elif [ "$GPU_ARCH" = "maxwell_pascal_volta" ]; then # Maxwell/Pascal/Volta (GTX 9xx/10xx, GT 10xx, Quadro P/M/GV, MX series, Titan X/Xp/V) lack GSP firmware - cat >>$HOME/.config/hypr/envs.conf <<'EOF' + cat >>"$HOME/.config/hypr/envs.conf" <<'EOF' # NVIDIA (Maxwell/Pascal/Volta without GSP firmware) env = NVD_BACKEND,egl diff --git a/migrations/1770159912.sh b/migrations/1770159912.sh index 7003c2d8..5709cdb7 100644 --- a/migrations/1770159912.sh +++ b/migrations/1770159912.sh @@ -14,13 +14,11 @@ if echo "$NVIDIA" | grep -qE "GTX (9[0-9]{2}|10[0-9]{2})|GT 10[0-9]{2}|Quadro [P # 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" + # Remove all NVIDIA env lines and section headers (we re-add the correct ones below) + sed -i '/^env = \(NVD_BACKEND\|LIBVA_DRIVER_NAME\|__GLX_VENDOR_LIBRARY_NAME\),/d; /^# NVIDIA/d' "$ENVS_CONF" # Add correct environment variables for legacy GPUs - cat >>$ENVS_CONF <<'EOF' + cat >>"$ENVS_CONF" <<'EOF' # NVIDIA (Maxwell/Pascal/Volta without GSP firmware) env = NVD_BACKEND,egl