diff options
Diffstat (limited to 'libs/hwui/renderthread')
| -rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 16 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 13 |
2 files changed, 21 insertions, 8 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index 706e14e..f8490b6 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -156,10 +156,18 @@ void CanvasContext::processLayerUpdate(DeferredLayerUpdater* layerUpdater) { } } +static bool wasSkipped(FrameInfo* info) { + return info && ((*info)[FrameInfoIndex::kFlags] & FrameInfoFlags::kSkippedFrame); +} + void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo) { mRenderThread.removeFrameCallback(this); - mCurrentFrameInfo = &mFrames.next(); + // If the previous frame was dropped we don't need to hold onto it, so + // just keep using the previous frame's structure instead + if (!wasSkipped(mCurrentFrameInfo)) { + mCurrentFrameInfo = &mFrames.next(); + } mCurrentFrameInfo->importUiThreadInfo(uiFrameInfo); mCurrentFrameInfo->markSyncStart(); @@ -391,7 +399,11 @@ void CanvasContext::setTextureAtlas(RenderThread& thread, void CanvasContext::dumpFrames(int fd) { FILE* file = fdopen(fd, "a"); - fprintf(file, "\n\n---PROFILEDATA---"); + fprintf(file, "\n\n---PROFILEDATA---\n"); + for (size_t i = 0; i < static_cast<size_t>(FrameInfoIndex::kNumIndexes); i++) { + fprintf(file, FrameInfoNames[i].c_str()); + fprintf(file, ","); + } for (size_t i = 0; i < mFrames.size(); i++) { FrameInfo& frame = mFrames[i]; if (frame[FrameInfoIndex::kSyncStart] == 0) { diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index d8a9921..6d9acd4 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -52,11 +52,12 @@ namespace renderthread { MethodInvokeRenderTask* task = new MethodInvokeRenderTask((RunnableMethod) Bridge_ ## method); \ ARGS(method) *args = (ARGS(method) *) task->payload() -enum class DumpFlags { - kFrameStats = 1 << 0, - kReset = 1 << 1, +namespace DumpFlags { + enum { + FrameStats = 1 << 0, + Reset = 1 << 1, + }; }; -MAKE_FLAGS_ENUM(DumpFlags) CREATE_BRIDGE4(createContext, RenderThread* thread, bool translucent, RenderNode* rootRenderNode, IContextFactory* contextFactory) { @@ -409,10 +410,10 @@ CREATE_BRIDGE4(dumpProfileInfo, CanvasContext* context, RenderThread* thread, int fd, int dumpFlags) { args->context->profiler().dumpData(args->fd); args->thread->jankTracker().dump(args->fd); - if (args->dumpFlags & DumpFlags::kFrameStats) { + if (args->dumpFlags & DumpFlags::FrameStats) { args->context->dumpFrames(args->fd); } - if (args->dumpFlags & DumpFlags::kReset) { + if (args->dumpFlags & DumpFlags::Reset) { args->context->resetFrameStats(); } return nullptr; |
