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

Commit cc0fc60b authored by Alec Mouri's avatar Alec Mouri
Browse files

Fix some missed frame reporting issues

* Distinguish between HWC and GL missed frames in systrace
* Report missed frames before performSetActiveConfig

Bug: 124383894
Test: systrace
Change-Id: I54f1bd6074e27fb6e00d8397a704fc1d5f1ddd35
parent 7ea0f7ea
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -1582,6 +1582,18 @@ void SurfaceFlinger::onMessageReceived(int32_t what) {
    ATRACE_CALL();
    switch (what) {
        case MessageQueue::INVALIDATE: {
            bool frameMissed = mPreviousPresentFence != Fence::NO_FENCE &&
                    (mPreviousPresentFence->getStatus() == Fence::Status::Unsignaled);
            bool hwcFrameMissed = mHadDeviceComposition && frameMissed;
            bool gpuFrameMissed = mHadClientComposition && frameMissed;
            ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
            ATRACE_INT("HwcFrameMissed", static_cast<int>(hwcFrameMissed));
            ATRACE_INT("GpuFrameMissed", static_cast<int>(gpuFrameMissed));
            if (frameMissed) {
                mFrameMissedCount++;
                mTimeStats->incrementMissedFrames();
            }

            if (mUseSmart90ForVideo) {
                // This call is made each time SF wakes up and creates a new frame. It is part
                // of video detection feature.
@@ -1592,14 +1604,6 @@ void SurfaceFlinger::onMessageReceived(int32_t what) {
                break;
            }

            bool frameMissed = mPreviousPresentFence != Fence::NO_FENCE &&
                    (mPreviousPresentFence->getStatus() == Fence::Status::Unsignaled);
            bool hwcFrameMissed = !mHadClientComposition && frameMissed;
            if (frameMissed) {
                ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
                mFrameMissedCount++;
                mTimeStats->incrementMissedFrames();
            }
            // For now, only propagate backpressure when missing a hwc frame.
            if (hwcFrameMissed) {
                if (mPropagateBackpressure) {
@@ -1680,11 +1684,14 @@ void SurfaceFlinger::handleMessageRefresh() {
    postComposition();

    mHadClientComposition = false;
    mHadDeviceComposition = false;
    for (const auto& [token, displayDevice] : mDisplays) {
        auto display = displayDevice->getCompositionDisplay();
        const auto displayId = display->getId();
        mHadClientComposition =
                mHadClientComposition || getHwComposer().hasClientComposition(displayId);
        mHadDeviceComposition =
                mHadDeviceComposition || getHwComposer().hasDeviceComposition(displayId);
    }

    mVsyncModulator.onRefreshed(mHadClientComposition);
+5 −0
Original line number Diff line number Diff line
@@ -970,7 +970,12 @@ private:
    // Tracks layers that need to update a display's dirty region.
    std::vector<sp<Layer>> mLayersPendingRefresh;
    sp<Fence> mPreviousPresentFence = Fence::NO_FENCE;
    // True if in the previous frame at least one layer was composed via the GPU.
    bool mHadClientComposition = false;
    // True if in the previous frame at least one layer was composed via HW Composer.
    // Note that it is possible for a frame to be composed via both client and device
    // composition, for example in the case of overlays.
    bool mHadDeviceComposition = false;

    enum class BootStage {
        BOOTLOADER,