Loading libs/hwui/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ hwui_src_files := \ ShadowTessellator.cpp \ SkiaCanvas.cpp \ SkiaCanvasProxy.cpp \ SkiaDisplayList.cpp \ SkiaShader.cpp \ Snapshot.cpp \ SpotShadow.cpp \ Loading Loading @@ -286,6 +287,7 @@ LOCAL_SRC_FILES += \ tests/unit/RenderNodeTests.cpp \ tests/unit/RenderPropertiesTests.cpp \ tests/unit/SkiaBehaviorTests.cpp \ tests/unit/SkiaDisplayListTests.cpp \ tests/unit/SkiaCanvasTests.cpp \ tests/unit/SnapshotTests.cpp \ tests/unit/StringUtilsTests.cpp \ Loading libs/hwui/DisplayList.cpp +43 −0 Original line number Diff line number Diff line Loading @@ -19,10 +19,12 @@ #include <utils/Trace.h> #include "DamageAccumulator.h" #include "Debug.h" #include "DisplayList.h" #include "RecordedOp.h" #include "RenderNode.h" #include "VectorDrawable.h" namespace android { namespace uirenderer { Loading Loading @@ -86,5 +88,46 @@ size_t DisplayList::addChild(NodeOpType* op) { return index; } void DisplayList::syncContents() { for (auto& iter : functors) { (*iter.functor)(DrawGlInfo::kModeSync, nullptr); } for (auto& vectorDrawable : vectorDrawables) { vectorDrawable->syncProperties(); } } void DisplayList::updateChildren(std::function<void(RenderNode*)> updateFn) { for (auto&& child : children) { updateFn(child->renderNode); } } bool DisplayList::prepareListAndChildren(TreeInfo& info, bool functorsNeedLayer, std::function<void(RenderNode*, TreeInfo&, bool)> childFn) { TextureCache& cache = Caches::getInstance().textureCache; for (auto&& bitmapResource : bitmapResources) { void* ownerToken = &info.canvasContext; info.prepareTextures = cache.prefetchAndMarkInUse(ownerToken, bitmapResource); } for (auto&& op : children) { RenderNode* childNode = op->renderNode; info.damageAccumulator->pushTransform(&op->localMatrix); bool childFunctorsNeedLayer = functorsNeedLayer; // TODO! || op->mRecordedWithPotentialStencilClip; childFn(childNode, info, childFunctorsNeedLayer); info.damageAccumulator->popTransform(); } bool isDirty = false; for (auto& vectorDrawable : vectorDrawables) { // If any vector drawable in the display list needs update, damage the node. if (vectorDrawable->isDirty()) { isDirty = true; } vectorDrawable->setPropertyChangeWillBeConsumed(true); } return isDirty; } }; // namespace uirenderer }; // namespace android libs/hwui/DisplayList.h +17 −6 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #pragma once #include <SkCamera.h> #include <SkDrawable.h> #include <SkMatrix.h> #include <private/hwui/DrawGlInfo.h> Loading @@ -36,6 +37,7 @@ #include "GlFunctorLifecycleListener.h" #include "Matrix.h" #include "RenderProperties.h" #include "TreeInfo.h" #include <vector> Loading Loading @@ -89,7 +91,7 @@ public: }; DisplayList(); ~DisplayList(); virtual ~DisplayList(); // index of DisplayListOp restore, after which projected descendants should be drawn int projectionReceiveIndex; Loading @@ -100,8 +102,6 @@ public: const LsaVector<NodeOpType*>& getChildren() const { return children; } const LsaVector<const SkBitmap*>& getBitmapResources() const { return bitmapResources; } const LsaVector<FunctorContainer>& getFunctors() const { return functors; } const LsaVector<VectorDrawableRoot*>& getVectorDrawables() const { return vectorDrawables; } size_t addChild(NodeOpType* childOp); Loading @@ -113,15 +113,26 @@ public: size_t getUsedSize() { return allocator.usedSize(); } bool isEmpty() { return ops.empty(); virtual bool isEmpty() const { return ops.empty(); } virtual bool hasFunctor() const { return !functors.empty(); } virtual bool hasVectorDrawables() const { return !vectorDrawables.empty(); } virtual bool isSkiaDL() const { return false; } virtual bool reuseDisplayList(RenderNode* node, renderthread::CanvasContext* context) { return false; } private: virtual void syncContents(); virtual void updateChildren(std::function<void(RenderNode*)> updateFn); virtual bool prepareListAndChildren(TreeInfo& info, bool functorsNeedLayer, std::function<void(RenderNode*, TreeInfo&, bool)> childFn); protected: // allocator into which all ops and LsaVector arrays allocated LinearAllocator allocator; LinearStdAllocator<void*> stdAllocator; private: LsaVector<Chunk> chunks; LsaVector<BaseOpType*> ops; Loading libs/hwui/Properties.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ RenderPipelineType Properties::getRenderPipelineType() { property_get(PROPERTY_DEFAULT_RENDERER, prop, "opengl"); if (!strcmp(prop, "skiagl") ) { sRenderPipelineType = RenderPipelineType::SkiaGL; } else if (!strcmp(prop, "skiavulkan") ) { } else if (!strcmp(prop, "skiavk") ) { sRenderPipelineType = RenderPipelineType::SkiaVulkan; } else { //"opengl" sRenderPipelineType = RenderPipelineType::OpenGL; Loading @@ -222,5 +222,11 @@ RenderPipelineType Properties::getRenderPipelineType() { return sRenderPipelineType; } bool Properties::isSkiaEnabled() { auto renderType = getRenderPipelineType(); return RenderPipelineType::SkiaGL == renderType || RenderPipelineType::SkiaVulkan == renderType; } }; // namespace uirenderer }; // namespace android libs/hwui/Properties.h +1 −0 Original line number Diff line number Diff line Loading @@ -308,6 +308,7 @@ public: static ProfileType getProfileType(); static RenderPipelineType getRenderPipelineType(); static bool isSkiaEnabled(); // Should be used only by test apps static bool waitForGpuCompletion; Loading Loading
libs/hwui/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ hwui_src_files := \ ShadowTessellator.cpp \ SkiaCanvas.cpp \ SkiaCanvasProxy.cpp \ SkiaDisplayList.cpp \ SkiaShader.cpp \ Snapshot.cpp \ SpotShadow.cpp \ Loading Loading @@ -286,6 +287,7 @@ LOCAL_SRC_FILES += \ tests/unit/RenderNodeTests.cpp \ tests/unit/RenderPropertiesTests.cpp \ tests/unit/SkiaBehaviorTests.cpp \ tests/unit/SkiaDisplayListTests.cpp \ tests/unit/SkiaCanvasTests.cpp \ tests/unit/SnapshotTests.cpp \ tests/unit/StringUtilsTests.cpp \ Loading
libs/hwui/DisplayList.cpp +43 −0 Original line number Diff line number Diff line Loading @@ -19,10 +19,12 @@ #include <utils/Trace.h> #include "DamageAccumulator.h" #include "Debug.h" #include "DisplayList.h" #include "RecordedOp.h" #include "RenderNode.h" #include "VectorDrawable.h" namespace android { namespace uirenderer { Loading Loading @@ -86,5 +88,46 @@ size_t DisplayList::addChild(NodeOpType* op) { return index; } void DisplayList::syncContents() { for (auto& iter : functors) { (*iter.functor)(DrawGlInfo::kModeSync, nullptr); } for (auto& vectorDrawable : vectorDrawables) { vectorDrawable->syncProperties(); } } void DisplayList::updateChildren(std::function<void(RenderNode*)> updateFn) { for (auto&& child : children) { updateFn(child->renderNode); } } bool DisplayList::prepareListAndChildren(TreeInfo& info, bool functorsNeedLayer, std::function<void(RenderNode*, TreeInfo&, bool)> childFn) { TextureCache& cache = Caches::getInstance().textureCache; for (auto&& bitmapResource : bitmapResources) { void* ownerToken = &info.canvasContext; info.prepareTextures = cache.prefetchAndMarkInUse(ownerToken, bitmapResource); } for (auto&& op : children) { RenderNode* childNode = op->renderNode; info.damageAccumulator->pushTransform(&op->localMatrix); bool childFunctorsNeedLayer = functorsNeedLayer; // TODO! || op->mRecordedWithPotentialStencilClip; childFn(childNode, info, childFunctorsNeedLayer); info.damageAccumulator->popTransform(); } bool isDirty = false; for (auto& vectorDrawable : vectorDrawables) { // If any vector drawable in the display list needs update, damage the node. if (vectorDrawable->isDirty()) { isDirty = true; } vectorDrawable->setPropertyChangeWillBeConsumed(true); } return isDirty; } }; // namespace uirenderer }; // namespace android
libs/hwui/DisplayList.h +17 −6 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #pragma once #include <SkCamera.h> #include <SkDrawable.h> #include <SkMatrix.h> #include <private/hwui/DrawGlInfo.h> Loading @@ -36,6 +37,7 @@ #include "GlFunctorLifecycleListener.h" #include "Matrix.h" #include "RenderProperties.h" #include "TreeInfo.h" #include <vector> Loading Loading @@ -89,7 +91,7 @@ public: }; DisplayList(); ~DisplayList(); virtual ~DisplayList(); // index of DisplayListOp restore, after which projected descendants should be drawn int projectionReceiveIndex; Loading @@ -100,8 +102,6 @@ public: const LsaVector<NodeOpType*>& getChildren() const { return children; } const LsaVector<const SkBitmap*>& getBitmapResources() const { return bitmapResources; } const LsaVector<FunctorContainer>& getFunctors() const { return functors; } const LsaVector<VectorDrawableRoot*>& getVectorDrawables() const { return vectorDrawables; } size_t addChild(NodeOpType* childOp); Loading @@ -113,15 +113,26 @@ public: size_t getUsedSize() { return allocator.usedSize(); } bool isEmpty() { return ops.empty(); virtual bool isEmpty() const { return ops.empty(); } virtual bool hasFunctor() const { return !functors.empty(); } virtual bool hasVectorDrawables() const { return !vectorDrawables.empty(); } virtual bool isSkiaDL() const { return false; } virtual bool reuseDisplayList(RenderNode* node, renderthread::CanvasContext* context) { return false; } private: virtual void syncContents(); virtual void updateChildren(std::function<void(RenderNode*)> updateFn); virtual bool prepareListAndChildren(TreeInfo& info, bool functorsNeedLayer, std::function<void(RenderNode*, TreeInfo&, bool)> childFn); protected: // allocator into which all ops and LsaVector arrays allocated LinearAllocator allocator; LinearStdAllocator<void*> stdAllocator; private: LsaVector<Chunk> chunks; LsaVector<BaseOpType*> ops; Loading
libs/hwui/Properties.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ RenderPipelineType Properties::getRenderPipelineType() { property_get(PROPERTY_DEFAULT_RENDERER, prop, "opengl"); if (!strcmp(prop, "skiagl") ) { sRenderPipelineType = RenderPipelineType::SkiaGL; } else if (!strcmp(prop, "skiavulkan") ) { } else if (!strcmp(prop, "skiavk") ) { sRenderPipelineType = RenderPipelineType::SkiaVulkan; } else { //"opengl" sRenderPipelineType = RenderPipelineType::OpenGL; Loading @@ -222,5 +222,11 @@ RenderPipelineType Properties::getRenderPipelineType() { return sRenderPipelineType; } bool Properties::isSkiaEnabled() { auto renderType = getRenderPipelineType(); return RenderPipelineType::SkiaGL == renderType || RenderPipelineType::SkiaVulkan == renderType; } }; // namespace uirenderer }; // namespace android
libs/hwui/Properties.h +1 −0 Original line number Diff line number Diff line Loading @@ -308,6 +308,7 @@ public: static ProfileType getProfileType(); static RenderPipelineType getRenderPipelineType(); static bool isSkiaEnabled(); // Should be used only by test apps static bool waitForGpuCompletion; Loading