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

Commit 0b10360a authored by Ady Abraham's avatar Ady Abraham
Browse files

SF: initiateDisplayModeChanges requires another commit

When initiateDisplayModeChanges decides to change the mode,
another commit is required as the call to finalizeDisplayModeChange
resides within commit.

Bug: 341152836
Change-Id: Ic60e144e113521b9143fa60e5fed46aa562ddfe4
Test: android.view.surfacecontrol.cts.ChoreographerNativeTest#testRefreshRateCallbacksIsSyncedWithDisplayManager
parent e9bd1823
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -1414,12 +1414,11 @@ void SurfaceFlinger::applyActiveMode(const sp<DisplayDevice>& display) {
    }
}

bool SurfaceFlinger::initiateDisplayModeChanges() {
void SurfaceFlinger::initiateDisplayModeChanges() {
    ATRACE_CALL();

    std::optional<PhysicalDisplayId> displayToUpdateImmediately;

    bool mustComposite = false;
    for (const auto& [id, physical] : mPhysicalDisplays) {
        const auto display = getDisplayDeviceLocked(id);
        if (!display) continue;
@@ -1471,11 +1470,7 @@ bool SurfaceFlinger::initiateDisplayModeChanges() {
        mScheduler->onNewVsyncPeriodChangeTimeline(outTimeline);

        if (outTimeline.refreshRequired) {
            if (FlagManager::getInstance().vrr_bugfix_24q4()) {
                mustComposite = true;
            } else {
            scheduleComposite(FrameHint::kNone);
            }
        } else {
            // TODO(b/255635711): Remove `displayToUpdateImmediately` to `finalizeDisplayModeChange`
            // for all displays. This was only needed when the loop iterated over `mDisplays` rather
@@ -1493,8 +1488,6 @@ bool SurfaceFlinger::initiateDisplayModeChanges() {
            applyActiveMode(display);
        }
    }

    return mustComposite;
}

void SurfaceFlinger::disableExpensiveRendering() {
@@ -2674,7 +2667,7 @@ bool SurfaceFlinger::commit(PhysicalDisplayId pacesetterId,
                                                        ? &mLayerHierarchyBuilder.getHierarchy()
                                                        : nullptr,
                                                updateAttachedChoreographer);
        mustComposite |= initiateDisplayModeChanges();
        initiateDisplayModeChanges();
    }

    updateCursorAsync();
+1 −1
Original line number Diff line number Diff line
@@ -737,7 +737,7 @@ private:
    status_t setActiveModeFromBackdoor(const sp<display::DisplayToken>&, DisplayModeId, Fps minFps,
                                       Fps maxFps);

    bool initiateDisplayModeChanges() REQUIRES(mStateLock, kMainThreadContext);
    void initiateDisplayModeChanges() REQUIRES(mStateLock, kMainThreadContext);
    void finalizeDisplayModeChange(DisplayDevice&) REQUIRES(mStateLock, kMainThreadContext);

    // TODO(b/241285191): Replace DisplayDevice with DisplayModeRequest, and move to Scheduler.