summaryrefslogtreecommitdiffstats
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.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 436946f..6d7dcf1 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -46,7 +46,8 @@ CanvasContext::CanvasContext(RenderThread& thread, bool translucent,
, mOpaque(!translucent)
, mAnimationContext(contextFactory->createAnimationContext(mRenderThread.timeLord()))
, mRootRenderNode(rootRenderNode)
- , mJankTracker(thread.timeLord().frameIntervalNanos()) {
+ , mJankTracker(thread.timeLord().frameIntervalNanos())
+ , mProfiler(mFrames) {
mRenderThread.renderState().registerCanvasContext(this);
mProfiler.setDensity(mRenderThread.mainDisplayInfo().density);
}
@@ -171,6 +172,7 @@ void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo) {
}
if (CC_UNLIKELY(!mNativeWindow.get())) {
+ mCurrentFrameInfo->addFlag(FrameInfoFlags::kSkippedFrame);
info.out.canDrawThisFrame = false;
return;
}
@@ -183,6 +185,10 @@ void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo) {
NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND, &runningBehind);
info.out.canDrawThisFrame = !runningBehind;
+ if (!info.out.canDrawThisFrame) {
+ mCurrentFrameInfo->addFlag(FrameInfoFlags::kSkippedFrame);
+ }
+
if (info.out.hasAnimations || !info.out.canDrawThisFrame) {
if (!info.out.requiresUiRedraw) {
// If animationsNeedsRedraw is set don't bother posting for an RT anim
@@ -213,7 +219,6 @@ void CanvasContext::draw() {
return;
}
- profiler().markPlaybackStart();
mCurrentFrameInfo->markIssueDrawCommandsStart();
EGLint width, height;
@@ -246,8 +251,6 @@ void CanvasContext::draw() {
bool drew = mCanvas->finish();
- profiler().markPlaybackEnd();
-
// Even if we decided to cancel the frame, from the perspective of jank
// metrics the frame was swapped at this point
mCurrentFrameInfo->markSwapBuffers();
@@ -262,7 +265,6 @@ void CanvasContext::draw() {
mCurrentFrameInfo->markFrameCompleted();
mJankTracker.addFrame(*mCurrentFrameInfo);
mRenderThread.jankTracker().addFrame(*mCurrentFrameInfo);
- profiler().finishFrame();
}
// Called by choreographer to do an RT-driven animation
@@ -273,7 +275,6 @@ void CanvasContext::doFrame() {
ATRACE_CALL();
- profiler().startFrame();
int64_t frameInfo[UI_THREAD_FRAME_INFO_SIZE];
UiFrameInfoBuilder(frameInfo)
.addFlag(FrameInfoFlags::kRTAnimation)
@@ -284,8 +285,6 @@ void CanvasContext::doFrame() {
prepareTree(info, frameInfo);
if (info.out.canDrawThisFrame) {
draw();
- } else {
- mCurrentFrameInfo->addFlag(FrameInfoFlags::kSkippedFrame);
}
}