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

Commit 889325a4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix some missed frame reporting issues"

parents 994ba6f6 cc0fc60b
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -1576,6 +1576,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.
@@ -1586,14 +1598,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) {
@@ -1674,11 +1678,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,