Sys-clk-OC: Fixed #41; Erista support added; Manager is deprecated

This commit is contained in:
KazushiM
2022-10-29 18:32:26 +08:00
parent a6dcf1da5c
commit 26c0bff4dd
24 changed files with 335 additions and 206 deletions

View File

@@ -58,7 +58,6 @@ ClockManager::ClockManager()
this->oc = new SysClkOcExtra;
this->oc->systemCoreBoostCPU = false;
this->oc->allowUnsafeFreq = false;
this->oc->governor = false;
this->oc->realProfile = SysClkProfile_Handheld;
this->oc->maxMEMFreq = 0;
@@ -138,7 +137,7 @@ uint32_t ClockManager::GetHz(SysClkModule module)
if (hz)
{
/* Considering realProfile frequency limit */
hz = Clocks::GetNearestHz(module, this->oc->realProfile, hz, this->oc->allowUnsafeFreq);
hz = Clocks::GetNearestHz(module, this->oc->realProfile, hz);
if (module == SysClkModule_MEM && hz == MAX_MEM_CLOCK)
{
@@ -244,7 +243,8 @@ bool ClockManager::RefreshContext()
bool hasChanged = this->config->Refresh();
if (hasChanged) {
this->rnxSync->ToggleSync(this->GetConfig()->GetConfigValue(SysClkConfigValue_SyncReverseNXMode));
this->oc->allowUnsafeFreq = this->GetConfig()->GetConfigValue(SysClkConfigValue_AllowUnsafeFrequencies);
bool allowUnsafe = this->GetConfig()->GetConfigValue(SysClkConfigValue_AllowUnsafeFrequencies);
Clocks::SetAllowUnsafe(allowUnsafe);
}
bool enabled = this->GetConfig()->Enabled();
@@ -255,14 +255,6 @@ bool ClockManager::RefreshContext()
hasChanged = true;
}
bool governor = this->GetConfig()->GetConfigValue(SysClkConfigValue_GovernorExperimental);
if (governor != this->oc->governor)
{
this->oc->governor = governor;
FileUtils::LogLine("[mgr] Governor status: %s", governor ? "enabled" : "disabled");
hasChanged = true;
}
std::uint64_t applicationId = ProcessManagement::GetCurrentApplicationId();
if (applicationId != this->context->applicationId)
{
@@ -274,8 +266,17 @@ bool ClockManager::RefreshContext()
this->rnxSync->Reset(applicationId);
}
bool governor = this->GetConfig()->GetConfigValue(SysClkConfigValue_GovernorExperimental);
governor &= !this->GetConfig()->GetTitleGovernorDisabled(applicationId);
if (governor != this->oc->governor)
{
this->oc->governor = governor;
FileUtils::LogLine("[mgr] Governor status: %s", governor ? "enabled" : "disabled");
hasChanged = true;
}
if (hasChanged) {
if (enabled && governor && !this->GetConfig()->GetTitleGovernorDisabled(applicationId))
if (enabled && governor)
this->governor->Start();
else
this->governor->Stop();