From 142c8ab9a4b292b4ec1527361fad3b6b77549a55 Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Fri, 5 Jul 2024 15:04:27 -0700 Subject: [PATCH] nixos/nvidia: enable fbdev when available In my experience this is required to get Plasma 6 Wayland to work on my GTX 1080 with the proprietary driver. Otherwise, I get errors in my `journalctl --user` about "MESA-LOADER: failed to open simpledrm" (among many other things) and Plasma just presents a black screen with a cursor and nothing else. I discovered this by searching the aforementioned error and found [this Arch Linux forum post][0] and some further clicking around led me to [this section on the ArchWiki][1], which is where I got the `versionAtLeast` value from. Tested with `nvidia-x11-555.58-6.9.7`. [0]: https://bbs.archlinux.org/viewtopic.php?id=293741 [1]: https://wiki.archlinux.org/title/NVIDIA#DRM_kernel_mode_setting --- nixos/modules/hardware/video/nvidia.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix index e38050e637b1..94d6acbdefea 100644 --- a/nixos/modules/hardware/video/nvidia.nix +++ b/nixos/modules/hardware/video/nvidia.nix @@ -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";