From 16d11c6d386914aef1de7fdcc9bac6239c738139 Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Thu, 8 Apr 2021 16:17:35 -0400 Subject: [PATCH] In CanvasContext check at start of frame if GrContext is abandoned. On Vulkan part of the abandoned check also checks for device lost. Following what we currently do in GL, we now crash if we are ever in this state. Test: local build Bug: 183722403 Change-Id: I2a41005fd6892e32a8b23dacbc0170d5542fe072 --- 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 800c58095041b..aedb5c28dc3e7 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -452,6 +452,12 @@ void CanvasContext::notifyFramePending() { } void CanvasContext::draw() { + if (auto grContext = getGrContext()) { + if (grContext->abandoned()) { + LOG_ALWAYS_FATAL("GrContext is abandoned/device lost at start of CanvasContext::draw"); + return; + } + } SkRect dirty; mDamageAccumulator.finish(&dirty);