diff options
author | Brian Orr <brianorr@google.com> | 2021-06-15 12:47:53 -0700 |
---|---|---|
committer | Daniel Norman <danielnorman@google.com> | 2021-06-17 13:37:54 -0700 |
commit | 71c831703ae59baf47e0afe611fecd714c481cdf (patch) | |
tree | 06731a987032723085b9e1a65951cf96abbc19cf /libs/hwui/renderthread/CanvasContext.cpp | |
parent | 065c9e9a6e9d61d4383a91721eb56a3de253bdbe (diff) | |
parent | 81833820d54b9a6b27894f9f8dfd72222d416992 (diff) |
Merge SP1A.210604.001
Change-Id: I5200ee05285ae422d5e9c1c00f45709a5d6188be
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.cpp')
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index bae1ab5bab44..d3173056065c 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -26,6 +26,7 @@ #include <cstdlib> #include <functional> +#include <gui/TraceUtils.h> #include "../Properties.h" #include "AnimationContext.h" #include "Frame.h" @@ -39,7 +40,6 @@ #include "thread/CommonPool.h" #include "utils/GLUtils.h" #include "utils/TimeUtils.h" -#include "utils/TraceUtils.h" #define TRIM_MEMORY_COMPLETE 80 #define TRIM_MEMORY_UI_HIDDEN 20 @@ -195,6 +195,10 @@ void CanvasContext::setSurfaceControl(ASurfaceControl* surfaceControl) { auto funcs = mRenderThread.getASurfaceControlFunctions(); + if (surfaceControl == nullptr) { + setASurfaceTransactionCallback(nullptr); + } + if (mSurfaceControl != nullptr) { funcs.unregisterListenerFunc(this, &onSurfaceStatsAvailable); funcs.releaseFunc(mSurfaceControl); @@ -673,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); } |