Loading libs/hwui/Caches.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -223,7 +223,6 @@ void Caches::dumpMemoryUsage(String8 &log) { /////////////////////////////////////////////////////////////////////////////// void Caches::clearGarbage() { textureCache.clearGarbage(); pathCache.clearGarbage(); patchCache.clearGarbage(); } Loading libs/hwui/TextureCache.cpp +7 −18 Original line number Diff line number Diff line Loading @@ -191,25 +191,14 @@ Texture* TextureCache::get(Bitmap* bitmap) { return texture; } void TextureCache::releaseTexture(uint32_t pixelRefStableID) { Mutex::Autolock _l(mLock); mGarbage.push_back(pixelRefStableID); } void TextureCache::clearGarbage() { Mutex::Autolock _l(mLock); size_t count = mGarbage.size(); for (size_t i = 0; i < count; i++) { uint32_t pixelRefId = mGarbage[i]; auto hardwareIter = mHardwareTextures.find(pixelRefId); if (hardwareIter == mHardwareTextures.end()) { mCache.remove(pixelRefId); } else { bool TextureCache::destroyTexture(uint32_t pixelRefStableID) { auto hardwareIter = mHardwareTextures.find(pixelRefStableID); if (hardwareIter != mHardwareTextures.end()) { hardwareIter->second->deleteTexture(); mHardwareTextures.erase(hardwareIter); return true; } } mGarbage.clear(); return mCache.remove(pixelRefStableID); } void TextureCache::clear() { Loading libs/hwui/TextureCache.h +3 −9 Original line number Diff line number Diff line Loading @@ -94,14 +94,10 @@ public: Texture* get(Bitmap* bitmap); /** * Removes the texture associated with the specified pixelRef. This is meant * to be called from threads that are not the EGL context thread. * Removes the texture associated with the specified pixelRef. Must be called from RenderThread * Returns true if a texture was destroyed, false if no texture with that id was found */ ANDROID_API void releaseTexture(uint32_t pixelRefStableID); /** * Process deferred removals. */ void clearGarbage(); bool destroyTexture(uint32_t pixelRefStableID); /** * Clears the cache. This causes all textures to be deleted. Loading Loading @@ -139,9 +135,7 @@ private: bool mDebugEnabled; std::vector<uint32_t> mGarbage; std::unordered_map<uint32_t, std::unique_ptr<Texture>> mHardwareTextures; mutable Mutex mLock; }; // class TextureCache }; // namespace uirenderer Loading libs/hwui/hwui/Bitmap.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -416,9 +416,7 @@ Bitmap::~Bitmap() { } if (android::uirenderer::Caches::hasInstance()) { android::uirenderer::Caches::getInstance().textureCache.releaseTexture(getStableID()); } android::uirenderer::renderthread::RenderProxy::onBitmapDestroyed(getStableID()); } bool Bitmap::hasHardwareMipMap() const { Loading libs/hwui/renderstate/RenderState.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,13 @@ void RenderState::flush(Caches::FlushMode mode) { mCaches->flush(mode); } void RenderState::onBitmapDestroyed(uint32_t pixelRefId) { if (mCaches->textureCache.destroyTexture(pixelRefId)) { glFlush(); GL_CHECKPOINT(MODERATE); } } void RenderState::setViewport(GLsizei width, GLsizei height) { mViewportWidth = width; mViewportHeight = height; Loading Loading
libs/hwui/Caches.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -223,7 +223,6 @@ void Caches::dumpMemoryUsage(String8 &log) { /////////////////////////////////////////////////////////////////////////////// void Caches::clearGarbage() { textureCache.clearGarbage(); pathCache.clearGarbage(); patchCache.clearGarbage(); } Loading
libs/hwui/TextureCache.cpp +7 −18 Original line number Diff line number Diff line Loading @@ -191,25 +191,14 @@ Texture* TextureCache::get(Bitmap* bitmap) { return texture; } void TextureCache::releaseTexture(uint32_t pixelRefStableID) { Mutex::Autolock _l(mLock); mGarbage.push_back(pixelRefStableID); } void TextureCache::clearGarbage() { Mutex::Autolock _l(mLock); size_t count = mGarbage.size(); for (size_t i = 0; i < count; i++) { uint32_t pixelRefId = mGarbage[i]; auto hardwareIter = mHardwareTextures.find(pixelRefId); if (hardwareIter == mHardwareTextures.end()) { mCache.remove(pixelRefId); } else { bool TextureCache::destroyTexture(uint32_t pixelRefStableID) { auto hardwareIter = mHardwareTextures.find(pixelRefStableID); if (hardwareIter != mHardwareTextures.end()) { hardwareIter->second->deleteTexture(); mHardwareTextures.erase(hardwareIter); return true; } } mGarbage.clear(); return mCache.remove(pixelRefStableID); } void TextureCache::clear() { Loading
libs/hwui/TextureCache.h +3 −9 Original line number Diff line number Diff line Loading @@ -94,14 +94,10 @@ public: Texture* get(Bitmap* bitmap); /** * Removes the texture associated with the specified pixelRef. This is meant * to be called from threads that are not the EGL context thread. * Removes the texture associated with the specified pixelRef. Must be called from RenderThread * Returns true if a texture was destroyed, false if no texture with that id was found */ ANDROID_API void releaseTexture(uint32_t pixelRefStableID); /** * Process deferred removals. */ void clearGarbage(); bool destroyTexture(uint32_t pixelRefStableID); /** * Clears the cache. This causes all textures to be deleted. Loading Loading @@ -139,9 +135,7 @@ private: bool mDebugEnabled; std::vector<uint32_t> mGarbage; std::unordered_map<uint32_t, std::unique_ptr<Texture>> mHardwareTextures; mutable Mutex mLock; }; // class TextureCache }; // namespace uirenderer Loading
libs/hwui/hwui/Bitmap.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -416,9 +416,7 @@ Bitmap::~Bitmap() { } if (android::uirenderer::Caches::hasInstance()) { android::uirenderer::Caches::getInstance().textureCache.releaseTexture(getStableID()); } android::uirenderer::renderthread::RenderProxy::onBitmapDestroyed(getStableID()); } bool Bitmap::hasHardwareMipMap() const { Loading
libs/hwui/renderstate/RenderState.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -122,6 +122,13 @@ void RenderState::flush(Caches::FlushMode mode) { mCaches->flush(mode); } void RenderState::onBitmapDestroyed(uint32_t pixelRefId) { if (mCaches->textureCache.destroyTexture(pixelRefId)) { glFlush(); GL_CHECKPOINT(MODERATE); } } void RenderState::setViewport(GLsizei width, GLsizei height) { mViewportWidth = width; mViewportHeight = height; Loading