Loading libs/hwui/pipeline/skia/SkiaPipeline.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ void SkiaPipeline::renderLayersImpl(const LayerUpdateQueue& layers, bool opaque) if (cachedContext.get() != currentContext) { if (cachedContext.get()) { ATRACE_NAME("flush layers (context changed)"); cachedContext->flush(); cachedContext->flushAndSubmit(); } cachedContext.reset(SkSafeRef(currentContext)); } Loading @@ -153,7 +153,7 @@ void SkiaPipeline::renderLayersImpl(const LayerUpdateQueue& layers, bool opaque) if (cachedContext.get()) { ATRACE_NAME("flush layers"); cachedContext->flush(); cachedContext->flushAndSubmit(); } } Loading Loading @@ -450,7 +450,7 @@ void SkiaPipeline::renderFrame(const LayerUpdateQueue& layers, const SkRect& cli } ATRACE_NAME("flush commands"); surface->getCanvas()->flush(); surface->flushAndSubmit(); Properties::skpCaptureEnabled = previousSkpEnabled; } Loading libs/hwui/renderthread/CacheManager.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ void CacheManager::trimMemory(TrimMemoryMode mode) { return; } mGrContext->flush(); mGrContext->flushAndSubmit(); switch (mode) { case TrimMemoryMode::Complete: Loading @@ -122,14 +122,17 @@ void CacheManager::trimMemory(TrimMemoryMode mode) { // 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); GrFlushInfo info; info.fFlags = kSyncCpu_GrFlushFlag; mGrContext->flush(info); mGrContext->submit(true); } void CacheManager::trimStaleResources() { if (!mGrContext) { return; } mGrContext->flush(); mGrContext->flushAndSubmit(); mGrContext->purgeResourcesNotUsedInMs(std::chrono::seconds(30)); } Loading libs/hwui/renderthread/VulkanManager.cpp +17 −6 Original line number Diff line number Diff line Loading @@ -459,7 +459,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. bufferInfo->skSurface->flush(); bufferInfo->skSurface->flushAndSubmit(); } } } Loading Loading @@ -525,9 +525,15 @@ void VulkanManager::swapBuffers(VulkanSurface* surface, const SkRect& dirtyRect) int fenceFd = -1; DestroySemaphoreInfo* destroyInfo = new DestroySemaphoreInfo(mDestroySemaphore, mDevice, semaphore); GrFlushInfo flushInfo; flushInfo.fNumSemaphores = 1; flushInfo.fSignalSemaphores = &backendSemaphore; flushInfo.fFinishedProc = destroy_semaphore; flushInfo.fFinishedContext = destroyInfo; GrSemaphoresSubmitted submitted = bufferInfo->skSurface->flush( SkSurface::BackendSurfaceAccess::kPresent, kNone_GrFlushFlags, 1, &backendSemaphore, destroy_semaphore, destroyInfo); SkSurface::BackendSurfaceAccess::kPresent, flushInfo); ALOGE_IF(!bufferInfo->skSurface->getContext(), "Surface is not backed by gpu"); bufferInfo->skSurface->getContext()->submit(); if (submitted == GrSemaphoresSubmitted::kYes) { VkSemaphoreGetFdInfoKHR getFdInfo; getFdInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR; Loading Loading @@ -612,7 +618,7 @@ status_t VulkanManager::fenceWait(int fence, GrContext* grContext) { // Skia takes ownership of the semaphore and will delete it once the wait has finished. grContext->wait(1, &beSemaphore); grContext->flush(); grContext->flushAndSubmit(); return OK; } Loading Loading @@ -648,8 +654,13 @@ status_t VulkanManager::createReleaseFence(int* nativeFence, GrContext* grContex // Even if Skia fails to submit the semaphore, it will still call the destroy_semaphore callback // which will remove its ref to the semaphore. The VulkanManager must still release its ref, // when it is done with the semaphore. GrSemaphoresSubmitted submitted = grContext->flush(kNone_GrFlushFlags, 1, &backendSemaphore, destroy_semaphore, destroyInfo); GrFlushInfo flushInfo; flushInfo.fNumSemaphores = 1; flushInfo.fSignalSemaphores = &backendSemaphore; flushInfo.fFinishedProc = destroy_semaphore; flushInfo.fFinishedContext = destroyInfo; GrSemaphoresSubmitted submitted = grContext->flush(flushInfo); grContext->submit(); if (submitted == GrSemaphoresSubmitted::kNo) { ALOGE("VulkanManager::createReleaseFence: Failed to submit semaphore"); Loading libs/hwui/tests/unit/CacheManagerTests.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ RENDERTHREAD_SKIA_PIPELINE_TEST(CacheManager, trimMemory) { sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget(grContext, SkBudgeted::kYes, info); surface->getCanvas()->drawColor(SK_AlphaTRANSPARENT); grContext->flush(); grContext->flushAndSubmit(); surfaces.push_back(surface); } Loading Loading
libs/hwui/pipeline/skia/SkiaPipeline.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -145,7 +145,7 @@ void SkiaPipeline::renderLayersImpl(const LayerUpdateQueue& layers, bool opaque) if (cachedContext.get() != currentContext) { if (cachedContext.get()) { ATRACE_NAME("flush layers (context changed)"); cachedContext->flush(); cachedContext->flushAndSubmit(); } cachedContext.reset(SkSafeRef(currentContext)); } Loading @@ -153,7 +153,7 @@ void SkiaPipeline::renderLayersImpl(const LayerUpdateQueue& layers, bool opaque) if (cachedContext.get()) { ATRACE_NAME("flush layers"); cachedContext->flush(); cachedContext->flushAndSubmit(); } } Loading Loading @@ -450,7 +450,7 @@ void SkiaPipeline::renderFrame(const LayerUpdateQueue& layers, const SkRect& cli } ATRACE_NAME("flush commands"); surface->getCanvas()->flush(); surface->flushAndSubmit(); Properties::skpCaptureEnabled = previousSkpEnabled; } Loading
libs/hwui/renderthread/CacheManager.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -101,7 +101,7 @@ void CacheManager::trimMemory(TrimMemoryMode mode) { return; } mGrContext->flush(); mGrContext->flushAndSubmit(); switch (mode) { case TrimMemoryMode::Complete: Loading @@ -122,14 +122,17 @@ void CacheManager::trimMemory(TrimMemoryMode mode) { // 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); GrFlushInfo info; info.fFlags = kSyncCpu_GrFlushFlag; mGrContext->flush(info); mGrContext->submit(true); } void CacheManager::trimStaleResources() { if (!mGrContext) { return; } mGrContext->flush(); mGrContext->flushAndSubmit(); mGrContext->purgeResourcesNotUsedInMs(std::chrono::seconds(30)); } Loading
libs/hwui/renderthread/VulkanManager.cpp +17 −6 Original line number Diff line number Diff line Loading @@ -459,7 +459,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. bufferInfo->skSurface->flush(); bufferInfo->skSurface->flushAndSubmit(); } } } Loading Loading @@ -525,9 +525,15 @@ void VulkanManager::swapBuffers(VulkanSurface* surface, const SkRect& dirtyRect) int fenceFd = -1; DestroySemaphoreInfo* destroyInfo = new DestroySemaphoreInfo(mDestroySemaphore, mDevice, semaphore); GrFlushInfo flushInfo; flushInfo.fNumSemaphores = 1; flushInfo.fSignalSemaphores = &backendSemaphore; flushInfo.fFinishedProc = destroy_semaphore; flushInfo.fFinishedContext = destroyInfo; GrSemaphoresSubmitted submitted = bufferInfo->skSurface->flush( SkSurface::BackendSurfaceAccess::kPresent, kNone_GrFlushFlags, 1, &backendSemaphore, destroy_semaphore, destroyInfo); SkSurface::BackendSurfaceAccess::kPresent, flushInfo); ALOGE_IF(!bufferInfo->skSurface->getContext(), "Surface is not backed by gpu"); bufferInfo->skSurface->getContext()->submit(); if (submitted == GrSemaphoresSubmitted::kYes) { VkSemaphoreGetFdInfoKHR getFdInfo; getFdInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR; Loading Loading @@ -612,7 +618,7 @@ status_t VulkanManager::fenceWait(int fence, GrContext* grContext) { // Skia takes ownership of the semaphore and will delete it once the wait has finished. grContext->wait(1, &beSemaphore); grContext->flush(); grContext->flushAndSubmit(); return OK; } Loading Loading @@ -648,8 +654,13 @@ status_t VulkanManager::createReleaseFence(int* nativeFence, GrContext* grContex // Even if Skia fails to submit the semaphore, it will still call the destroy_semaphore callback // which will remove its ref to the semaphore. The VulkanManager must still release its ref, // when it is done with the semaphore. GrSemaphoresSubmitted submitted = grContext->flush(kNone_GrFlushFlags, 1, &backendSemaphore, destroy_semaphore, destroyInfo); GrFlushInfo flushInfo; flushInfo.fNumSemaphores = 1; flushInfo.fSignalSemaphores = &backendSemaphore; flushInfo.fFinishedProc = destroy_semaphore; flushInfo.fFinishedContext = destroyInfo; GrSemaphoresSubmitted submitted = grContext->flush(flushInfo); grContext->submit(); if (submitted == GrSemaphoresSubmitted::kNo) { ALOGE("VulkanManager::createReleaseFence: Failed to submit semaphore"); Loading
libs/hwui/tests/unit/CacheManagerTests.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ RENDERTHREAD_SKIA_PIPELINE_TEST(CacheManager, trimMemory) { sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget(grContext, SkBudgeted::kYes, info); surface->getCanvas()->drawColor(SK_AlphaTRANSPARENT); grContext->flush(); grContext->flushAndSubmit(); surfaces.push_back(surface); } Loading