Fix freqs not being set

This commit is contained in:
Lightos1
2026-02-20 15:15:21 +01:00
parent bc12388b6d
commit dcec618ae9

View File

@@ -95,7 +95,7 @@ ClockManager::ClockManager()
this->sysDockIntegration = new SysDockIntegration; this->sysDockIntegration = new SysDockIntegration;
memset(&initialConfigValues, 0, sizeof(initialConfigValues)); memset(&initialConfigValues, 0, sizeof(initialConfigValues));
this->GetKipData(); this->GetKipData();
threadCreate( threadCreate(
&cpuGovernorTHREAD, &cpuGovernorTHREAD,
ClockManager::CpuGovernorThread, ClockManager::CpuGovernorThread,
@@ -664,7 +664,7 @@ void ClockManager::HandleMiscFeatures() {
void ClockManager::HandleGovernor(uint32_t targetHz) { void ClockManager::HandleGovernor(uint32_t targetHz) {
GovernorState appGovernorState = (GovernorState)targetHz; GovernorState appGovernorState = (GovernorState)targetHz;
u32 tempTargetHz = this->context->overrideFreqs[HorizonOCModule_Governor]; u32 tempTargetHz = this->context->overrideFreqs[HorizonOCModule_Governor];
if (!tempTargetHz) if (!tempTargetHz)
{ {
@@ -673,9 +673,9 @@ void ClockManager::HandleGovernor(uint32_t targetHz) {
tempTargetHz = this->config->GetAutoClockHz(GLOBAL_PROFILE_ID, HorizonOCModule_Governor, this->context->profile, true); tempTargetHz = this->config->GetAutoClockHz(GLOBAL_PROFILE_ID, HorizonOCModule_Governor, this->context->profile, true);
} }
GovernorState tempGovernorState = (GovernorState)tempTargetHz; GovernorState tempGovernorState = (GovernorState)tempTargetHz;
GovernorState effectiveState = this->GetEffectiveGovernorState(appGovernorState, tempGovernorState); GovernorState effectiveState = this->GetEffectiveGovernorState(appGovernorState, tempGovernorState);
bool newCpuGovernorState = (effectiveState == GovernorState_Enabled_CpuGpu || effectiveState == GovernorState_Enabled_Cpu); bool newCpuGovernorState = (effectiveState == GovernorState_Enabled_CpuGpu || effectiveState == GovernorState_Enabled_Cpu);
bool newGpuGovernorState = (effectiveState == GovernorState_Enabled_CpuGpu || effectiveState == GovernorState_Enabled_Gpu); bool newGpuGovernorState = (effectiveState == GovernorState_Enabled_CpuGpu || effectiveState == GovernorState_Enabled_Gpu);
@@ -740,8 +740,21 @@ void ClockManager::HandleCpuUv() {
void ClockManager::DVFSReset() { void ClockManager::DVFSReset() {
if (Board::GetSocType() == SysClkSocType_Mariko && this->config->GetConfigValue(HorizonOCConfigValue_DVFSMode) == DVFSMode_Hijack) { if (Board::GetSocType() == SysClkSocType_Mariko && this->config->GetConfigValue(HorizonOCConfigValue_DVFSMode) == DVFSMode_Hijack) {
Board::PcvHijackDvfs(0); Board::PcvHijackDvfs(0);
u32 targetHz = this->context->overrideFreqs[SysClkModule_GPU];
if (!targetHz) {
targetHz = this->config->GetAutoClockHz(this->context->applicationId, SysClkModule_GPU, this->context->profile, false);
if(!targetHz) {
targetHz = this->config->GetAutoClockHz(GLOBAL_PROFILE_ID, SysClkModule_GPU, this->context->profile, false);
}
}
Board::SetHz(SysClkModule_GPU, ~0); Board::SetHz(SysClkModule_GPU, ~0);
Board::ResetToStockGpu(); if(targetHz) {
Board::SetHz(SysClkModule_GPU, targetHz);
} else {
Board::ResetToStockGpu();
}
} }
} }
@@ -757,7 +770,7 @@ void ClockManager::HandleFreqReset(SysClkModule module, bool isBoost) {
else else
Board::SetCpuUvLevel(this->config->GetConfigValue(KipConfigValue_marikoCpuUVLow), this->config->GetConfigValue(KipConfigValue_marikoCpuUVHigh), Board::CalculateTbreak(this->config->GetConfigValue(KipConfigValue_tableConf))); Board::SetCpuUvLevel(this->config->GetConfigValue(KipConfigValue_marikoCpuUVLow), this->config->GetConfigValue(KipConfigValue_marikoCpuUVHigh), Board::CalculateTbreak(this->config->GetConfigValue(KipConfigValue_tableConf)));
} }
break; break;
case SysClkModule_GPU: case SysClkModule_GPU:
Board::ResetToStockGpu(); Board::ResetToStockGpu();
@@ -812,10 +825,10 @@ void ClockManager::SetClocks(bool isBoost) {
if(module > SysClkModule_MEM) { if(module > SysClkModule_MEM) {
continue; continue;
} }
bool noCPU = isCpuGovernorEnabled; bool noCPU = isCpuGovernorEnabled;
bool noGPU = isGpuGovernorEnabled; bool noGPU = isGpuGovernorEnabled;
if(noCPU && module == SysClkModule_CPU) if(noCPU && module == SysClkModule_CPU)
continue; continue;
if(noGPU && module == SysClkModule_GPU) if(noGPU && module == SysClkModule_GPU)
@@ -1023,8 +1036,8 @@ bool ClockManager::RefreshContext()
} }
if(targetHz && this->context->realFreqs[HorizonOCModule_Display] > targetHz && this->context->profile != SysClkProfile_Docked) if(targetHz && this->context->realFreqs[HorizonOCModule_Display] > targetHz && this->context->profile != SysClkProfile_Docked)
this->context->realFreqs[HorizonOCModule_Display] = targetHz; // clean up display real freqs, should probably be moved to the real freqs loop? this->context->realFreqs[HorizonOCModule_Display] = targetHz; // clean up display real freqs, should probably be moved to the real freqs loop?
if(Board::GetConsoleType() != HorizonOCConsoleType_Hoag) if(Board::GetConsoleType() != HorizonOCConsoleType_Hoag)
Board::SetDisplayRefreshDockedState(this->context->profile == SysClkProfile_Docked); Board::SetDisplayRefreshDockedState(this->context->profile == SysClkProfile_Docked);