From d78d52a86fa3c646a96cc21a149a4e42467f2871 Mon Sep 17 00:00:00 2001 From: Tyler Denniston Date: Thu, 26 May 2022 15:06:14 +0000 Subject: [PATCH] Revert "Add Perfetto library (gn & bazel) and bare-bones SkPerfTrace class" This reverts commit bfc9b9484092e969664aed59c0bb410fecfc107e. Reason for revert: new dependency causing Android build error Original change's description: > Add Perfetto library (gn & bazel) and bare-bones SkPerfTrace class > > First incremental step to incorporating Perfetto tracing into Skia, more CLs to follow > > NOTE: The presubmit check is failing. This appears to be due to the known issue where the presubmit check bugs out if the DEPS file is edited, which it was on this CL (modified to include Perfetto). > > Bug: skia:13303 > Change-Id: I908be0392b520e8da14b34588b842bf6d955bd93 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543081 > Reviewed-by: Greg Daniel > Commit-Queue: Nicolette Prevost Bug: skia:13303 Change-Id: Ia2b883bbab1f8fb4f3914b63104a39240cc60e86 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/544239 Reviewed-by: Tyler Denniston Auto-Submit: Tyler Denniston Reviewed-by: Nicolette Prevost Bot-Commit: Rubber Stamper Commit-Queue: Tyler Denniston --- BUILD.gn | 8 ----- DEPS | 1 - WORKSPACE.bazel | 7 ---- bazel/external/perfetto/BUILD.bazel | 13 -------- gn/skia.gni | 1 - third_party/perfetto/BUILD.gn | 14 -------- tools/trace/BUILD.bazel | 23 ------------- tools/trace/EventTracingPriv.cpp | 17 +--------- tools/trace/SkPerfettoTrace.cpp | 43 ------------------------- tools/trace/SkPerfettoTrace.h | 50 ----------------------------- 10 files changed, 1 insertion(+), 176 deletions(-) delete mode 100644 bazel/external/perfetto/BUILD.bazel delete mode 100644 third_party/perfetto/BUILD.gn delete mode 100644 tools/trace/SkPerfettoTrace.cpp delete mode 100644 tools/trace/SkPerfettoTrace.h diff --git a/BUILD.gn b/BUILD.gn index 67a584b6b4..535ddeccc4 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1951,14 +1951,6 @@ if (skia_enable_tools) { "tools/trace/SkDebugfTracer.cpp", "tools/trace/SkDebugfTracer.h", ] - if (skia_use_perfetto) { - deps += [ "//third_party/perfetto" ] - sources += [ - "tools/trace/SkPerfettoTrace.cpp", - "tools/trace/SkPerfettoTrace.h", - ] - defines = [ "SK_USE_PERFETTO" ] - } } test_lib("tool_utils") { diff --git a/DEPS b/DEPS index 4fe599f7d5..0c7877dca7 100644 --- a/DEPS +++ b/DEPS @@ -37,7 +37,6 @@ deps = { "third_party/externals/opengl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553", "third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406", "third_party/externals/rive" : "https://skia.googlesource.com/external/github.com/rive-app/rive-cpp.git@2e80e5803390f16e5047c8e15ab78f7a1d846856", - "third_party/externals/perfetto" : "https://android.googlesource.com/platform/external/perfetto@d5b124f8a69f517e91514135e8dfc4c995d34c36", "third_party/externals/sfntly" : "https://chromium.googlesource.com/external/github.com/googlei18n/sfntly.git@b55ff303ea2f9e26702b514cf6a3196a2e3e2974", "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@b5cb037f029213553f194ca4203d6d3c03639ebc", "third_party/externals/vulkanmemoryallocator" : "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@7de5cc00de50e71a3aab22dea52fbb7ff4efceb6", diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index c2381447ca..302e4377da 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -230,10 +230,3 @@ new_local_repository( path = "third_party/externals/vulkan-tools", workspace_file_content = "", ) - -new_local_repository( - name = "perfetto", - build_file = "bazel/external/perfetto/BUILD.bazel", - path = "third_party/externals/perfetto", - workspace_file_content = "", -) diff --git a/bazel/external/perfetto/BUILD.bazel b/bazel/external/perfetto/BUILD.bazel deleted file mode 100644 index 2b30228bcd..0000000000 --- a/bazel/external/perfetto/BUILD.bazel +++ /dev/null @@ -1,13 +0,0 @@ -# This file will be copied into //third_party/externals/perfetto via the -# new_local_repository rule in WORKSPACE.bazel, so all files should be relative to that path. - -cc_library( - name = "perfetto", - hdrs = [ - "sdk/perfetto.h", - ], - srcs = [ "sdk/perfetto.cc" ], - includes = ["sdk"], - visibility = ["//visibility:public"], - defines = [ "SK_USE_PERFETTO" ], -) diff --git a/gn/skia.gni b/gn/skia.gni index 63f5ac931f..3055aae75a 100644 --- a/gn/skia.gni +++ b/gn/skia.gni @@ -62,7 +62,6 @@ declare_args() { skia_use_lua = is_skia_dev_build && !is_ios skia_use_metal = false skia_use_ndk_images = is_android && defined(ndk_api) && ndk_api >= 30 - skia_use_perfetto = is_linux || is_mac || is_android skia_use_piex = !is_win && !is_wasm skia_use_sfml = false skia_use_webgl = is_wasm diff --git a/third_party/perfetto/BUILD.gn b/third_party/perfetto/BUILD.gn deleted file mode 100644 index 0cf22d8163..0000000000 --- a/third_party/perfetto/BUILD.gn +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2022 Google LLC -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("../third_party.gni") - -third_party("perfetto") { - public_include_dirs = [ - ".", - "../externals/perfetto/sdk", - ] - sources = [ "../externals/perfetto/sdk/perfetto.cc" ] -} diff --git a/tools/trace/BUILD.bazel b/tools/trace/BUILD.bazel index bd3a4e3d03..8cc40ddcbe 100644 --- a/tools/trace/BUILD.bazel +++ b/tools/trace/BUILD.bazel @@ -47,7 +47,6 @@ generated_cc_atom( ":ChromeTracingTracer_hdr", ":EventTracingPriv_hdr", ":SkDebugfTracer_hdr", - ":SkPerfettoTrace_hdr", "//include/utils:SkEventTracer_hdr", "//src/core:SkATrace_hdr", "//src/core:SkTraceEvent_hdr", @@ -75,25 +74,3 @@ generated_cc_atom( "//src/core:SkTraceEvent_hdr", ], ) - -generated_cc_atom( - name = "SkPerfettoTrace_hdr", - hdrs = ["SkPerfettoTrace.h"], - visibility = ["//:__subpackages__"], - deps = [ - ":EventTracingPriv_hdr", - "//include/utils:SkEventTracer_hdr", - "//third_party/externals/perfetto/sdk:perfetto_hdr", - ], -) - -generated_cc_atom( - name = "SkPerfettoTrace_src", - srcs = ["SkPerfettoTrace.cpp"], - visibility = ["//:__subpackages__"], - deps = [ - ":SkPerfettoTrace_hdr", - "//src/core:SkTraceEventCommon_hdr", - "//src/core:SkTraceEvent_hdr", - ], -) diff --git a/tools/trace/EventTracingPriv.cpp b/tools/trace/EventTracingPriv.cpp index 50fdde6ca8..47a7f524ec 100644 --- a/tools/trace/EventTracingPriv.cpp +++ b/tools/trace/EventTracingPriv.cpp @@ -13,16 +13,12 @@ #include "tools/flags/CommandLineFlags.h" #include "tools/trace/ChromeTracingTracer.h" #include "tools/trace/SkDebugfTracer.h" -#if defined(SK_USE_PERFETTO) - #include "tools/trace/SkPerfettoTrace.h" -#endif static DEFINE_string(trace, "", "Log trace events in one of several modes:\n" " debugf : Show events using SkDebugf\n" " atrace : Send events to Android ATrace\n" - " perfetto : Send events to Perfetto (Linux, Android, and Mac only)\n" " : Any other string is interpreted as a filename. Writes\n" " trace events to specified file as JSON, for viewing\n" " with chrome://tracing"); @@ -45,18 +41,7 @@ void initializeEventTracingForTools(const char* traceFlag) { eventTracer = new SkATrace(); } else if (0 == strcmp(traceFlag, "debugf")) { eventTracer = new SkDebugfTracer(); - } - else if (0 == strcmp(traceFlag, "perfetto")) { - #if defined(SK_USE_PERFETTO) - eventTracer = new SkPerfettoTrace(); - #else - SkDebugf("Perfetto is not enabled (SK_USE_PERFETTO is false). " - "Perfetto tracing will not be performed.\n" - "Tracing with Perfetto is only enabled for Linux, Android, and Mac."); - return; - #endif - } - else { + } else { eventTracer = new ChromeTracingTracer(traceFlag); } diff --git a/tools/trace/SkPerfettoTrace.cpp b/tools/trace/SkPerfettoTrace.cpp deleted file mode 100644 index 30af3e6f81..0000000000 --- a/tools/trace/SkPerfettoTrace.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "src/core/SkTraceEvent.h" -#include "src/core/SkTraceEventCommon.h" -#include "tools/trace/SkPerfettoTrace.h" - -PERFETTO_TRACK_EVENT_STATIC_STORAGE(); - -SkPerfettoTrace::SkPerfettoTrace() { -} - -SkPerfettoTrace::~SkPerfettoTrace() { -} - -SkEventTracer::Handle SkPerfettoTrace::addTraceEvent(char phase, - const uint8_t* categoryEnabledFlag, - const char* name, - uint64_t id, - int numArgs, - const char** argNames, - const uint8_t* argTypes, - const uint64_t* argValues, - uint8_t flags) { - return 0; -} - -void SkPerfettoTrace::updateTraceEventDuration(const uint8_t* categoryEnabledFlag, - const char* name, - SkEventTracer::Handle handle) { -} - -const uint8_t* SkPerfettoTrace::getCategoryGroupEnabled(const char* name) { - return fCategories.getCategoryGroupEnabled(name); -} - -const char* SkPerfettoTrace::getCategoryGroupName(const uint8_t* categoryEnabledFlag) { - return fCategories.getCategoryGroupName(categoryEnabledFlag); -} diff --git a/tools/trace/SkPerfettoTrace.h b/tools/trace/SkPerfettoTrace.h deleted file mode 100644 index fc07e4d16e..0000000000 --- a/tools/trace/SkPerfettoTrace.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPerfettoTrace_DEFINED -#define SkPerfettoTrace_DEFINED - -#include "include/utils/SkEventTracer.h" -#include "tools/trace/EventTracingPriv.h" -#include "third_party/externals/perfetto/sdk/perfetto.h" - -PERFETTO_DEFINE_CATEGORIES(); - -/** - * This class is used to support Perfetto tracing. It hooks into the SkEventTracer system. - */ -class SkPerfettoTrace : public SkEventTracer { -public: - SkPerfettoTrace(); - ~SkPerfettoTrace() override; - - SkEventTracer::Handle addTraceEvent(char phase, - const uint8_t* categoryEnabledFlag, - const char* name, - uint64_t id, - int numArgs, - const char** argNames, - const uint8_t* argTypes, - const uint64_t* argValues, - uint8_t flags) override; - - - void updateTraceEventDuration(const uint8_t* categoryEnabledFlag, - const char* name, - SkEventTracer::Handle handle) override; - - const uint8_t* getCategoryGroupEnabled(const char* name) override; - - const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override; - -private: - SkPerfettoTrace(const SkPerfettoTrace&) = delete; - SkPerfettoTrace& operator=(const SkPerfettoTrace&) = delete; - SkEventTracingCategories fCategories; -}; - -#endif