Loading libs/hwui/MemoryPolicy.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -28,7 +28,10 @@ namespace android::uirenderer { constexpr static MemoryPolicy sDefaultMemoryPolicy; constexpr static MemoryPolicy sPersistentOrSystemPolicy{ .contextTimeout = 10_s, .minimumResourceRetention = 1_s, .maximumResourceRetention = 10_s, .useAlternativeUiHidden = true, .purgeScratchOnly = false, }; constexpr static MemoryPolicy sLowRamPolicy{ .useAlternativeUiHidden = true, Loading libs/hwui/MemoryPolicy.h +2 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ struct MemoryPolicy { // The minimum amount of time to hold onto items in the resource cache // The actual time used will be the max of this & when frames were actually rendered nsecs_t minimumResourceRetention = 10_s; // The maximum amount of time to hold onto items in the resource cache nsecs_t maximumResourceRetention = 100000_s; // If false, use only TRIM_UI_HIDDEN to drive background cache limits; // If true, use all signals (such as all contexts are stopped) to drive the limits bool useAlternativeUiHidden = true; Loading libs/hwui/renderthread/CacheManager.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -277,12 +277,13 @@ void CacheManager::onThreadIdle() { const nsecs_t now = systemTime(CLOCK_MONOTONIC); // Rate limiting if ((now - mLastDeferredCleanup) < 25_ms) { if ((now - mLastDeferredCleanup) > 25_ms) { mLastDeferredCleanup = now; const nsecs_t frameCompleteNanos = mFrameCompletions[0]; const nsecs_t frameDiffNanos = now - frameCompleteNanos; const nsecs_t cleanupMillis = ns2ms(std::max(frameDiffNanos, mMemoryPolicy.minimumResourceRetention)); ns2ms(std::clamp(frameDiffNanos, mMemoryPolicy.minimumResourceRetention, mMemoryPolicy.maximumResourceRetention)); mGrContext->performDeferredCleanup(std::chrono::milliseconds(cleanupMillis), mMemoryPolicy.purgeScratchOnly); } Loading Loading
libs/hwui/MemoryPolicy.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -28,7 +28,10 @@ namespace android::uirenderer { constexpr static MemoryPolicy sDefaultMemoryPolicy; constexpr static MemoryPolicy sPersistentOrSystemPolicy{ .contextTimeout = 10_s, .minimumResourceRetention = 1_s, .maximumResourceRetention = 10_s, .useAlternativeUiHidden = true, .purgeScratchOnly = false, }; constexpr static MemoryPolicy sLowRamPolicy{ .useAlternativeUiHidden = true, Loading
libs/hwui/MemoryPolicy.h +2 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ struct MemoryPolicy { // The minimum amount of time to hold onto items in the resource cache // The actual time used will be the max of this & when frames were actually rendered nsecs_t minimumResourceRetention = 10_s; // The maximum amount of time to hold onto items in the resource cache nsecs_t maximumResourceRetention = 100000_s; // If false, use only TRIM_UI_HIDDEN to drive background cache limits; // If true, use all signals (such as all contexts are stopped) to drive the limits bool useAlternativeUiHidden = true; Loading
libs/hwui/renderthread/CacheManager.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -277,12 +277,13 @@ void CacheManager::onThreadIdle() { const nsecs_t now = systemTime(CLOCK_MONOTONIC); // Rate limiting if ((now - mLastDeferredCleanup) < 25_ms) { if ((now - mLastDeferredCleanup) > 25_ms) { mLastDeferredCleanup = now; const nsecs_t frameCompleteNanos = mFrameCompletions[0]; const nsecs_t frameDiffNanos = now - frameCompleteNanos; const nsecs_t cleanupMillis = ns2ms(std::max(frameDiffNanos, mMemoryPolicy.minimumResourceRetention)); ns2ms(std::clamp(frameDiffNanos, mMemoryPolicy.minimumResourceRetention, mMemoryPolicy.maximumResourceRetention)); mGrContext->performDeferredCleanup(std::chrono::milliseconds(cleanupMillis), mMemoryPolicy.purgeScratchOnly); } Loading