mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
nixos/amdgpu: add overdrive and ppfeaturemask option (#411155)
- `programs.corectrl.gpuOverclock.enable` -> `hardware.amdgpu.overdrive.enable` - `programs.corectrl.gpuOverclock.ppfeaturemask` -> `hardware.amdgpu.overdrive.ppfeaturemask` - `programs.tuxclocker.enableAMD` -> `hardware.amdgpu.overdrive.enable`
This commit is contained in:
parent
84937b29d6
commit
c9f192da92
4 changed files with 50 additions and 39 deletions
|
@ -27,3 +27,6 @@
|
||||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||||
|
|
||||||
- `services.clamsmtp` is unmaintained and was removed from Nixpkgs.
|
- `services.clamsmtp` is unmaintained and was removed from Nixpkgs.
|
||||||
|
|
||||||
|
- `amdgpu` kernel driver overdrive mode can now be enabled by setting [hardware.amdgpu.overdrive.enable](#opt-hardware.amdgpu.overdrive.enable) and customized through [hardware.amdgpu.overdrive.ppfeaturemask](#opt-hardware.amdgpu.overdrive.ppfeaturemask).
|
||||||
|
This allows for fine-grained control over the GPU's performance and maybe required by overclocking softwares like Corectrl and Lact. These new options replace old options such as {option}`programs.corectrl.gpuOverclock.enable` and {option}`programs.tuxclocker.enableAMD`.
|
||||||
|
|
|
@ -8,13 +8,23 @@ let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkEnableOption
|
mkEnableOption
|
||||||
mkIf
|
mkIf
|
||||||
mkOption
|
|
||||||
mkPackageOption
|
mkPackageOption
|
||||||
;
|
;
|
||||||
|
|
||||||
cfg = config.programs.corectrl;
|
cfg = config.programs.corectrl;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
(lib.mkRenamedOptionModule
|
||||||
|
[ "programs" "corectrl" "gpuOverclock" "enable" ]
|
||||||
|
[ "hardware" "amdgpu" "overdrive" "enable" ]
|
||||||
|
)
|
||||||
|
(lib.mkRenamedOptionModule
|
||||||
|
[ "programs" "corectrl" "gpuOverclock" "ppfeaturemask" ]
|
||||||
|
[ "hardware" "amdgpu" "overdrive" "ppfeaturemask" ]
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
options.programs.corectrl = {
|
options.programs.corectrl = {
|
||||||
enable = mkEnableOption ''
|
enable = mkEnableOption ''
|
||||||
CoreCtrl, a tool to overclock amd graphics cards and processors.
|
CoreCtrl, a tool to overclock amd graphics cards and processors.
|
||||||
|
@ -24,23 +34,6 @@ in
|
||||||
package = mkPackageOption pkgs "corectrl" {
|
package = mkPackageOption pkgs "corectrl" {
|
||||||
extraDescription = "Useful for overriding the configuration options used for the package.";
|
extraDescription = "Useful for overriding the configuration options used for the package.";
|
||||||
};
|
};
|
||||||
|
|
||||||
gpuOverclock = {
|
|
||||||
enable = mkEnableOption ''
|
|
||||||
GPU overclocking
|
|
||||||
'';
|
|
||||||
ppfeaturemask = mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "0xfffd7fff";
|
|
||||||
example = "0xffffffff";
|
|
||||||
description = ''
|
|
||||||
Sets the `amdgpu.ppfeaturemask` kernel option.
|
|
||||||
In particular, it is used here to set the overdrive bit.
|
|
||||||
Default is `0xfffd7fff` as it is less likely to cause flicker issues.
|
|
||||||
Setting it to `0xffffffff` enables all features.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -61,12 +54,6 @@ in
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/amd/include/amd_shared.h#n169
|
|
||||||
# The overdrive bit
|
|
||||||
boot.kernelParams = mkIf cfg.gpuOverclock.enable [
|
|
||||||
"amdgpu.ppfeaturemask=${cfg.gpuOverclock.ppfeaturemask}"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta.maintainers = with lib.maintainers; [
|
meta.maintainers = with lib.maintainers; [
|
||||||
|
|
|
@ -16,21 +16,44 @@ in
|
||||||
series cards. Note: this removes support for analog video outputs,
|
series cards. Note: this removes support for analog video outputs,
|
||||||
which is only available in the `radeon` driver
|
which is only available in the `radeon` driver
|
||||||
'';
|
'';
|
||||||
|
|
||||||
initrd.enable = lib.mkEnableOption ''
|
initrd.enable = lib.mkEnableOption ''
|
||||||
loading `amdgpu` kernelModule in stage 1.
|
loading `amdgpu` kernelModule in stage 1.
|
||||||
Can fix lower resolution in boot screen during initramfs phase
|
Can fix lower resolution in boot screen during initramfs phase
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
overdrive = {
|
||||||
|
enable = lib.mkEnableOption ''`amdgpu` overdrive mode for overclocking'';
|
||||||
|
|
||||||
|
ppfeaturemask = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "0xfffd7fff";
|
||||||
|
example = "0xffffffff";
|
||||||
|
description = ''
|
||||||
|
Sets the `amdgpu.ppfeaturemask` kernel option. It can be used to enable the overdrive bit.
|
||||||
|
Default is `0xfffd7fff` as it is less likely to cause flicker issues. Setting it to
|
||||||
|
`0xffffffff` enables all features, but also can be unstable. See
|
||||||
|
[the kernel documentation](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/amd/include/amd_shared.h#n169)
|
||||||
|
for more information.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
opencl.enable = lib.mkEnableOption ''OpenCL support using ROCM runtime library'';
|
opencl.enable = lib.mkEnableOption ''OpenCL support using ROCM runtime library'';
|
||||||
# cfg.amdvlk option is defined in ./amdvlk.nix module
|
# cfg.amdvlk option is defined in ./amdvlk.nix module
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
boot.kernelParams = lib.optionals cfg.legacySupport.enable [
|
boot.kernelParams =
|
||||||
"amdgpu.si_support=1"
|
lib.optionals cfg.legacySupport.enable [
|
||||||
"amdgpu.cik_support=1"
|
"amdgpu.si_support=1"
|
||||||
"radeon.si_support=0"
|
"amdgpu.cik_support=1"
|
||||||
"radeon.cik_support=0"
|
"radeon.si_support=0"
|
||||||
];
|
"radeon.cik_support=0"
|
||||||
|
]
|
||||||
|
++ lib.optionals cfg.overdrive.enable [
|
||||||
|
"amdgpu.ppfeaturemask=${cfg.overdrive.ppfeaturemask}"
|
||||||
|
];
|
||||||
|
|
||||||
boot.initrd.kernelModules = lib.optionals cfg.initrd.enable [ "amdgpu" ];
|
boot.initrd.kernelModules = lib.optionals cfg.initrd.enable [ "amdgpu" ];
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,18 @@ let
|
||||||
cfg = config.programs.tuxclocker;
|
cfg = config.programs.tuxclocker;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
(lib.mkRenamedOptionModule
|
||||||
|
[ "programs" "tuxclocker" "enableAMD" ]
|
||||||
|
[ "hardware" "amdgpu" "overdrive" "enable" ]
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
options.programs.tuxclocker = {
|
options.programs.tuxclocker = {
|
||||||
enable = lib.mkEnableOption ''
|
enable = lib.mkEnableOption ''
|
||||||
TuxClocker, a hardware control and monitoring program
|
TuxClocker, a hardware control and monitoring program
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enableAMD = lib.mkEnableOption ''
|
|
||||||
AMD GPU controls.
|
|
||||||
Sets the `amdgpu.ppfeaturemask` kernel parameter to 0xfffd7fff to enable all TuxClocker controls
|
|
||||||
'';
|
|
||||||
|
|
||||||
enabledNVIDIADevices = lib.mkOption {
|
enabledNVIDIADevices = lib.mkOption {
|
||||||
type = lib.types.listOf lib.types.int;
|
type = lib.types.listOf lib.types.int;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
|
@ -72,9 +74,5 @@ in
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
lib.concatStrings (map configSection cfg.enabledNVIDIADevices);
|
lib.concatStrings (map configSection cfg.enabledNVIDIADevices);
|
||||||
|
|
||||||
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/amd/include/amd_shared.h#n207
|
|
||||||
# Enable everything modifiable in TuxClocker
|
|
||||||
boot.kernelParams = lib.mkIf cfg.enableAMD [ "amdgpu.ppfeaturemask=0xfffd7fff" ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue