@@ -14,15 +14,15 @@ installDeps() {
14
14
printf " %b\n" " ${CYAN} Installing headers for $kernel ...${RC} "
15
15
" $ESCALATION_TOOL " " $PACKAGER " -S --needed --noconfirm " $header "
16
16
done
17
-
18
17
}
19
18
20
19
checkHardware () {
20
+ # Refer https://nouveau.freedesktop.org/CodeNames.html for model code names
21
21
model=$( lspci -k | grep -A 2 -E " (VGA|3D)" | grep controller | cut -d ' ' -f 7 | cut -c 1-2 )
22
22
case " $model " in
23
23
GM|GP|GV) return 1 ;;
24
24
TU|GA|AD) return 0 ;;
25
- * ) printf " %b\n" " ${RED} Your hardware is not supported ." && exit 1 ;;
25
+ * ) printf " %b\n" " ${RED} Unsupported hardware." && exit 1 ;;
26
26
esac
27
27
}
28
28
@@ -40,13 +40,18 @@ enableNvidiaModeset() {
40
40
else
41
41
" $ESCALATION_TOOL " sed -i " /^GRUB_CMDLINE_LINUX_DEFAULT=/ s/\" $/ $PARAMETER \" /" /etc/default/grub
42
42
printf " %b\n" " ${CYAN} Added $PARAMETER to /etc/default/grub.${RC} "
43
-
44
43
" $ESCALATION_TOOL " grub-mkconfig -o /boot/grub/grub.cfg
45
44
fi
46
45
}
47
46
48
- setupHardwareAccelration () {
47
+ setupHardwareAcceleration () {
48
+ if ! command_exists grub-mkconfig; then
49
+ printf " %b\n" " ${RED} Currently hardware acceleration is only available with GRUB.${RC} "
50
+ return ;
51
+ fi
52
+
49
53
modeset=$( " $ESCALATION_TOOL " cat /sys/module/nvidia_drm/parameters/modeset)
54
+
50
55
if [ ! " $modeset " = " Y" ]; then
51
56
enableNvidiaModeset
52
57
fi
@@ -70,18 +75,19 @@ setupHardwareAccelration() {
70
75
71
76
printf " LIBVA_DRIVER_NAME=nvidia\nMOZ_DISABLE_RDD_SANDBOX=1" | " $ESCALATION_TOOL " tee -a /etc/environment > /dev/null
72
77
73
- printf " %b\n" " ${GREEN} Hardware Accelration setup completed successfully.${RC} "
78
+ printf " %b\n" " ${GREEN} Hardware Acceleration setup completed successfully.${RC} "
74
79
75
- if promptUser " enable hardware accelration in mpv player" ; then
80
+ if promptUser " enable hardware Acceleration in mpv player" ; then
76
81
if [ -f " $HOME /.config/mpv/mpv.conf" ]; then
77
82
sed -i ' /^hwdec/d' " $HOME /.config/mpv/mpv.conf"
78
83
fi
79
84
printf " hwdec=auto" | tee -a " $HOME /.config/mpv/mpv.conf" > /dev/null
80
- printf " %b\n" " ${GREEN} MPV Hardware Accelration enabled successfully.${RC} "
85
+ printf " %b\n" " ${GREEN} MPV Hardware Acceleration enabled successfully.${RC} "
81
86
fi
82
87
}
83
88
84
89
installDriver () {
90
+ # Refer https://wiki.archlinux.org/title/NVIDIA for open-dkms or dkms driver selection
85
91
if checkHardware && promptUser " install nvidia's open source drivers" ; then
86
92
printf " %b\n" " ${YELLOW} Installing nvidia open source driver...${RC} "
87
93
installDeps
@@ -92,13 +98,9 @@ installDriver() {
92
98
" $ESCALATION_TOOL " " $PACKAGER " -S --needed --noconfirm nvidia-dkms
93
99
fi
94
100
95
- if echo " $XDG_CURRENT_DESKTOP " | grep -q " GNOME" ; then
96
- " $ESCALATION_TOOL " systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service
97
- fi
98
-
99
101
printf " %b\n" " ${GREEN} Driver installed successfully.${RC} "
100
- if command_exists grub-mkconfig && promptUser " setup hardware accelration " ; then
101
- setupHardwareAccelration
102
+ if promptUser " setup hardware Acceleration " ; then
103
+ setupHardwareAcceleration
102
104
fi
103
105
104
106
printf " %b\n" " ${GREEN} Please reboot your system for the changes to take effect.${RC} "
0 commit comments