mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2026-11-30 13:03:30 +01:00
Merge pull request #1992 from r-vdp/amdgpu-dcdebugmask-options
common/gpu/amd: add hardware.amdgpu.dcDebugMask options
This commit is contained in:
5 files changed
+64
-25
No files matched your search
@@ -0,0 +1,36 @@
|
||||
# Flag values from drivers/gpu/drm/amd/include/amd_shared.h
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
flags = {
|
||||
disablePipeSplit = 1;
|
||||
disableStutter = 2;
|
||||
disableDsc = 4;
|
||||
disableClockGating = 8;
|
||||
disablePsr = 16;
|
||||
disableMpo = 64;
|
||||
disablePsrSu = 512;
|
||||
disableReplay = 1024;
|
||||
disableIps = 2048;
|
||||
};
|
||||
|
||||
cfg = config.hardware.amdgpu.dcDebugMask;
|
||||
|
||||
mask = lib.foldlAttrs (
|
||||
acc: name: bit:
|
||||
if cfg.${name} then lib.bitOr acc bit else acc
|
||||
) 0 flags;
|
||||
in
|
||||
{
|
||||
options.hardware.amdgpu.dcDebugMask = lib.mapAttrs (
|
||||
_name: bit:
|
||||
lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Set flag 0x${lib.toHexString bit} in amdgpu.dcdebugmask.";
|
||||
}
|
||||
) flags;
|
||||
|
||||
config = lib.mkIf (mask != 0) {
|
||||
boot.kernelParams = [ "amdgpu.dcdebugmask=0x${lib.toHexString mask}" ];
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./dc-debug-mask.nix ];
|
||||
|
||||
config = {
|
||||
services.xserver.videoDrivers = lib.mkDefault [ "modesetting" ];
|
||||
|
||||
|
||||
@@ -6,18 +6,18 @@
|
||||
../../../common/gpu/amd
|
||||
];
|
||||
|
||||
boot.kernelParams = [
|
||||
# There seems to be an issue with panel self-refresh (PSR) that
|
||||
# causes hangs for users.
|
||||
#
|
||||
# https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459
|
||||
# https://gitlab.freedesktop.org/drm/amd/-/issues/3647
|
||||
"amdgpu.dcdebugmask=0x10"
|
||||
]
|
||||
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/
|
||||
++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [
|
||||
"rtc_cmos.use_acpi_alarm=1"
|
||||
];
|
||||
# There seems to be an issue with panel self-refresh (PSR) that
|
||||
# causes hangs for users.
|
||||
#
|
||||
# https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459
|
||||
# https://gitlab.freedesktop.org/drm/amd/-/issues/3647
|
||||
hardware.amdgpu.dcDebugMask.disablePsr = lib.mkDefault true;
|
||||
|
||||
boot.kernelParams =
|
||||
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/
|
||||
lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [
|
||||
"rtc_cmos.use_acpi_alarm=1"
|
||||
];
|
||||
|
||||
# AMD has better battery life with PPD over TLP:
|
||||
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
|
||||
# The following mitigations fix various graphics issues
|
||||
# See https://gist.github.com/lbrame/f9034b1a9fe4fc2d2835c5542acb170a#user-content-quick-version-apply-the-mitigations-i-am-personally-using
|
||||
hardware.amdgpu.dcDebugMask.disableReplay = lib.mkDefault true;
|
||||
|
||||
boot.kernelParams = [
|
||||
"amdgpu.dcdebugmask=0x410"
|
||||
"amdgpu.sg_display=0"
|
||||
"amdgpu.abmlevel=0"
|
||||
];
|
||||
|
||||
@@ -6,18 +6,18 @@
|
||||
../../../common/gpu/amd
|
||||
];
|
||||
|
||||
boot.kernelParams = [
|
||||
# There seems to be an issue with panel self-refresh (PSR) that
|
||||
# causes hangs for users.
|
||||
#
|
||||
# https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459
|
||||
# https://gitlab.freedesktop.org/drm/amd/-/issues/3647
|
||||
"amdgpu.dcdebugmask=0x10"
|
||||
]
|
||||
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/
|
||||
++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [
|
||||
"rtc_cmos.use_acpi_alarm=1"
|
||||
];
|
||||
# There seems to be an issue with panel self-refresh (PSR) that
|
||||
# causes hangs for users.
|
||||
#
|
||||
# https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459
|
||||
# https://gitlab.freedesktop.org/drm/amd/-/issues/3647
|
||||
hardware.amdgpu.dcDebugMask.disablePsr = lib.mkDefault true;
|
||||
|
||||
boot.kernelParams =
|
||||
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/
|
||||
lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [
|
||||
"rtc_cmos.use_acpi_alarm=1"
|
||||
];
|
||||
|
||||
# AMD has better battery life with PPD over TLP:
|
||||
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
|
||||
|
||||
Reference in new issue
Block a user