summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Caches.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-09-03 07:39:53 -0700
committerJohn Reck <jreck@google.com>2014-09-03 11:13:53 -0700
commit17035b0211a3c9d45ea46a99217a6acbe76e8fbe (patch)
tree0dc5117cec7ace03afc6dc817d9865752c6116f0 /libs/hwui/Caches.cpp
parent6e31e0f3d1ca8579e75ee1cfe4ac7c30c525f946 (diff)
downloadframeworks_base-17035b0211a3c9d45ea46a99217a6acbe76e8fbe.zip
frameworks_base-17035b0211a3c9d45ea46a99217a6acbe76e8fbe.tar.gz
frameworks_base-17035b0211a3c9d45ea46a99217a6acbe76e8fbe.tar.bz2
Have destroy call freePrefetchedLayers
Bug: 17208461 There's a potential race condition between HardwareRenderer.destroy() being called (which calls destroyCanvasAndSurface()) and the renderer being finalized (which is what calls freePrefetchedLayers), during which time it's possible we get a TRIM_MEMORY_COMPLETE and destroy the EGL context. Fix this race condition by moving stopDrawing() and freePrefetchedLayers() into destroyCanvasAndSurface() where they should have been in the first place. Also, if we hit the assertion failure, dump the current state of Caches to try and provide more context for the failure. Change-Id: Ife0ba3562041e8b08e87e3e13640472b3004eed6
Diffstat (limited to 'libs/hwui/Caches.cpp')
-rw-r--r--libs/hwui/Caches.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index 5689e17..9855f71 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -24,6 +24,7 @@
#include "Properties.h"
#include "LayerRenderer.h"
#include "ShadowTessellator.h"
+#include "RenderState.h"
namespace android {
@@ -49,7 +50,7 @@ namespace uirenderer {
///////////////////////////////////////////////////////////////////////////////
Caches::Caches(): Singleton<Caches>(),
- mExtensions(Extensions::getInstance()), mInitialized(false) {
+ mExtensions(Extensions::getInstance()), mInitialized(false), mRenderState(NULL) {
init();
initFont();
initConstraints();
@@ -267,8 +268,11 @@ void Caches::dumpMemoryUsage(String8 &log) {
log.appendFormat("Current memory usage / total memory usage (bytes):\n");
log.appendFormat(" TextureCache %8d / %8d\n",
textureCache.getSize(), textureCache.getMaxSize());
- log.appendFormat(" LayerCache %8d / %8d\n",
- layerCache.getSize(), layerCache.getMaxSize());
+ log.appendFormat(" LayerCache %8d / %8d (numLayers = %zu)\n",
+ layerCache.getSize(), layerCache.getMaxSize(), layerCache.getCount());
+ log.appendFormat(" Garbage layers %8zu\n", mLayerGarbage.size());
+ log.appendFormat(" Active layers %8zu\n",
+ mRenderState ? mRenderState->mActiveLayers.size() : 0);
log.appendFormat(" RenderBufferCache %8d / %8d\n",
renderBufferCache.getSize(), renderBufferCache.getMaxSize());
log.appendFormat(" GradientCache %8d / %8d\n",