diff --git a/py_modules/cpu_utils.py b/py_modules/cpu_utils.py index 988a543..132740e 100644 --- a/py_modules/cpu_utils.py +++ b/py_modules/cpu_utils.py @@ -50,16 +50,18 @@ def ryzenadj(tdp: int): if advanced_options.get_setting(RogAllySettings.USE_WMI.value): return rog_ally.ryzenadj(tdp) - fast_tdp = (tdp+2)*1000 tdp = tdp*1000 if RYZENADJ_PATH: commands = [ RYZENADJ_PATH, '--stapm-limit', f"{tdp}", - '--fast-limit', f"{fast_tdp}", + '--fast-limit', f"{tdp}", '--slow-limit', f"{tdp}", - '--apu-slow-limit', f"{tdp}" + '--tctl-temp', f"95", + '--apu-skin-temp', f"95", + '--dgpu-skin-temp', f"95", + '--max-performance' ] results = subprocess.call(commands) @@ -235,4 +237,4 @@ def get_scaling_driver(): return scaling_driver except Exception as e: logging.error(f'{__name__} get_scaling_driver {e}') - return '' \ No newline at end of file + return '' diff --git a/py_modules/gpu_utils.py b/py_modules/gpu_utils.py index 2514b59..9a015d9 100644 --- a/py_modules/gpu_utils.py +++ b/py_modules/gpu_utils.py @@ -76,6 +76,10 @@ def set_gpu_frequency(current_game_id): except Exception as e: decky_plugin.logger.error(f"{__name__} power mode error {e}") return False + elif gpu_mode == GpuModes.RANGE.value: + new_min = tdp_profile.get(GpuRange.MIN.value, 0) + new_max = tdp_profile.get(GpuRange.MAX.value, 0) + return set_gpu_frequency_range(new_min, new_max) elif gpu_mode == GpuModes.FIXED.value: new_freq = tdp_profile.get(GpuRange.FIXED.value, 0) return set_gpu_frequency_range(new_freq, new_freq) diff --git a/py_modules/plugin_enums.py b/py_modules/plugin_enums.py index 336a912..a174b15 100644 --- a/py_modules/plugin_enums.py +++ b/py_modules/plugin_enums.py @@ -1,7 +1,9 @@ from enum import Enum class GpuModes(Enum): - DEFAULT = "DEFAULT" + BATTERY = "BATTERY" + BALANCE = "BALANCE" + PERFORMANCE = "PERFORMANCE" RANGE = "RANGE" FIXED = "FIXED" diff --git a/py_modules/plugin_update.py b/py_modules/plugin_update.py index 3a261ad..d623bc8 100644 --- a/py_modules/plugin_update.py +++ b/py_modules/plugin_update.py @@ -7,7 +7,7 @@ import ssl import shutil -API_URL = "https://api.github.com/repos/aarron-lee/SimpleDeckyTDP/releases/latest" +API_URL = "https://api.github.com/repos/SteamFork/SimpleDeckyTDP/releases/latest" def recursive_chmod(path, perms): for dirpath, dirnames, filenames in os.walk(path): diff --git a/py_modules/plugin_utils.py b/py_modules/plugin_utils.py index 958f475..194db5a 100644 --- a/py_modules/plugin_utils.py +++ b/py_modules/plugin_utils.py @@ -3,7 +3,7 @@ from time import sleep # import advanced_options from plugin_settings import bootstrap_profile, merge_tdp_profiles, get_tdp_profile, set_setting as persist_setting -from cpu_utils import ryzenadj, set_cpu_boost, get_scaling_driver, set_smt +from cpu_utils import ryzenadj, set_cpu_boost, get_scaling_driver, set_smt, supports_cpu_boost from gpu_utils import set_gpu_frequency_range import power_utils @@ -56,7 +56,9 @@ def set_smt_for_tdp_profile(tdp_profile): def set_cpu_boost_for_tdp_profile(tdp_profile): cpu_boost = tdp_profile.get('cpuBoost', False) - set_cpu_boost(cpu_boost) + + if supports_cpu_boost(): + set_cpu_boost(cpu_boost) def set_tdp_for_tdp_profile(tdp_profile): if tdp_profile.get('tdp'): @@ -72,6 +74,7 @@ def set_gpu_for_tdp_profile(tdp_profile): min_frequency = tdp_profile.get('minGpuFrequency') max_frequency = tdp_profile.get('maxGpuFrequency') + if gpu_mode: try: with file_timeout.time_limit(3): @@ -87,6 +90,9 @@ def set_gpu_for_tdp_profile(tdp_profile): elif gpu_mode == 'FIXED' and fixed_frequency: set_gpu_frequency_range(fixed_frequency, fixed_frequency) return True + elif gpu_mode == 'RANGE' and min_frequency and max_frequency: + set_gpu_frequency_range(min_frequency, max_frequency) + return True return False except Exception as e: logging.error(f'main#set_gpu_for_game_id timeout {e}') @@ -123,6 +129,10 @@ def persist_gpu(minGpuFrequency, maxGpuFrequency, game_id): elif minGpuFrequency == maxGpuFrequency: gpu_mode = 'FIXED' profile_contents["fixedGpuFrequency"] = maxGpuFrequency + elif minGpuFrequency < maxGpuFrequency: + gpu_mode = 'RANGE' + profile_contents["minGpuFrequency"] = minGpuFrequency + profile_contents["maxGpuFrequency"] = maxGpuFrequency else: # invalid, return return diff --git a/src/backend/utils.tsx b/src/backend/utils.tsx index 2507aa2..fa6e3a5 100644 --- a/src/backend/utils.tsx +++ b/src/backend/utils.tsx @@ -34,7 +34,9 @@ export const DesktopAdvancedOptions = [ ] as string[]; export enum GpuModes { - DEFAULT = "DEFAULT", + BATTERY = "BATTERY", + BALANCE = "BALANCE", + PERFORMANCE = "PERFORMANCE", RANGE = "RANGE", FIXED = "FIXED", } diff --git a/src/components/atoms/GpuModeSlider.tsx b/src/components/atoms/GpuModeSlider.tsx index d0bb55e..08f5440 100644 --- a/src/components/atoms/GpuModeSlider.tsx +++ b/src/components/atoms/GpuModeSlider.tsx @@ -7,7 +7,8 @@ enum Mode { BATTERY = 0, BALANCE = 1, PERFORMANCE = 2 - FIXED = 3, + RANGE = 3, + FIXED = 4, } const GpuModeSlider: FC<{ showSeparator: boolean }> = ({ showSeparator }) => { @@ -21,7 +22,7 @@ const GpuModeSlider: FC<{ showSeparator: boolean }> = ({ showSeparator }) => { const MODES: NotchLabel[] = Object.keys(Mode) .filter((key) => isNaN(Number(key))) .map((mode, idx) => { - return { notchIndex: idx, label: capitalize(mode), value: idx }; + return { notchIndex: idx, label: capitalize(mode.slice(0,7) + " " + mode.slice(7)), value: idx }; }); // known bug: typescript has incorrect type for reverse mapping from enums diff --git a/src/components/molecules/Gpu.tsx b/src/components/molecules/Gpu.tsx index 841d114..298a2a0 100644 --- a/src/components/molecules/Gpu.tsx +++ b/src/components/molecules/Gpu.tsx @@ -18,6 +18,11 @@ const Gpu = () => { + {gpuMode === GpuModes.RANGE && ( + + + + )} {gpuMode === GpuModes.FIXED && (