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

Commit 0acc384b authored by Dominik Laskowski's avatar Dominik Laskowski
Browse files

SF: Add dumpsys flags to dump displays

Dump display configuration (--displays) and composition state (--comp-
displays) separately.

Use consistent formatting. Remove noise, e.g. repetitive display modes,
physical display state that is expectedly missing for virtual displays.

Bug: 182939859
Test: dumpsys SurfaceFlinger --displays
Test: dumpsys SurfaceFlinger --comp-displays
Change-Id: I787eedb82d76c74363e653a648ae88699096cc47
parent 3c363247
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ status_t DeviceProductInfo::unflatten(void const* buffer, size_t size) {
}

void DeviceProductInfo::dump(std::string& result) const {
    StringAppendF(&result, "{name=%s, ", name.c_str());
    StringAppendF(&result, "{name=\"%s\", ", name.c_str());
    StringAppendF(&result, "manufacturerPnpId=%s, ", manufacturerPnpId.data());
    StringAppendF(&result, "productId=%s, ", productId.c_str());

+7 −7
Original line number Diff line number Diff line
@@ -120,15 +120,15 @@ private:

} // namespace compositionengine

inline std::string to_string(const android::compositionengine::ProjectionSpace& space) {
    return android::base::
            StringPrintf("ProjectionSpace(bounds = %s, content = %s, orientation = %s)",
inline std::string to_string(const compositionengine::ProjectionSpace& space) {
    return base::StringPrintf("ProjectionSpace{bounds=%s, content=%s, orientation=%s}",
                              to_string(space.getBoundsAsRect()).c_str(),
                         to_string(space.getContent()).c_str(), toCString(space.getOrientation()));
                              to_string(space.getContent()).c_str(),
                              toCString(space.getOrientation()));
}

// Defining PrintTo helps with Google Tests.
inline void PrintTo(const android::compositionengine::ProjectionSpace& space, ::std::ostream* os) {
inline void PrintTo(const compositionengine::ProjectionSpace& space, std::ostream* os) {
    *os << to_string(space);
}

+2 −0
Original line number Diff line number Diff line
@@ -155,6 +155,8 @@ struct OutputCompositionState {
        SUCCESS = 1,
        // Composition strategy prediction failed for this frame.
        FAIL = 2,

        ftl_last = FAIL
    };

    CompositionStrategyPredictionState strategyPrediction =
+4 −8
Original line number Diff line number Diff line
@@ -131,15 +131,11 @@ void Display::setColorProfile(const ColorProfile& colorProfile) {
}

void Display::dump(std::string& out) const {
    using android::base::StringAppendF;

    StringAppendF(&out, "   Composition Display State: [\"%s\"]", getName().c_str());

    out.append("\n   ");
    dumpVal(out, "isVirtual", isVirtual());
    dumpVal(out, "DisplayId", to_string(mId));
    out.append("\n");
    const char* const type = isVirtual() ? "virtual" : "physical";
    base::StringAppendF(&out, "Display %s (%s, \"%s\")", to_string(mId).c_str(), type,
                        getName().c_str());

    out.append("\n   Composition Display State:\n");
    Output::dumpBase(out);
}

+4 −5
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ void dumpVal(std::string& out, const char* name, const Region& region) {

void dumpVal(std::string& out, const char* name, const ui::Transform& transform) {
    transform.dump(out, name);
    out.append(" ");
}

void dumpVal(std::string& out, const char* name, const mat4& tr) {
@@ -109,9 +108,9 @@ void dumpVal(std::string& out, const char* name, const mat4& tr) {
}

void dumpVal(std::string& out, const char* name, const StretchEffect& effect) {
    StringAppendF(&out, "%s={ width =%f, height = %f, vec=(%f, %f), max=(%f, %f) } ", name,
                  effect.width, effect.height,
                  effect.vectorX, effect.vectorY, effect.maxAmountX, effect.maxAmountY);
    StringAppendF(&out, "%s={width=%f, height=%f, vec=(%f, %f), max=(%f, %f)} ", name, effect.width,
                  effect.height, effect.vectorX, effect.vectorY, effect.maxAmountX,
                  effect.maxAmountY);
}

} // namespace android::compositionengine::impl
Loading