Loading services/surfaceflinger/Tracing/TransactionProtoParser.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ #include <gui/SurfaceComposerClient.h> #include <renderengine/mock/FakeExternalTexture.h> #include <ui/Fence.h> #include <ui/Rect.h> Loading Loading @@ -313,6 +314,14 @@ TransactionState TransactionProtoParser::fromProto(const proto::TransactionState ResolvedComposerState s; s.state.what = 0; fromProto(proto.layer_changes(i), s.state); if (s.state.bufferData) { s.externalTexture = std::make_shared< renderengine::mock::FakeExternalTexture>(s.state.bufferData->getWidth(), s.state.bufferData->getHeight(), s.state.bufferData->getId(), s.state.bufferData->getPixelFormat(), s.state.bufferData->getUsage()); } t.states.emplace_back(s); } Loading services/surfaceflinger/Tracing/tools/run.sh +11 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,15 @@ set -ex # Build, push and run layertracegenerator $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode layertracegenerator adb wait-for-device && adb push $OUT/system/bin/layertracegenerator /data/layertracegenerator if [ -z "$1" ] then echo "Writing transaction trace to file" adb shell service call SurfaceFlinger 1041 i32 0 adb shell /data/layertracegenerator else echo "Pushing transaction trace to device" adb push $1 /data/transaction_trace.winscope adb shell /data/layertracegenerator /data/transaction_trace.winscope fi adb pull /data/misc/wmtrace/layers_trace.winscope No newline at end of file services/surfaceflinger/tests/tracing/TransactionTraceTestSuite.cpp +18 −9 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ struct LayerInfo { uint64_t curr_frame; float x; float y; uint32_t bufferWidth; uint32_t bufferHeight; }; bool operator==(const LayerInfo& lh, const LayerInfo& rh) { Loading @@ -105,7 +107,8 @@ bool compareById(const LayerInfo& a, const LayerInfo& b) { inline void PrintTo(const LayerInfo& info, ::std::ostream* os) { *os << "Layer [" << info.id << "] name=" << info.name << " parent=" << info.parent << " z=" << info.z << " curr_frame=" << info.curr_frame << " x=" << info.x << " y=" << info.y; << " y=" << info.y << " bufferWidth=" << info.bufferWidth << " bufferHeight=" << info.bufferHeight; } struct find_id : std::unary_function<LayerInfo, bool> { Loading @@ -114,6 +117,18 @@ struct find_id : std::unary_function<LayerInfo, bool> { bool operator()(LayerInfo const& m) const { return m.id == id; } }; static LayerInfo getLayerInfoFromProto(::android::surfaceflinger::LayerProto& proto) { return {proto.id(), proto.name(), proto.parent(), proto.z(), proto.curr_frame(), proto.has_position() ? proto.position().x() : -1, proto.has_position() ? proto.position().y() : -1, proto.has_active_buffer() ? proto.active_buffer().width() : 0, proto.has_active_buffer() ? proto.active_buffer().height() : 0}; } TEST_P(TransactionTraceTestSuite, validateEndState) { ASSERT_GT(mActualLayersTraceProto.entry_size(), 0); ASSERT_GT(mExpectedLayersTraceProto.entry_size(), 0); Loading @@ -128,10 +143,7 @@ TEST_P(TransactionTraceTestSuite, validateEndState) { expectedLayers.reserve(static_cast<size_t>(expectedLastEntry.layers().layers_size())); for (int i = 0; i < expectedLastEntry.layers().layers_size(); i++) { auto layer = expectedLastEntry.layers().layers(i); expectedLayers.push_back({layer.id(), layer.name(), layer.parent(), layer.z(), layer.curr_frame(), layer.has_position() ? layer.position().x() : -1, layer.has_position() ? layer.position().y() : -1}); expectedLayers.push_back(getLayerInfoFromProto(layer)); } std::sort(expectedLayers.begin(), expectedLayers.end(), compareById); Loading @@ -139,10 +151,7 @@ TEST_P(TransactionTraceTestSuite, validateEndState) { actualLayers.reserve(static_cast<size_t>(actualLastEntry.layers().layers_size())); for (int i = 0; i < actualLastEntry.layers().layers_size(); i++) { auto layer = actualLastEntry.layers().layers(i); actualLayers.push_back({layer.id(), layer.name(), layer.parent(), layer.z(), layer.curr_frame(), layer.has_position() ? layer.position().x() : -1, layer.has_position() ? layer.position().y() : -1}); actualLayers.push_back(getLayerInfoFromProto(layer)); } std::sort(actualLayers.begin(), actualLayers.end(), compareById); Loading Loading
services/surfaceflinger/Tracing/TransactionProtoParser.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ #include <gui/SurfaceComposerClient.h> #include <renderengine/mock/FakeExternalTexture.h> #include <ui/Fence.h> #include <ui/Rect.h> Loading Loading @@ -313,6 +314,14 @@ TransactionState TransactionProtoParser::fromProto(const proto::TransactionState ResolvedComposerState s; s.state.what = 0; fromProto(proto.layer_changes(i), s.state); if (s.state.bufferData) { s.externalTexture = std::make_shared< renderengine::mock::FakeExternalTexture>(s.state.bufferData->getWidth(), s.state.bufferData->getHeight(), s.state.bufferData->getId(), s.state.bufferData->getPixelFormat(), s.state.bufferData->getUsage()); } t.states.emplace_back(s); } Loading
services/surfaceflinger/Tracing/tools/run.sh +11 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,15 @@ set -ex # Build, push and run layertracegenerator $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode layertracegenerator adb wait-for-device && adb push $OUT/system/bin/layertracegenerator /data/layertracegenerator if [ -z "$1" ] then echo "Writing transaction trace to file" adb shell service call SurfaceFlinger 1041 i32 0 adb shell /data/layertracegenerator else echo "Pushing transaction trace to device" adb push $1 /data/transaction_trace.winscope adb shell /data/layertracegenerator /data/transaction_trace.winscope fi adb pull /data/misc/wmtrace/layers_trace.winscope No newline at end of file
services/surfaceflinger/tests/tracing/TransactionTraceTestSuite.cpp +18 −9 Original line number Diff line number Diff line Loading @@ -91,6 +91,8 @@ struct LayerInfo { uint64_t curr_frame; float x; float y; uint32_t bufferWidth; uint32_t bufferHeight; }; bool operator==(const LayerInfo& lh, const LayerInfo& rh) { Loading @@ -105,7 +107,8 @@ bool compareById(const LayerInfo& a, const LayerInfo& b) { inline void PrintTo(const LayerInfo& info, ::std::ostream* os) { *os << "Layer [" << info.id << "] name=" << info.name << " parent=" << info.parent << " z=" << info.z << " curr_frame=" << info.curr_frame << " x=" << info.x << " y=" << info.y; << " y=" << info.y << " bufferWidth=" << info.bufferWidth << " bufferHeight=" << info.bufferHeight; } struct find_id : std::unary_function<LayerInfo, bool> { Loading @@ -114,6 +117,18 @@ struct find_id : std::unary_function<LayerInfo, bool> { bool operator()(LayerInfo const& m) const { return m.id == id; } }; static LayerInfo getLayerInfoFromProto(::android::surfaceflinger::LayerProto& proto) { return {proto.id(), proto.name(), proto.parent(), proto.z(), proto.curr_frame(), proto.has_position() ? proto.position().x() : -1, proto.has_position() ? proto.position().y() : -1, proto.has_active_buffer() ? proto.active_buffer().width() : 0, proto.has_active_buffer() ? proto.active_buffer().height() : 0}; } TEST_P(TransactionTraceTestSuite, validateEndState) { ASSERT_GT(mActualLayersTraceProto.entry_size(), 0); ASSERT_GT(mExpectedLayersTraceProto.entry_size(), 0); Loading @@ -128,10 +143,7 @@ TEST_P(TransactionTraceTestSuite, validateEndState) { expectedLayers.reserve(static_cast<size_t>(expectedLastEntry.layers().layers_size())); for (int i = 0; i < expectedLastEntry.layers().layers_size(); i++) { auto layer = expectedLastEntry.layers().layers(i); expectedLayers.push_back({layer.id(), layer.name(), layer.parent(), layer.z(), layer.curr_frame(), layer.has_position() ? layer.position().x() : -1, layer.has_position() ? layer.position().y() : -1}); expectedLayers.push_back(getLayerInfoFromProto(layer)); } std::sort(expectedLayers.begin(), expectedLayers.end(), compareById); Loading @@ -139,10 +151,7 @@ TEST_P(TransactionTraceTestSuite, validateEndState) { actualLayers.reserve(static_cast<size_t>(actualLastEntry.layers().layers_size())); for (int i = 0; i < actualLastEntry.layers().layers_size(); i++) { auto layer = actualLastEntry.layers().layers(i); actualLayers.push_back({layer.id(), layer.name(), layer.parent(), layer.z(), layer.curr_frame(), layer.has_position() ? layer.position().x() : -1, layer.has_position() ? layer.position().y() : -1}); actualLayers.push_back(getLayerInfoFromProto(layer)); } std::sort(actualLayers.begin(), actualLayers.end(), compareById); Loading