diff options
Diffstat (limited to 'libs/hwui/renderthread/CacheManager.cpp')
-rw-r--r-- | libs/hwui/renderthread/CacheManager.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/libs/hwui/renderthread/CacheManager.cpp b/libs/hwui/renderthread/CacheManager.cpp index 1e5877356e8d..d998e5031984 100644 --- a/libs/hwui/renderthread/CacheManager.cpp +++ b/libs/hwui/renderthread/CacheManager.cpp @@ -61,7 +61,7 @@ CacheManager::CacheManager() SkGraphics::SetFontCacheLimit(mMaxCpuFontCacheBytes); } -void CacheManager::reset(sk_sp<GrContext> context) { +void CacheManager::reset(sk_sp<GrDirectContext> context) { if (context != mGrContext) { destroy(); } @@ -101,7 +101,8 @@ void CacheManager::trimMemory(TrimMemoryMode mode) { return; } - mGrContext->flush(); + // flush and submit all work to the gpu and wait for it to finish + mGrContext->flushAndSubmit(/*syncCpu=*/true); switch (mode) { case TrimMemoryMode::Complete: @@ -119,17 +120,13 @@ void CacheManager::trimMemory(TrimMemoryMode mode) { SkGraphics::SetFontCacheLimit(mMaxCpuFontCacheBytes); break; } - - // We must sync the cpu to make sure deletions of resources still queued up on the GPU actually - // happen. - mGrContext->flush(kSyncCpu_GrFlushFlag, 0, nullptr); } void CacheManager::trimStaleResources() { if (!mGrContext) { return; } - mGrContext->flush(); + mGrContext->flushAndSubmit(); mGrContext->purgeResourcesNotUsedInMs(std::chrono::seconds(30)); } |