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

Commit 13e11b5e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: Rename RefreshRateConfigs"

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

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

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

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

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

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

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

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

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

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

    // 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;
    }

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

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

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

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

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

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

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

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

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

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

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

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

    // 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
    // RefreshRateConfigs::getBestRefreshRate for more details.
    // RefreshRateSelector::rankRefreshRates for details.
    const auto layerVotedWithDefaultCompatibility =
            frameRate.rate.isValid() && frameRate.type == FrameRateCompatibility::Default;
    const auto layerVotedWithNoVote = frameRate.type == FrameRateCompatibility::NoVote;
@@ -3593,7 +3593,7 @@ void Layer::onPostComposition(const DisplayDevice* display,
    }

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

+2 −2
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ void LayerHistory::setDefaultFrameRateCompatibility(Layer* layer, bool contentDe
            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;

    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,
              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
        if (vote.type == LayerVoteType::NoVote) {
            continue;
Loading