Loading libs/hwui/Caches.cpp +18 −3 Original line number Diff line number Diff line Loading @@ -166,11 +166,16 @@ bool Caches::initProperties() { debugLayersUpdates = false; } debugOverdraw = false; if (property_get(PROPERTY_DEBUG_OVERDRAW, property, NULL) > 0) { INIT_LOGD(" Overdraw debug enabled: %s", property); debugOverdraw = !strcmp(property, "show"); } else { debugOverdraw = false; if (!strcmp(property, "show")) { debugOverdraw = true; mOverdrawDebugColorSet = kColorSet_Default; } else if (!strcmp(property, "show_deuteranomaly")) { debugOverdraw = true; mOverdrawDebugColorSet = kColorSet_Deuteranomaly; } } // See Properties.h for valid values Loading Loading @@ -235,6 +240,16 @@ void Caches::terminate() { // Debug /////////////////////////////////////////////////////////////////////////////// uint32_t Caches::getOverdrawColor(uint32_t amount) const { static uint32_t sOverdrawColors[2][4] = { { 0x2f0000ff, 0x2f00ff00, 0x3fff0000, 0x7fff0000 }, { 0x2f0000ff, 0x4fffff00, 0x5fff8ad8, 0x7fff0000 } }; if (amount < 1) amount = 1; if (amount > 4) amount = 4; return sOverdrawColors[mOverdrawDebugColorSet][amount - 1]; } void Caches::dumpMemoryUsage() { String8 stringLog; dumpMemoryUsage(stringLog); Loading libs/hwui/Caches.h +13 −0 Original line number Diff line number Diff line Loading @@ -149,6 +149,12 @@ public: return mDebugLevel; } /** * Returns a non-premultiplied ARGB color for the specified * amount of overdraw (1 for 1x, 2 for 2x, etc.) */ uint32_t getOverdrawColor(uint32_t amount) const; /** * Call this on each frame to ensure that garbage is deleted from * GPU memory. Loading Loading @@ -348,6 +354,11 @@ public: PFNGLGETOBJECTLABELEXTPROC getLabel; private: enum OverdrawColorSet { kColorSet_Default = 0, kColorSet_Deuteranomaly }; void initFont(); void initExtensions(); void initConstraints(); Loading Loading @@ -400,6 +411,8 @@ private: uint32_t mFunctorsCount; GLuint mBoundTextures[REQUIRED_TEXTURE_UNITS_COUNT]; OverdrawColorSet mOverdrawDebugColorSet; }; // class Caches }; // namespace uirenderer Loading libs/hwui/OpenGLRenderer.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -530,14 +530,22 @@ void OpenGLRenderer::renderOverdraw() { mCaches.setScissor(clip->left, mFirstSnapshot->height - clip->bottom, clip->right - clip->left, clip->bottom - clip->top); // 1x overdraw mCaches.stencil.enableDebugTest(2); drawColor(0x2f0000ff, SkXfermode::kSrcOver_Mode); drawColor(mCaches.getOverdrawColor(1), SkXfermode::kSrcOver_Mode); // 2x overdraw mCaches.stencil.enableDebugTest(3); drawColor(0x2f00ff00, SkXfermode::kSrcOver_Mode); drawColor(mCaches.getOverdrawColor(2), SkXfermode::kSrcOver_Mode); // 3x overdraw mCaches.stencil.enableDebugTest(4); drawColor(0x3fff0000, SkXfermode::kSrcOver_Mode); drawColor(mCaches.getOverdrawColor(3), SkXfermode::kSrcOver_Mode); // 4x overdraw and higher mCaches.stencil.enableDebugTest(4, true); drawColor(0x7fff0000, SkXfermode::kSrcOver_Mode); drawColor(mCaches.getOverdrawColor(4), SkXfermode::kSrcOver_Mode); mCaches.stencil.disable(); } } Loading libs/hwui/Properties.h +9 −2 Original line number Diff line number Diff line Loading @@ -70,8 +70,15 @@ enum DebugLevel { #define PROPERTY_DEBUG_LAYERS_UPDATES "debug.hwui.show_layers_updates" /** * Used to enable/disable overdraw debugging. The accepted values are * "show", "count" and "false". The default value is "false". * Used to enable/disable overdraw debugging. * * The accepted values are * "show", to show overdraw * "show_deuteranomaly", to show overdraw if you suffer from Deuteranomaly * "count", to show an overdraw counter * "false", to disable overdraw debugging * * The default value is "false". */ #define PROPERTY_DEBUG_OVERDRAW "debug.hwui.overdraw" Loading Loading
libs/hwui/Caches.cpp +18 −3 Original line number Diff line number Diff line Loading @@ -166,11 +166,16 @@ bool Caches::initProperties() { debugLayersUpdates = false; } debugOverdraw = false; if (property_get(PROPERTY_DEBUG_OVERDRAW, property, NULL) > 0) { INIT_LOGD(" Overdraw debug enabled: %s", property); debugOverdraw = !strcmp(property, "show"); } else { debugOverdraw = false; if (!strcmp(property, "show")) { debugOverdraw = true; mOverdrawDebugColorSet = kColorSet_Default; } else if (!strcmp(property, "show_deuteranomaly")) { debugOverdraw = true; mOverdrawDebugColorSet = kColorSet_Deuteranomaly; } } // See Properties.h for valid values Loading Loading @@ -235,6 +240,16 @@ void Caches::terminate() { // Debug /////////////////////////////////////////////////////////////////////////////// uint32_t Caches::getOverdrawColor(uint32_t amount) const { static uint32_t sOverdrawColors[2][4] = { { 0x2f0000ff, 0x2f00ff00, 0x3fff0000, 0x7fff0000 }, { 0x2f0000ff, 0x4fffff00, 0x5fff8ad8, 0x7fff0000 } }; if (amount < 1) amount = 1; if (amount > 4) amount = 4; return sOverdrawColors[mOverdrawDebugColorSet][amount - 1]; } void Caches::dumpMemoryUsage() { String8 stringLog; dumpMemoryUsage(stringLog); Loading
libs/hwui/Caches.h +13 −0 Original line number Diff line number Diff line Loading @@ -149,6 +149,12 @@ public: return mDebugLevel; } /** * Returns a non-premultiplied ARGB color for the specified * amount of overdraw (1 for 1x, 2 for 2x, etc.) */ uint32_t getOverdrawColor(uint32_t amount) const; /** * Call this on each frame to ensure that garbage is deleted from * GPU memory. Loading Loading @@ -348,6 +354,11 @@ public: PFNGLGETOBJECTLABELEXTPROC getLabel; private: enum OverdrawColorSet { kColorSet_Default = 0, kColorSet_Deuteranomaly }; void initFont(); void initExtensions(); void initConstraints(); Loading Loading @@ -400,6 +411,8 @@ private: uint32_t mFunctorsCount; GLuint mBoundTextures[REQUIRED_TEXTURE_UNITS_COUNT]; OverdrawColorSet mOverdrawDebugColorSet; }; // class Caches }; // namespace uirenderer Loading
libs/hwui/OpenGLRenderer.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -530,14 +530,22 @@ void OpenGLRenderer::renderOverdraw() { mCaches.setScissor(clip->left, mFirstSnapshot->height - clip->bottom, clip->right - clip->left, clip->bottom - clip->top); // 1x overdraw mCaches.stencil.enableDebugTest(2); drawColor(0x2f0000ff, SkXfermode::kSrcOver_Mode); drawColor(mCaches.getOverdrawColor(1), SkXfermode::kSrcOver_Mode); // 2x overdraw mCaches.stencil.enableDebugTest(3); drawColor(0x2f00ff00, SkXfermode::kSrcOver_Mode); drawColor(mCaches.getOverdrawColor(2), SkXfermode::kSrcOver_Mode); // 3x overdraw mCaches.stencil.enableDebugTest(4); drawColor(0x3fff0000, SkXfermode::kSrcOver_Mode); drawColor(mCaches.getOverdrawColor(3), SkXfermode::kSrcOver_Mode); // 4x overdraw and higher mCaches.stencil.enableDebugTest(4, true); drawColor(0x7fff0000, SkXfermode::kSrcOver_Mode); drawColor(mCaches.getOverdrawColor(4), SkXfermode::kSrcOver_Mode); mCaches.stencil.disable(); } } Loading
libs/hwui/Properties.h +9 −2 Original line number Diff line number Diff line Loading @@ -70,8 +70,15 @@ enum DebugLevel { #define PROPERTY_DEBUG_LAYERS_UPDATES "debug.hwui.show_layers_updates" /** * Used to enable/disable overdraw debugging. The accepted values are * "show", "count" and "false". The default value is "false". * Used to enable/disable overdraw debugging. * * The accepted values are * "show", to show overdraw * "show_deuteranomaly", to show overdraw if you suffer from Deuteranomaly * "count", to show an overdraw counter * "false", to disable overdraw debugging * * The default value is "false". */ #define PROPERTY_DEBUG_OVERDRAW "debug.hwui.overdraw" Loading