Loading services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp +4 −1 Original line number Original line Diff line number Diff line Loading @@ -48,7 +48,7 @@ std::string RefreshRateConfigs::layerVoteTypeString(LayerVoteType vote) { } } } } std::string RefreshRateConfigs::Policy::toString() { std::string RefreshRateConfigs::Policy::toString() const { return base::StringPrintf("default config ID: %d, allowGroupSwitching = %d" return base::StringPrintf("default config ID: %d, allowGroupSwitching = %d" ", primary range: [%.2f %.2f], app request range: [%.2f %.2f]", ", primary range: [%.2f %.2f], app request range: [%.2f %.2f]", defaultConfig.value(), allowGroupSwitching, primaryRange.min, defaultConfig.value(), allowGroupSwitching, primaryRange.min, Loading Loading @@ -433,10 +433,12 @@ bool RefreshRateConfigs::isPolicyValid(const Policy& policy) { // defaultConfig must be a valid config, and within the given refresh rate range. // defaultConfig must be a valid config, and within the given refresh rate range. auto iter = mRefreshRates.find(policy.defaultConfig); auto iter = mRefreshRates.find(policy.defaultConfig); if (iter == mRefreshRates.end()) { if (iter == mRefreshRates.end()) { ALOGE("Default config is not found."); return false; return false; } } const RefreshRate& refreshRate = *iter->second; const RefreshRate& refreshRate = *iter->second; if (!refreshRate.inPolicy(policy.primaryRange.min, policy.primaryRange.max)) { if (!refreshRate.inPolicy(policy.primaryRange.min, policy.primaryRange.max)) { ALOGE("Default config is not in the primary range."); return false; return false; } } return policy.appRequestRange.min <= policy.primaryRange.min && return policy.appRequestRange.min <= policy.primaryRange.min && Loading @@ -446,6 +448,7 @@ bool RefreshRateConfigs::isPolicyValid(const Policy& policy) { status_t RefreshRateConfigs::setDisplayManagerPolicy(const Policy& policy) { status_t RefreshRateConfigs::setDisplayManagerPolicy(const Policy& policy) { std::lock_guard lock(mLock); std::lock_guard lock(mLock); if (!isPolicyValid(policy)) { if (!isPolicyValid(policy)) { ALOGE("Invalid refresh rate policy: %s", policy.toString().c_str()); return BAD_VALUE; return BAD_VALUE; } } Policy previousPolicy = *getCurrentPolicyLocked(); Policy previousPolicy = *getCurrentPolicyLocked(); Loading services/surfaceflinger/Scheduler/RefreshRateConfigs.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -166,7 +166,7 @@ public: } } bool operator!=(const Policy& other) const { return !(*this == other); } bool operator!=(const Policy& other) const { return !(*this == other); } std::string toString(); std::string toString() const; }; }; // Return code set*Policy() to indicate the current policy is unchanged. // Return code set*Policy() to indicate the current policy is unchanged. Loading Loading
services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp +4 −1 Original line number Original line Diff line number Diff line Loading @@ -48,7 +48,7 @@ std::string RefreshRateConfigs::layerVoteTypeString(LayerVoteType vote) { } } } } std::string RefreshRateConfigs::Policy::toString() { std::string RefreshRateConfigs::Policy::toString() const { return base::StringPrintf("default config ID: %d, allowGroupSwitching = %d" return base::StringPrintf("default config ID: %d, allowGroupSwitching = %d" ", primary range: [%.2f %.2f], app request range: [%.2f %.2f]", ", primary range: [%.2f %.2f], app request range: [%.2f %.2f]", defaultConfig.value(), allowGroupSwitching, primaryRange.min, defaultConfig.value(), allowGroupSwitching, primaryRange.min, Loading Loading @@ -433,10 +433,12 @@ bool RefreshRateConfigs::isPolicyValid(const Policy& policy) { // defaultConfig must be a valid config, and within the given refresh rate range. // defaultConfig must be a valid config, and within the given refresh rate range. auto iter = mRefreshRates.find(policy.defaultConfig); auto iter = mRefreshRates.find(policy.defaultConfig); if (iter == mRefreshRates.end()) { if (iter == mRefreshRates.end()) { ALOGE("Default config is not found."); return false; return false; } } const RefreshRate& refreshRate = *iter->second; const RefreshRate& refreshRate = *iter->second; if (!refreshRate.inPolicy(policy.primaryRange.min, policy.primaryRange.max)) { if (!refreshRate.inPolicy(policy.primaryRange.min, policy.primaryRange.max)) { ALOGE("Default config is not in the primary range."); return false; return false; } } return policy.appRequestRange.min <= policy.primaryRange.min && return policy.appRequestRange.min <= policy.primaryRange.min && Loading @@ -446,6 +448,7 @@ bool RefreshRateConfigs::isPolicyValid(const Policy& policy) { status_t RefreshRateConfigs::setDisplayManagerPolicy(const Policy& policy) { status_t RefreshRateConfigs::setDisplayManagerPolicy(const Policy& policy) { std::lock_guard lock(mLock); std::lock_guard lock(mLock); if (!isPolicyValid(policy)) { if (!isPolicyValid(policy)) { ALOGE("Invalid refresh rate policy: %s", policy.toString().c_str()); return BAD_VALUE; return BAD_VALUE; } } Policy previousPolicy = *getCurrentPolicyLocked(); Policy previousPolicy = *getCurrentPolicyLocked(); Loading
services/surfaceflinger/Scheduler/RefreshRateConfigs.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -166,7 +166,7 @@ public: } } bool operator!=(const Policy& other) const { return !(*this == other); } bool operator!=(const Policy& other) const { return !(*this == other); } std::string toString(); std::string toString() const; }; }; // Return code set*Policy() to indicate the current policy is unchanged. // Return code set*Policy() to indicate the current policy is unchanged. Loading