Remove modeset and add preserve memory

This commit is contained in:
Jeevitha Kannan K S 2024-10-12 10:49:02 +05:30
parent 6f89bca8d1
commit 1fe1bffe1f
No known key found for this signature in database
GPG Key ID: 5904C34A2F7CE333
2 changed files with 7 additions and 9 deletions

View File

@ -32,8 +32,8 @@ promptUser() {
[ "$confirm" = "y" ] || [ "$confirm" = "Y" ] [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]
} }
enableNvidiaModeset() { setKernelParam() {
PARAMETER="nvidia-drm.modeset=1" PARAMETER="$1"
if grep -q "$PARAMETER" /etc/default/grub; then if grep -q "$PARAMETER" /etc/default/grub; then
printf "%b\n" "${YELLOW}NVIDIA modesetting is already enabled in GRUB.${RC}" printf "%b\n" "${YELLOW}NVIDIA modesetting is already enabled in GRUB.${RC}"
@ -50,12 +50,6 @@ setupHardwareAcceleration() {
return; return;
fi fi
modeset=$("$ESCALATION_TOOL" cat /sys/module/nvidia_drm/parameters/modeset)
if [ ! "$modeset" = "Y" ]; then
enableNvidiaModeset
fi
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libva-nvidia-driver "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libva-nvidia-driver
mkdir -p "$HOME/linuxtoolbox" mkdir -p "$HOME/linuxtoolbox"
@ -98,6 +92,10 @@ installDriver() {
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm nvidia-dkms
fi fi
# Refer https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend
setKernelParam "nvidia.NVreg_PreserveVideoMemoryAllocations=1"
"$ESCALATION_TOOL" systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service
printf "%b\n" "${GREEN}Driver installed successfully.${RC}" printf "%b\n" "${GREEN}Driver installed successfully.${RC}"
if promptUser "setup Hardware Acceleration"; then if promptUser "setup Hardware Acceleration"; then
setupHardwareAcceleration setupHardwareAcceleration

View File

@ -19,7 +19,7 @@ task_list = "SI D"
name = "Nvidia Drivers && Hardware Acceleration" name = "Nvidia Drivers && Hardware Acceleration"
description = "This script installs and configures nvidia drivers with Hardware Acceleration." description = "This script installs and configures nvidia drivers with Hardware Acceleration."
script = "arch/nvidia-drivers.sh" script = "arch/nvidia-drivers.sh"
task_list = "I FM" task_list = "I FM SS"
[[data.entries]] [[data.entries]]
name = "Paru AUR Helper" name = "Paru AUR Helper"