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

Commit aed830c7 authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

CachedSet::dump: show the PixelFormat

This helps verify we're using the intended PixelFormat for screen decor
layers, and is also more generally useful. While I'm touching this code,
generally make the single-layer and multi-layer more consistent by
printing the buffer pointer in both cases. Also, only print the buffer
pointer if it's non-null.

Bug: 193170859
Test: manual

Change-Id: I71e7a8eecefa8a757bf72c487bc44900e8e0a846
parent 80cce845
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <math/HashCombine.h>
#include <renderengine/DisplaySettings.h>
#include <renderengine/RenderEngine.h>
#include <ui/DebugUtils.h>
#include <utils/Trace.h>

#include <utils/Trace.h>
@@ -391,20 +392,29 @@ void CachedSet::dump(std::string& result) const {

    if (mLayers.size() == 1) {
        base::StringAppendF(&result, "    Layer [%s]\n", mLayers[0].getName().c_str());
        base::StringAppendF(&result, "    Buffer %p", mLayers[0].getBuffer().get());
        base::StringAppendF(&result, "    Protected [%s]",
        if (auto* buffer = mLayers[0].getBuffer().get()) {
            base::StringAppendF(&result, "    Buffer %p", buffer);
            base::StringAppendF(&result, "    Format %s",
                                decodePixelFormat(buffer->getPixelFormat()).c_str());
        }
        base::StringAppendF(&result, "    Protected [%s]\n",
                            mLayers[0].getState()->isProtected() ? "true" : "false");
    } else {
        result.append("    Cached set of:");
        result.append("    Cached set of:\n");
        for (const Layer& layer : mLayers) {
            base::StringAppendF(&result, "\n      Layer [%s]", layer.getName().c_str());
            base::StringAppendF(&result, "\n      Protected [%s]",
            base::StringAppendF(&result, "      Layer [%s]\n", layer.getName().c_str());
            if (auto* buffer = layer.getBuffer().get()) {
                base::StringAppendF(&result, "       Buffer %p", buffer);
                base::StringAppendF(&result, "    Format[%s]",
                                    decodePixelFormat(buffer->getPixelFormat()).c_str());
            }
            base::StringAppendF(&result, "       Protected [%s]\n",
                                layer.getState()->isProtected() ? "true" : "false");
        }
    }

    base::StringAppendF(&result, "\n    Creation cost: %zd", getCreationCost());
    base::StringAppendF(&result, "\n    Display cost: %zd\n", getDisplayCost());
    base::StringAppendF(&result, "    Creation cost: %zd\n", getCreationCost());
    base::StringAppendF(&result, "    Display cost: %zd\n", getDisplayCost());
}

} // namespace android::compositionengine::impl::planner