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

Commit 50f52e2b authored by Midas Chien's avatar Midas Chien
Browse files

SurfaceFlinger: Modify the meaning of composition strategy changes

Modify the meaning of composition strategy changes to count sf move in
and out of client composition. When this happens too frequently, sf
offset changes rapidly - may cause system jank.

Bug: 144526027
Test: adb shell dumpsys SurfaceFlinger --timestats -dump
Change-Id: Ia9281b6fd6afe13386e48c3077a24660a8c1a6e3
parent 487496c4
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -1982,7 +1982,7 @@ void SurfaceFlinger::onMessageRefresh() {
    mFrameTimeline->setSfPresent(systemTime(),
    mFrameTimeline->setSfPresent(systemTime(),
                                 std::make_shared<FenceTime>(mPreviousPresentFences[0]));
                                 std::make_shared<FenceTime>(mPreviousPresentFences[0]));


    const bool prevFrameHadDeviceComposition = mHadDeviceComposition;
    const bool prevFrameHadClientComposition = mHadClientComposition;


    mHadClientComposition = std::any_of(displays.cbegin(), displays.cend(), [](const auto& pair) {
    mHadClientComposition = std::any_of(displays.cbegin(), displays.cend(), [](const auto& pair) {
        const auto& state = pair.second->getCompositionDisplay()->getState();
        const auto& state = pair.second->getCompositionDisplay()->getState();
@@ -1997,9 +1997,8 @@ void SurfaceFlinger::onMessageRefresh() {
                const auto& state = pair.second->getCompositionDisplay()->getState();
                const auto& state = pair.second->getCompositionDisplay()->getState();
                return state.reusedClientComposition;
                return state.reusedClientComposition;
            });
            });

    // Only report a strategy change if we move in and out of client composition
    // Only report a strategy change if we move in and out of composition with hw overlays
    if (prevFrameHadClientComposition != mHadClientComposition) {
    if (prevFrameHadDeviceComposition != mHadDeviceComposition) {
        mTimeStats->incrementCompositionStrategyChanges();
        mTimeStats->incrementCompositionStrategyChanges();
    }
    }