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

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

Merge changes If83c9084,Iee87316e

* changes:
  SF: Identify the active display with its ID
  SF: Refactor setter for DM and override policy
parents b7ebd507 e591b55b
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -216,7 +216,6 @@ status_t DisplayDevice::initiateModeChange(const ActiveModeInfo& info,
              to_string(getId()).c_str());
        return BAD_VALUE;
    }
    mNumModeSwitchesInPolicy++;
    mUpcomingActiveMode = info;
    ATRACE_INT(mActiveModeFPSHwcTrace.c_str(), info.mode->getFps().getIntValue());
    return mHwComposer.setActiveModeWithConstraints(getPhysicalId(), info.mode->getHwcId(),
@@ -498,27 +497,6 @@ void DisplayDevice::clearDesiredActiveModeState() {
    mDesiredActiveModeChanged = false;
}

status_t DisplayDevice::setRefreshRatePolicy(
        const std::optional<scheduler::RefreshRateConfigs::Policy>& policy, bool overridePolicy) {
    const auto oldPolicy = mRefreshRateConfigs->getCurrentPolicy();
    const status_t setPolicyResult = overridePolicy
            ? mRefreshRateConfigs->setOverridePolicy(policy)
            : mRefreshRateConfigs->setDisplayManagerPolicy(*policy);

    if (setPolicyResult == OK) {
        const int numModeChanges = mNumModeSwitchesInPolicy.exchange(0);

        ALOGI("Display %s policy changed\n"
              "Previous: {%s}\n"
              "Current:  {%s}\n"
              "%d mode changes were performed under the previous policy",
              to_string(getId()).c_str(), oldPolicy.toString().c_str(),
              policy ? policy->toString().c_str() : "null", numModeChanges);
    }

    return setPolicyResult;
}

std::atomic<int32_t> DisplayDeviceState::sNextSequenceId(1);

}  // namespace android
+0 −6
Original line number Diff line number Diff line
@@ -236,10 +236,6 @@ public:

    nsecs_t getVsyncPeriodFromHWC() const;

    status_t setRefreshRatePolicy(
            const std::optional<scheduler::RefreshRateConfigs::Policy>& policy,
            bool overridePolicy);

    // release HWC resources (if any) for removable displays
    void disconnect();

@@ -287,8 +283,6 @@ private:
    TracedOrdinal<bool> mDesiredActiveModeChanged
            GUARDED_BY(mActiveModeLock) = {"DesiredActiveModeChanged", false};
    ActiveModeInfo mUpcomingActiveMode GUARDED_BY(kMainThreadContext);

    std::atomic_int mNumModeSwitchesInPolicy = 0;
};

struct DisplayDeviceState {
+67 −27
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <android-base/stringprintf.h>
#include <ftl/enum.h>
#include <ftl/fake_guard.h>
#include <ftl/match.h>
#include <utils/Trace.h>

#include "../SurfaceFlingerProperties.h"
@@ -117,6 +118,20 @@ bool canModesSupportFrameRateOverride(const std::vector<DisplayModeIterator>& so
    return false;
}

std::string toString(const RefreshRateConfigs::PolicyVariant& policy) {
    using namespace std::string_literals;

    return ftl::match(
            policy,
            [](const RefreshRateConfigs::DisplayManagerPolicy& policy) {
                return "DisplayManagerPolicy"s + policy.toString();
            },
            [](const RefreshRateConfigs::OverridePolicy& policy) {
                return "OverridePolicy"s + policy.toString();
            },
            [](RefreshRateConfigs::NoOverridePolicy) { return "NoOverridePolicy"s; });
}

} // namespace

struct RefreshRateConfigs::RefreshRateScoreComparator {
@@ -874,35 +889,60 @@ bool RefreshRateConfigs::isPolicyValidLocked(const Policy& policy) const {
            policy.appRequestRange.max >= policy.primaryRange.max;
}

status_t RefreshRateConfigs::setDisplayManagerPolicy(const Policy& policy) {
auto RefreshRateConfigs::setPolicy(const PolicyVariant& policy) -> SetPolicyResult {
    Policy oldPolicy;
    {
        std::lock_guard lock(mLock);
        oldPolicy = *getCurrentPolicyLocked();

        const bool valid = ftl::match(
                policy,
                [this](const auto& policy) {
                    ftl::FakeGuard guard(mLock);
                    if (!isPolicyValidLocked(policy)) {
        ALOGE("Invalid refresh rate policy: %s", policy.toString().c_str());
        return BAD_VALUE;
                        ALOGE("Invalid policy: %s", policy.toString().c_str());
                        return false;
                    }
    mGetRankedRefreshRatesCache.reset();
    Policy previousPolicy = *getCurrentPolicyLocked();

                    using T = std::decay_t<decltype(policy)>;

                    if constexpr (std::is_same_v<T, DisplayManagerPolicy>) {
                        mDisplayManagerPolicy = policy;
    if (*getCurrentPolicyLocked() == previousPolicy) {
        return CURRENT_POLICY_UNCHANGED;
    }
    constructAvailableRefreshRates();
    return NO_ERROR;
                    } else {
                        static_assert(std::is_same_v<T, OverridePolicy>);
                        mOverridePolicy = policy;
                    }
                    return true;
                },
                [this](NoOverridePolicy) {
                    ftl::FakeGuard guard(mLock);
                    mOverridePolicy.reset();
                    return true;
                });

status_t RefreshRateConfigs::setOverridePolicy(const std::optional<Policy>& policy) {
    std::lock_guard lock(mLock);
    if (policy && !isPolicyValidLocked(*policy)) {
        return BAD_VALUE;
        if (!valid) {
            return SetPolicyResult::Invalid;
        }

        mGetRankedRefreshRatesCache.reset();
    Policy previousPolicy = *getCurrentPolicyLocked();
    mOverridePolicy = policy;
    if (*getCurrentPolicyLocked() == previousPolicy) {
        return CURRENT_POLICY_UNCHANGED;

        if (*getCurrentPolicyLocked() == oldPolicy) {
            return SetPolicyResult::Unchanged;
        }
        constructAvailableRefreshRates();
    return NO_ERROR;
    }

    const auto displayId = getActiveMode().getPhysicalDisplayId();
    const unsigned numModeChanges = std::exchange(mNumModeSwitchesInPolicy, 0u);

    ALOGI("Display %s policy changed\n"
          "Previous: %s\n"
          "Current:  %s\n"
          "%u mode changes were performed under the previous policy",
          to_string(displayId).c_str(), oldPolicy.toString().c_str(), toString(policy).c_str(),
          numModeChanges);

    return SetPolicyResult::Changed;
}

const RefreshRateConfigs::Policy* RefreshRateConfigs::getCurrentPolicyLocked() const {
+20 −13
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <optional>
#include <type_traits>
#include <utility>
#include <variant>

#include <gui/DisplayEventReceiver.h>

@@ -67,8 +68,7 @@ public:
    static constexpr nsecs_t MARGIN_FOR_PERIOD_CALCULATION =
            std::chrono::nanoseconds(800us).count();

    struct Policy {
    private:
    class Policy {
        static constexpr int kAllowGroupSwitchingDefault = false;

    public:
@@ -118,23 +118,28 @@ public:
        std::string toString() const;
    };

    // Return code set*Policy() to indicate the current policy is unchanged.
    static constexpr int CURRENT_POLICY_UNCHANGED = 1;
    enum class SetPolicyResult { Invalid, Unchanged, Changed };

    // We maintain the display manager policy and the override policy separately. The override
    // policy is used by CTS tests to get a consistent device state for testing. While the override
    // policy is set, it takes precedence over the display manager policy. Once the override policy
    // is cleared, we revert to using the display manager policy.
    struct DisplayManagerPolicy : Policy {
        using Policy::Policy;
    };

    struct OverridePolicy : Policy {
        using Policy::Policy;
    };

    struct NoOverridePolicy {};

    using PolicyVariant = std::variant<DisplayManagerPolicy, OverridePolicy, NoOverridePolicy>;

    SetPolicyResult setPolicy(const PolicyVariant&) EXCLUDES(mLock) REQUIRES(kMainThreadContext);

    void onModeChangeInitiated() REQUIRES(kMainThreadContext) { mNumModeSwitchesInPolicy++; }

    // Sets the display manager policy to choose refresh rates. The return value will be:
    //   - A negative value if the policy is invalid or another error occurred.
    //   - NO_ERROR if the policy was successfully updated, and the current policy is different from
    //     what it was before the call.
    //   - CURRENT_POLICY_UNCHANGED if the policy was successfully updated, but the current policy
    //     is the same as it was before the call.
    status_t setDisplayManagerPolicy(const Policy& policy) EXCLUDES(mLock);
    // Sets the override policy. See setDisplayManagerPolicy() for the meaning of the return value.
    status_t setOverridePolicy(const std::optional<Policy>& policy) EXCLUDES(mLock);
    // Gets the current policy, which will be the override policy if active, and the display manager
    // policy otherwise.
    Policy getCurrentPolicy() const EXCLUDES(mLock);
@@ -418,6 +423,8 @@ private:
    Policy mDisplayManagerPolicy GUARDED_BY(mLock);
    std::optional<Policy> mOverridePolicy GUARDED_BY(mLock);

    unsigned mNumModeSwitchesInPolicy GUARDED_BY(kMainThreadContext) = 0;

    mutable std::mutex mLock;

    // A sorted list of known frame rates that a Heuristic layer will choose
+54 −53
Original line number Diff line number Diff line
@@ -1105,7 +1105,7 @@ status_t SurfaceFlinger::setActiveModeFromBackdoor(const sp<display::DisplayToke
    }

    const char* const whence = __func__;
    auto future = mScheduler->schedule([=]() -> status_t {
    auto future = mScheduler->schedule([=]() FTL_FAKE_GUARD(kMainThreadContext) -> status_t {
        const auto displayOpt =
                FTL_FAKE_GUARD(mStateLock,
                               ftl::find_if(mPhysicalDisplays,
@@ -1130,13 +1130,16 @@ status_t SurfaceFlinger::setActiveModeFromBackdoor(const sp<display::DisplayToke
        }

        const Fps fps = *fpsOpt;

        // Keep the old switching type.
        const bool allowGroupSwitching =
                display->refreshRateConfigs().getCurrentPolicy().allowGroupSwitching;
        const scheduler::RefreshRateConfigs::Policy policy{modeId, allowGroupSwitching, {fps, fps}};
        constexpr bool kOverridePolicy = false;

        return setDesiredDisplayModeSpecsInternal(display, policy, kOverridePolicy);
        const scheduler::RefreshRateConfigs::DisplayManagerPolicy policy{modeId,
                                                                         allowGroupSwitching,
                                                                         {fps, fps}};

        return setDesiredDisplayModeSpecsInternal(display, policy);
    });

    return future.get();
@@ -1187,7 +1190,7 @@ void SurfaceFlinger::updateInternalStateWithChangedMode() {

void SurfaceFlinger::clearDesiredActiveModeState(const sp<DisplayDevice>& display) {
    display->clearDesiredActiveModeState();
    if (isDisplayActiveLocked(display)) {
    if (display->getPhysicalId() == mActiveDisplayId) {
        mScheduler->setModeChangePending(false);
    }
}
@@ -1217,12 +1220,12 @@ void SurfaceFlinger::setActiveModeInHwcIfNeeded() {
        // Store the local variable to release the lock.
        const auto desiredActiveMode = display->getDesiredActiveMode();
        if (!desiredActiveMode) {
            // No desired active mode pending to be applied
            // No desired active mode pending to be applied.
            continue;
        }

        if (!isDisplayActiveLocked(display)) {
            // display is no longer the active display, so abort the mode change
        if (id != mActiveDisplayId) {
            // Display is no longer the active display, so abort the mode change.
            clearDesiredActiveModeState(display);
            continue;
        }
@@ -1273,6 +1276,8 @@ void SurfaceFlinger::setActiveModeInHwcIfNeeded() {
            ALOGW("initiateModeChange failed: %d", status);
            continue;
        }

        display->refreshRateConfigs().onModeChangeInitiated();
        mScheduler->onNewVsyncPeriodChangeTimeline(outTimeline);

        if (outTimeline.refreshRequired) {
@@ -1853,10 +1858,8 @@ void SurfaceFlinger::onComposerHalVsync(hal::HWDisplayId hwcDisplayId, int64_t t
        return;
    }

    const auto displayId = getHwComposer().toPhysicalDisplayId(hwcDisplayId);
    const bool isActiveDisplay =
            displayId && getPhysicalDisplayTokenLocked(*displayId) == mActiveDisplayToken;
    if (!isActiveDisplay) {
    if (const auto displayId = getHwComposer().toPhysicalDisplayId(hwcDisplayId);
        displayId != mActiveDisplayId) {
        // For now, we don't do anything with non active display vsyncs.
        return;
    }
@@ -2052,8 +2055,7 @@ bool SurfaceFlinger::commit(TimePoint frameTime, VsyncId vsyncId, TimePoint expe

    // Save this once per commit + composite to ensure consistency
    // TODO (b/240619471): consider removing active display check once AOD is fixed
    const auto activeDisplay =
            FTL_FAKE_GUARD(mStateLock, getDisplayDeviceLocked(mActiveDisplayToken));
    const auto activeDisplay = FTL_FAKE_GUARD(mStateLock, getDisplayDeviceLocked(mActiveDisplayId));
    mPowerHintSessionEnabled = mPowerAdvisor->usePowerHintSession() && activeDisplay &&
            activeDisplay->getPowerMode() == hal::PowerMode::ON;
    if (mPowerHintSessionEnabled) {
@@ -3026,7 +3028,7 @@ void SurfaceFlinger::processDisplayChanged(const wp<IBinder>& displayToken,
            (currentState.orientedDisplaySpaceRect != drawingState.orientedDisplaySpaceRect)) {
            display->setProjection(currentState.orientation, currentState.layerStackSpaceRect,
                                   currentState.orientedDisplaySpaceRect);
            if (isDisplayActiveLocked(display)) {
            if (display->getId() == mActiveDisplayId) {
                mActiveDisplayTransformHint = display->getTransformHint();
            }
        }
@@ -3034,7 +3036,7 @@ void SurfaceFlinger::processDisplayChanged(const wp<IBinder>& displayToken,
            currentState.height != drawingState.height) {
            display->setDisplaySize(currentState.width, currentState.height);

            if (isDisplayActiveLocked(display)) {
            if (display->getId() == mActiveDisplayId) {
                onActiveDisplaySizeChanged(display);
            }
        }
@@ -4721,11 +4723,12 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& display, hal:
        return;
    }

    const bool isActiveDisplay = displayId == mActiveDisplayId;
    const bool isInternalDisplay = mPhysicalDisplays.get(displayId)
                                           .transform(&PhysicalDisplay::isInternal)
                                           .value_or(false);

    const auto activeDisplay = getDisplayDeviceLocked(mActiveDisplayToken);
    const auto activeDisplay = getDisplayDeviceLocked(mActiveDisplayId);
    if (isInternalDisplay && activeDisplay != display && activeDisplay &&
        activeDisplay->isPoweredOn()) {
        ALOGW("Trying to change power mode on non active display while the active display is ON");
@@ -4751,7 +4754,7 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& display, hal:
            ALOGW("Couldn't set SCHED_FIFO on display on: %s\n", strerror(errno));
        }
        getHwComposer().setPowerMode(displayId, mode);
        if (isDisplayActiveLocked(display) && mode != hal::PowerMode::DOZE_SUSPEND) {
        if (isActiveDisplay && mode != hal::PowerMode::DOZE_SUSPEND) {
            setHWCVsyncEnabled(displayId, mHWCVsyncPendingState);
            mScheduler->onScreenAcquired(mAppConnectionHandle);
            mScheduler->resyncToHardwareVsync(true, refreshRate);
@@ -4767,7 +4770,7 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& display, hal:
        if (SurfaceFlinger::setSchedAttr(false) != NO_ERROR) {
            ALOGW("Couldn't set uclamp.min on display off: %s\n", strerror(errno));
        }
        if (isDisplayActiveLocked(display) && *currentMode != hal::PowerMode::DOZE_SUSPEND) {
        if (isActiveDisplay && *currentMode != hal::PowerMode::DOZE_SUSPEND) {
            mScheduler->disableHardwareVsync(true);
            mScheduler->onScreenReleased(mAppConnectionHandle);
        }
@@ -4781,7 +4784,7 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& display, hal:
    } else if (mode == hal::PowerMode::DOZE || mode == hal::PowerMode::ON) {
        // Update display while dozing
        getHwComposer().setPowerMode(displayId, mode);
        if (isDisplayActiveLocked(display) && *currentMode == hal::PowerMode::DOZE_SUSPEND) {
        if (isActiveDisplay && *currentMode == hal::PowerMode::DOZE_SUSPEND) {
            ALOGI("Force repainting for DOZE_SUSPEND -> DOZE or ON.");
            mVisibleRegionsDirty = true;
            scheduleRepaint();
@@ -4790,7 +4793,7 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& display, hal:
        }
    } else if (mode == hal::PowerMode::DOZE_SUSPEND) {
        // Leave display going to doze
        if (isDisplayActiveLocked(display)) {
        if (isActiveDisplay) {
            mScheduler->disableHardwareVsync(true);
            mScheduler->onScreenReleased(mAppConnectionHandle);
        }
@@ -4800,7 +4803,7 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& display, hal:
        getHwComposer().setPowerMode(displayId, mode);
    }

    if (isDisplayActiveLocked(display)) {
    if (isActiveDisplay) {
        mTimeStats->setPowerMode(mode);
        mRefreshRateStats->setPowerMode(mode);
        mScheduler->setDisplayPowerMode(mode);
@@ -5186,7 +5189,7 @@ void SurfaceFlinger::dumpHwcLayersMinidumpLocked(std::string& result) const {
        }

        StringAppendF(&result, "Display %s (%s) HWC layers:\n", to_string(*displayId).c_str(),
                      (isDisplayActiveLocked(display) ? "active" : "inactive"));
                      displayId == mActiveDisplayId ? "active" : "inactive");
        Layer::miniDumpHeader(result);

        const DisplayDevice& ref = *display;
@@ -5827,7 +5830,7 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
            case 1036: {
                if (data.readInt32() > 0) { // turn on
                    return mScheduler
                            ->schedule([this] {
                            ->schedule([this]() FTL_FAKE_GUARD(kMainThreadContext) {
                                const auto display =
                                        FTL_FAKE_GUARD(mStateLock, getDefaultDisplayDeviceLocked());

@@ -5837,24 +5840,21 @@ status_t SurfaceFlinger::onTransact(uint32_t code, const Parcel& data, Parcel* r
                                // defaultMode. The defaultMode doesn't matter for the override
                                // policy though, since we set allowGroupSwitching to true, so it's
                                // not a problem.
                                scheduler::RefreshRateConfigs::Policy overridePolicy;
                                scheduler::RefreshRateConfigs::OverridePolicy overridePolicy;
                                overridePolicy.defaultMode = display->refreshRateConfigs()
                                                                     .getDisplayManagerPolicy()
                                                                     .defaultMode;
                                overridePolicy.allowGroupSwitching = true;
                                constexpr bool kOverridePolicy = true;
                                return setDesiredDisplayModeSpecsInternal(display, overridePolicy,
                                                                          kOverridePolicy);
                                return setDesiredDisplayModeSpecsInternal(display, overridePolicy);
                            })
                            .get();
                } else { // turn off
                    return mScheduler
                            ->schedule([this] {
                            ->schedule([this]() FTL_FAKE_GUARD(kMainThreadContext) {
                                const auto display =
                                        FTL_FAKE_GUARD(mStateLock, getDefaultDisplayDeviceLocked());
                                constexpr bool kOverridePolicy = true;
                                return setDesiredDisplayModeSpecsInternal(display, {},
                                                                          kOverridePolicy);
                                return setDesiredDisplayModeSpecsInternal(
                                        display, scheduler::RefreshRateConfigs::NoOverridePolicy{});
                            })
                            .get();
                }
@@ -6693,7 +6693,9 @@ std::optional<DisplayModePtr> SurfaceFlinger::getPreferredDisplayMode(

status_t SurfaceFlinger::setDesiredDisplayModeSpecsInternal(
        const sp<DisplayDevice>& display,
        const std::optional<scheduler::RefreshRateConfigs::Policy>& policy, bool overridePolicy) {
        const scheduler::RefreshRateConfigs::PolicyVariant& policy) {
    const auto displayId = display->getPhysicalId();

    Mutex::Autolock lock(mStateLock);

    if (mDebugDisplayModeSetByBackdoor) {
@@ -6701,31 +6703,31 @@ status_t SurfaceFlinger::setDesiredDisplayModeSpecsInternal(
        return NO_ERROR;
    }

    const status_t setPolicyResult = display->setRefreshRatePolicy(policy, overridePolicy);
    if (setPolicyResult < 0) {
    auto& configs = display->refreshRateConfigs();
    using SetPolicyResult = scheduler::RefreshRateConfigs::SetPolicyResult;

    switch (configs.setPolicy(policy)) {
        case SetPolicyResult::Invalid:
            return BAD_VALUE;
    }
    if (setPolicyResult == scheduler::RefreshRateConfigs::CURRENT_POLICY_UNCHANGED) {
        case SetPolicyResult::Unchanged:
            return NO_ERROR;
        case SetPolicyResult::Changed:
            break;
    }

    const scheduler::RefreshRateConfigs::Policy currentPolicy =
            display->refreshRateConfigs().getCurrentPolicy();

    const scheduler::RefreshRateConfigs::Policy currentPolicy = configs.getCurrentPolicy();
    ALOGV("Setting desired display mode specs: %s", currentPolicy.toString().c_str());

    // TODO(b/140204874): Leave the event in until we do proper testing with all apps that might
    // be depending in this callback.
    const auto activeModePtr = display->refreshRateConfigs().getActiveModePtr();
    if (isDisplayActiveLocked(display)) {
    if (const auto activeModePtr = configs.getActiveModePtr(); displayId == mActiveDisplayId) {
        mScheduler->onPrimaryDisplayModeChanged(mAppConnectionHandle, activeModePtr);
        toggleKernelIdleTimer();
    } else {
        mScheduler->onNonPrimaryDisplayModeChanged(mAppConnectionHandle, activeModePtr);
    }

    auto preferredModeOpt =
            getPreferredDisplayMode(display->getPhysicalId(), currentPolicy.defaultMode);
    auto preferredModeOpt = getPreferredDisplayMode(displayId, currentPolicy.defaultMode);
    if (!preferredModeOpt) {
        ALOGE("%s: Preferred mode is unknown", __func__);
        return NAME_NOT_FOUND;
@@ -6737,7 +6739,7 @@ status_t SurfaceFlinger::setDesiredDisplayModeSpecsInternal(
    ALOGV("Switching to Scheduler preferred mode %d (%s)", preferredModeId.value(),
          to_string(preferredMode->getFps()).c_str());

    if (!display->refreshRateConfigs().isModeAllowed(preferredModeId)) {
    if (!configs.isModeAllowed(preferredModeId)) {
        ALOGE("%s: Preferred mode %d is disallowed", __func__, preferredModeId.value());
        return INVALID_OPERATION;
    }
@@ -6756,7 +6758,7 @@ status_t SurfaceFlinger::setDesiredDisplayModeSpecs(
        return BAD_VALUE;
    }

    auto future = mScheduler->schedule([=]() -> status_t {
    auto future = mScheduler->schedule([=]() FTL_FAKE_GUARD(kMainThreadContext) -> status_t {
        const auto display = FTL_FAKE_GUARD(mStateLock, getDisplayDeviceLocked(displayToken));
        if (!display) {
            ALOGE("Attempt to set desired display modes for invalid display token %p",
@@ -6766,16 +6768,15 @@ status_t SurfaceFlinger::setDesiredDisplayModeSpecs(
            ALOGW("Attempt to set desired display modes for virtual display");
            return INVALID_OPERATION;
        } else {
            using Policy = scheduler::RefreshRateConfigs::Policy;
            using Policy = scheduler::RefreshRateConfigs::DisplayManagerPolicy;
            const Policy policy{DisplayModeId(defaultMode),
                                allowGroupSwitching,
                                {Fps::fromValue(primaryRefreshRateMin),
                                 Fps::fromValue(primaryRefreshRateMax)},
                                {Fps::fromValue(appRequestRefreshRateMin),
                                 Fps::fromValue(appRequestRefreshRateMax)}};
            constexpr bool kOverridePolicy = false;

            return setDesiredDisplayModeSpecsInternal(display, policy, kOverridePolicy);
            return setDesiredDisplayModeSpecsInternal(display, policy);
        }
    });

@@ -7019,7 +7020,7 @@ void SurfaceFlinger::onActiveDisplaySizeChanged(const sp<const DisplayDevice>& a
void SurfaceFlinger::onActiveDisplayChangedLocked(const sp<DisplayDevice>& activeDisplay) {
    ATRACE_CALL();

    if (const auto display = getDisplayDeviceLocked(mActiveDisplayToken)) {
    if (const auto display = getDisplayDeviceLocked(mActiveDisplayId)) {
        display->getCompositionDisplay()->setLayerCachingTexturePoolEnabled(false);
    }

@@ -7027,7 +7028,7 @@ void SurfaceFlinger::onActiveDisplayChangedLocked(const sp<DisplayDevice>& activ
        ALOGE("%s: activeDisplay is null", __func__);
        return;
    }
    mActiveDisplayToken = activeDisplay->getDisplayToken();
    mActiveDisplayId = activeDisplay->getPhysicalId();
    activeDisplay->getCompositionDisplay()->setLayerCachingTexturePoolEnabled(true);
    updateInternalDisplayVsyncLocked(activeDisplay);
    mScheduler->setModeChangePending(false);
Loading