Loading libs/hwui/pipeline/skia/SkiaDisplayList.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -53,11 +53,15 @@ void SkiaDisplayList::updateChildren(std::function<void(RenderNode*)> updateFn) bool SkiaDisplayList::prepareListAndChildren(TreeInfo& info, bool functorsNeedLayer, std::function<void(RenderNode*, TreeInfo&, bool)> childFn) { // If the prepare tree is triggered by the UI thread then we must force all // mutable images to be pinned in the GPU cache until the next UI thread // draw if (info.mode == TreeInfo::MODE_FULL) { info.prepareTextures = info.canvasContext.pinImages(mMutableImages); // If the prepare tree is triggered by the UI thread and no previous call to // pinImages has failed then we must pin all mutable images in the GPU cache // until the next UI thread draw. if (info.prepareTextures && !info.canvasContext.pinImages(mMutableImages)) { // In the event that pinning failed we prevent future pinImage calls for the // remainder of this tree traversal and also unpin any currently pinned images // to free up GPU resources. info.prepareTextures = false; info.canvasContext.unpinImages(); } for (auto& child : mChildNodes) { Loading libs/hwui/pipeline/skia/SkiaPipeline.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -48,9 +48,11 @@ void SkiaPipeline::onDestroyHardwareResources() { bool SkiaPipeline::pinImages(std::vector<SkImage*>& mutableImages) { for (SkImage* image : mutableImages) { if (SkImage_pinAsTexture(image, mRenderThread.getGrContext())) { mPinnedImages.emplace_back(sk_ref_sp(image)); // TODO: return false if texture creation fails (see b/32691999) SkImage_pinAsTexture(image, mRenderThread.getGrContext()); } else { return false; } } return true; } Loading libs/hwui/renderthread/CanvasContext.h +1 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ public: * remain in the cache until it has been unpinned. We leverage this feature * to avoid making a CPU copy of the pixels. * * @return true if the images have been successfully pinned to the GPU cache * @return true if all images have been successfully pinned to the GPU cache * and false otherwise (e.g. cache limits have been exceeded). */ bool pinImages(std::vector<SkImage*>& mutableImages) { Loading Loading
libs/hwui/pipeline/skia/SkiaDisplayList.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -53,11 +53,15 @@ void SkiaDisplayList::updateChildren(std::function<void(RenderNode*)> updateFn) bool SkiaDisplayList::prepareListAndChildren(TreeInfo& info, bool functorsNeedLayer, std::function<void(RenderNode*, TreeInfo&, bool)> childFn) { // If the prepare tree is triggered by the UI thread then we must force all // mutable images to be pinned in the GPU cache until the next UI thread // draw if (info.mode == TreeInfo::MODE_FULL) { info.prepareTextures = info.canvasContext.pinImages(mMutableImages); // If the prepare tree is triggered by the UI thread and no previous call to // pinImages has failed then we must pin all mutable images in the GPU cache // until the next UI thread draw. if (info.prepareTextures && !info.canvasContext.pinImages(mMutableImages)) { // In the event that pinning failed we prevent future pinImage calls for the // remainder of this tree traversal and also unpin any currently pinned images // to free up GPU resources. info.prepareTextures = false; info.canvasContext.unpinImages(); } for (auto& child : mChildNodes) { Loading
libs/hwui/pipeline/skia/SkiaPipeline.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -48,9 +48,11 @@ void SkiaPipeline::onDestroyHardwareResources() { bool SkiaPipeline::pinImages(std::vector<SkImage*>& mutableImages) { for (SkImage* image : mutableImages) { if (SkImage_pinAsTexture(image, mRenderThread.getGrContext())) { mPinnedImages.emplace_back(sk_ref_sp(image)); // TODO: return false if texture creation fails (see b/32691999) SkImage_pinAsTexture(image, mRenderThread.getGrContext()); } else { return false; } } return true; } Loading
libs/hwui/renderthread/CanvasContext.h +1 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ public: * remain in the cache until it has been unpinned. We leverage this feature * to avoid making a CPU copy of the pixels. * * @return true if the images have been successfully pinned to the GPU cache * @return true if all images have been successfully pinned to the GPU cache * and false otherwise (e.g. cache limits have been exceeded). */ bool pinImages(std::vector<SkImage*>& mutableImages) { Loading