summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-07-26 20:35:55 -0700
committerRomain Guy <romainguy@google.com>2011-07-26 20:35:55 -0700
commiteea60692b060737faeaa02bb30f5b79e2202b482 (patch)
tree3dcf0aee4e80c38b0475250767a37901e686fde7 /libs/hwui
parent912a7b32d0c59ba38265c5dd6ff84ce93f909a7f (diff)
downloadframeworks_base-eea60692b060737faeaa02bb30f5b79e2202b482.zip
frameworks_base-eea60692b060737faeaa02bb30f5b79e2202b482.tar.gz
frameworks_base-eea60692b060737faeaa02bb30f5b79e2202b482.tar.bz2
Improve layers debugging
Change-Id: Ia4950dd5f0e0a224ecb69c581d33aa4f32260a7c
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/LayerCache.cpp14
-rw-r--r--libs/hwui/LayerCache.h5
-rw-r--r--libs/hwui/LayerRenderer.cpp10
3 files changed, 22 insertions, 7 deletions
diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp
index 58c0fac..89c35da 100644
--- a/libs/hwui/LayerCache.cpp
+++ b/libs/hwui/LayerCache.cpp
@@ -112,17 +112,21 @@ Layer* LayerCache::get(const uint32_t width, const uint32_t height) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
#if DEBUG_LAYERS
- size_t size = mCache.size();
- for (size_t i = 0; i < size; i++) {
- const LayerEntry& entry = mCache.itemAt(i);
- LAYER_LOGD(" Layer size %dx%d", entry.mWidth, entry.mHeight);
- }
+ dump();
#endif
}
return layer;
}
+void LayerCache::dump() {
+ size_t size = mCache.size();
+ for (size_t i = 0; i < size; i++) {
+ const LayerEntry& entry = mCache.itemAt(i);
+ LAYER_LOGD(" Layer size %dx%d", entry.mWidth, entry.mHeight);
+ }
+}
+
bool LayerCache::resize(Layer* layer, const uint32_t width, const uint32_t height) {
// TODO: We should be smarter and see if we have a texture of the appropriate
// size already in the cache, and reuse it instead of creating a new one
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h
index 81b8bf3..a0eae59 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -101,6 +101,11 @@ public:
*/
uint32_t getSize();
+ /**
+ * Prints out the content of the cache.
+ */
+ void dump();
+
private:
void deleteLayer(Layer* layer);
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index 1fa343b..81816f6 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -167,7 +167,7 @@ void LayerRenderer::generateMesh() {
///////////////////////////////////////////////////////////////////////////////
Layer* LayerRenderer::createLayer(uint32_t width, uint32_t height, bool isOpaque) {
- LAYER_RENDERER_LOGD("Creating new layer %dx%d", width, height);
+ LAYER_RENDERER_LOGD("Requesting new render layer %dx%d", width, height);
GLuint fbo = Caches::getInstance().fboCache.get();
if (!fbo) {
@@ -288,16 +288,22 @@ void LayerRenderer::updateTextureLayer(Layer* layer, uint32_t width, uint32_t he
void LayerRenderer::destroyLayer(Layer* layer) {
if (layer) {
- LAYER_RENDERER_LOGD("Destroying layer, fbo = %d", layer->getFbo());
+ LAYER_RENDERER_LOGD("Recycling layer, %dx%d fbo = %d",
+ layer->getWidth(), layer->getHeight(), layer->getFbo());
if (layer->getFbo()) {
Caches::getInstance().fboCache.put(layer->getFbo());
}
if (!Caches::getInstance().layerCache.put(layer)) {
+ LAYER_RENDERER_LOGD(" Destroyed!");
layer->deleteTexture();
delete layer;
} else {
+ LAYER_RENDERER_LOGD(" Cached!");
+#if DEBUG_LAYERS
+ Caches::getInstance().layerCache.dump();
+#endif
layer->region.clear();
}
}