diff options
-rw-r--r-- | libs/hwui/HardwareBitmapUploader.cpp | 3 | ||||
-rw-r--r-- | libs/hwui/renderthread/CacheManager.cpp | 14 | ||||
-rw-r--r-- | libs/hwui/renderthread/VulkanManager.cpp | 2 |
3 files changed, 13 insertions, 6 deletions
diff --git a/libs/hwui/HardwareBitmapUploader.cpp b/libs/hwui/HardwareBitmapUploader.cpp index 19a1dfa91539..16de21def0e3 100644 --- a/libs/hwui/HardwareBitmapUploader.cpp +++ b/libs/hwui/HardwareBitmapUploader.cpp @@ -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> @@ -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); }); diff --git a/libs/hwui/renderthread/CacheManager.cpp b/libs/hwui/renderthread/CacheManager.cpp index 8f81dbad2320..735fc074435d 100644 --- a/libs/hwui/renderthread/CacheManager.cpp +++ b/libs/hwui/renderthread/CacheManager.cpp @@ -17,6 +17,7 @@ #include "CacheManager.h" #include <GrContextOptions.h> +#include <GrTypes.h> #include <SkExecutor.h> #include <SkGraphics.h> #include <math.h> @@ -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: @@ -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; @@ -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: @@ -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)); } } diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp index ee3b2e48fe4b..90850d36b612 100644 --- a/libs/hwui/renderthread/VulkanManager.cpp +++ b/libs/hwui/renderthread/VulkanManager.cpp @@ -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()); } } } |