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

Commit d2a0e72f authored by ramindani's avatar ramindani
Browse files

SF: Adds support for getSuggestedFrameRate api

BUG: 361433796
Flag: com.android.server.display.feature.flags.enable_get_suggested_frame_rate
Test: atest android.display.cts.DisplayTest
Change-Id: I491fe7ef1793cf7c3e7d919db2b7d6e7e41d3c20
parent 8204da2c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1638,9 +1638,9 @@ std::chrono::milliseconds RefreshRateSelector::getIdleTimerTimeout() {
FpsRange RefreshRateSelector::getFrameRateCategoryRange(FrameRateCategory category) {
    switch (category) {
        case FrameRateCategory::High:
            return FpsRange{90_Hz, 120_Hz};
            return FpsRange{kFrameRateCategoryRateHigh, 120_Hz};
        case FrameRateCategory::Normal:
            return FpsRange{60_Hz, 120_Hz};
            return FpsRange{kFrameRateCategoryRateNormal, 120_Hz};
        case FrameRateCategory::Low:
            return FpsRange{48_Hz, 120_Hz};
        case FrameRateCategory::HighHint:
+8 −0
Original line number Diff line number Diff line
@@ -52,6 +52,12 @@ public:
    // The lowest Render Frame Rate that will ever be selected
    static constexpr Fps kMinSupportedFrameRate = 20_Hz;

    // Start range for FrameRateCategory Normal and High.
    static constexpr Fps kFrameRateCategoryRateHigh = 90_Hz;
    static constexpr Fps kFrameRateCategoryRateNormal = 60_Hz;
    static constexpr std::pair<Fps, Fps> kFrameRateCategoryRates = {kFrameRateCategoryRateNormal,
                                                                    kFrameRateCategoryRateHigh};

    class Policy {
        static constexpr int kAllowGroupSwitchingDefault = false;

@@ -433,6 +439,8 @@ public:

    bool isVrrDevice() const;

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

private:
    friend struct TestableRefreshRateSelector;

+8 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@
#include <ui/DisplayStatInfo.h>
#include <ui/DisplayState.h>
#include <ui/DynamicDisplayInfo.h>
#include <ui/FrameRateCategoryRate.h>
#include <ui/GraphicBufferAllocator.h>
#include <ui/HdrRenderTypeUtils.h>
#include <ui/LayerStack.h>
@@ -1217,6 +1218,10 @@ void SurfaceFlinger::getDynamicDisplayInfoInternal(ui::DynamicDisplayInfo*& info
    info->activeDisplayModeId = ftl::to_underlying(mode.modePtr->getId());
    info->renderFrameRate = mode.fps.getValue();
    info->hasArrSupport = mode.modePtr->getVrrConfig() && FlagManager::getInstance().vrr_config();

    const auto [normal, high] = display->refreshRateSelector().getFrameRateCategoryRates();
    ui::FrameRateCategoryRate frameRateCategoryRate(normal.getValue(), high.getValue());
    info->frameRateCategoryRate = frameRateCategoryRate;
    info->activeColorMode = display->getCompositionDisplay()->getState().colorMode;
    info->hdrCapabilities = filterOut4k30(display->getHdrCapabilities());

@@ -8598,6 +8603,9 @@ void SurfaceComposerAIDL::getDynamicDisplayInfoInternal(ui::DynamicDisplayInfo&
    outInfo->activeDisplayModeId = info.activeDisplayModeId;
    outInfo->renderFrameRate = info.renderFrameRate;
    outInfo->hasArrSupport = info.hasArrSupport;
    gui::FrameRateCategoryRate& frameRateCategoryRate = outInfo->frameRateCategoryRate;
    frameRateCategoryRate.normal = info.frameRateCategoryRate.getNormal();
    frameRateCategoryRate.high = info.frameRateCategoryRate.getHigh();

    outInfo->supportedColorModes.clear();
    outInfo->supportedColorModes.reserve(info.supportedColorModes.size());