diff options
author | Stan Iliev <stani@google.com> | 2018-03-26 14:29:50 -0400 |
---|---|---|
committer | Stan Iliev <stani@google.com> | 2018-03-28 13:49:21 -0400 |
commit | 216b1572b46ecb1225c8b1a904d7f98e2e6c4b01 (patch) | |
tree | 3009b84e23a643564b0e20caa54555eadaf51dd2 /libs/hwui/pipeline/skia/SkiaPipeline.cpp | |
parent | 294ad785342f0eaaf41c59d819edd559450a4a2a (diff) |
Better error reporting for createOrUpdateLayer
Pass error handler down to the pipeline object, which allows
skia pipelines to print cache memory usage.
In case of an error, print arguments that were used to invoke
SkSurface::MakeRenderTarget.
Test: Ran android build on a device
Bug: 76115654
Change-Id: I5baddfa66debd505eddc3117cf94aa6ae69bedaa
Diffstat (limited to 'libs/hwui/pipeline/skia/SkiaPipeline.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/SkiaPipeline.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.cpp b/libs/hwui/pipeline/skia/SkiaPipeline.cpp index 0cd1c151629d..07052cdab48b 100644 --- a/libs/hwui/pipeline/skia/SkiaPipeline.cpp +++ b/libs/hwui/pipeline/skia/SkiaPipeline.cpp @@ -22,6 +22,7 @@ #include <SkOverdrawColorFilter.h> #include <SkPicture.h> #include <SkPictureRecorder.h> +#include "TreeInfo.h" #include "VectorDrawable.h" #include "utils/TraceUtils.h" @@ -158,7 +159,7 @@ void SkiaPipeline::renderLayersImpl(const LayerUpdateQueue& layers, bool opaque, } bool SkiaPipeline::createOrUpdateLayer(RenderNode* node, const DamageAccumulator& damageAccumulator, - bool wideColorGamut) { + bool wideColorGamut, ErrorHandler* errorHandler) { // compute the size of the surface (i.e. texture) to be allocated for this layer const int surfaceWidth = ceilf(node->getWidth() / float(LAYER_SIZE)) * LAYER_SIZE; const int surfaceHeight = ceilf(node->getHeight() / float(LAYER_SIZE)) * LAYER_SIZE; @@ -182,6 +183,20 @@ bool SkiaPipeline::createOrUpdateLayer(RenderNode* node, const DamageAccumulator Matrix4 windowTransform; damageAccumulator.computeCurrentTransform(&windowTransform); node->getSkiaLayer()->inverseTransformInWindow = windowTransform; + } else { + String8 cachesOutput; + mRenderThread.cacheManager().dumpMemoryUsage(cachesOutput, + &mRenderThread.renderState()); + ALOGE("%s", cachesOutput.string()); + if (errorHandler) { + std::ostringstream err; + err << "Unable to create layer for " << node->getName(); + const int maxTextureSize = DeviceInfo::get()->maxTextureSize(); + err << ", size " << info.width() << "x" << info.height() << " max size " + << maxTextureSize << " color type " << (int)info.colorType() + << " has context " << (int)(mRenderThread.getGrContext() != nullptr); + errorHandler->onError(err.str()); + } } return true; } |