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

Commit 95cf4e70 authored by Boleyn Su's avatar Boleyn Su
Browse files

gpuDrawTime should default to 0 when endTime is unknown

gpuDrawTime should default to 0 when endTime is unknown, otherwise we
will treat nagative duration as infinity in JankTracker::finishGpuDraw.

Test: atest com.android.server.cts.GraphicsStatsValidationTest#testJankyDrawFrame
Bug: b/168262403
Change-Id: I4bb61074e6917ec7ef4af429f48487ae34f8ad0b
parent 97d89af9
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -158,7 +158,7 @@ public:
        // GPU start time is approximated to the moment before swapBuffer is invoked.
        // GPU start time is approximated to the moment before swapBuffer is invoked.
        // We could add an EGLSyncKHR fence at the beginning of the frame, but that is an overhead.
        // We could add an EGLSyncKHR fence at the beginning of the frame, but that is an overhead.
        int64_t endTime = get(FrameInfoIndex::GpuCompleted);
        int64_t endTime = get(FrameInfoIndex::GpuCompleted);
        return endTime > 0 ? endTime - get(FrameInfoIndex::SwapBuffers) : -1;
        return endTime > 0 ? endTime - get(FrameInfoIndex::SwapBuffers) : 0;
    }
    }


    inline int64_t& set(FrameInfoIndex index) { return mFrameInfo[static_cast<int>(index)]; }
    inline int64_t& set(FrameInfoIndex index) { return mFrameInfo[static_cast<int>(index)]; }