about summary refs log tree commit diff
path: root/nixos/modules/hardware
diff options
context:
space:
mode:
authorThiago Kenji Okada <thiagokokada@gmail.com>2022-06-02 17:50:50 +0100
committerGitHub <noreply@github.com>2022-06-02 17:50:50 +0100
commit64870a0c570bbed2bf9ed511c27bee28eba8c39c (patch)
tree7ba0ef8ff2ef0a379a74da1c8ba1c062bb95a2d0 /nixos/modules/hardware
parent1c9b93ae54d38ae3e23496d18fffa83ea777d1c8 (diff)
parent446d2cb0216dc02c37f6f4eb815a5c1754594a44 (diff)
Merge pull request #174259 from schuelermine/add-nixos-option/hardware.nvidia.forceFullCompositionPipeline
nixos/nvidia: add hardware.nvidia.forceFullCompositionPipeline
Diffstat (limited to 'nixos/modules/hardware')
-rw-r--r--nixos/modules/hardware/video/nvidia.nix23
1 files changed, 20 insertions, 3 deletions
diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix
index a5412b0de7644..85c8350fbbb21 100644
--- a/nixos/modules/hardware/video/nvidia.nix
+++ b/nixos/modules/hardware/video/nvidia.nix
@@ -163,8 +163,19 @@ in
       '';
     };
 
+    hardware.nvidia.forceFullCompositionPipeline = lib.mkOption {
+      default = false;
+      type = types.bool;
+      description = ''
+        Whether to force-enable the full composition pipeline.
+        This sometimes fixes screen tearing issues.
+        This has been reported to reduce the performance of some OpenGL applications and may produce issues in WebGL.
+        It also drastically increases the time the driver needs to clock down after load.
+      '';
+    };
+
     hardware.nvidia.package = lib.mkOption {
-      type = lib.types.package;
+      type = types.package;
       default = config.boot.kernelPackages.nvidiaPackages.stable;
       defaultText = literalExpression "config.boot.kernelPackages.nvidiaPackages.stable";
       description = ''
@@ -259,8 +270,14 @@ in
       screenSection =
         ''
           Option "RandRRotation" "on"
-          ${optionalString syncCfg.enable "Option \"AllowEmptyInitialConfiguration\""}
-        '';
+        '' + optionalString syncCfg.enable ''
+          Option "AllowEmptyInitialConfiguration"
+        '' + optionalString cfg.forceFullCompositionPipeline ''
+          Option         "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
+          Option         "AllowIndirectGLXProtocol" "off"
+          Option         "TripleBuffer" "on"
+        ''
+        ;
     };
 
     services.xserver.serverLayoutSection = optionalString syncCfg.enable ''