diff options
-rw-r--r-- | libs/hwui/DisplayList.h | 2 | ||||
-rw-r--r-- | libs/hwui/RenderNode.cpp | 7 | ||||
-rw-r--r-- | libs/hwui/RenderNode.h | 8 | ||||
-rw-r--r-- | libs/hwui/pipeline/skia/SkiaDisplayList.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/pipeline/skia/SkiaDisplayList.h | 2 | ||||
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/renderthread/CanvasContext.h | 2 | ||||
-rw-r--r-- | libs/hwui/renderthread/RenderThread.cpp | 10 |
8 files changed, 37 insertions, 6 deletions
diff --git a/libs/hwui/DisplayList.h b/libs/hwui/DisplayList.h index eb5878d95561..8c180da9c84f 100644 --- a/libs/hwui/DisplayList.h +++ b/libs/hwui/DisplayList.h @@ -54,6 +54,8 @@ public: mImpl->updateChildren(std::move(updateFn)); } + void visit(std::function<void(const RenderNode&)> func) const { mImpl->visit(std::move(func)); } + [[nodiscard]] explicit operator bool() const { return mImpl.get() != nullptr; } diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 1dd22cf43c5c..eee93c153b9a 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -109,6 +109,13 @@ void RenderNode::output(std::ostream& output, uint32_t level) { output << std::endl; } +void RenderNode::visit(std::function<void(const RenderNode&)> func) const { + func(*this); + if (mDisplayList) { + mDisplayList.visit(func); + } +} + int RenderNode::getUsageSize() { int size = sizeof(RenderNode); size += mStagingDisplayList.getUsedSize(); diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h index d1e04adcb642..b5b828e50cdd 100644 --- a/libs/hwui/RenderNode.h +++ b/libs/hwui/RenderNode.h @@ -129,10 +129,6 @@ public: StretchMask& getStretchMask() { return mStretchMask; } - VirtualLightRefBase* getUserContext() const { return mUserContext.get(); } - - void setUserContext(VirtualLightRefBase* context) { mUserContext = context; } - bool isPropertyFieldDirty(DirtyPropertyMask field) const { return mDirtyPropertyFields & field; } @@ -215,6 +211,8 @@ public: void output(std::ostream& output, uint32_t level); + void visit(std::function<void(const RenderNode&)>) const; + void setUsageHint(UsageHint usageHint) { mUsageHint = usageHint; } UsageHint usageHint() const { return mUsageHint; } @@ -222,6 +220,7 @@ public: int64_t uniqueId() const { return mUniqueId; } void setIsTextureView() { mIsTextureView = true; } + bool isTextureView() const { return mIsTextureView; } void markDrawStart(SkCanvas& canvas); void markDrawEnd(SkCanvas& canvas); @@ -248,7 +247,6 @@ private: const int64_t mUniqueId; String8 mName; - sp<VirtualLightRefBase> mUserContext; uint32_t mDirtyPropertyFields; RenderProperties mProperties; diff --git a/libs/hwui/pipeline/skia/SkiaDisplayList.cpp b/libs/hwui/pipeline/skia/SkiaDisplayList.cpp index af2d3b34bac7..5c8285a8e1e9 100644 --- a/libs/hwui/pipeline/skia/SkiaDisplayList.cpp +++ b/libs/hwui/pipeline/skia/SkiaDisplayList.cpp @@ -66,6 +66,12 @@ void SkiaDisplayList::updateChildren(std::function<void(RenderNode*)> updateFn) } } +void SkiaDisplayList::visit(std::function<void(const RenderNode&)> func) const { + for (auto& child : mChildNodes) { + child.getRenderNode()->visit(func); + } +} + static bool intersects(const SkISize screenSize, const Matrix4& mat, const SkRect& bounds) { Vector3 points[] = { Vector3 {bounds.fLeft, bounds.fTop, 0}, Vector3 {bounds.fRight, bounds.fTop, 0}, diff --git a/libs/hwui/pipeline/skia/SkiaDisplayList.h b/libs/hwui/pipeline/skia/SkiaDisplayList.h index 7af31a4dc4c6..e5bd5c9b2a3b 100644 --- a/libs/hwui/pipeline/skia/SkiaDisplayList.h +++ b/libs/hwui/pipeline/skia/SkiaDisplayList.h @@ -145,6 +145,8 @@ public: */ void updateChildren(std::function<void(RenderNode*)> updateFn); + void visit(std::function<void(const RenderNode&)> func) const; + /** * Returns true if there is a child render node that is a projection receiver. */ diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index 2e0de3f8f590..4064bb933491 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -1132,6 +1132,12 @@ bool CanvasContext::shouldDither() { return self->mColorMode != ColorMode::Default; } +void CanvasContext::visitAllRenderNodes(std::function<void(const RenderNode&)> func) const { + for (auto node : mRenderNodes) { + node->visit(func); + } +} + } /* namespace renderthread */ } /* namespace uirenderer */ } /* namespace android */ diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h index 3f02674d3b53..241f8dd879d9 100644 --- a/libs/hwui/renderthread/CanvasContext.h +++ b/libs/hwui/renderthread/CanvasContext.h @@ -238,6 +238,8 @@ public: static bool shouldDither(); + void visitAllRenderNodes(std::function<void(const RenderNode&)>) const; + private: CanvasContext(RenderThread& thread, bool translucent, RenderNode* rootRenderNode, IContextFactory* contextFactory, std::unique_ptr<IRenderPipeline> renderPipeline, diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp index eb28c080c056..c7400743a14b 100644 --- a/libs/hwui/renderthread/RenderThread.cpp +++ b/libs/hwui/renderthread/RenderThread.cpp @@ -357,7 +357,15 @@ void RenderThread::dumpGraphicsMemory(int fd, bool includeProfileData) { String8 cachesOutput; mCacheManager->dumpMemoryUsage(cachesOutput, mRenderState); - dprintf(fd, "\nPipeline=%s\n%s\n", pipelineToString(), cachesOutput.string()); + dprintf(fd, "\nPipeline=%s\n%s", pipelineToString(), cachesOutput.string()); + for (auto&& context : mCacheManager->mCanvasContexts) { + context->visitAllRenderNodes([&](const RenderNode& node) { + if (node.isTextureView()) { + dprintf(fd, "TextureView: %dx%d\n", node.getWidth(), node.getHeight()); + } + }); + } + dprintf(fd, "\n"); } void RenderThread::getMemoryUsage(size_t* cpuUsage, size_t* gpuUsage) { |