From 42d7e506777436d5e98ca02bd4a5f2da451cf485 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Mon, 29 Jan 2024 11:20:48 -0500 Subject: [PATCH 1/8] starfive visionfive2: update kernel to 6.6.0 --- starfive/visionfive/v2/linux-6.6.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/starfive/visionfive/v2/linux-6.6.nix b/starfive/visionfive/v2/linux-6.6.nix index 8e7b445..5999dd6 100644 --- a/starfive/visionfive/v2/linux-6.6.nix +++ b/starfive/visionfive/v2/linux-6.6.nix @@ -9,8 +9,8 @@ let src = fetchFromGitHub { owner = "starfive-tech"; repo = "linux"; - rev = "7ccbe4604c1498e880cc63c7e8b45e3c55914d6d"; - hash = "sha256-iO7tnnWYfveVbyvVZKL0dDLwONijt1n0RUD1kTkOQew="; + rev = "13eb70da2a73187c8c7aece13d23d68928aa8210"; + hash = "sha256-bwB7Pc+Z+MWXPfWYdgtRGuhqjiNHLDGNCY62e4lBGvE="; }; inherit modDirVersion kernelPatches; From 80223acd7f2cfe4ea103bc7e0d671f8a23b35990 Mon Sep 17 00:00:00 2001 From: ChaosAttractor Date: Tue, 30 Jan 2024 04:54:38 +0800 Subject: [PATCH 2/8] ga401: enable nvidia.dynamicBoost --- asus/zephyrus/ga401/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/asus/zephyrus/ga401/default.nix b/asus/zephyrus/ga401/default.nix index edb3a5b..f79128d 100644 --- a/asus/zephyrus/ga401/default.nix +++ b/asus/zephyrus/ga401/default.nix @@ -16,6 +16,8 @@ modesetting.enable = lib.mkDefault true; # Enable DRM kernel mode setting powerManagement.enable = lib.mkDefault true; + + dynamicBoost.enable = true; prime = { amdgpuBusId = "PCI:4:0:0"; From 83ce5906a5b9a798ef2e653ddc12491c1b9e9929 Mon Sep 17 00:00:00 2001 From: ChaosAttractor Date: Tue, 30 Jan 2024 04:55:36 +0800 Subject: [PATCH 3/8] ga401: disable hardware.nvidia.powerManagement.enable --- asus/zephyrus/ga401/default.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/asus/zephyrus/ga401/default.nix b/asus/zephyrus/ga401/default.nix index f79128d..726f58e 100644 --- a/asus/zephyrus/ga401/default.nix +++ b/asus/zephyrus/ga401/default.nix @@ -11,11 +11,9 @@ ]; hardware.nvidia = { - # PCI-Express Runtime D3 Power Management is enabled by default on this laptop - # But it can fix screen tearing & suspend/resume screen corruption in sync mode - modesetting.enable = lib.mkDefault true; # Enable DRM kernel mode setting - powerManagement.enable = lib.mkDefault true; + # This will also cause "PCI-Express Runtime D3 Power Management" to be enabled by default + modesetting.enable = lib.mkDefault true; dynamicBoost.enable = true; From 3b54f86b535735d22f2f18ec90a8c0c9ba508f6e Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Sun, 28 Jan 2024 12:00:00 +0000 Subject: [PATCH 4/8] dell inspiron 5515: add early kms since the update to 23.11, the screen would remain black frequently on boot. Pressing alt+sysrq+k would make the display manager start. Empirically, setting early kms up has solved the issue. --- dell/inspiron/5515/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dell/inspiron/5515/default.nix b/dell/inspiron/5515/default.nix index 5e1fa64..c2e8e31 100644 --- a/dell/inspiron/5515/default.nix +++ b/dell/inspiron/5515/default.nix @@ -29,5 +29,9 @@ # https://bbs.archlinux.org/viewtopic.php?id=266108 says linux >= 5.12 required boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") pkgs.linuxPackages_latest; + # sometimes boots to a black screen, and pressing alt+sysrq+k makes the + # display manager start + # fixed by early kernel modesetting + boot.initrd.kernelModules = [ "amdgpu" ]; } From 58b17dc23452c1827a38660c44db16ea6f599f2c Mon Sep 17 00:00:00 2001 From: 4JX <79868816+4JX@users.noreply.github.com> Date: Fri, 19 Jan 2024 19:37:12 +0100 Subject: [PATCH 5/8] 16ach6h: Do not duplicate nvidia config --- lenovo/legion/16ach6h/default.nix | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lenovo/legion/16ach6h/default.nix b/lenovo/legion/16ach6h/default.nix index 523d9d0..fcd5746 100644 --- a/lenovo/legion/16ach6h/default.nix +++ b/lenovo/legion/16ach6h/default.nix @@ -6,13 +6,6 @@ specialisation.ddg.configuration = { # This specialisation is for the case where "DDG" (Dual-Direct GFX, A hardware feature that can enable in bios) is enabled, since the amd igpu is blocked at hardware level and the built-in display is directly connected to the dgpu, we no longer need the amdgpu and prime configuration. system.nixos.tags = [ "Dual-Direct-GFX-Mode" ]; - services.xserver.videoDrivers = [ "nvidia" ]; # This will override services.xserver.videoDrivers = lib.mkDefault [ "amdgpu" "nvidia" ]; - hardware = { - nvidia.prime.offload.enable = false; - amdgpu = { - amdvlk = false; - opencl = false; - }; - }; + imports = [ ./nvidia ]; }; -} \ No newline at end of file +} From 07e43b0530503b6034eb82f47bb9ae4af34f9f93 Mon Sep 17 00:00:00 2001 From: 4JX <79868816+4JX@users.noreply.github.com> Date: Fri, 19 Jan 2024 19:45:19 +0100 Subject: [PATCH 6/8] 16ach6h: Fix X11 setup Fixes #628 --- lenovo/legion/16ach6h/hybrid/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lenovo/legion/16ach6h/hybrid/default.nix b/lenovo/legion/16ach6h/hybrid/default.nix index ab94e1c..6381e6a 100644 --- a/lenovo/legion/16ach6h/hybrid/default.nix +++ b/lenovo/legion/16ach6h/hybrid/default.nix @@ -11,6 +11,15 @@ ../edid ]; + # Still needs to load at some point if we want X11 to work + boot.kernelModules = [ "amdgpu" ]; + + # modesetting just doesn't work (on X11?), so get rid of it by only explicitly declaring nvidia + # Needed due to https://github.com/NixOS/nixos-hardware/commit/630a8e3e4eea61d35524699f2f59dbc64886357d + # See also https://github.com/NixOS/nixos-hardware/issues/628 + # options.services.xserver.drivers will have a amdgpu entry from using the prime stuff in nixpkgs + services.xserver.videoDrivers = [ "nvidia" ]; + hardware = { amdgpu.loadInInitrd = lib.mkDefault false; @@ -24,4 +33,4 @@ }; }; }; -} \ No newline at end of file +} From ed01236ece433b5fe96ebd7fe104f18f790aa066 Mon Sep 17 00:00:00 2001 From: 4JX <79868816+4JX@users.noreply.github.com> Date: Fri, 19 Jan 2024 19:46:38 +0100 Subject: [PATCH 7/8] 16ach6h: Comment out failing edid line Fixes #795 --- lenovo/legion/16ach6h/edid/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lenovo/legion/16ach6h/edid/default.nix b/lenovo/legion/16ach6h/edid/default.nix index ec77c24..81c44d5 100644 --- a/lenovo/legion/16ach6h/edid/default.nix +++ b/lenovo/legion/16ach6h/edid/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ...}: +{ pkgs, ... }: let # This file was obtained from the display while "DDG" mode was enabled. @@ -11,5 +11,7 @@ in hardware.firmware = [ chip_edid ]; boot.kernelParams = [ "drm.edid_firmware=edid/16ach6h.bin" ]; - boot.initrd.extraFiles."lib/firmware/edid/16ach6h.bin".source = pkgs.runCommandLocal "chip_edid" { } "cp ${./16ach6h.bin} $out"; -} \ No newline at end of file + # This fails at the moment, https://github.com/NixOS/nixos-hardware/issues/795 + # Extra refresh rates seem to work regardless + # boot.initrd.extraFiles."lib/firmware/edid/16ach6h.bin".source = pkgs.runCommandLocal "chip_edid" { } "cp ${./16ach6h.bin} $out"; +} From cc65e27670abccced5997d4a93c4c930aef6fd0b Mon Sep 17 00:00:00 2001 From: 4JX <79868816+4JX@users.noreply.github.com> Date: Sun, 28 Jan 2024 01:25:14 +0100 Subject: [PATCH 8/8] Better default for amdgpuBusId --- lenovo/legion/16ach6h/README.md | 6 ++++++ lenovo/legion/16ach6h/hybrid/default.nix | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lenovo/legion/16ach6h/README.md b/lenovo/legion/16ach6h/README.md index f8c1190..19f6c24 100644 --- a/lenovo/legion/16ach6h/README.md +++ b/lenovo/legion/16ach6h/README.md @@ -3,6 +3,12 @@ Due to the introduction of DDG feature, you may toggle DDG frequently, so for th **But It will slow down NixOS evaluation by factor 2 and increase memory usage.** So if you don't need specialization feature, you can just use hybrid only configuration or nvidia only (DDG only) configuration +## Using multiple drives with this configuration + +When using more than one drive, the value of `hardware.nvidia.prime.amdgpuBusId` will change from the default of `PCI:5:0:0`. + +Make sure you override this default in your personal configuration. For two drives, it should be `PCI:6:0:0`. + ## Setup at the time of testing ``` $ nix-info -m diff --git a/lenovo/legion/16ach6h/hybrid/default.nix b/lenovo/legion/16ach6h/hybrid/default.nix index 6381e6a..51e10dc 100644 --- a/lenovo/legion/16ach6h/hybrid/default.nix +++ b/lenovo/legion/16ach6h/hybrid/default.nix @@ -28,7 +28,7 @@ powerManagement.enable = lib.mkDefault true; prime = { - amdgpuBusId = "PCI:6:0:0"; + amdgpuBusId = lib.mkDefault "PCI:5:0:0"; nvidiaBusId = "PCI:1:0:0"; }; };