From 9fded232a9548a304e0145011df8849fba0dcda7 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Wed, 11 Nov 2015 16:42:34 -0800 Subject: Recycle OffscreenBuffers Change-Id: Ia2e219026f211a5308ecf8209c5f986bb888aadd --- libs/hwui/Properties.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'libs/hwui/Properties.cpp') diff --git a/libs/hwui/Properties.cpp b/libs/hwui/Properties.cpp index e81818679f3e..0669596b21ca 100644 --- a/libs/hwui/Properties.cpp +++ b/libs/hwui/Properties.cpp @@ -37,6 +37,7 @@ bool Properties::useBufferAge = true; bool Properties::enablePartialUpdates = true; float Properties::textGamma = DEFAULT_TEXT_GAMMA; +int Properties::layerPoolSize = DEFAULT_LAYER_CACHE_SIZE; DebugLevel Properties::debugLevel = kDebugDisabled; OverdrawColorSet Properties::overdrawColorSet = OverdrawColorSet::Default; @@ -52,10 +53,19 @@ int Properties::overrideSpotShadowStrength = -1; ProfileType Properties::sProfileType = ProfileType::None; bool Properties::sDisableProfileBars = false; +static int property_get_int(const char* key, int defaultValue) { + char buf[PROPERTY_VALUE_MAX] = {'\0',}; + + if (property_get(key, buf, "") > 0) { + return atoi(buf); + } + return defaultValue; +} + static float property_get_float(const char* key, float defaultValue) { char buf[PROPERTY_VALUE_MAX] = {'\0',}; - if (property_get(PROPERTY_PROFILE, buf, "") > 0) { + if (property_get(key, buf, "") > 0) { return atof(buf); } return defaultValue; @@ -114,16 +124,14 @@ bool Properties::load() { showDirtyRegions = property_get_bool(PROPERTY_DEBUG_SHOW_DIRTY_REGIONS, false); - debugLevel = kDebugDisabled; - if (property_get(PROPERTY_DEBUG, property, nullptr) > 0) { - debugLevel = (DebugLevel) atoi(property); - } + debugLevel = (DebugLevel) property_get_int(PROPERTY_DEBUG, kDebugDisabled); skipEmptyFrames = property_get_bool(PROPERTY_SKIP_EMPTY_DAMAGE, true); useBufferAge = property_get_bool(PROPERTY_USE_BUFFER_AGE, true); enablePartialUpdates = property_get_bool(PROPERTY_ENABLE_PARTIAL_UPDATES, true); textGamma = property_get_float(PROPERTY_TEXT_GAMMA, DEFAULT_TEXT_GAMMA); + layerPoolSize = MB(property_get_float(PROPERTY_LAYER_CACHE_SIZE, DEFAULT_LAYER_CACHE_SIZE)); return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw) -- cgit v1.2.3-59-g8ed1b