Merge "Log only 1 line per process when using OpenGLRenderer." into honeycomb

This commit is contained in:
Romain Guy
2011-01-21 21:15:40 -08:00
committed by Android (Google) Code Review
10 changed files with 47 additions and 25 deletions

View File

@@ -69,7 +69,7 @@ static const GLsizei gMeshCount = 4;
struct CacheLogger { struct CacheLogger {
CacheLogger() { CacheLogger() {
LOGD("Creating caches"); LOGD("Creating OpenGL renderer caches");
} }
}; // struct CacheLogger }; // struct CacheLogger

View File

@@ -20,6 +20,9 @@
// Turn on to check for OpenGL errors on each frame // Turn on to check for OpenGL errors on each frame
#define DEBUG_OPENGL 1 #define DEBUG_OPENGL 1
// Turn on to enable initialization information
#define DEBUG_INIT 0
// Turn on to enable memory usage summary on each frame // Turn on to enable memory usage summary on each frame
#define DEBUG_MEMORY_USAGE 0 #define DEBUG_MEMORY_USAGE 0
@@ -54,4 +57,10 @@
// Turn on to dump display list state // Turn on to dump display list state
#define DEBUG_DISPLAY_LIST 0 #define DEBUG_DISPLAY_LIST 0
#if DEBUG_INIT
#define INIT_LOGD(...) LOGD(__VA_ARGS__)
#else
#define INIT_LOGD(...)
#endif
#endif // ANDROID_HWUI_DEBUG_H #endif // ANDROID_HWUI_DEBUG_H

View File

@@ -18,6 +18,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "Debug.h"
#include "FboCache.h" #include "FboCache.h"
#include "Properties.h" #include "Properties.h"
@@ -31,10 +32,10 @@ namespace uirenderer {
FboCache::FboCache(): mMaxSize(DEFAULT_FBO_CACHE_SIZE) { FboCache::FboCache(): mMaxSize(DEFAULT_FBO_CACHE_SIZE) {
char property[PROPERTY_VALUE_MAX]; char property[PROPERTY_VALUE_MAX];
if (property_get(PROPERTY_FBO_CACHE_SIZE, property, NULL) > 0) { if (property_get(PROPERTY_FBO_CACHE_SIZE, property, NULL) > 0) {
LOGD(" Setting fbo cache size to %s", property); INIT_LOGD(" Setting fbo cache size to %s", property);
mMaxSize = atoi(property); mMaxSize = atoi(property);
} else { } else {
LOGD(" Using default fbo cache size of %d", DEFAULT_FBO_CACHE_SIZE); INIT_LOGD(" Using default fbo cache size of %d", DEFAULT_FBO_CACHE_SIZE);
} }
} }

View File

@@ -22,6 +22,7 @@
#include <utils/Log.h> #include <utils/Log.h>
#include "Debug.h"
#include "FontRenderer.h" #include "FontRenderer.h"
namespace android { namespace android {
@@ -301,7 +302,9 @@ Font* Font::create(FontRenderer* state, uint32_t fontId, float fontSize,
static bool sLogFontRendererCreate = true; static bool sLogFontRendererCreate = true;
FontRenderer::FontRenderer() { FontRenderer::FontRenderer() {
if (sLogFontRendererCreate) LOGD("Creating FontRenderer"); if (sLogFontRendererCreate) {
INIT_LOGD("Creating FontRenderer");
}
mGammaTable = NULL; mGammaTable = NULL;
mInitialized = false; mInitialized = false;
@@ -319,20 +322,24 @@ FontRenderer::FontRenderer() {
char property[PROPERTY_VALUE_MAX]; char property[PROPERTY_VALUE_MAX];
if (property_get(PROPERTY_TEXT_CACHE_WIDTH, property, NULL) > 0) { if (property_get(PROPERTY_TEXT_CACHE_WIDTH, property, NULL) > 0) {
if (sLogFontRendererCreate) LOGD(" Setting text cache width to %s pixels", property); if (sLogFontRendererCreate) {
INIT_LOGD(" Setting text cache width to %s pixels", property);
}
mCacheWidth = atoi(property); mCacheWidth = atoi(property);
} else { } else {
if (sLogFontRendererCreate) { if (sLogFontRendererCreate) {
LOGD(" Using default text cache width of %i pixels", mCacheWidth); INIT_LOGD(" Using default text cache width of %i pixels", mCacheWidth);
} }
} }
if (property_get(PROPERTY_TEXT_CACHE_HEIGHT, property, NULL) > 0) { if (property_get(PROPERTY_TEXT_CACHE_HEIGHT, property, NULL) > 0) {
if (sLogFontRendererCreate) LOGD(" Setting text cache width to %s pixels", property); if (sLogFontRendererCreate) {
INIT_LOGD(" Setting text cache width to %s pixels", property);
}
mCacheHeight = atoi(property); mCacheHeight = atoi(property);
} else { } else {
if (sLogFontRendererCreate) { if (sLogFontRendererCreate) {
LOGD(" Using default text cache height of %i pixels", mCacheHeight); INIT_LOGD(" Using default text cache height of %i pixels", mCacheHeight);
} }
} }

View File

@@ -16,6 +16,7 @@
#define LOG_TAG "OpenGLRenderer" #define LOG_TAG "OpenGLRenderer"
#include "Debug.h"
#include "GammaFontRenderer.h" #include "GammaFontRenderer.h"
#include "Properties.h" #include "Properties.h"
@@ -27,7 +28,7 @@ namespace uirenderer {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
GammaFontRenderer::GammaFontRenderer() { GammaFontRenderer::GammaFontRenderer() {
LOGD("Creating gamma font renderer"); INIT_LOGD("Creating gamma font renderer");
// Get the renderer properties // Get the renderer properties
char property[PROPERTY_VALUE_MAX]; char property[PROPERTY_VALUE_MAX];
@@ -35,29 +36,29 @@ GammaFontRenderer::GammaFontRenderer() {
// Get the gamma // Get the gamma
float gamma = DEFAULT_TEXT_GAMMA; float gamma = DEFAULT_TEXT_GAMMA;
if (property_get(PROPERTY_TEXT_GAMMA, property, NULL) > 0) { if (property_get(PROPERTY_TEXT_GAMMA, property, NULL) > 0) {
LOGD(" Setting text gamma to %s", property); INIT_LOGD(" Setting text gamma to %s", property);
gamma = atof(property); gamma = atof(property);
} else { } else {
LOGD(" Using default text gamma of %.2f", DEFAULT_TEXT_GAMMA); INIT_LOGD(" Using default text gamma of %.2f", DEFAULT_TEXT_GAMMA);
} }
// Get the black gamma threshold // Get the black gamma threshold
mBlackThreshold = DEFAULT_TEXT_BLACK_GAMMA_THRESHOLD; mBlackThreshold = DEFAULT_TEXT_BLACK_GAMMA_THRESHOLD;
if (property_get(PROPERTY_TEXT_BLACK_GAMMA_THRESHOLD, property, NULL) > 0) { if (property_get(PROPERTY_TEXT_BLACK_GAMMA_THRESHOLD, property, NULL) > 0) {
LOGD(" Setting text black gamma threshold to %s", property); INIT_LOGD(" Setting text black gamma threshold to %s", property);
mBlackThreshold = atoi(property); mBlackThreshold = atoi(property);
} else { } else {
LOGD(" Using default text black gamma threshold of %d", INIT_LOGD(" Using default text black gamma threshold of %d",
DEFAULT_TEXT_BLACK_GAMMA_THRESHOLD); DEFAULT_TEXT_BLACK_GAMMA_THRESHOLD);
} }
// Get the white gamma threshold // Get the white gamma threshold
mWhiteThreshold = DEFAULT_TEXT_WHITE_GAMMA_THRESHOLD; mWhiteThreshold = DEFAULT_TEXT_WHITE_GAMMA_THRESHOLD;
if (property_get(PROPERTY_TEXT_WHITE_GAMMA_THRESHOLD, property, NULL) > 0) { if (property_get(PROPERTY_TEXT_WHITE_GAMMA_THRESHOLD, property, NULL) > 0) {
LOGD(" Setting text white gamma threshold to %s", property); INIT_LOGD(" Setting text white gamma threshold to %s", property);
mWhiteThreshold = atoi(property); mWhiteThreshold = atoi(property);
} else { } else {
LOGD(" Using default white black gamma threshold of %d", INIT_LOGD(" Using default white black gamma threshold of %d",
DEFAULT_TEXT_WHITE_GAMMA_THRESHOLD); DEFAULT_TEXT_WHITE_GAMMA_THRESHOLD);
} }

View File

@@ -23,6 +23,7 @@
#include <utils/threads.h> #include <utils/threads.h>
#include "Debug.h"
#include "GradientCache.h" #include "GradientCache.h"
#include "Properties.h" #include "Properties.h"
@@ -38,10 +39,10 @@ GradientCache::GradientCache():
mSize(0), mMaxSize(MB(DEFAULT_GRADIENT_CACHE_SIZE)) { mSize(0), mMaxSize(MB(DEFAULT_GRADIENT_CACHE_SIZE)) {
char property[PROPERTY_VALUE_MAX]; char property[PROPERTY_VALUE_MAX];
if (property_get(PROPERTY_GRADIENT_CACHE_SIZE, property, NULL) > 0) { if (property_get(PROPERTY_GRADIENT_CACHE_SIZE, property, NULL) > 0) {
LOGD(" Setting gradient cache size to %sMB", property); INIT_LOGD(" Setting gradient cache size to %sMB", property);
setMaxSize(MB(atof(property))); setMaxSize(MB(atof(property)));
} else { } else {
LOGD(" Using default gradient cache size of %.2fMB", DEFAULT_GRADIENT_CACHE_SIZE); INIT_LOGD(" Using default gradient cache size of %.2fMB", DEFAULT_GRADIENT_CACHE_SIZE);
} }
mCache.setOnEntryRemovedListener(this); mCache.setOnEntryRemovedListener(this);

View File

@@ -20,6 +20,7 @@
#include <utils/Log.h> #include <utils/Log.h>
#include "Debug.h"
#include "LayerCache.h" #include "LayerCache.h"
#include "Properties.h" #include "Properties.h"
@@ -33,10 +34,10 @@ namespace uirenderer {
LayerCache::LayerCache(): mSize(0), mMaxSize(MB(DEFAULT_LAYER_CACHE_SIZE)) { LayerCache::LayerCache(): mSize(0), mMaxSize(MB(DEFAULT_LAYER_CACHE_SIZE)) {
char property[PROPERTY_VALUE_MAX]; char property[PROPERTY_VALUE_MAX];
if (property_get(PROPERTY_LAYER_CACHE_SIZE, property, NULL) > 0) { if (property_get(PROPERTY_LAYER_CACHE_SIZE, property, NULL) > 0) {
LOGD(" Setting layer cache size to %sMB", property); INIT_LOGD(" Setting layer cache size to %sMB", property);
setMaxSize(MB(atof(property))); setMaxSize(MB(atof(property)));
} else { } else {
LOGD(" Using default layer cache size of %.2fMB", DEFAULT_LAYER_CACHE_SIZE); INIT_LOGD(" Using default layer cache size of %.2fMB", DEFAULT_LAYER_CACHE_SIZE);
} }
} }

View File

@@ -302,10 +302,10 @@ ShapeCache<Entry>::ShapeCache(const char* name, const char* propertyName, float
mSize(0), mMaxSize(MB(defaultSize)) { mSize(0), mMaxSize(MB(defaultSize)) {
char property[PROPERTY_VALUE_MAX]; char property[PROPERTY_VALUE_MAX];
if (property_get(propertyName, property, NULL) > 0) { if (property_get(propertyName, property, NULL) > 0) {
LOGD(" Setting %s cache size to %sMB", name, property); INIT_LOGD(" Setting %s cache size to %sMB", name, property);
setMaxSize(MB(atof(property))); setMaxSize(MB(atof(property)));
} else { } else {
LOGD(" Using default %s cache size of %.2fMB", name, defaultSize); INIT_LOGD(" Using default %s cache size of %.2fMB", name, defaultSize);
} }
size_t len = strlen(name); size_t len = strlen(name);

View File

@@ -16,6 +16,7 @@
#define LOG_TAG "OpenGLRenderer" #define LOG_TAG "OpenGLRenderer"
#include "Debug.h"
#include "TextDropShadowCache.h" #include "TextDropShadowCache.h"
#include "Properties.h" #include "Properties.h"
@@ -31,10 +32,11 @@ TextDropShadowCache::TextDropShadowCache():
mSize(0), mMaxSize(MB(DEFAULT_DROP_SHADOW_CACHE_SIZE)) { mSize(0), mMaxSize(MB(DEFAULT_DROP_SHADOW_CACHE_SIZE)) {
char property[PROPERTY_VALUE_MAX]; char property[PROPERTY_VALUE_MAX];
if (property_get(PROPERTY_DROP_SHADOW_CACHE_SIZE, property, NULL) > 0) { if (property_get(PROPERTY_DROP_SHADOW_CACHE_SIZE, property, NULL) > 0) {
LOGD(" Setting drop shadow cache size to %sMB", property); INIT_LOGD(" Setting drop shadow cache size to %sMB", property);
setMaxSize(MB(atof(property))); setMaxSize(MB(atof(property)));
} else { } else {
LOGD(" Using default drop shadow cache size of %.2fMB", DEFAULT_DROP_SHADOW_CACHE_SIZE); INIT_LOGD(" Using default drop shadow cache size of %.2fMB",
DEFAULT_DROP_SHADOW_CACHE_SIZE);
} }
init(); init();

View File

@@ -37,10 +37,10 @@ TextureCache::TextureCache():
mSize(0), mMaxSize(MB(DEFAULT_TEXTURE_CACHE_SIZE)) { mSize(0), mMaxSize(MB(DEFAULT_TEXTURE_CACHE_SIZE)) {
char property[PROPERTY_VALUE_MAX]; char property[PROPERTY_VALUE_MAX];
if (property_get(PROPERTY_TEXTURE_CACHE_SIZE, property, NULL) > 0) { if (property_get(PROPERTY_TEXTURE_CACHE_SIZE, property, NULL) > 0) {
LOGD(" Setting texture cache size to %sMB", property); INIT_LOGD(" Setting texture cache size to %sMB", property);
setMaxSize(MB(atof(property))); setMaxSize(MB(atof(property)));
} else { } else {
LOGD(" Using default texture cache size of %.2fMB", DEFAULT_TEXTURE_CACHE_SIZE); INIT_LOGD(" Using default texture cache size of %.2fMB", DEFAULT_TEXTURE_CACHE_SIZE);
} }
init(); init();