summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Leon Scroggins III <scroggo@google.com> 2023-04-14 17:01:09 -0400
committer Leon Scroggins III <scroggo@google.com> 2023-04-14 17:08:55 -0400
commitc10321d271d4cea78d7745531c2d3b3533769d6c (patch)
treeef3124cc19f4501f209b9a4681203d6e3d908a00
parent43b5d521210b89dbc72c3c5cca8c10454fad3348 (diff)
Better logs for "Unable to generate SkImage/SkSurface"
In both cases, we don't have enough information to debug the issue, and none of these have been reproducible, so we need more info in the logs to know what's going on. Combine the logs, since they're complaining about similar issues. Add the data that was added in https://skia-review.googlesource.com/c/skia/+/573879 for SkSurfaces. Tested by converting the fatal logs to ALOGD and removing the if statements. The logs then look like: D RenderEngine: Unable to generate SkSurface. isTextureValid:1 dataspace:143261696 D RenderEngine: GrBackendTexture: (2208 x 1840) hasMipmaps: 0 isProtected: 0 texType: 1 D RenderEngine: GrGLTextureInfo: success: 0 fTarget: 0 fFormat: 0 colorType 4 Bug: 275475401 Bug: 242603007 Bug: 223762683 Test: m; look at logs Change-Id: If1f3a933ea612279e9911c191ab2553160e744c2
-rw-r--r--libs/renderengine/skia/AutoBackendTexture.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/libs/renderengine/skia/AutoBackendTexture.cpp b/libs/renderengine/skia/AutoBackendTexture.cpp
index 5c122d4154..932be56cde 100644
--- a/libs/renderengine/skia/AutoBackendTexture.cpp
+++ b/libs/renderengine/skia/AutoBackendTexture.cpp
@@ -82,6 +82,18 @@ void AutoBackendTexture::releaseImageProc(SkImage::ReleaseContext releaseContext
textureRelease->unref(false);
}
+void logFatalTexture(const char* msg, const GrBackendTexture& tex, ui::Dataspace dataspace,
+ SkColorType colorType) {
+ GrGLTextureInfo textureInfo;
+ bool retrievedTextureInfo = tex.getGLTextureInfo(&textureInfo);
+ LOG_ALWAYS_FATAL("%s isTextureValid:%d dataspace:%d"
+ "\n\tGrBackendTexture: (%i x %i) hasMipmaps: %i isProtected: %i texType: %i"
+ "\n\t\tGrGLTextureInfo: success: %i fTarget: %u fFormat: %u colorType %i",
+ msg, tex.isValid(), dataspace, tex.width(), tex.height(), tex.hasMipmaps(),
+ tex.isProtected(), static_cast<int>(tex.textureType()), retrievedTextureInfo,
+ textureInfo.fTarget, textureInfo.fFormat, colorType);
+}
+
sk_sp<SkImage> AutoBackendTexture::makeImage(ui::Dataspace dataspace, SkAlphaType alphaType,
GrDirectContext* context) {
ATRACE_CALL();
@@ -107,9 +119,9 @@ sk_sp<SkImage> AutoBackendTexture::makeImage(ui::Dataspace dataspace, SkAlphaTyp
mImage = image;
mDataspace = dataspace;
- LOG_ALWAYS_FATAL_IF(mImage == nullptr,
- "Unable to generate SkImage. isTextureValid:%d dataspace:%d",
- mBackendTexture.isValid(), dataspace);
+ if (!mImage) {
+ logFatalTexture("Unable to generate SkImage.", mBackendTexture, dataspace, colorType);
+ }
return mImage;
}
@@ -131,9 +143,9 @@ sk_sp<SkSurface> AutoBackendTexture::getOrCreateSurface(ui::Dataspace dataspace,
}
mDataspace = dataspace;
- LOG_ALWAYS_FATAL_IF(mSurface == nullptr,
- "Unable to generate SkSurface. isTextureValid:%d dataspace:%d",
- mBackendTexture.isValid(), dataspace);
+ if (!mSurface) {
+ logFatalTexture("Unable to generate SkSurface.", mBackendTexture, dataspace, mColorType);
+ }
return mSurface;
}