try some nvidia clocks

This commit is contained in:
Kopatz
2025-02-10 18:25:36 +01:00
parent 67c3a21777
commit 72b94b1d4b
3 changed files with 45 additions and 2 deletions

View File

@@ -351,6 +351,7 @@ exec_always --no-startup-id sleep 5 && pactl list short sources | grep 'alsa_inp
exec --no-startup-id /usr/bin/env dunst exec --no-startup-id /usr/bin/env dunst
# alternative if you installed aside with XFCE4: # alternative if you installed aside with XFCE4:
# exec --no-startup-id /usr/lib/xfce4/notifyd/xfce4-notifyd & # exec --no-startup-id /usr/lib/xfce4/notifyd/xfce4-notifyd &
exec --no-startup-id nvidia-settings -a "[gpu:0]/GPUGraphicsClockOffsetAllPerformanceLevels=230"
# autotiling script # autotiling script
# https://github.com/nwg-piotr/autotiling # https://github.com/nwg-piotr/autotiling

View File

@@ -11,6 +11,21 @@ in {
description = "The power limit to set the GPU to"; description = "The power limit to set the GPU to";
}; };
}; };
clock = {
enable = lib.mkEnableOption "Set GPU clocks";
min = lib.mkOption {
type = lib.types.int;
description = "The minimum GPU clock to set";
};
max = lib.mkOption {
type = lib.types.int;
description = "The maximum GPU clock to set";
};
offset = lib.mkOption {
type = lib.types.int;
description = "The GPU clock offset to set";
};
};
}; };
config = let config = let
@@ -88,9 +103,10 @@ in {
libvdpau-va-gl libvdpau-va-gl
libva libva
libva-utils libva-utils
(gwe.override { nvidia_x11 = config.hardware.nvidia.package; })
]; ];
systemd.services.nvpl = lib.mkIf cfg.powerLimit.enable { systemd.services.nvidiaSetPower = lib.mkIf cfg.powerLimit.enable {
description = description =
"Increase GPU power limit to ${toString cfg.powerLimit.wattage} watts"; "Increase GPU power limit to ${toString cfg.powerLimit.wattage} watts";
script = "/run/current-system/sw/bin/nvidia-smi -pl=${ script = "/run/current-system/sw/bin/nvidia-smi -pl=${
@@ -98,5 +114,26 @@ in {
}"; }";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
}; };
systemd.services.nvidiaSetClocks = lib.mkIf cfg.clock.enable {
description = "Set GPU clocks";
script = ''/run/current-system/sw/bin/nvidia-smi -i 0 -lgc ${toString cfg.clock.min},${toString cfg.clock.max}'';
wantedBy = [ "multi-user.target" ];
after = [ "display-manager.service" ];
requires = [ "display-manager.service" ];
environment.DISPLAY = ":0";
environment.XAUTHORITY = "/home/kopatz/.Xauthority";
};
systemd.user.services.nvidiaSetOffset = lib.mkIf cfg.clock.enable {
description = "Sets gpu offset";
enable = true;
serviceConfig = { Type = "oneshot"; };
script = ''
${config.hardware.nvidia.package.settings}/bin/nvidia-settings -a "[gpu:0]/GPUGraphicsClockOffsetAllPerformanceLevels=${
toString cfg.clock.offset
}"'';
environment = { DISPLAY = ":0"; };
after = [ "xdg-desktop-autostart.target" ];
wantedBy = [ "default.target" ];
};
}); });
} }

View File

@@ -44,7 +44,12 @@
android.enable = true; android.enable = true;
nvidia = { nvidia = {
enable = true; enable = true;
powerLimit.enable = true; clock = {
enable = true;
min = 210;
max = 1755;
offset = 230;
};
}; };
firmware.enable = true; firmware.enable = true;
ssd.enable = true; ssd.enable = true;