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

Commit bee19021 authored by ramindani's avatar ramindani
Browse files

Adds getSupportedRefreshRates support

Source values for refresh rates from the RefreshRateSelector
through SurfaceComposerClient.

Test: atest android.display.cts.DisplayTest
BUG: 365163968
Flag: com.android.server.display.feature.flags.enable_get_supported_refresh_rates
Change-Id: I149e6e51b3b3718ef53e522f1fca5650dbbd8b7b
parent 2a8a1ae5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2873,6 +2873,11 @@ void SurfaceComposerClient::getDynamicDisplayInfoInternal(gui::DynamicDisplayInf
    outInfo->hasArrSupport = ginfo.hasArrSupport;
    outInfo->frameRateCategoryRate = ui::FrameRateCategoryRate(ginfo.frameRateCategoryRate.normal,
                                                               ginfo.frameRateCategoryRate.high);
    outInfo->supportedRefreshRates.clear();
    outInfo->supportedRefreshRates.reserve(ginfo.supportedRefreshRates.size());
    for (const auto rate : ginfo.supportedRefreshRates) {
        outInfo->supportedRefreshRates.push_back(static_cast<float>(rate));
    }
}

status_t SurfaceComposerClient::getDynamicDisplayInfoFromId(int64_t displayId,
+3 −0
Original line number Diff line number Diff line
@@ -50,4 +50,7 @@ parcelable DynamicDisplayInfo {

    // Represents frame rate for FrameRateCategory Normal and High.
    FrameRateCategoryRate frameRateCategoryRate;

    // All the refresh rates supported for the default display mode.
    float[] supportedRefreshRates;
}
+3 −0
Original line number Diff line number Diff line
@@ -59,6 +59,9 @@ struct DynamicDisplayInfo {

    // Represents frame rate for FrameRateCategory Normal and High.
    ui::FrameRateCategoryRate frameRateCategoryRate;

    // All the refresh rates supported for the default display mode.
    std::vector<float> supportedRefreshRates;
};

} // namespace android::ui
+13 −0
Original line number Diff line number Diff line
@@ -1569,6 +1569,19 @@ Fps RefreshRateSelector::findClosestKnownFrameRate(Fps frameRate) const {
    return distance1 < distance2 ? *lowerBound : *std::prev(lowerBound);
}

std::vector<float> RefreshRateSelector::getSupportedFrameRates() const {
    std::scoped_lock lock(mLock);
    // TODO(b/356986687) Remove the limit once we have the anchor list implementation.
    const size_t frameRatesSize = std::min<size_t>(11, mPrimaryFrameRates.size());
    std::vector<float> supportedFrameRates;
    supportedFrameRates.reserve(frameRatesSize);
    std::transform(mPrimaryFrameRates.rbegin(),
                   mPrimaryFrameRates.rbegin() + static_cast<int>(frameRatesSize),
                   std::back_inserter(supportedFrameRates),
                   [](FrameRateMode mode) { return mode.fps.getValue(); });
    return supportedFrameRates;
}

auto RefreshRateSelector::getIdleTimerAction() const -> KernelIdleTimerAction {
    std::lock_guard lock(mLock);

+2 −0
Original line number Diff line number Diff line
@@ -441,6 +441,8 @@ public:

    std::pair<Fps, Fps> getFrameRateCategoryRates() const { return kFrameRateCategoryRates; }

    std::vector<float> getSupportedFrameRates() const EXCLUDES(mLock);

private:
    friend struct TestableRefreshRateSelector;

Loading