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

Commit 087d3748 authored by yuhui.zhang's avatar yuhui.zhang Committed by Ady Abraham
Browse files

Do not handle VSync event during resolution switch

When there is a resolution switch, SurfaceFlinger will handle as display
changes. If the VSync comes before the display is ready, the access to
the display will bring exception.

Solution: Add mutex lock between onComposerHalVsync() and
setActiveModeInternal().

Bug: 210378166
Test: run cts-on-gsi -m CtsDisplayTestCases
Change-Id: Ide53b0e5cff3b569593a2ed388d0ea66e0002e9d
parent 4a3ce08f
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -2035,7 +2035,10 @@ bool SurfaceFlinger::commit(nsecs_t frameTime, int64_t vsyncId, nsecs_t expected
        // We received the present fence from the HWC, so we assume it successfully updated
        // the mode, hence we update SF.
        mSetActiveModePending = false;
        ON_MAIN_THREAD(updateInternalStateWithChangedMode());
        {
            Mutex::Autolock lock(mStateLock);
            updateInternalStateWithChangedMode();
        }
    }

    if (framePending) {
@@ -2100,10 +2103,9 @@ bool SurfaceFlinger::commit(nsecs_t frameTime, int64_t vsyncId, nsecs_t expected
    {
        Mutex::Autolock _l(mStateLock);
        mScheduler->chooseRefreshRateForContent();
        setActiveModeInHwcIfNeeded();
    }

    ON_MAIN_THREAD(setActiveModeInHwcIfNeeded());

    updateCursorAsync();
    updateInputFlinger();