From 6261a2842933491190fb2d20959513a252afb7af Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 12 Jul 2022 20:01:42 -0400 Subject: [PATCH] conditionally turn on power management and modesetting when we are in sync mode --- lenovo/thinkpad/p50/default.nix | 15 +++++++++++++-- lenovo/thinkpad/p51/default.nix | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/lenovo/thinkpad/p50/default.nix b/lenovo/thinkpad/p50/default.nix index 4b249bf..04f88cf 100644 --- a/lenovo/thinkpad/p50/default.nix +++ b/lenovo/thinkpad/p50/default.nix @@ -1,5 +1,4 @@ -{ lib, pkgs, ... }: -{ +{ lib, config, ... }: { imports = [ ../../../common/gpu/nvidia.nix ../../../common/cpu/intel @@ -25,6 +24,18 @@ # required to make wireless work hardware.enableAllFirmware = lib.mkDefault true; + # fix suspend/resume screen corruption in sync mode + hardware.nvidia.powerManagement = + lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; + + # fix screen tearing in sync mode + hardware.nvidia.modesetting = + lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; + # throttled vs. thermald # ----------------------- # diff --git a/lenovo/thinkpad/p51/default.nix b/lenovo/thinkpad/p51/default.nix index 0b3d16b..d3de794 100644 --- a/lenovo/thinkpad/p51/default.nix +++ b/lenovo/thinkpad/p51/default.nix @@ -1,5 +1,4 @@ -{ lib, ... }: -{ +{ config, lib, ... }: { imports = [ ../../../common/gpu/nvidia.nix ../../../common/cpu/intel @@ -26,6 +25,18 @@ # required to make wireless work hardware.enableAllFirmware = lib.mkDefault true; + # fix suspend/resume screen corruption in sync mode + hardware.nvidia.powerManagement = + lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; + + # fix screen tearing in sync mode + hardware.nvidia.modesetting = + lib.mkIf config.hardware.nvidia.prime.sync.enable { + enable = lib.mkDefault true; + }; + # throttled vs. thermald # ----------------------- #