summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CacheManager.cpp
diff options
context:
space:
mode:
authorScott Lobdell <slobdell@google.com>2019-01-31 11:53:41 -0800
committerScott Lobdell <slobdell@google.com>2019-02-01 14:08:42 -0800
commit88b45c586d461df38b866d529bc98d1dfa3e8838 (patch)
treeae57a86275dac94c0899015923778f3016c865b2 /libs/hwui/renderthread/CacheManager.cpp
parent067596650927fa91a97355e84b152b21826f7ae2 (diff)
parent9b9ca46fc2d3da231bf9ef6ff630105720f94cf2 (diff)
Merge QP1A.190122.001
Conflicts: api/system-current.txt core/java/android/bluetooth/BluetoothAdapter.java core/jni/android_util_Process.cpp core/jni/com_android_internal_os_Zygote.cpp core/res/res/values/config.xml core/res/res/values/symbols.xml media/java/android/media/MediaCodecInfo.java packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java services/core/java/com/android/server/ConnectivityService.java services/core/java/com/android/server/LocationManagerService.java services/core/java/com/android/server/am/ActivityManagerService.java services/core/java/com/android/server/connectivity/NetworkAgentInfo.java services/core/java/com/android/server/location/GnssLocationProvider.java services/core/java/com/android/server/wm/ActivityStack.java services/net/java/android/net/ip/IpClient.java telecomm/java/android/telecom/Connection.java telephony/java/android/telephony/ims/ImsCallSession.java telephony/java/android/telephony/ims/ImsCallSessionListener.java telephony/java/android/telephony/ims/aidl/IImsCallSessionListener.aidl telephony/java/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java telephony/java/com/android/ims/internal/IImsCallSessionListener.aidl wifi/java/android/net/wifi/WifiConfiguration.java Change-Id: I367301986f2ae80a528050c3d78776b5a4c6b5ee
Diffstat (limited to 'libs/hwui/renderthread/CacheManager.cpp')
-rw-r--r--libs/hwui/renderthread/CacheManager.cpp29
1 files changed, 5 insertions, 24 deletions
diff --git a/libs/hwui/renderthread/CacheManager.cpp b/libs/hwui/renderthread/CacheManager.cpp
index 7acc44ca65b7..6c04232ab7f5 100644
--- a/libs/hwui/renderthread/CacheManager.cpp
+++ b/libs/hwui/renderthread/CacheManager.cpp
@@ -30,6 +30,7 @@
#include <gui/Surface.h>
#include <math.h>
#include <set>
+#include <SkMathPriv.h>
namespace android {
namespace uirenderer {
@@ -42,11 +43,6 @@ namespace renderthread {
#define SURFACE_SIZE_MULTIPLIER (12.0f * 4.0f)
#define BACKGROUND_RETENTION_PERCENTAGE (0.5f)
-// for super large fonts we will draw them as paths so no need to keep linearly
-// increasing the font cache size.
-#define FONT_CACHE_MIN_MB (0.5f)
-#define FONT_CACHE_MAX_MB (4.0f)
-
CacheManager::CacheManager(const DisplayInfo& display) : mMaxSurfaceArea(display.w * display.h) {
mVectorDrawableAtlas = new skiapipeline::VectorDrawableAtlas(
mMaxSurfaceArea / 2,
@@ -106,25 +102,10 @@ public:
void CacheManager::configureContext(GrContextOptions* contextOptions, const void* identity, ssize_t size) {
contextOptions->fAllowPathMaskCaching = true;
- float screenMP = mMaxSurfaceArea / 1024.0f / 1024.0f;
- float fontCacheMB = 0;
- float decimalVal = std::modf(screenMP, &fontCacheMB);
-
- // This is a basic heuristic to size the cache to a multiple of 512 KB
- if (decimalVal > 0.8f) {
- fontCacheMB += 1.0f;
- } else if (decimalVal > 0.5f) {
- fontCacheMB += 0.5f;
- }
-
- // set limits on min/max size of the cache
- fontCacheMB = std::max(FONT_CACHE_MIN_MB, std::min(FONT_CACHE_MAX_MB, fontCacheMB));
-
- // We must currently set the size of the text cache based on the size of the
- // display even though we like to be dynamicallysizing it to the size of the window.
- // Skia's implementation doesn't provide a mechanism to resize the font cache due to
- // the potential cost of recreating the glyphs.
- contextOptions->fGlyphCacheTextureMaximumBytes = fontCacheMB * 1024 * 1024;
+ // This sets the maximum size for a single texture atlas in the GPU font cache. If necessary,
+ // the cache can allocate additional textures that are counted against the total cache limits
+ // provided to Skia.
+ contextOptions->fGlyphCacheTextureMaximumBytes = GrNextSizePow2(mMaxSurfaceArea);
if (mTaskManager.canRunTasks()) {
if (!mTaskProcessor.get()) {