-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-nitro-gpu.sh
More file actions
114 lines (95 loc) · 3.25 KB
/
fix-nitro-gpu.sh
File metadata and controls
114 lines (95 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
# Acer Nitro V16 Cinnamon + NVIDIA Fix Script
# Fixes GPU power management and fan issues after DE switching
echo "=== Acer Nitro V16 GPU & Fan Fix for Cinnamon ==="
echo ""
# 1. Check current GPU mode
echo "[1/6] Checking current GPU configuration..."
prime-select query 2>/dev/null || echo "prime-select not found, will install"
echo ""
# 2. Install necessary packages
echo "[2/6] Installing GPU management tools..."
sudo apt update
sudo apt install -y nvidia-prime system76-power tlp tlp-rdw
echo ""
# 3. Set GPU to on-demand mode (hybrid)
echo "[3/6] Setting GPU to on-demand (hybrid) mode..."
sudo prime-select on-demand
echo ""
# 4. Configure TLP for better power management
echo "[4/6] Configuring TLP for laptop power management..."
sudo tee /etc/tlp.conf > /dev/null <<'EOF'
# TLP configuration for Acer Nitro V16
# CPU Scaling Governor
CPU_SCALING_GOVERNOR_ON_AC=performance
CPU_SCALING_GOVERNOR_ON_BAT=powersave
# CPU Energy Performance
CPU_ENERGY_PERF_POLICY_ON_AC=balance_performance
CPU_ENERGY_PERF_POLICY_ON_BAT=power
# CPU Boost
CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0
# Platform Profile (AMD)
PLATFORM_PROFILE_ON_AC=balanced
PLATFORM_PROFILE_ON_BAT=low-power
# Runtime Power Management for PCI(e) devices
RUNTIME_PM_ON_AC=auto
RUNTIME_PM_ON_BAT=auto
# NVIDIA GPU runtime power management
RUNTIME_PM_DRIVER_DENYLIST="nouveau nvidia"
# SATA Link Power Management
SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"
# WiFi Power Saving
WIFI_PWR_ON_AC=off
WIFI_PWR_ON_BAT=on
EOF
sudo systemctl enable tlp
sudo systemctl start tlp
echo ""
# 5. Fix Cinnamon compositor settings
echo "[5/6] Optimizing Cinnamon settings for hybrid GPU..."
gsettings set org.cinnamon.desktop.wm.preferences unredirect-fullscreen-windows true
gsettings set org.cinnamon.muffin unredirect-fullscreen-windows true
echo ""
# 6. Set NVIDIA settings to use integrated GPU by default
echo "[6/6] Configuring NVIDIA to use iGPU by default..."
sudo tee /etc/environment.d/50-nvidia-prime.conf > /dev/null <<'EOF'
# Use integrated GPU by default
__NV_PRIME_RENDER_OFFLOAD=0
__GLX_VENDOR_LIBRARY_NAME=
DRI_PRIME=
EOF
# Add NVIDIA offload functions to bashrc
if ! grep -q "nvidia-offload" ~/.bashrc; then
cat >> ~/.bashrc <<'EOF'
# NVIDIA GPU offload functions
alias nvidia-offload='__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia'
alias nvidia-run='DRI_PRIME=1 __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia'
EOF
fi
echo ""
echo "=== Fix Complete! ==="
echo ""
echo "What was done:"
echo "✓ Installed GPU power management tools"
echo "✓ Set GPU to on-demand (hybrid) mode"
echo "✓ Configured TLP for better laptop power management"
echo "✓ Fixed Cinnamon compositor settings"
echo "✓ Set system to use integrated GPU by default"
echo ""
echo "IMPORTANT: REBOOT NOW for changes to take effect!"
echo ""
echo "After reboot:"
echo "• Normal use = AMD iGPU (quiet fans, cool temps)"
echo "• Gaming = Run games with: nvidia-run <game-command>"
echo " Example: nvidia-run steam"
echo ""
echo "To check GPU status: prime-select query"
echo "To check which GPU is active: nvidia-smi"
echo ""
read -p "Reboot now? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
sudo reboot
fi