From 8dc02f99d09130ace2ee738c2e689db1b3f33181 Mon Sep 17 00:00:00 2001 From: John Reck Date: Mon, 17 Jul 2017 09:55:02 -0700 Subject: Delete all ro.hwui.* props Remove all ro.hwui.* tuning props and instead calculate them from the screen resolution. Or just hardcode them to what all devices were hardcoding them to anyway. Bug: 63741221 Test: Check cache size results on sailfish Change-Id: I8b0d210572a246f4fefb076935cf5156a70c274c --- libs/hwui/PathCache.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'libs/hwui/PathCache.cpp') diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index cc96de71df82..8d4ae1b6622a 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -38,6 +38,8 @@ namespace android { namespace uirenderer { +static constexpr size_t PATH_CACHE_COUNT_LIMIT = 256; + template static bool compareWidthHeight(const T& lhs, const T& rhs) { return (lhs.mWidth == rhs.mWidth) && (lhs.mHeight == rhs.mHeight); @@ -179,13 +181,9 @@ static sk_sp drawPath(const SkPath* path, const SkPaint* paint, PathText PathCache::PathCache() : mCache(LruCache::kUnlimitedCapacity) , mSize(0) - , mMaxSize(Properties::pathCacheSize) { + , mMaxSize(DeviceInfo::multiplyByResolution(4)) { mCache.setOnEntryRemovedListener(this); - - GLint maxTextureSize; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); - mMaxTextureSize = maxTextureSize; - + mMaxTextureSize = DeviceInfo::get()->maxTextureSize(); mDebugEnabled = Properties::debugLevel & kDebugCaches; } @@ -259,12 +257,7 @@ void PathCache::purgeCache(uint32_t width, uint32_t height) { } void PathCache::trim() { - // 25 is just an arbitrary lower bound to ensure we aren't in weird edge cases - // of things like a cap of 0 or 1 as that's going to break things. - // It does not represent a reasonable minimum value - static_assert(DEFAULT_PATH_TEXTURE_CAP > 25, "Path cache texture cap is too small"); - - while (mSize > mMaxSize || mCache.size() > DEFAULT_PATH_TEXTURE_CAP) { + while (mSize > mMaxSize || mCache.size() > PATH_CACHE_COUNT_LIMIT) { LOG_ALWAYS_FATAL_IF(!mCache.size(), "Inconsistent mSize! Ran out of items to remove!" " mSize = %u, mMaxSize = %u", mSize, mMaxSize); mCache.removeOldest(); -- cgit v1.2.3-59-g8ed1b