[Hardware/Nvidia] no longer enable EGLStream by default, use GBM by default

This commit is contained in:
Antoine Viallon 2023-05-11 19:16:04 +02:00
parent b19f93d591
commit 8c61e3f0da
Signed by: aviallon
GPG key ID: 186FC35EDEB25716

View file

@ -1,9 +1,13 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, options, ... }:
with lib; with lib;
let let
cfg = config.aviallon.hardware.nvidia; cfg = config.aviallon.hardware.nvidia;
generalCfg = config.aviallon.general; generalCfg = config.aviallon.general;
hardwareCfg = config.hardware;
toValue = x: if x then "1" else "0"; toValue = x: if x then "1" else "0";
xwaylandEGLStream = pkgs.writeShellScriptBin "xwayland" ''
exec ${options.programs.xwayland.package.default}/bin/xwayland -eglstream "$@"
'';
in { in {
options = { options = {
aviallon.hardware.nvidia.proprietary = { aviallon.hardware.nvidia.proprietary = {
@ -21,6 +25,15 @@ in {
example = 28; example = 28;
type = types.int; type = types.int;
}; };
EGLStream = mkOption {
description = "Wether to make some packages use EGLStream instead of GBM when using Wayland";
example = true;
default = false;
defaultText = literalExpression ''
versionOlder config.hardware.nvidia.package.version "490.29.05"; # https://www.nvidia.com/download/driverResults.aspx/181159/en-us/
'';
type = types.bool;
};
saveAllVram = mkEnableOption "back up all VRAM in /var/tmp before going to sleep. May reduce artifacts after resuming"; saveAllVram = mkEnableOption "back up all VRAM in /var/tmp before going to sleep. May reduce artifacts after resuming";
}; };
}; };
@ -56,6 +69,10 @@ in {
nvidiaSettings = true; nvidiaSettings = true;
}; };
aviallon.hardware.nvidia.proprietary.EGLStream = mkDefault (
versionOlder hardwareCfg.nvidia.package.version "490.29.05" # https://www.nvidia.com/download/driverResults.aspx/181159/en-us/
);
aviallon.programs.nvtop.nvidia = true; aviallon.programs.nvtop.nvidia = true;
aviallon.boot.cmdline = {} aviallon.boot.cmdline = {}
@ -69,6 +86,7 @@ in {
} }
; ;
programs.xwayland.package = mkIf cfg.proprietary.EGLStream xwaylandEGLStream;
aviallon.programs.allowUnfreeList = [ aviallon.programs.allowUnfreeList = [
"nvidia-x11" "nvidia-x11"
"nvidia-settings" "nvidia-settings"
@ -98,7 +116,7 @@ in {
"__GL_VRR_ALLOWED" = "1"; # Try to enable G-SYNC VRR if screen AND app is compatible "__GL_VRR_ALLOWED" = "1"; # Try to enable G-SYNC VRR if screen AND app is compatible
"__GL_SYNC_TO_VBLANK" = toValue cfg.proprietary.vsync; "__GL_SYNC_TO_VBLANK" = toValue cfg.proprietary.vsync;
"__GL_THREADED_OPTIMIZATIONS" = toValue generalCfg.unsafeOptimizations; "__GL_THREADED_OPTIMIZATIONS" = toValue generalCfg.unsafeOptimizations;
"KWIN_DRM_USE_EGL_STREAMS" = "1"; # Make KWin use EGL Streams, because otherwise performance will be horrible. "KWIN_DRM_USE_EGL_STREAMS" = toValue cfg.proprietary.EGLStream; # Make KWin use EGL Streams if needed, because otherwise performance will be horrible.
}; };
}; };
} }