diff options
author | Xin Li <delphij@google.com> | 2017-11-14 12:31:11 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2017-11-14 12:31:11 -0800 |
commit | 220871a697290529278ed16db508eda8e12f3fc7 (patch) | |
tree | bc13101b63c6fe39a9d92706ecb7ded7f98f5a9c /libs/hwui/renderthread/CacheManager.cpp | |
parent | 802f191b2b84a1b1b82c7f6f3268846084b35dfb (diff) | |
parent | 98e12851336b7db16e583f9afac63ecc97465980 (diff) |
Merge commit '98e12851336b7db16e583f9afac63ecc97465980' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master.
Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7
Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
Diffstat (limited to 'libs/hwui/renderthread/CacheManager.cpp')
-rw-r--r-- | libs/hwui/renderthread/CacheManager.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/libs/hwui/renderthread/CacheManager.cpp b/libs/hwui/renderthread/CacheManager.cpp index f0d6b3860938..55694d046c2f 100644 --- a/libs/hwui/renderthread/CacheManager.cpp +++ b/libs/hwui/renderthread/CacheManager.cpp @@ -43,7 +43,8 @@ namespace renderthread { CacheManager::CacheManager(const DisplayInfo& display) : mMaxSurfaceArea(display.w * display.h) { - mVectorDrawableAtlas.reset(new VectorDrawableAtlas); + mVectorDrawableAtlas = new skiapipeline::VectorDrawableAtlas(mMaxSurfaceArea/2, + skiapipeline::VectorDrawableAtlas::StorageMode::allowSharedSurface); } void CacheManager::reset(GrContext* context) { @@ -61,7 +62,7 @@ void CacheManager::reset(GrContext* context) { void CacheManager::destroy() { // cleanup any caches here as the GrContext is about to go away... mGrContext.reset(nullptr); - mVectorDrawableAtlas.reset(new VectorDrawableAtlas); + mVectorDrawableAtlas = new skiapipeline::VectorDrawableAtlas(mMaxSurfaceArea/2); } void CacheManager::updateContextCacheSizes() { @@ -104,7 +105,7 @@ void CacheManager::trimMemory(TrimMemoryMode mode) { switch (mode) { case TrimMemoryMode::Complete: - mVectorDrawableAtlas.reset(new VectorDrawableAtlas); + mVectorDrawableAtlas = new skiapipeline::VectorDrawableAtlas(mMaxSurfaceArea/2); mGrContext->freeGpuResources(); break; case TrimMemoryMode::UiHidden: @@ -121,24 +122,14 @@ void CacheManager::trimStaleResources() { mGrContext->purgeResourcesNotUsedInMs(std::chrono::seconds(30)); } -VectorDrawableAtlas* CacheManager::acquireVectorDrawableAtlas() { +sp<skiapipeline::VectorDrawableAtlas> CacheManager::acquireVectorDrawableAtlas() { LOG_ALWAYS_FATAL_IF(mVectorDrawableAtlas.get() == nullptr); LOG_ALWAYS_FATAL_IF(mGrContext == nullptr); /** - * TODO LIST: - * 1) compute the atlas based on the surfaceArea surface - * 2) identify a way to reuse cache entries - * 3) add ability to repack the cache? - * 4) define memory conditions where we clear the cache (e.g. surface->reset()) + * TODO: define memory conditions where we clear the cache (e.g. surface->reset()) */ - - return mVectorDrawableAtlas.release(); -} -void CacheManager::releaseVectorDrawableAtlas(VectorDrawableAtlas* atlas) { - LOG_ALWAYS_FATAL_IF(mVectorDrawableAtlas.get() != nullptr); - mVectorDrawableAtlas.reset(atlas); - mVectorDrawableAtlas->isNewAtlas = false; + return mVectorDrawableAtlas; } void CacheManager::dumpMemoryUsage(String8& log, const RenderState* renderState) { |