Fix dvfs yet again, todo make this not shit
This commit is contained in:
@@ -145,14 +145,14 @@ ClockManager::ClockManager()
|
|||||||
this->context->isDram8GB = Board::IsDram8GB();
|
this->context->isDram8GB = Board::IsDram8GB();
|
||||||
Board::SetGpuSchedulingMode((GpuSchedulingMode)this->config->GetConfigValue(HorizonOCConfigValue_GPUScheduling), (GpuSchedulingOverrideMethod)this->config->GetConfigValue(HorizonOCConfigValue_GPUSchedulingMethod));
|
Board::SetGpuSchedulingMode((GpuSchedulingMode)this->config->GetConfigValue(HorizonOCConfigValue_GPUScheduling), (GpuSchedulingOverrideMethod)this->config->GetConfigValue(HorizonOCConfigValue_GPUSchedulingMethod));
|
||||||
this->context->gpuSchedulingMode = (GpuSchedulingMode)this->config->GetConfigValue(HorizonOCConfigValue_GPUScheduling);
|
this->context->gpuSchedulingMode = (GpuSchedulingMode)this->config->GetConfigValue(HorizonOCConfigValue_GPUScheduling);
|
||||||
|
|
||||||
this->context->isSysDockInstalled = this->sysDockIntegration->getCurrentSysDockState();
|
this->context->isSysDockInstalled = this->sysDockIntegration->getCurrentSysDockState();
|
||||||
this->context->isSaltyNXInstalled = this->saltyNXIntegration->getCurrentSaltyNXState();
|
this->context->isSaltyNXInstalled = this->saltyNXIntegration->getCurrentSaltyNXState();
|
||||||
if(this->context->isSaltyNXInstalled) {
|
if(this->context->isSaltyNXInstalled) {
|
||||||
this->saltyNXIntegration->LoadSaltyNX();
|
this->saltyNXIntegration->LoadSaltyNX();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
threadStart(&cpuGovernorTHREAD);
|
threadStart(&cpuGovernorTHREAD);
|
||||||
threadStart(&gpuGovernorTHREAD);
|
threadStart(&gpuGovernorTHREAD);
|
||||||
threadStart(&vrrTHREAD);
|
threadStart(&vrrTHREAD);
|
||||||
@@ -635,7 +635,7 @@ void ClockManager::HandleGovernor(uint32_t targetHz) {
|
|||||||
effectiveState == GovernorState_Enabled_CpuVrr ||
|
effectiveState == GovernorState_Enabled_CpuVrr ||
|
||||||
effectiveState == GovernorState_Enabled_GpuVrr ||
|
effectiveState == GovernorState_Enabled_GpuVrr ||
|
||||||
effectiveState == GovernorState_Enabled_Vrr);
|
effectiveState == GovernorState_Enabled_Vrr);
|
||||||
|
|
||||||
isCpuGovernorEnabled = newCpuGovernorState;
|
isCpuGovernorEnabled = newCpuGovernorState;
|
||||||
isGpuGovernorEnabled = newGpuGovernorState;
|
isGpuGovernorEnabled = newGpuGovernorState;
|
||||||
isVRREnabled = newVrrGovernorState;
|
isVRREnabled = newVrrGovernorState;
|
||||||
@@ -675,22 +675,18 @@ void ClockManager::DVFSBeforeSet(u32 targetHz) {
|
|||||||
|
|
||||||
void ClockManager::DVFSAfterSet(u32 targetHz) {
|
void ClockManager::DVFSAfterSet(u32 targetHz) {
|
||||||
s32 dvfsOffset = this->config->GetConfigValue(HorizonOCConfigValue_DVFSOffset);
|
s32 dvfsOffset = this->config->GetConfigValue(HorizonOCConfigValue_DVFSOffset);
|
||||||
dvfsOffset = std::max(dvfsOffset, -50);
|
dvfsOffset = std::max(dvfsOffset, -80);
|
||||||
u32 vmin = Board::GetMinimumGpuVoltage(targetHz / 1000000) + dvfsOffset;
|
u32 vmin = Board::GetMinimumGpuVoltage(targetHz / 1000000);
|
||||||
Board::PcvHijackDvfs(vmin);
|
|
||||||
|
|
||||||
targetHz = this->context->overrideFreqs[SysClkModule_GPU];
|
if (vmin) {
|
||||||
if (!targetHz)
|
vmin += dvfsOffset;
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 maxHz = this->GetMaxAllowedHz(SysClkModule_GPU, this->context->profile);
|
u32 maxHz = this->GetMaxAllowedHz(SysClkModule_GPU, this->context->profile);
|
||||||
u32 nearestHz = this->GetNearestHz(SysClkModule_GPU, targetHz, maxHz);
|
u32 nearestHz = this->GetNearestHz(SysClkModule_GPU, targetHz, maxHz);
|
||||||
|
Board::PcvHijackDvfs(vmin);
|
||||||
|
|
||||||
if(targetHz) {
|
if (targetHz) {
|
||||||
Board::SetHz(SysClkModule_GPU, ~0);
|
Board::SetHz(SysClkModule_GPU, ~0);
|
||||||
Board::SetHz(SysClkModule_GPU, nearestHz);
|
Board::SetHz(SysClkModule_GPU, nearestHz);
|
||||||
} else {
|
} else {
|
||||||
@@ -1030,7 +1026,7 @@ bool ClockManager::RefreshContext()
|
|||||||
this->context->fps = saltyNXIntegration->GetFPS();
|
this->context->fps = saltyNXIntegration->GetFPS();
|
||||||
else
|
else
|
||||||
this->context->fps = 254; // N/A
|
this->context->fps = 254; // N/A
|
||||||
|
|
||||||
return hasChanged;
|
return hasChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user