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

Commit 76cbf5be authored by Dominik Laskowski's avatar Dominik Laskowski
Browse files

SF: Remove flag check for modesetting lock

Ie15de10d16eefeb65289574b120d2ef4cc09d6c0, which restored mStateLock for
modesetting to fix races that led to crashes and broken scheduling, was
flagged to the rolled-out connected_display flag, such that the feature
could be rolled back if needed. Now that the fix has soaked, remove the
race-prone code path that is no longer taken.

Bug: 255635711
Flag: EXEMPT removing connected_display
Test: Build
Change-Id: Ib535e92906fb2d8be2bc70b9af29805a00d40e90
parent 225c2c82
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -1418,8 +1418,6 @@ status_t SurfaceFlinger::setActiveModeFromBackdoor(const sp<display::DisplayToke
    return future.get();
}

// TODO: b/241285876 - Restore thread safety analysis once mStateLock below is unconditional.
[[clang::no_thread_safety_analysis]]
void SurfaceFlinger::finalizeDisplayModeChange(PhysicalDisplayId displayId) {
    SFTRACE_NAME(ftl::Concat(__func__, ' ', displayId.value).c_str());

@@ -1435,8 +1433,6 @@ void SurfaceFlinger::finalizeDisplayModeChange(PhysicalDisplayId displayId) {
    if (const auto oldResolution =
                mDisplayModeController.getActiveMode(displayId).modePtr->getResolution();
        oldResolution != activeMode.modePtr->getResolution()) {
        ConditionalLock lock(mStateLock, !FlagManager::getInstance().connected_display());

        auto& state = mCurrentState.displays.editValueFor(getPhysicalDisplayTokenLocked(displayId));
        // We need to generate new sequenceId in order to recreate the display (and this
        // way the framebuffer).
@@ -2597,7 +2593,7 @@ bool SurfaceFlinger::commit(PhysicalDisplayId pacesetterId,
    }

    {
        ConditionalLock lock(mStateLock, FlagManager::getInstance().connected_display());
        Mutex::Autolock lock(mStateLock);

        for (const auto [displayId, _] : frameTargets) {
            if (mDisplayModeController.isModeSetPending(displayId)) {
@@ -2700,13 +2696,6 @@ bool SurfaceFlinger::commit(PhysicalDisplayId pacesetterId,
        mScheduler->chooseRefreshRateForContent(&mLayerHierarchyBuilder.getHierarchy(),
                                                updateAttachedChoreographer);

        if (FlagManager::getInstance().connected_display()) {
            initiateDisplayModeChanges();
        }
    }

    if (!FlagManager::getInstance().connected_display()) {
        ftl::FakeGuard guard(mStateLock);
        initiateDisplayModeChanges();
    }