From 7fbd0ad0f9ce3c365c61be9b34d3b731b6ecc4d1 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Fri, 6 Aug 2021 13:42:49 -0400 Subject: [PATCH] CanvasContext::draw: flushAndSubmit when not drawing Bug: 195081399 Test: manual + dumpsys gfxinfo CanvasContext::draw has some conditions under which it will not draw. We still need to flushAndSubmit to free scratch memory if there were texture uploads this frame. Change-Id: I60d230cd36bed310a3155e4f1ca647c99c13c4cd --- libs/hwui/renderthread/CanvasContext.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index 025be7b2b6c1f..2f3a509831d13 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -482,6 +482,12 @@ nsecs_t CanvasContext::draw() { if (dirty.isEmpty() && Properties::skipEmptyFrames && !surfaceRequiresRedraw()) { mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame); + if (auto grContext = getGrContext()) { + // Submit to ensure that any texture uploads complete and Skia can + // free its staging buffers. + grContext->flushAndSubmit(); + } + // Notify the callbacks, even if there's nothing to draw so they aren't waiting // indefinitely waitOnFences();