summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2016-11-08 01:15:29 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-11-08 01:15:33 +0000
commite3d281ea18f7ccd477e4db5e74cf4fc1506e9f98 (patch)
tree29adbdfb0fab66111d70e32345fddd1bb81fac38
parentb54e147041540acda5869d4e3e997fa24aad1da9 (diff)
parent4bda6bfaa6b8cb775f18f2453720d05f4cb29152 (diff)
Merge "Add debug memory tracking to SkiaGLPipeline"
-rw-r--r--libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp5
-rw-r--r--libs/hwui/pipeline/skia/SkiaPipeline.cpp14
-rw-r--r--libs/hwui/pipeline/skia/SkiaPipeline.h3
-rw-r--r--libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp5
4 files changed, 27 insertions, 0 deletions
diff --git a/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp b/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp
index ca7ee8b7078e..f046e4b93db1 100644
--- a/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp
@@ -95,6 +95,11 @@ bool SkiaOpenGLPipeline::draw(const Frame& frame, const SkRect& screenDirty,
profileCanvas->flush();
}
+ // Log memory statistics
+ if (CC_UNLIKELY(Properties::debugLevel != kDebugDisabled)) {
+ dumpResourceCacheUsage();
+ }
+
return true;
}
diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.cpp b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
index 69e603b6c927..a6612c96b8f3 100644
--- a/libs/hwui/pipeline/skia/SkiaPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaPipeline.cpp
@@ -266,6 +266,20 @@ void SkiaPipeline::renderFrame(const LayerUpdateQueue& layers, const SkRect& cli
canvas->flush();
}
+void SkiaPipeline::dumpResourceCacheUsage() const {
+ int resources, maxResources;
+ size_t bytes, maxBytes;
+ mRenderThread.getGrContext()->getResourceCacheUsage(&resources, &bytes);
+ mRenderThread.getGrContext()->getResourceCacheLimits(&maxResources, &maxBytes);
+
+ SkString log("Resource Cache Usage:\n");
+ log.appendf("%8d items out of %d maximum items\n", resources, maxResources);
+ log.appendf("%8zu bytes (%.2f MB) out of %.2f MB maximum\n",
+ bytes, bytes * (1.0f / (1024.0f * 1024.0f)), maxBytes * (1.0f / (1024.0f * 1024.0f)));
+
+ ALOGD("%s", log.c_str());
+}
+
} /* namespace skiapipeline */
} /* namespace uirenderer */
} /* namespace android */
diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.h b/libs/hwui/pipeline/skia/SkiaPipeline.h
index 877a3538254c..c1c8cbef4d70 100644
--- a/libs/hwui/pipeline/skia/SkiaPipeline.h
+++ b/libs/hwui/pipeline/skia/SkiaPipeline.h
@@ -100,7 +100,10 @@ public:
mSpotShadowAlpha = lightInfo.spotShadowAlpha;
mLightCenter = lightGeometry.center;
}
+
protected:
+ void dumpResourceCacheUsage() const;
+
renderthread::RenderThread& mRenderThread;
private:
diff --git a/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp b/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp
index 21f348892ccb..ba13ca586129 100644
--- a/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp
@@ -81,6 +81,11 @@ bool SkiaVulkanPipeline::draw(const Frame& frame, const SkRect& screenDirty,
profileCanvas->flush();
}
+ // Log memory statistics
+ if (CC_UNLIKELY(Properties::debugLevel != kDebugDisabled)) {
+ dumpResourceCacheUsage();
+ }
+
return true;
}