diff options
author | Jorim Jaggi <jjaggi@google.com> | 2021-05-11 14:57:25 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2021-05-17 23:24:03 +0200 |
commit | b891cdf24a2b9d086c99ea4b6c527f46c4324634 (patch) | |
tree | 2e54c263f36aad687fbc30189aeb67f4c366737a /libs/hwui/renderthread/CanvasContext.cpp | |
parent | 65782cf2c14cf4e3603b6ee5a9690891fb99f8cd (diff) |
Use SwapBuffersCompleted as frame end time
...in case GPU completes really quickly.
Fixes: 181899835
Test: atest FrameMetricsListenerTest --iterations 50
Change-Id: I73b9380f92eb15f94ae4754746ee98c7fbc4e6c7
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.cpp')
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index 891a99489fcf..c1f61e08e38c 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -677,20 +677,8 @@ void CanvasContext::onSurfaceStatsAvailable(void* context, ASurfaceControl* cont } if (frameInfo != nullptr) { - if (gpuCompleteTime == -1) { - gpuCompleteTime = frameInfo->get(FrameInfoIndex::SwapBuffersCompleted); - } - if (gpuCompleteTime < frameInfo->get(FrameInfoIndex::IssueDrawCommandsStart)) { - // On Vulkan the GPU commands are flushed to the GPU during IssueDrawCommands rather - // than after SwapBuffers. So if the GPU signals before issue draw commands, then - // something probably went wrong. Anything after that could just be expected - // pipeline differences - ALOGW("Impossible GPU complete time issueCommandsStart=%" PRIi64 - " gpuComplete=%" PRIi64, - frameInfo->get(FrameInfoIndex::IssueDrawCommandsStart), gpuCompleteTime); - gpuCompleteTime = frameInfo->get(FrameInfoIndex::SwapBuffersCompleted); - } - frameInfo->set(FrameInfoIndex::FrameCompleted) = gpuCompleteTime; + frameInfo->set(FrameInfoIndex::FrameCompleted) = std::max(gpuCompleteTime, + frameInfo->get(FrameInfoIndex::SwapBuffersCompleted)); frameInfo->set(FrameInfoIndex::GpuCompleted) = gpuCompleteTime; instance->mJankTracker.finishFrame(*frameInfo, instance->mFrameMetricsReporter); } |