Add layer updates debugging feature to Skia pipelines
When this property is turned on, we flash green
every time a hardware layer is updated.
Test: Matches the behavior in OpenGLPipeline
BUG:32370375
Change-Id: I916f94eee644c185d8a3f9fa4cd69e087ed1e92d
diff --git a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
index accbabd..7dcbbd0 100644
--- a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
+++ b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
@@ -164,6 +164,14 @@
paint = &tmpPaint;
}
renderNode->getLayerSurface()->draw(canvas, 0, 0, paint);
+
+ if (CC_UNLIKELY(Properties::debugLayersUpdates
+ && !renderNode->getSkiaLayer()->hasRenderedSinceRepaint)) {
+ renderNode->getSkiaLayer()->hasRenderedSinceRepaint = true;
+ SkPaint layerPaint;
+ layerPaint.setColor(0x7f00ff00);
+ canvas->drawRect(bounds, layerPaint);
+ }
// composing a software layer with alpha
} else if (properties.effectiveLayerType() == LayerType::Software) {
SkPaint paint;
diff --git a/libs/hwui/pipeline/skia/SkiaLayer.h b/libs/hwui/pipeline/skia/SkiaLayer.h
index 0988d7e..904d57e0 100644
--- a/libs/hwui/pipeline/skia/SkiaLayer.h
+++ b/libs/hwui/pipeline/skia/SkiaLayer.h
@@ -30,6 +30,7 @@
{
sk_sp<SkSurface> layerSurface;
Matrix4 inverseTransformInWindow;
+ bool hasRenderedSinceRepaint = false;
};
diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.cpp b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
index a6612c9..a4a83ef 100644
--- a/libs/hwui/pipeline/skia/SkiaPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
@@ -106,6 +106,7 @@
return;
}
+ layerNode->getSkiaLayer()->hasRenderedSinceRepaint = false;
layerCanvas->clear(SK_ColorTRANSPARENT);
RenderNodeDrawable root(layerNode, layerCanvas, false);