RE: Better error messages for context lost and SkiaVk
As in HWUI's CanvasContext::draw, check whether the context has been
abandoned at the beginning of a frame. Previously, RE never checked for
this, though it may have been responsible for other spurious failures,
such as "Unable to generate SkSurface".
When RE fails to generate an SkSurface/SkImage, query the backend to
determine which method to call to get more information about the
texture. This allows us to get meaningful information when running
SkiaVk.
Bug: 286058063
Test: manual - build and boot with gl and vk
Test: manual - change fatal logs to ALOGD always
Change-Id: I532f9073698a920619ffd665d05d8e63163366d8
diff --git a/libs/renderengine/skia/SkiaRenderEngine.cpp b/libs/renderengine/skia/SkiaRenderEngine.cpp
index fda6ea1..18d9864 100644
--- a/libs/renderengine/skia/SkiaRenderEngine.cpp
+++ b/libs/renderengine/skia/SkiaRenderEngine.cpp
@@ -665,6 +665,8 @@
validateOutputBufferUsage(buffer->getBuffer());
auto grContext = getActiveGrContext();
+ LOG_ALWAYS_FATAL_IF(grContext->abandoned(), "GrContext is abandoned/device lost at start of %s",
+ __func__);
// any AutoBackendTexture deletions will now be deferred until cleanupPostRender is called
DeferTextureCleanup dtc(mTextureCleanupMgr);