From 6f97e15e3be1ea7aacf4f5aa92c0bec3b729ce0a Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 13 Apr 2021 12:02:50 -0400 Subject: [PATCH] Fix a logspam On skiavk the flush to GPU happens sooner than it does on skiagl, which was resulting in false-positive warning logs. Adjust the condition to avoid this, so it should now only log if the GPU fence time is significantly incorrect. Fixes: 180488606 Test: doesn't log on skiavk Change-Id: Ie6546b788663b5d863fb064f55245bead4eb0160 --- libs/hwui/renderthread/CanvasContext.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index aedb5c28dc3e7..a9efb1a4ee32e 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -667,10 +667,14 @@ void CanvasContext::onSurfaceStatsAvailable(void* context, ASurfaceControl* cont if (gpuCompleteTime == -1) { gpuCompleteTime = frameInfo->get(FrameInfoIndex::SwapBuffersCompleted); } - if (gpuCompleteTime < frameInfo->get(FrameInfoIndex::SwapBuffers)) { - // TODO (b/180488606): Investigate why this can happen for first frames. - ALOGW("Impossible GPU complete time swapBuffers=%" PRIi64 " gpuComplete=%" PRIi64, - frameInfo->get(FrameInfoIndex::SwapBuffers), gpuCompleteTime); + 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;