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

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

Merge "SF: Track transaction tracing states in order"

parents 23a2fe41 473838d6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ proto::TransactionState TransactionProtoParser::toProto(const TransactionState&
}

proto::TransactionState TransactionProtoParser::toProto(
        const std::unordered_map<int32_t /* layerId */, TracingLayerState> states) {
        const std::map<int32_t /* layerId */, TracingLayerState> states) {
    proto::TransactionState proto;
    for (auto& [layerId, state] : states) {
        proto::LayerState layerProto = toProto(state, nullptr);
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ public:
    static proto::TransactionState toProto(const TransactionState&, LayerHandleToIdFn getLayerIdFn,
                                           DisplayHandleToIdFn getDisplayIdFn);
    static proto::TransactionState toProto(
            const std::unordered_map<int32_t /* layerId */, TracingLayerState>);
            const std::map<int32_t /* layerId */, TracingLayerState>);

    static proto::LayerCreationArgs toProto(const TracingLayerCreationArgs& args);

+1 −2
Original line number Diff line number Diff line
@@ -85,8 +85,7 @@ private:
    std::vector<proto::LayerCreationArgs> mCreatedLayers GUARDED_BY(mTraceLock);
    std::unordered_map<BBinder* /* layerHandle */, int32_t /* layerId */> mLayerHandles
            GUARDED_BY(mTraceLock);
    std::unordered_map<int32_t /* layerId */, TracingLayerState> mStartingStates
            GUARDED_BY(mTraceLock);
    std::map<int32_t /* layerId */, TracingLayerState> mStartingStates GUARDED_BY(mTraceLock);

    // We do not want main thread to block so main thread will try to acquire mMainThreadLock,
    // otherwise will push data to temporary container.
+8 −3
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ protected:
        mTracing->onLayerAdded(fakeLayerHandle->localBinder(), mParentLayerId, "parent",
                               123 /* flags */, -1 /* parentId */);
        const sp<IBinder> fakeChildLayerHandle = new BBinder();
        mTracing->onLayerAdded(fakeChildLayerHandle->localBinder(), 2 /* layerId */, "child",
        mTracing->onLayerAdded(fakeChildLayerHandle->localBinder(), mChildLayerId, "child",
                               456 /* flags */, mParentLayerId);

        // add some layer transaction
@@ -179,7 +179,8 @@ protected:
            transaction.states.add(layerState);
            ComposerState childState;
            childState.state.surface = fakeChildLayerHandle;
            layerState.state.z = 43;
            childState.state.what = layer_state_t::eLayerChanged;
            childState.state.z = 43;
            transaction.states.add(childState);
            mTracing->addQueuedTransaction(transaction);

@@ -227,6 +228,7 @@ protected:
    }

    int mParentLayerId = 1;
    int mChildLayerId = 2;
    int64_t mVsyncId = 0;
    int64_t VSYNC_ID_FIRST_LAYER_CHANGE;
    int64_t VSYNC_ID_SECOND_LAYER_CHANGE;
@@ -244,8 +246,11 @@ TEST_F(TransactionTracingLayerHandlingTest, addStartingState) {
    EXPECT_GT(proto.entry().size(), 0);
    EXPECT_GT(proto.entry(0).transactions().size(), 0);
    EXPECT_GT(proto.entry(0).added_layers().size(), 0);
    EXPECT_GT(proto.entry(0).transactions(0).layer_changes().size(), 0);
    EXPECT_EQ(proto.entry(0).transactions(0).layer_changes().size(), 2);
    EXPECT_EQ(proto.entry(0).transactions(0).layer_changes(0).layer_id(), mParentLayerId);
    EXPECT_EQ(proto.entry(0).transactions(0).layer_changes(0).z(), 42);
    EXPECT_EQ(proto.entry(0).transactions(0).layer_changes(1).layer_id(), mChildLayerId);
    EXPECT_EQ(proto.entry(0).transactions(0).layer_changes(1).z(), 43);
}

TEST_F(TransactionTracingLayerHandlingTest, updateStartingState) {