Loading libs/hwui/Android.mk +8 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ include $(CLEAR_VARS) LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk HWUI_NEW_OPS := true BUGREPORT_FONT_CACHE_USAGE := true # Enables fine-grained GLES error checking # If set to true, every GLES call is wrapped & error checked Loading Loading @@ -135,6 +136,13 @@ ifeq (true, $(HWUI_NEW_OPS)) endif ifeq (true, $(BUGREPORT_FONT_CACHE_USAGE)) hwui_src_files += \ font/FontCacheHistoryTracker.cpp hwui_cflags += -DBUGREPORT_FONT_CACHE_USAGE endif ifndef HWUI_COMPILE_SYMBOLS hwui_cflags += -fvisibility=hidden endif Loading libs/hwui/Caches.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,9 @@ #include "Properties.h" #include "renderstate/RenderState.h" #include "ShadowTessellator.h" #ifdef BUGREPORT_FONT_CACHE_USAGE #include "font/FontCacheHistoryTracker.h" #endif #include "utils/GLUtils.h" #include <cutils/properties.h> Loading Loading @@ -212,6 +215,10 @@ void Caches::dumpMemoryUsage(String8 &log) { log.appendFormat("Total memory usage:\n"); log.appendFormat(" %d bytes, %.2f MB\n", total, total / 1024.0f / 1024.0f); #ifdef BUGREPORT_FONT_CACHE_USAGE fontRenderer.getFontRenderer().historyTracker().dump(log); #endif } /////////////////////////////////////////////////////////////////////////////// Loading libs/hwui/FontRenderer.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -168,10 +168,17 @@ void FontRenderer::flushAllAndInvalidate() { for (uint32_t i = 0; i < mACacheTextures.size(); i++) { mACacheTextures[i]->init(); #ifdef BUGREPORT_FONT_CACHE_USAGE mHistoryTracker.glyphsCleared(mACacheTextures[i]); #endif } for (uint32_t i = 0; i < mRGBACacheTextures.size(); i++) { mRGBACacheTextures[i]->init(); #ifdef BUGREPORT_FONT_CACHE_USAGE mHistoryTracker.glyphsCleared(mRGBACacheTextures[i]); #endif } mDrawn = false; Loading @@ -183,6 +190,9 @@ void FontRenderer::flushLargeCaches(std::vector<CacheTexture*>& cacheTextures) { CacheTexture* cacheTexture = cacheTextures[i]; if (cacheTexture->getPixelBuffer()) { cacheTexture->init(); #ifdef BUGREPORT_FONT_CACHE_USAGE mHistoryTracker.glyphsCleared(cacheTexture); #endif LruCache<Font::FontDescription, Font*>::Iterator it(mActiveFonts); while (it.next()) { it.value()->invalidateTextureCache(cacheTexture); Loading Loading @@ -385,6 +395,10 @@ void FontRenderer::cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyp } cachedGlyph->mIsValid = true; #ifdef BUGREPORT_FONT_CACHE_USAGE mHistoryTracker.glyphUploaded(cacheTexture, startX, startY, glyph.fWidth, glyph.fHeight); #endif } CacheTexture* FontRenderer::createCacheTexture(int width, int height, GLenum format, Loading libs/hwui/FontRenderer.h +11 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,9 @@ #include "font/CacheTexture.h" #include "font/CachedGlyphInfo.h" #include "font/Font.h" #ifdef BUGREPORT_FONT_CACHE_USAGE #include "font/FontCacheHistoryTracker.h" #endif #include <utils/LruCache.h> #include <utils/String8.h> Loading Loading @@ -136,6 +139,10 @@ public: uint32_t getSize() const; void dumpMemoryUsage(String8& log) const; #ifdef BUGREPORT_FONT_CACHE_USAGE FontCacheHistoryTracker& historyTracker() { return mHistoryTracker; } #endif private: friend class Font; Loading Loading @@ -205,6 +212,10 @@ private: bool mLinearFiltering; #ifdef BUGREPORT_FONT_CACHE_USAGE FontCacheHistoryTracker mHistoryTracker; #endif #ifdef ANDROID_ENABLE_RENDERSCRIPT // RS constructs RSC::sp<RSC::RS> mRs; Loading libs/hwui/font/Font.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -408,9 +408,15 @@ void Font::render(const SkPaint* paint, const glyph_t* glyphs, if (cachedGlyph->mIsValid && cachedGlyph->mCacheTexture) { int penX = x + (int) roundf(positions[(glyphsCount << 1)]); int penY = y + (int) roundf(positions[(glyphsCount << 1) + 1]); #ifdef BUGREPORT_FONT_CACHE_USAGE mState->historyTracker().glyphRendered(cachedGlyph, penX, penY); #endif (*this.*render)(cachedGlyph, penX, penY, bitmap, bitmapW, bitmapH, bounds, positions); } else { #ifdef BUGREPORT_FONT_CACHE_USAGE mState->historyTracker().glyphRendered(cachedGlyph, -1, -1); #endif } glyphsCount++; Loading Loading
libs/hwui/Android.mk +8 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ include $(CLEAR_VARS) LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk HWUI_NEW_OPS := true BUGREPORT_FONT_CACHE_USAGE := true # Enables fine-grained GLES error checking # If set to true, every GLES call is wrapped & error checked Loading Loading @@ -135,6 +136,13 @@ ifeq (true, $(HWUI_NEW_OPS)) endif ifeq (true, $(BUGREPORT_FONT_CACHE_USAGE)) hwui_src_files += \ font/FontCacheHistoryTracker.cpp hwui_cflags += -DBUGREPORT_FONT_CACHE_USAGE endif ifndef HWUI_COMPILE_SYMBOLS hwui_cflags += -fvisibility=hidden endif Loading
libs/hwui/Caches.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,9 @@ #include "Properties.h" #include "renderstate/RenderState.h" #include "ShadowTessellator.h" #ifdef BUGREPORT_FONT_CACHE_USAGE #include "font/FontCacheHistoryTracker.h" #endif #include "utils/GLUtils.h" #include <cutils/properties.h> Loading Loading @@ -212,6 +215,10 @@ void Caches::dumpMemoryUsage(String8 &log) { log.appendFormat("Total memory usage:\n"); log.appendFormat(" %d bytes, %.2f MB\n", total, total / 1024.0f / 1024.0f); #ifdef BUGREPORT_FONT_CACHE_USAGE fontRenderer.getFontRenderer().historyTracker().dump(log); #endif } /////////////////////////////////////////////////////////////////////////////// Loading
libs/hwui/FontRenderer.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -168,10 +168,17 @@ void FontRenderer::flushAllAndInvalidate() { for (uint32_t i = 0; i < mACacheTextures.size(); i++) { mACacheTextures[i]->init(); #ifdef BUGREPORT_FONT_CACHE_USAGE mHistoryTracker.glyphsCleared(mACacheTextures[i]); #endif } for (uint32_t i = 0; i < mRGBACacheTextures.size(); i++) { mRGBACacheTextures[i]->init(); #ifdef BUGREPORT_FONT_CACHE_USAGE mHistoryTracker.glyphsCleared(mRGBACacheTextures[i]); #endif } mDrawn = false; Loading @@ -183,6 +190,9 @@ void FontRenderer::flushLargeCaches(std::vector<CacheTexture*>& cacheTextures) { CacheTexture* cacheTexture = cacheTextures[i]; if (cacheTexture->getPixelBuffer()) { cacheTexture->init(); #ifdef BUGREPORT_FONT_CACHE_USAGE mHistoryTracker.glyphsCleared(cacheTexture); #endif LruCache<Font::FontDescription, Font*>::Iterator it(mActiveFonts); while (it.next()) { it.value()->invalidateTextureCache(cacheTexture); Loading Loading @@ -385,6 +395,10 @@ void FontRenderer::cacheBitmap(const SkGlyph& glyph, CachedGlyphInfo* cachedGlyp } cachedGlyph->mIsValid = true; #ifdef BUGREPORT_FONT_CACHE_USAGE mHistoryTracker.glyphUploaded(cacheTexture, startX, startY, glyph.fWidth, glyph.fHeight); #endif } CacheTexture* FontRenderer::createCacheTexture(int width, int height, GLenum format, Loading
libs/hwui/FontRenderer.h +11 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,9 @@ #include "font/CacheTexture.h" #include "font/CachedGlyphInfo.h" #include "font/Font.h" #ifdef BUGREPORT_FONT_CACHE_USAGE #include "font/FontCacheHistoryTracker.h" #endif #include <utils/LruCache.h> #include <utils/String8.h> Loading Loading @@ -136,6 +139,10 @@ public: uint32_t getSize() const; void dumpMemoryUsage(String8& log) const; #ifdef BUGREPORT_FONT_CACHE_USAGE FontCacheHistoryTracker& historyTracker() { return mHistoryTracker; } #endif private: friend class Font; Loading Loading @@ -205,6 +212,10 @@ private: bool mLinearFiltering; #ifdef BUGREPORT_FONT_CACHE_USAGE FontCacheHistoryTracker mHistoryTracker; #endif #ifdef ANDROID_ENABLE_RENDERSCRIPT // RS constructs RSC::sp<RSC::RS> mRs; Loading
libs/hwui/font/Font.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -408,9 +408,15 @@ void Font::render(const SkPaint* paint, const glyph_t* glyphs, if (cachedGlyph->mIsValid && cachedGlyph->mCacheTexture) { int penX = x + (int) roundf(positions[(glyphsCount << 1)]); int penY = y + (int) roundf(positions[(glyphsCount << 1) + 1]); #ifdef BUGREPORT_FONT_CACHE_USAGE mState->historyTracker().glyphRendered(cachedGlyph, penX, penY); #endif (*this.*render)(cachedGlyph, penX, penY, bitmap, bitmapW, bitmapH, bounds, positions); } else { #ifdef BUGREPORT_FONT_CACHE_USAGE mState->historyTracker().glyphRendered(cachedGlyph, -1, -1); #endif } glyphsCount++; Loading