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

Commit 8e0af367 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Trace drawing state

Some state that was dumped was still the current state, creating
misalignment between what was visible on screen and what was being
dumped. Make sure to dump all state consistently.

Test: adb shell service call SurfaceFlinger 1025 i32 1 &&
adb shell service call SurfaceFlinger 1025 i32 0 &&
adb pull /data/misc/trace/layerstrace.pb
Inspect with WindowScope

Change-Id: I16ea06764328fd8c506ed90dfc59929f7d26d156
parent c2c0dce2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1786,7 +1786,7 @@ void Layer::writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet)
    LayerProtoHelper::writeToProto(transform, layerInfo->mutable_transform());
    LayerProtoHelper::writeToProto(requestedTransform, layerInfo->mutable_requested_transform());

    auto parent = getParent();
    auto parent = useDrawing ? mDrawingParent.promote() : mCurrentParent.promote();
    if (parent != nullptr) {
        layerInfo->set_parent(parent->sequence);
    }
+8 −6
Original line number Diff line number Diff line
@@ -1585,7 +1585,7 @@ void SurfaceFlinger::doTracing(const char* where) {
    ATRACE_CALL();
    ATRACE_NAME(where);
    if (CC_UNLIKELY(mTracing.isEnabled())) {
        mTracing.traceLayers(where, dumpProtoInfo());
        mTracing.traceLayers(where, dumpProtoInfo(LayerVector::StateSet::Drawing));
    }
}

@@ -3534,7 +3534,7 @@ status_t SurfaceFlinger::doDump(int fd, const Vector<String16>& args, bool asPro
        size_t numArgs = args.size();

        if (asProto) {
            LayersProto layersProto = dumpProtoInfo();
            LayersProto layersProto = dumpProtoInfo(LayerVector::StateSet::Current);
            result.append(layersProto.SerializeAsString().c_str(), layersProto.ByteSize());
            dumpAll = false;
        }
@@ -3783,11 +3783,13 @@ void SurfaceFlinger::dumpWideColorInfo(String8& result) const {
    result.append("\n");
}

LayersProto SurfaceFlinger::dumpProtoInfo() const {
LayersProto SurfaceFlinger::dumpProtoInfo(LayerVector::StateSet stateSet) const {
    LayersProto layersProto;
    mCurrentState.traverseInZOrder([&](Layer* layer) {
    const bool useDrawing = stateSet == LayerVector::StateSet::Drawing;
    const State& state = useDrawing ? mDrawingState : mCurrentState;
    state.traverseInZOrder([&](Layer* layer) {
        LayerProto* layerProto = layersProto.add_layers();
        layer->writeToProto(layerProto, LayerVector::StateSet::Current);
        layer->writeToProto(layerProto, stateSet);
    });

    return layersProto;
@@ -3858,7 +3860,7 @@ void SurfaceFlinger::dumpAllLocked(const Vector<String16>& args, size_t& index,
    result.appendFormat("Visible layers (count = %zu)\n", mNumLayers);
    colorizer.reset(result);

    LayersProto layersProto = dumpProtoInfo();
    LayersProto layersProto = dumpProtoInfo(LayerVector::StateSet::Current);
    auto layerTree = LayerProtoParser::generateLayerTree(layersProto);
    result.append(LayerProtoParser::layersToString(layerTree).c_str());

+1 −1
Original line number Diff line number Diff line
@@ -602,7 +602,7 @@ private:
            std::vector<OccupancyTracker::Segment>&& history);
    void dumpBufferingStats(String8& result) const;
    void dumpWideColorInfo(String8& result) const;
    LayersProto dumpProtoInfo() const;
    LayersProto dumpProtoInfo(LayerVector::StateSet stateSet) const;

    bool isLayerTripleBufferingDisabled() const {
        return this->mLayerTripleBufferingDisabled;