Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67968805 authored by Ady Abraham's avatar Ady Abraham
Browse files

SurfaceFlinger: do not choose POWER_SAVING as refresh rate

Skip POWER_SAVING when looking for a content based refresh rate
as it is not a real config.

Test: Play 29fps video
Bug: 140374873
Change-Id: Ia1be8b849e4ad3c59fdff084f2394e52bdb3828c
parent f145c01c
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -514,8 +514,13 @@ Scheduler::RefreshRateType Scheduler::calculateRefreshRateType() {
    // Content detection is on, find the appropriate refresh rate with minimal error
    // Content detection is on, find the appropriate refresh rate with minimal error
    // TODO(b/139751853): Scan allowed refresh rates only (SurfaceFlinger::mAllowedDisplayConfigs)
    // TODO(b/139751853): Scan allowed refresh rates only (SurfaceFlinger::mAllowedDisplayConfigs)
    const float rate = static_cast<float>(mFeatures.contentRefreshRate);
    const float rate = static_cast<float>(mFeatures.contentRefreshRate);
    auto iter = min_element(mRefreshRateConfigs.getRefreshRates().cbegin(),
    auto begin = mRefreshRateConfigs.getRefreshRates().cbegin();
                            mRefreshRateConfigs.getRefreshRates().cend(),

    // Skip POWER_SAVING config as it is not a real config
    if (begin->first == RefreshRateType::POWER_SAVING) {
        ++begin;
    }
    auto iter = min_element(begin, mRefreshRateConfigs.getRefreshRates().cend(),
                            [rate](const auto& lhs, const auto& rhs) -> bool {
                            [rate](const auto& lhs, const auto& rhs) -> bool {
                                return std::abs(lhs.second->fps - rate) <
                                return std::abs(lhs.second->fps - rate) <
                                        std::abs(rhs.second->fps - rate);
                                        std::abs(rhs.second->fps - rate);