diff options
author | Brian Orr <brianorr@google.com> | 2021-06-15 12:47:53 -0700 |
---|---|---|
committer | Daniel Norman <danielnorman@google.com> | 2021-06-17 13:37:54 -0700 |
commit | 71c831703ae59baf47e0afe611fecd714c481cdf (patch) | |
tree | 06731a987032723085b9e1a65951cf96abbc19cf /libs/hwui/renderthread/RenderProxy.cpp | |
parent | 065c9e9a6e9d61d4383a91721eb56a3de253bdbe (diff) | |
parent | 81833820d54b9a6b27894f9f8dfd72222d416992 (diff) |
Merge SP1A.210604.001
Change-Id: I5200ee05285ae422d5e9c1c00f45709a5d6188be
Diffstat (limited to 'libs/hwui/renderthread/RenderProxy.cpp')
-rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index ad325cf2cdcc..ac19a153b6fb 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -16,6 +16,7 @@ #include "RenderProxy.h" +#include <gui/TraceUtils.h> #include "DeferredLayerUpdater.h" #include "DisplayList.h" #include "Properties.h" @@ -27,7 +28,6 @@ #include "renderthread/RenderThread.h" #include "utils/Macros.h" #include "utils/TimeUtils.h" -#include "utils/TraceUtils.h" namespace android { namespace uirenderer { @@ -195,6 +195,17 @@ void RenderProxy::trimMemory(int level) { } } +void RenderProxy::purgeCaches() { + if (RenderThread::hasInstance()) { + RenderThread& thread = RenderThread::getInstance(); + thread.queue().post([&thread]() { + if (thread.getGrContext()) { + thread.cacheManager().trimMemory(CacheManager::TrimMemoryMode::Complete); + } + }); + } +} + void RenderProxy::overrideProperty(const char* name, const char* value) { // expensive, but block here since name/value pointers owned by caller RenderThread::getInstance().queue().runSync( @@ -256,6 +267,13 @@ void RenderProxy::dumpGraphicsMemory(int fd, bool includeProfileData) { } } +void RenderProxy::getMemoryUsage(size_t* cpuUsage, size_t* gpuUsage) { + if (RenderThread::hasInstance()) { + auto& thread = RenderThread::getInstance(); + thread.queue().runSync([&]() { thread.getMemoryUsage(cpuUsage, gpuUsage); }); + } +} + void RenderProxy::setProcessStatsBuffer(int fd) { auto& rt = RenderThread::getInstance(); rt.queue().post([&rt, fd = dup(fd)]() { |