From 33c41c3e3da7ad3f5a0e5cbfd737332db70eec18 Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Thu, 24 Aug 2023 21:22:43 -0400 Subject: [PATCH] Unset slow memory properly, if the kernel behaved as documented --- backend/src/settings/steam_deck/gpu.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/backend/src/settings/steam_deck/gpu.rs b/backend/src/settings/steam_deck/gpu.rs index de68403..f1f428b 100644 --- a/backend/src/settings/steam_deck/gpu.rs +++ b/backend/src/settings/steam_deck/gpu.rs @@ -182,12 +182,22 @@ impl Gpu { fn set_slow_memory(&self, slow: bool) -> Result<(), SettingError> { let path = GPU_MEMORY_DOWNCLOCK_ATTRIBUTE.path(&self.sysfs_card); - self.sysfs_card.set(GPU_MEMORY_DOWNCLOCK_ATTRIBUTE.to_owned(), slow as u8).map_err(|e| { - SettingError { - msg: format!("Failed to write to `{}`: {}", path.display(), e), - setting: crate::settings::SettingVariant::Gpu, - } - }) + if slow { + self.sysfs_card.set(GPU_MEMORY_DOWNCLOCK_ATTRIBUTE.to_owned(), slow as u8).map_err(|e| { + SettingError { + msg: format!("Failed to write to `{}`: {}", path.display(), e), + setting: crate::settings::SettingVariant::Gpu, + } + }) + } else { + // NOTE: there is a GPU driver/hardware bug that prevents this from working + self.sysfs_card.set(GPU_MEMORY_DOWNCLOCK_ATTRIBUTE.to_owned(), "0 1\n").map_err(|e| { + SettingError { + msg: format!("Failed to write to `{}`: {}", path.display(), e), + setting: crate::settings::SettingVariant::Gpu, + } + }) + } } fn set_force_performance_related(&mut self) -> Result<(), Vec> {