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

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

SF: Remove connected_display flag

Bug: 380251940
Flag: EXEMPT removing connected_display
Test: presubmit
Change-Id: I870d8f13fe8012f07a47dace756c5d4b2261ebd3
parent f863ba4d
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -97,9 +97,7 @@ auto DisplayModeController::setDesiredMode(PhysicalDisplayId displayId,
            const bool force = desiredModeOpt->force;
            desiredModeOpt = std::move(desiredMode);
            desiredModeOpt->emitEvent |= emitEvent;
            if (FlagManager::getInstance().connected_display()) {
            desiredModeOpt->force |= force;
            }
            return DesiredModeAction::None;
        }

@@ -191,7 +189,7 @@ auto DisplayModeController::initiateModeChange(
    // cleared until the next `SF::initiateDisplayModeChanges`. However, the desired mode has been
    // consumed at this point, so clear the `force` flag to prevent an endless loop of
    // `initiateModeChange`.
    if (FlagManager::getInstance().connected_display()) {
    {
        std::scoped_lock lock(displayPtr->desiredModeLock);
        if (displayPtr->desiredModeOpt) {
            displayPtr->desiredModeOpt->force = false;
+1 −4
Original line number Diff line number Diff line
@@ -439,11 +439,8 @@ Error Display::setActiveConfigWithConstraints(hal::HWConfigId configId,
    // FIXME (b/319505580): At least the first config set on an external display must be
    // `setActiveConfig`, so skip over the block that calls `setActiveConfigWithConstraints`
    // for simplicity.
    const bool connected_display = FlagManager::getInstance().connected_display();

    if (isVsyncPeriodSwitchSupported() &&
        (!connected_display ||
         getConnectionType().value_opt() != ui::DisplayConnectionType::External)) {
        getConnectionType().value_opt() != ui::DisplayConnectionType::External) {
        Hwc2::IComposerClient::VsyncPeriodChangeConstraints hwc2Constraints;
        hwc2Constraints.desiredTimeNanos = constraints.desiredTimeNanos;
        hwc2Constraints.seamlessRequired = constraints.seamlessRequired;
+2 −2
Original line number Diff line number Diff line
@@ -986,7 +986,7 @@ std::shared_ptr<VsyncSchedule> Scheduler::promotePacesetterDisplayLocked(
    if (const auto pacesetterOpt = pacesetterDisplayLocked()) {
        const Display& pacesetter = *pacesetterOpt;

        if (!FlagManager::getInstance().connected_display() || params.toggleIdleTimer) {
        if (params.toggleIdleTimer) {
            pacesetter.selectorPtr->setIdleTimerCallbacks(
                    {.platform = {.onReset = [this] { idleTimerCallback(TimerState::Reset); },
                                  .onExpired = [this] { idleTimerCallback(TimerState::Expired); }},
@@ -1018,7 +1018,7 @@ void Scheduler::applyNewVsyncSchedule(std::shared_ptr<VsyncSchedule> vsyncSchedu
}

void Scheduler::demotePacesetterDisplay(PromotionParams params) {
    if (!FlagManager::getInstance().connected_display() || params.toggleIdleTimer) {
    if (params.toggleIdleTimer) {
        // No need to lock for reads on kMainThreadContext.
        if (const auto pacesetterPtr =
                    FTL_FAKE_GUARD(mDisplayLock, pacesetterSelectorPtrLocked())) {
+1 −1
Original line number Diff line number Diff line
@@ -386,7 +386,7 @@ private:
    // a deadlock where the main thread joins with the timer thread as the timer thread waits to
    // lock a mutex held by the main thread.
    struct PromotionParams {
        // Whether to stop and start the idle timer. Ignored unless connected_display flag is set.
        // Whether to stop and start the idle timer.
        bool toggleIdleTimer;
    };

+4 −11
Original line number Diff line number Diff line
@@ -2286,8 +2286,7 @@ void SurfaceFlinger::scheduleSample() {

void SurfaceFlinger::onComposerHalVsync(hal::HWDisplayId hwcDisplayId, int64_t timestamp,
                                        std::optional<hal::VsyncPeriodNanos> vsyncPeriod) {
    if (FlagManager::getInstance().connected_display() && timestamp < 0 &&
        vsyncPeriod.has_value()) {
    if (timestamp < 0 && vsyncPeriod.has_value()) {
        if (mIsHdcpViaNegVsync && vsyncPeriod.value() == ~1) {
            const int32_t value = static_cast<int32_t>(-timestamp);
            // one byte is good enough to encode android.hardware.drm.HdcpLevel
@@ -3552,8 +3551,7 @@ std::pair<DisplayModes, DisplayModePtr> SurfaceFlinger::loadDisplayModes(
    std::vector<HWComposer::HWCDisplayMode> hwcModes;
    std::optional<hal::HWConfigId> activeModeHwcIdOpt;

    const bool isExternalDisplay = FlagManager::getInstance().connected_display() &&
            getHwComposer().getDisplayConnectionType(displayId) ==
    const bool isExternalDisplay = getHwComposer().getDisplayConnectionType(displayId) ==
            ui::DisplayConnectionType::External;

    int attempt = 0;
@@ -4049,8 +4047,7 @@ void SurfaceFlinger::processDisplayAdded(const wp<IBinder>& displayToken,
    // For an external display, loadDisplayModes already attempted to select the same mode
    // as DM, but SF still needs to be updated to match.
    // TODO (b/318534874): Let DM decide the initial mode.
    if (const auto& physical = state.physical;
        mScheduler && physical && FlagManager::getInstance().connected_display()) {
    if (const auto& physical = state.physical; mScheduler && physical) {
        const bool isInternalDisplay = mPhysicalDisplays.get(physical->id)
                                               .transform(&PhysicalDisplay::isInternal)
                                               .value_or(false);
@@ -8359,10 +8356,6 @@ status_t SurfaceFlinger::getStalledTransactionInfo(

void SurfaceFlinger::updateHdcpLevels(hal::HWDisplayId hwcDisplayId, int32_t connectedLevel,
                                      int32_t maxLevel) {
    if (!FlagManager::getInstance().connected_display()) {
        return;
    }

    Mutex::Autolock lock(mStateLock);

    const auto idOpt = getHwComposer().toPhysicalDisplayId(hwcDisplayId);
Loading