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
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 800c580..aedb5c2 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -452,6 +452,12 @@
}
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);