Merge branch 'master' into microsoft/surface/kernel-6.6

This commit is contained in:
mergify[bot] 2024-02-02 00:47:25 +00:00 committed by GitHub
commit 76cea60f68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 34 additions and 20 deletions

View file

@ -11,11 +11,11 @@
]; ];
hardware.nvidia = { 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 # 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;
prime = { prime = {
amdgpuBusId = "PCI:4:0:0"; amdgpuBusId = "PCI:4:0:0";

View file

@ -29,5 +29,9 @@
# https://bbs.archlinux.org/viewtopic.php?id=266108 says linux >= 5.12 required # 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; 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" ];
} }

View file

@ -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.** **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 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 ## Setup at the time of testing
``` ```
$ nix-info -m $ nix-info -m

View file

@ -6,13 +6,6 @@
specialisation.ddg.configuration = { 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. # 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" ]; system.nixos.tags = [ "Dual-Direct-GFX-Mode" ];
services.xserver.videoDrivers = [ "nvidia" ]; # This will override services.xserver.videoDrivers = lib.mkDefault [ "amdgpu" "nvidia" ]; imports = [ ./nvidia ];
hardware = {
nvidia.prime.offload.enable = false;
amdgpu = {
amdvlk = false;
opencl = false;
};
};
}; };
} }

View file

@ -1,4 +1,4 @@
{ pkgs, ...}: { pkgs, ... }:
let let
# This file was obtained from the display while "DDG" mode was enabled. # This file was obtained from the display while "DDG" mode was enabled.
@ -11,5 +11,7 @@ in
hardware.firmware = [ chip_edid ]; hardware.firmware = [ chip_edid ];
boot.kernelParams = [ "drm.edid_firmware=edid/16ach6h.bin" ]; 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"; # 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";
}

View file

@ -11,6 +11,15 @@
../edid ../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 = { hardware = {
amdgpu.loadInInitrd = lib.mkDefault false; amdgpu.loadInInitrd = lib.mkDefault false;
@ -19,9 +28,9 @@
powerManagement.enable = lib.mkDefault true; powerManagement.enable = lib.mkDefault true;
prime = { prime = {
amdgpuBusId = "PCI:6:0:0"; amdgpuBusId = lib.mkDefault "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0"; nvidiaBusId = "PCI:1:0:0";
}; };
}; };
}; };
} }

View file

@ -9,8 +9,8 @@ let
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "starfive-tech"; owner = "starfive-tech";
repo = "linux"; repo = "linux";
rev = "7ccbe4604c1498e880cc63c7e8b45e3c55914d6d"; rev = "13eb70da2a73187c8c7aece13d23d68928aa8210";
hash = "sha256-iO7tnnWYfveVbyvVZKL0dDLwONijt1n0RUD1kTkOQew="; hash = "sha256-bwB7Pc+Z+MWXPfWYdgtRGuhqjiNHLDGNCY62e4lBGvE=";
}; };
inherit modDirVersion kernelPatches; inherit modDirVersion kernelPatches;