sysclk: rework governor

now should work in more games and behave more like a schedutil (slow rampdown, fast rampup)

fixes issues in Kirby and the Forgotten Land
This commit is contained in:
souldbminersmwc
2026-03-11 19:03:46 -04:00
parent 40800ffe4b
commit e781e67b43
2 changed files with 124 additions and 262 deletions

View File

@@ -193,10 +193,10 @@ class ClockManager
GovernorState GetEffectiveGovernorState(GovernorState appState, GovernorState tempState);
/**
* Frequency tables
* Frequency table
*
*/
struct {
struct FreqTable {
std::uint32_t count;
std::uint32_t list[SYSCLK_FREQ_LIST_MAX];
} freqTable[SysClkModule_EnumMax];
@@ -216,6 +216,30 @@ class ClockManager
*/
unsigned int GetGpuVoltage (unsigned int freq, int speedo);
/**
* Gets the required vMin for a ram frequency for a speedo
*
* @param util Utilization in percentile
* @param tableMaxHz Table Max Hz
*/
static u32 SchedutilTargetHz(u32 util, u32 tableMaxHz);
/**
* Gets the required vMin for a ram frequency for a speedo
*
* @param table FreqTable for module
* @param targetHz Hz to search for
*/
static u32 TableIndexForHz(const FreqTable& table, u32 targetHz);
/**
* Gets the required vMin for a ram frequency for a speedo
*
* @param mgr ClockManager instance (runs in a thread so must be passed)
* @param module Module for which to resolve target Hz
*/
static u32 ResolveTargetHz(ClockManager* mgr, SysClkModule module);
protected:
bool IsAssignableHz(SysClkModule module, std::uint32_t hz);
inline std::uint32_t GetMaxAllowedHz(SysClkModule module, SysClkProfile profile);