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

Commit 164d006c authored by Ram Indani's avatar Ram Indani Committed by Android (Google) Code Review
Browse files

Merge "Adds getSupportedRefreshRates support" into main

parents 51993661 bee19021
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
@@ -1557,6 +1557,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