forked from firka/flutter
Enable DisplayList benchmarks to be built on Android (flutter/engine#31268)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "benchmarking.h"
|
||||
|
||||
#include "flutter/fml/backtrace.h"
|
||||
#include "flutter/fml/build_config.h"
|
||||
#include "flutter/fml/command_line.h"
|
||||
#include "flutter/fml/icu_util.h"
|
||||
|
||||
@@ -12,11 +13,13 @@ namespace benchmarking {
|
||||
|
||||
int Main(int argc, char** argv) {
|
||||
fml::InstallCrashHandler();
|
||||
#if !defined(FML_OS_ANDROID)
|
||||
fml::CommandLine cmd = fml::CommandLineFromArgcArgv(argc, argv);
|
||||
benchmark::Initialize(&argc, argv);
|
||||
std::string icudtl_path =
|
||||
cmd.GetOptionValueWithDefault("icu-data-file-path", "icudtl.dat");
|
||||
fml::icu::InitializeICU(icudtl_path);
|
||||
#endif
|
||||
benchmark::Initialize(&argc, argv);
|
||||
::benchmark::RunSpecifiedBenchmarks();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -55,49 +55,74 @@ fixtures_location("display_list_benchmarks_fixtures") {
|
||||
assets_dir = "$target_gen_dir/"
|
||||
}
|
||||
|
||||
if (enable_unittests) {
|
||||
executable("display_list_benchmarks") {
|
||||
testonly = true
|
||||
source_set("display_list_benchmarks_source") {
|
||||
testonly = true
|
||||
|
||||
sources = [
|
||||
"display_list_benchmarks.cc",
|
||||
"display_list_benchmarks.h",
|
||||
sources = [
|
||||
"display_list_benchmarks.cc",
|
||||
"display_list_benchmarks.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":display_list",
|
||||
":display_list_benchmarks_fixtures",
|
||||
"//flutter/benchmarking",
|
||||
"//flutter/common/graphics",
|
||||
"//flutter/fml",
|
||||
"//flutter/testing:skia",
|
||||
"//flutter/testing:testing_lib",
|
||||
"//third_party/dart/runtime:libdart_jit", # for tracing
|
||||
"//third_party/skia",
|
||||
]
|
||||
|
||||
defines = []
|
||||
|
||||
if (is_android) {
|
||||
libs = [
|
||||
"android",
|
||||
"EGL",
|
||||
"GLESv2",
|
||||
]
|
||||
}
|
||||
|
||||
# We only do software benchmarks on non-mobile platforms
|
||||
if (!is_android && !is_ios) {
|
||||
sources += [
|
||||
"display_list_benchmarks_software.cc",
|
||||
"display_list_benchmarks_software.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":display_list",
|
||||
":display_list_benchmarks_fixtures",
|
||||
"//flutter/benchmarking",
|
||||
"//flutter/common/graphics",
|
||||
"//flutter/fml",
|
||||
"//flutter/testing:skia",
|
||||
"//flutter/testing:testing_lib",
|
||||
"//third_party/dart/runtime:libdart_jit", # for tracing
|
||||
"//third_party/skia",
|
||||
]
|
||||
|
||||
defines = [ "ENABLE_SOFTWARE_BENCHMARKS" ]
|
||||
|
||||
if (!is_fuchsia) {
|
||||
defines += [ "ENABLE_OPENGL_BENCHMARKS" ]
|
||||
sources += [
|
||||
"display_list_benchmarks_gl.cc",
|
||||
"display_list_benchmarks_gl.h",
|
||||
]
|
||||
deps += [ "//flutter/testing:opengl" ]
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
defines += [ "ENABLE_METAL_BENCHMARKS" ]
|
||||
sources += [
|
||||
"display_list_benchmarks_metal.cc",
|
||||
"display_list_benchmarks_metal.h",
|
||||
]
|
||||
deps += [ "//flutter/testing:metal" ]
|
||||
}
|
||||
defines += [ "ENABLE_SOFTWARE_BENCHMARKS" ]
|
||||
}
|
||||
|
||||
# iOS and Fuchsia don't support OpenGL
|
||||
if (!is_fuchsia && !is_ios) {
|
||||
defines += [ "ENABLE_OPENGL_BENCHMARKS" ]
|
||||
sources += [
|
||||
"display_list_benchmarks_gl.cc",
|
||||
"display_list_benchmarks_gl.h",
|
||||
]
|
||||
deps += [ "//flutter/testing:opengl" ]
|
||||
}
|
||||
|
||||
if (is_mac || is_ios) {
|
||||
defines += [ "ENABLE_METAL_BENCHMARKS" ]
|
||||
sources += [
|
||||
"display_list_benchmarks_metal.cc",
|
||||
"display_list_benchmarks_metal.h",
|
||||
]
|
||||
deps += [ "//flutter/testing:metal" ]
|
||||
}
|
||||
|
||||
# Don't snapshot test results on mobile platforms
|
||||
if (is_android || is_ios) {
|
||||
defines += [ "BENCHMARKS_NO_SNAPSHOT" ]
|
||||
}
|
||||
}
|
||||
|
||||
executable("display_list_benchmarks") {
|
||||
testonly = true
|
||||
|
||||
deps = [ ":display_list_benchmarks_source" ]
|
||||
}
|
||||
|
||||
if (is_ios) {
|
||||
@@ -116,29 +141,9 @@ if (is_ios) {
|
||||
]
|
||||
ldflags =
|
||||
[ "-Wl,-install_name,@rpath/libios_display_list_benchmarks.dylib" ]
|
||||
defines = [
|
||||
"BENCHMARKS_NO_SNAPSHOT",
|
||||
"ENABLE_METAL_BENCHMARKS",
|
||||
]
|
||||
sources = [
|
||||
"display_list_benchmarks.cc",
|
||||
"display_list_benchmarks.h",
|
||||
"display_list_benchmarks_metal.cc",
|
||||
"display_list_benchmarks_metal.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":display_list",
|
||||
":display_list_benchmarks_fixtures",
|
||||
":display_list_benchmarks_source",
|
||||
"//flutter/benchmarking:benchmarking_library",
|
||||
"//flutter/common/graphics",
|
||||
"//flutter/fml",
|
||||
"//flutter/testing:metal",
|
||||
"//flutter/testing:skia",
|
||||
"//flutter/testing:testing_lib",
|
||||
"//third_party/benchmark",
|
||||
"//third_party/dart/runtime:libdart_jit", # for tracing
|
||||
"//third_party/skia",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,26 +150,6 @@ if (enable_unittests) {
|
||||
}
|
||||
}
|
||||
|
||||
# SwiftShader only supports x86/x86_64
|
||||
if (target_cpu == "x86" || target_cpu == "x64") {
|
||||
source_set("opengl") {
|
||||
testonly = true
|
||||
|
||||
configs += [ "//third_party/swiftshader_flutter:swiftshader_config" ]
|
||||
|
||||
sources = [
|
||||
"test_gl_surface.cc",
|
||||
"test_gl_surface.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":skia",
|
||||
"//flutter/fml",
|
||||
"//third_party/swiftshader_flutter:swiftshader_gl",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
test_fixtures("testing_fixtures") {
|
||||
fixtures = []
|
||||
}
|
||||
@@ -205,7 +185,7 @@ if (enable_unittests) {
|
||||
# is exercised on platforms where Metal itself is available.
|
||||
#
|
||||
# On iOS, this is enabled to allow for Metal tests to run within a test app
|
||||
if (enable_unittests || is_ios) {
|
||||
if (is_mac || is_ios) {
|
||||
source_set("metal") {
|
||||
if (shell_enable_metal) {
|
||||
sources = [
|
||||
@@ -231,3 +211,27 @@ if (enable_unittests || is_ios) {
|
||||
testonly = true
|
||||
}
|
||||
}
|
||||
|
||||
# We only use SwiftShader on unittests and
|
||||
# SwiftShader only supports x86/x86_64
|
||||
use_swiftshader =
|
||||
enable_unittests && (target_cpu == "x86" || target_cpu == "x64")
|
||||
|
||||
source_set("opengl") {
|
||||
testonly = true
|
||||
|
||||
sources = [
|
||||
"test_gl_surface.cc",
|
||||
"test_gl_surface.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":skia",
|
||||
"//flutter/fml",
|
||||
]
|
||||
|
||||
if (use_swiftshader) {
|
||||
configs += [ "//third_party/swiftshader_flutter:swiftshader_config" ]
|
||||
deps += [ "//third_party/swiftshader_flutter:swiftshader_gl" ]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user