Loading libs/hwui/HardwareBitmapUploader.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <GLES2/gl2ext.h> #include <GLES3/gl3.h> #include <GrDirectContext.h> #include <GrTypes.h> #include <SkBitmap.h> #include <SkCanvas.h> #include <SkImage.h> Loading Loading @@ -265,7 +266,7 @@ private: sk_sp<SkImage> image = SkImages::TextureFromAHardwareBufferWithData(mGrContext.get(), bitmap.pixmap(), ahb); mGrContext->submit(true); mGrContext->submit(GrSyncCpu::kYes); uploadSucceeded = (image.get() != nullptr); }); Loading libs/hwui/renderthread/CacheManager.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include "CacheManager.h" #include <GrContextOptions.h> #include <GrTypes.h> #include <SkExecutor.h> #include <SkGraphics.h> #include <math.h> Loading Loading @@ -110,13 +111,18 @@ void CacheManager::configureContext(GrContextOptions* contextOptions, const void contextOptions->fPersistentCache = &cache; } static GrPurgeResourceOptions toSkiaEnum(bool scratchOnly) { return scratchOnly ? GrPurgeResourceOptions::kScratchResourcesOnly : GrPurgeResourceOptions::kAllResources; } void CacheManager::trimMemory(TrimLevel mode) { if (!mGrContext) { return; } // flush and submit all work to the gpu and wait for it to finish mGrContext->flushAndSubmit(/*syncCpu=*/true); mGrContext->flushAndSubmit(GrSyncCpu::kYes); switch (mode) { case TrimLevel::BACKGROUND: Loading @@ -130,7 +136,7 @@ void CacheManager::trimMemory(TrimLevel mode) { // that have persistent data to be purged in LRU order. mGrContext->setResourceCacheLimit(mBackgroundResourceBytes); SkGraphics::SetFontCacheLimit(mBackgroundCpuFontCacheBytes); mGrContext->purgeUnlockedResources(mMemoryPolicy.purgeScratchOnly); mGrContext->purgeUnlockedResources(toSkiaEnum(mMemoryPolicy.purgeScratchOnly)); mGrContext->setResourceCacheLimit(mMaxResourceBytes); SkGraphics::SetFontCacheLimit(mMaxCpuFontCacheBytes); break; Loading @@ -150,7 +156,7 @@ void CacheManager::trimCaches(CacheTrimLevel mode) { case CacheTrimLevel::ALL_CACHES: SkGraphics::PurgeAllCaches(); if (mGrContext) { mGrContext->purgeUnlockedResources(false); mGrContext->purgeUnlockedResources(GrPurgeResourceOptions::kAllResources); } break; default: Loading Loading @@ -285,7 +291,7 @@ void CacheManager::onThreadIdle() { ns2ms(std::clamp(frameDiffNanos, mMemoryPolicy.minimumResourceRetention, mMemoryPolicy.maximumResourceRetention)); mGrContext->performDeferredCleanup(std::chrono::milliseconds(cleanupMillis), mMemoryPolicy.purgeScratchOnly); toSkiaEnum(mMemoryPolicy.purgeScratchOnly)); } } Loading libs/hwui/renderthread/VulkanManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -515,7 +515,7 @@ Frame VulkanManager::dequeueNextBuffer(VulkanSurface* surface) { // The following flush blocks the GPU immediately instead of waiting for // other drawing ops. It seems dequeue_fence is not respected otherwise. // TODO: remove the flush after finding why backendSemaphore is not working. skgpu::ganesh::FlushAndSubmit(bufferInfo->skSurface); skgpu::ganesh::FlushAndSubmit(bufferInfo->skSurface.get()); } } } Loading Loading
libs/hwui/HardwareBitmapUploader.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include <GLES2/gl2ext.h> #include <GLES3/gl3.h> #include <GrDirectContext.h> #include <GrTypes.h> #include <SkBitmap.h> #include <SkCanvas.h> #include <SkImage.h> Loading Loading @@ -265,7 +266,7 @@ private: sk_sp<SkImage> image = SkImages::TextureFromAHardwareBufferWithData(mGrContext.get(), bitmap.pixmap(), ahb); mGrContext->submit(true); mGrContext->submit(GrSyncCpu::kYes); uploadSucceeded = (image.get() != nullptr); }); Loading
libs/hwui/renderthread/CacheManager.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include "CacheManager.h" #include <GrContextOptions.h> #include <GrTypes.h> #include <SkExecutor.h> #include <SkGraphics.h> #include <math.h> Loading Loading @@ -110,13 +111,18 @@ void CacheManager::configureContext(GrContextOptions* contextOptions, const void contextOptions->fPersistentCache = &cache; } static GrPurgeResourceOptions toSkiaEnum(bool scratchOnly) { return scratchOnly ? GrPurgeResourceOptions::kScratchResourcesOnly : GrPurgeResourceOptions::kAllResources; } void CacheManager::trimMemory(TrimLevel mode) { if (!mGrContext) { return; } // flush and submit all work to the gpu and wait for it to finish mGrContext->flushAndSubmit(/*syncCpu=*/true); mGrContext->flushAndSubmit(GrSyncCpu::kYes); switch (mode) { case TrimLevel::BACKGROUND: Loading @@ -130,7 +136,7 @@ void CacheManager::trimMemory(TrimLevel mode) { // that have persistent data to be purged in LRU order. mGrContext->setResourceCacheLimit(mBackgroundResourceBytes); SkGraphics::SetFontCacheLimit(mBackgroundCpuFontCacheBytes); mGrContext->purgeUnlockedResources(mMemoryPolicy.purgeScratchOnly); mGrContext->purgeUnlockedResources(toSkiaEnum(mMemoryPolicy.purgeScratchOnly)); mGrContext->setResourceCacheLimit(mMaxResourceBytes); SkGraphics::SetFontCacheLimit(mMaxCpuFontCacheBytes); break; Loading @@ -150,7 +156,7 @@ void CacheManager::trimCaches(CacheTrimLevel mode) { case CacheTrimLevel::ALL_CACHES: SkGraphics::PurgeAllCaches(); if (mGrContext) { mGrContext->purgeUnlockedResources(false); mGrContext->purgeUnlockedResources(GrPurgeResourceOptions::kAllResources); } break; default: Loading Loading @@ -285,7 +291,7 @@ void CacheManager::onThreadIdle() { ns2ms(std::clamp(frameDiffNanos, mMemoryPolicy.minimumResourceRetention, mMemoryPolicy.maximumResourceRetention)); mGrContext->performDeferredCleanup(std::chrono::milliseconds(cleanupMillis), mMemoryPolicy.purgeScratchOnly); toSkiaEnum(mMemoryPolicy.purgeScratchOnly)); } } Loading
libs/hwui/renderthread/VulkanManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -515,7 +515,7 @@ Frame VulkanManager::dequeueNextBuffer(VulkanSurface* surface) { // The following flush blocks the GPU immediately instead of waiting for // other drawing ops. It seems dequeue_fence is not respected otherwise. // TODO: remove the flush after finding why backendSemaphore is not working. skgpu::ganesh::FlushAndSubmit(bufferInfo->skSurface); skgpu::ganesh::FlushAndSubmit(bufferInfo->skSurface.get()); } } } Loading