summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CanvasContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.cpp')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp22
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);
}