Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ab66f46 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SurfaceFlinger: Add ClientCache dumps" into sc-dev

parents a8109d46 beba6f0a
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@

namespace android {

using base::StringAppendF;

ANDROID_SINGLETON_STATIC_INSTANCE(ClientCache);

ClientCache::ClientCache() : mDeathRecipient(new CacheDeathRecipient) {}
@@ -203,4 +205,18 @@ void ClientCache::CacheDeathRecipient::binderDied(const wp<IBinder>& who) {
    ClientCache::getInstance().removeProcess(who);
}

void ClientCache::dump(std::string& result) {
    std::lock_guard lock(mMutex);
    for (auto i : mBuffers) {
        const sp<IBinder>& cacheOwner = i.second.first;
        StringAppendF(&result," Cache owner: %p\n", cacheOwner.get());
        auto &buffers = i.second.second;
        for (auto& [id, clientCacheBuffer] : buffers) {
            StringAppendF(&result, "\t ID: %d, Width/Height: %d,%d\n", (int)id,
                          (int)clientCacheBuffer.buffer->getWidth(),
                          (int)clientCacheBuffer.buffer->getHeight());
        }
    }
}

}; // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -53,6 +53,8 @@ public:
    void unregisterErasedRecipient(const client_cache_t& cacheId,
                                   const wp<ErasedRecipient>& recipient);

    void dump(std::string& result);

private:
    std::mutex mMutex;

+2 −0
Original line number Diff line number Diff line
@@ -4812,6 +4812,8 @@ void SurfaceFlinger::dumpAllLocked(const DumpArgs& args, std::string& result) co

    getRenderEngine().dump(result);

    result.append("ClientCache state:\n");
    ClientCache::getInstance().dump(result);
    DebugEGLImageTracker::getInstance()->dump(result);

    if (const auto display = getDefaultDisplayDeviceLocked()) {