From 9da7de788eefb36267edcb15243ce63de568db57 Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Mon, 20 Feb 2023 11:34:31 -0500 Subject: [PATCH] Add ability to disable setting clock to min-max on resume from sleep for SD --- backend/src/settings/steam_deck/cpu.rs | 2 +- backend/src/settings/steam_deck/gpu.rs | 2 +- backend/src/settings/steam_deck/oc_limits.rs | 4 +++ pt_oc.json | 27 +++++++++++++------- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/backend/src/settings/steam_deck/cpu.rs b/backend/src/settings/steam_deck/cpu.rs index 909b3a7..426497d 100644 --- a/backend/src/settings/steam_deck/cpu.rs +++ b/backend/src/settings/steam_deck/cpu.rs @@ -273,7 +273,7 @@ impl Cpu { setting: crate::settings::SettingVariant::Cpu, }, )?; - } else if self.state.clock_limits_set || self.state.is_resuming { + } else if self.state.clock_limits_set || (self.state.is_resuming && !self.limits.skip_resume_reclock) { self.state.clock_limits_set = false; // disable manual clock limits log::debug!("Setting CPU {} to default clockspeed", self.index); diff --git a/backend/src/settings/steam_deck/gpu.rs b/backend/src/settings/steam_deck/gpu.rs index 3253a8a..cf5e788 100644 --- a/backend/src/settings/steam_deck/gpu.rs +++ b/backend/src/settings/steam_deck/gpu.rs @@ -125,7 +125,7 @@ impl Gpu { setting: crate::settings::SettingVariant::Gpu, }, )?; - } else if self.state.clock_limits_set || self.state.is_resuming { + } else if self.state.clock_limits_set || (self.state.is_resuming && !self.limits.skip_resume_reclock) { self.state.clock_limits_set = false; // disable manual clock limits // max clock diff --git a/backend/src/settings/steam_deck/oc_limits.rs b/backend/src/settings/steam_deck/oc_limits.rs index 47e84be..3e64bf6 100644 --- a/backend/src/settings/steam_deck/oc_limits.rs +++ b/backend/src/settings/steam_deck/oc_limits.rs @@ -83,6 +83,7 @@ pub(super) struct CpuLimits { pub clock_min: MinMax, pub clock_max: MinMax, pub clock_step: u64, + pub skip_resume_reclock: bool, } impl Default for CpuLimits { @@ -91,6 +92,7 @@ impl Default for CpuLimits { clock_min: MinMax { min: 1400, max: 3500 }, clock_max: MinMax { min: 400, max: 3500 }, clock_step: 100, + skip_resume_reclock: false, } } } @@ -104,6 +106,7 @@ pub(super) struct GpuLimits { pub clock_min: MinMax, pub clock_max: MinMax, pub clock_step: u64, + pub skip_resume_reclock: bool, } impl Default for GpuLimits { @@ -116,6 +119,7 @@ impl Default for GpuLimits { clock_min: MinMax { min: 200, max: 1600 }, clock_max: MinMax { min: 200, max: 1600 }, clock_step: 100, + skip_resume_reclock: false, } } } diff --git a/pt_oc.json b/pt_oc.json index 3d30b49..36dba50 100644 --- a/pt_oc.json +++ b/pt_oc.json @@ -7,42 +7,50 @@ { "clock_min": {"min": 1400, "max": 3500}, "clock_max": {"min": 500, "max": 3500}, - "clock_step": 100 + "clock_step": 100, + "skip_resume_reclock": false }, { "clock_min": {"min": 1400, "max": 3500}, "clock_max": {"min": 500, "max": 3500}, - "clock_step": 100 + "clock_step": 100, + "skip_resume_reclock": false }, { "clock_min": {"min": 1400, "max": 3500}, "clock_max": {"min": 500, "max": 3500}, - "clock_step": 100 + "clock_step": 100, + "skip_resume_reclock": false }, { "clock_min": {"min": 1400, "max": 3500}, "clock_max": {"min": 500, "max": 3500}, - "clock_step": 100 + "clock_step": 100, + "skip_resume_reclock": false }, { "clock_min": {"min": 1400, "max": 3500}, "clock_max": {"min": 500, "max": 3500}, - "clock_step": 100 + "clock_step": 100, + "skip_resume_reclock": false }, { "clock_min": {"min": 1400, "max": 3500}, "clock_max": {"min": 500, "max": 3500}, - "clock_step": 100 + "clock_step": 100, + "skip_resume_reclock": false }, { "clock_min": {"min": 1400, "max": 3500}, "clock_max": {"min": 500, "max": 3500}, - "clock_step": 100 + "clock_step": 100, + "skip_resume_reclock": false }, { "clock_min": {"min": 1400, "max": 3500}, "clock_max": {"min": 500, "max": 3500}, - "clock_step": 100 + "clock_step": 100, + "skip_resume_reclock": false } ], "global_governors": false @@ -54,6 +62,7 @@ "ppt_step": 1, "clock_min": {"min": 200, "max": 1600}, "clock_max": {"min": 200, "max": 1600}, - "clock_step": 100 + "clock_step": 100, + "skip_resume_reclock": false } }