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

Commit d82e0f03 authored by Dominik Laskowski's avatar Dominik Laskowski
Browse files

SF: Rename RefreshRateConfigs

"Configs" is vague and overloaded, and collections thereof cannot simply
pluralize the name. Also, update the stale class comment.

Bug: 241285191
Test: Build
Change-Id: I3b6d2259dcaa390f44c07caa07c05361c6cb428b
parent 2cb50128
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -180,7 +180,7 @@ filegroup {
        "Scheduler/LayerHistory.cpp",
        "Scheduler/LayerHistory.cpp",
        "Scheduler/LayerInfo.cpp",
        "Scheduler/LayerInfo.cpp",
        "Scheduler/MessageQueue.cpp",
        "Scheduler/MessageQueue.cpp",
        "Scheduler/RefreshRateConfigs.cpp",
        "Scheduler/RefreshRateSelector.cpp",
        "Scheduler/Scheduler.cpp",
        "Scheduler/Scheduler.cpp",
        "Scheduler/VSyncDispatchTimerQueue.cpp",
        "Scheduler/VSyncDispatchTimerQueue.cpp",
        "Scheduler/VSyncPredictor.cpp",
        "Scheduler/VSyncPredictor.cpp",
+9 −9
Original line number Original line Diff line number Diff line
@@ -69,7 +69,7 @@ DisplayDevice::DisplayDevice(DisplayDeviceCreationArgs& args)
        mActiveModeFPSHwcTrace("ActiveModeFPS_HWC -" + to_string(getId())),
        mActiveModeFPSHwcTrace("ActiveModeFPS_HWC -" + to_string(getId())),
        mPhysicalOrientation(args.physicalOrientation),
        mPhysicalOrientation(args.physicalOrientation),
        mIsPrimary(args.isPrimary),
        mIsPrimary(args.isPrimary),
        mRefreshRateConfigs(std::move(args.refreshRateConfigs)) {
        mRefreshRateSelector(std::move(args.refreshRateSelector)) {
    mCompositionDisplay->editState().isSecure = args.isSecure;
    mCompositionDisplay->editState().isSecure = args.isSecure;
    mCompositionDisplay->createRenderSurface(
    mCompositionDisplay->createRenderSurface(
            compositionengine::RenderSurfaceCreationArgsBuilder()
            compositionengine::RenderSurfaceCreationArgsBuilder()
@@ -200,7 +200,7 @@ void DisplayDevice::setActiveMode(DisplayModeId modeId, const display::DisplaySn


    ATRACE_INT(mActiveModeFPSTrace.c_str(), fps.getIntValue());
    ATRACE_INT(mActiveModeFPSTrace.c_str(), fps.getIntValue());


    mRefreshRateConfigs->setActiveModeId(modeId);
    mRefreshRateSelector->setActiveModeId(modeId);


    if (mRefreshRateOverlay) {
    if (mRefreshRateOverlay) {
        mRefreshRateOverlay->changeRefreshRate(fps);
        mRefreshRateOverlay->changeRefreshRate(fps);
@@ -234,7 +234,7 @@ nsecs_t DisplayDevice::getVsyncPeriodFromHWC() const {
        return vsyncPeriod;
        return vsyncPeriod;
    }
    }


    return refreshRateConfigs().getActiveModePtr()->getVsyncPeriod();
    return refreshRateSelector().getActiveModePtr()->getVsyncPeriod();
}
}


ui::Dataspace DisplayDevice::getCompositionDataSpace() const {
ui::Dataspace DisplayDevice::getCompositionDataSpace() const {
@@ -335,8 +335,8 @@ void DisplayDevice::dump(utils::Dumper& dumper) const {
    utils::Dumper::Indent indent(dumper);
    utils::Dumper::Indent indent(dumper);
    dumper.dump("powerMode"sv, mPowerMode);
    dumper.dump("powerMode"sv, mPowerMode);


    if (mRefreshRateConfigs) {
    if (mRefreshRateSelector) {
        mRefreshRateConfigs->dump(dumper);
        mRefreshRateSelector->dump(dumper);
    }
    }
}
}


@@ -430,7 +430,7 @@ void DisplayDevice::enableRefreshRateOverlay(bool enable, bool showSpinnner) {
        return;
        return;
    }
    }


    const auto fpsRange = mRefreshRateConfigs->getSupportedRefreshRateRange();
    const auto fpsRange = mRefreshRateSelector->getSupportedRefreshRateRange();
    mRefreshRateOverlay = std::make_unique<RefreshRateOverlay>(fpsRange, showSpinnner);
    mRefreshRateOverlay = std::make_unique<RefreshRateOverlay>(fpsRange, showSpinnner);
    mRefreshRateOverlay->setLayerStack(getLayerStack());
    mRefreshRateOverlay->setLayerStack(getLayerStack());
    mRefreshRateOverlay->setViewport(getSize());
    mRefreshRateOverlay->setViewport(getSize());
@@ -439,9 +439,9 @@ void DisplayDevice::enableRefreshRateOverlay(bool enable, bool showSpinnner) {


bool DisplayDevice::onKernelTimerChanged(std::optional<DisplayModeId> desiredModeId,
bool DisplayDevice::onKernelTimerChanged(std::optional<DisplayModeId> desiredModeId,
                                         bool timerExpired) {
                                         bool timerExpired) {
    if (mRefreshRateConfigs && mRefreshRateOverlay) {
    if (mRefreshRateSelector && mRefreshRateOverlay) {
        const auto newRefreshRate =
        const auto newRefreshRate =
                mRefreshRateConfigs->onKernelTimerChanged(desiredModeId, timerExpired);
                mRefreshRateSelector->onKernelTimerChanged(desiredModeId, timerExpired);
        if (newRefreshRate) {
        if (newRefreshRate) {
            mRefreshRateOverlay->changeRefreshRate(*newRefreshRate);
            mRefreshRateOverlay->changeRefreshRate(*newRefreshRate);
            return true;
            return true;
@@ -475,7 +475,7 @@ bool DisplayDevice::setDesiredActiveMode(const ActiveModeInfo& info) {
    }
    }


    // Check if we are already at the desired mode
    // Check if we are already at the desired mode
    if (refreshRateConfigs().getActiveModePtr()->getId() == info.mode->getId()) {
    if (refreshRateSelector().getActiveModePtr()->getId() == info.mode->getId()) {
        return false;
        return false;
    }
    }


+8 −11
Original line number Original line Diff line number Diff line
@@ -45,7 +45,7 @@
#include "DisplayHardware/DisplayMode.h"
#include "DisplayHardware/DisplayMode.h"
#include "DisplayHardware/Hal.h"
#include "DisplayHardware/Hal.h"
#include "DisplayHardware/PowerAdvisor.h"
#include "DisplayHardware/PowerAdvisor.h"
#include "Scheduler/RefreshRateConfigs.h"
#include "Scheduler/RefreshRateSelector.h"
#include "ThreadContext.h"
#include "ThreadContext.h"
#include "TracedOrdinal.h"
#include "TracedOrdinal.h"
#include "Utils/Dumper.h"
#include "Utils/Dumper.h"
@@ -219,7 +219,7 @@ public:
    }
    }


    const DisplayMode& getActiveMode() const REQUIRES(kMainThreadContext) {
    const DisplayMode& getActiveMode() const REQUIRES(kMainThreadContext) {
        return mRefreshRateConfigs->getActiveMode();
        return mRefreshRateSelector->getActiveMode();
    }
    }


    // Precondition: DisplaySnapshot must contain a mode with DisplayModeId.
    // Precondition: DisplaySnapshot must contain a mode with DisplayModeId.
@@ -230,14 +230,11 @@ public:
                                hal::VsyncPeriodChangeTimeline* outTimeline)
                                hal::VsyncPeriodChangeTimeline* outTimeline)
            REQUIRES(kMainThreadContext);
            REQUIRES(kMainThreadContext);


    // Returns the refresh rate configs for this display.
    scheduler::RefreshRateSelector& refreshRateSelector() const { return *mRefreshRateSelector; }
    scheduler::RefreshRateConfigs& refreshRateConfigs() const { return *mRefreshRateConfigs; }


    // Returns a shared pointer to the refresh rate configs for this display.
    // Extends the lifetime of the RefreshRateSelector, so it can outlive this DisplayDevice.
    // Clients can store this refresh rate configs and use it even if the DisplayDevice
    std::shared_ptr<scheduler::RefreshRateSelector> holdRefreshRateSelector() const {
    // is destroyed.
        return mRefreshRateSelector;
    std::shared_ptr<scheduler::RefreshRateConfigs> holdRefreshRateConfigs() const {
        return mRefreshRateConfigs;
    }
    }


    // Enables an overlay to be displayed with the current refresh rate
    // Enables an overlay to be displayed with the current refresh rate
@@ -287,7 +284,7 @@ private:


    std::vector<ui::Hdr> mOverrideHdrTypes;
    std::vector<ui::Hdr> mOverrideHdrTypes;


    std::shared_ptr<scheduler::RefreshRateConfigs> mRefreshRateConfigs;
    std::shared_ptr<scheduler::RefreshRateSelector> mRefreshRateSelector;
    std::unique_ptr<RefreshRateOverlay> mRefreshRateOverlay;
    std::unique_ptr<RefreshRateOverlay> mRefreshRateOverlay;


    mutable std::mutex mActiveModeLock;
    mutable std::mutex mActiveModeLock;
@@ -337,7 +334,7 @@ struct DisplayDeviceCreationArgs {
    HWComposer& hwComposer;
    HWComposer& hwComposer;
    const wp<IBinder> displayToken;
    const wp<IBinder> displayToken;
    const std::shared_ptr<compositionengine::Display> compositionDisplay;
    const std::shared_ptr<compositionengine::Display> compositionDisplay;
    std::shared_ptr<scheduler::RefreshRateConfigs> refreshRateConfigs;
    std::shared_ptr<scheduler::RefreshRateSelector> refreshRateSelector;


    int32_t sequenceId{0};
    int32_t sequenceId{0};
    bool isSecure{false};
    bool isSecure{false};
+3 −3
Original line number Original line Diff line number Diff line
@@ -195,7 +195,7 @@ Layer::Layer(const LayerCreationArgs& args)
    }
    }


    mFrameTracker.setDisplayRefreshPeriod(
    mFrameTracker.setDisplayRefreshPeriod(
            args.flinger->mScheduler->getVsyncPeriodFromRefreshRateConfigs());
            args.flinger->mScheduler->getVsyncPeriodFromRefreshRateSelector());


    mOwnerUid = args.ownerUid;
    mOwnerUid = args.ownerUid;
    mOwnerPid = args.ownerPid;
    mOwnerPid = args.ownerPid;
@@ -1128,7 +1128,7 @@ bool Layer::propagateFrameRateForLayerTree(FrameRate parentFrameRate, bool* tran


    // We return whether this layer ot its children has a vote. We ignore ExactOrMultiple votes for
    // We return whether this layer ot its children has a vote. We ignore ExactOrMultiple votes for
    // the same reason we are allowing touch boost for those layers. See
    // the same reason we are allowing touch boost for those layers. See
    // RefreshRateConfigs::getBestRefreshRate for more details.
    // RefreshRateSelector::rankRefreshRates for details.
    const auto layerVotedWithDefaultCompatibility =
    const auto layerVotedWithDefaultCompatibility =
            frameRate.rate.isValid() && frameRate.type == FrameRateCompatibility::Default;
            frameRate.rate.isValid() && frameRate.type == FrameRateCompatibility::Default;
    const auto layerVotedWithNoVote = frameRate.type == FrameRateCompatibility::NoVote;
    const auto layerVotedWithNoVote = frameRate.type == FrameRateCompatibility::NoVote;
@@ -3613,7 +3613,7 @@ void Layer::onPostComposition(const DisplayDevice* display,
    }
    }


    if (display) {
    if (display) {
        const Fps refreshRate = display->refreshRateConfigs().getActiveModePtr()->getFps();
        const Fps refreshRate = display->refreshRateSelector().getActiveModePtr()->getFps();
        const std::optional<Fps> renderRate =
        const std::optional<Fps> renderRate =
                mFlinger->mScheduler->getFrameRateOverride(getOwnerUid());
                mFlinger->mScheduler->getFrameRateOverride(getOwnerUid());


+2 −2
Original line number Original line Diff line number Diff line
@@ -164,7 +164,7 @@ void LayerHistory::setDefaultFrameRateCompatibility(Layer* layer, bool contentDe
            getVoteType(layer->getDefaultFrameRateCompatibility(), contentDetectionEnabled));
            getVoteType(layer->getDefaultFrameRateCompatibility(), contentDetectionEnabled));
}
}


auto LayerHistory::summarize(const RefreshRateConfigs& configs, nsecs_t now) -> Summary {
auto LayerHistory::summarize(const RefreshRateSelector& selector, nsecs_t now) -> Summary {
    Summary summary;
    Summary summary;


    std::lock_guard lock(mLock);
    std::lock_guard lock(mLock);
@@ -178,7 +178,7 @@ auto LayerHistory::summarize(const RefreshRateConfigs& configs, nsecs_t now) ->
        ALOGV("%s has priority: %d %s focused", info->getName().c_str(), frameRateSelectionPriority,
        ALOGV("%s has priority: %d %s focused", info->getName().c_str(), frameRateSelectionPriority,
              layerFocused ? "" : "not");
              layerFocused ? "" : "not");


        const auto vote = info->getRefreshRateVote(configs, now);
        const auto vote = info->getRefreshRateVote(selector, now);
        // Skip NoVote layer as those don't have any requirements
        // Skip NoVote layer as those don't have any requirements
        if (vote.type == LayerVoteType::NoVote) {
        if (vote.type == LayerVoteType::NoVote) {
            continue;
            continue;
Loading