Merge pull request #324921 from CobaltCause/more-magic-kernel-params

nixos/nvidia: enable fbdev when available
This commit is contained in:
K900 2024-07-11 09:39:35 +03:00 committed by GitHub
commit 1f86d2ae2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,7 +96,11 @@ in
Enabling this fixes screen tearing when using Optimus via PRIME (see
{option}`hardware.nvidia.prime.sync.enable`. This is not enabled
by default because it is not officially supported by NVIDIA and would not
work with SLI
work with SLI.
Enabling this and using version 545 or newer of the proprietary NVIDIA
driver causes it to provide its own framebuffer device, which can cause
Wayland compositors to work when they otherwise wouldn't.
'';
prime.nvidiaBusId = lib.mkOption {
@ -568,9 +572,10 @@ in
"nvidia_drm"
];
# If requested enable modesetting via kernel parameter.
# If requested enable modesetting via kernel parameters.
kernelParams =
lib.optional (offloadCfg.enable || cfg.modesetting.enable) "nvidia-drm.modeset=1"
++ lib.optional ((offloadCfg.enable || cfg.modesetting.enable) && lib.versionAtLeast nvidia_x11.version "545") "nvidia-drm.fbdev=1"
++ lib.optional cfg.powerManagement.enable "nvidia.NVreg_PreserveVideoMemoryAllocations=1"
++ lib.optional cfg.open "nvidia.NVreg_OpenRmEnableUnsupportedGpus=1"
++ lib.optional (config.boot.kernelPackages.kernel.kernelAtLeast "6.2" && !ibtSupport) "ibt=off";