From 465044080f44b9f7eed8973026cc7bb7dff2fddd Mon Sep 17 00:00:00 2001 From: Alexander Frick Date: Wed, 27 Nov 2024 15:14:00 -0600 Subject: [PATCH] fix arm/third_party and polly --- arm/build/config/compiler/BUILD.gn | 76 +++++++------- arm/third_party/libaom/BUILD.gn | 6 +- arm/third_party/libaom/cmake_update.sh | 3 +- arm/third_party/libvpx/BUILD.gn | 35 ++----- other/thorium-2024-ui.patch | 12 +++ src/build/config/compiler/BUILD.gn | 76 +++++++------- src/media/base/media_switches.cc | 2 +- tatus | 135 +++++++++++++++++++++++++ 8 files changed, 244 insertions(+), 101 deletions(-) create mode 100644 tatus diff --git a/arm/build/config/compiler/BUILD.gn b/arm/build/config/compiler/BUILD.gn index 2e0cfdf6..f933f6cc 100644 --- a/arm/build/config/compiler/BUILD.gn +++ b/arm/build/config/compiler/BUILD.gn @@ -266,21 +266,6 @@ config("no_unresolved_symbols") { } } -# Emit relocations for BOLT -config("emit-relocs") { - if (!using_sanitizer && use_bolt) { - if (is_win) { - ldflags = [ - "-mllvm:--emit-relocs", - ] - } else { - ldflags = [ - "-Wl,--emit-relocs", - ] - } - } -} - # compiler --------------------------------------------------------------------- # # Base compiler configuration. @@ -2642,16 +2627,6 @@ if (is_win) { ] } - if (use_polly == true) { - common_optimize_on_ldflags += [ - "-mllvm:-polly", - "-mllvm:-polly-detect-profitability-min-per-loop-insts=40", - #"-mllvm:-polly-invariant-load-hoisting", - "-mllvm:-polly-run-dce", - "-mllvm:-polly-vectorizer=stripmine", - ] - } - # /OPT:ICF is not desirable in Debug builds, since code-folding can result in # misleading symbols in stack traces. if (!is_debug && !is_component_build) { @@ -2785,16 +2760,6 @@ if (is_win) { ] } - if (use_polly == true) { - common_optimize_on_ldflags += [ - "-Wl,-mllvm,-polly", - "-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40", - #"-Wl,-mllvm,-polly-invariant-load-hoisting", - "-Wl,-mllvm,-polly-run-dce", - "-Wl,-mllvm,-polly-vectorizer=stripmine", - ] - } - if (is_android) { # TODO(jdduke) Re-enable on mips after resolving linking # issues with libc++ (crbug.com/456380). @@ -3032,6 +2997,45 @@ config("no_optimize") { } } +# Emit relocs for BOLT +config("emit-relocs") { + if (!using_sanitizer && use_bolt) { + if (is_win) { + ldflags = [ + "-mllvm:--emit-relocs", + ] + } else { + ldflags = [ + "-Wl,--emit-relocs", + ] + } + } +} + +# Use LLVM's Polly optimizer +config("polly") { + if (use_polly == true) { + ldflags = common_optimize_on_ldflags + if (is_win) { + ldflags += [ + "-mllvm:-polly", + "-mllvm:-polly-detect-profitability-min-per-loop-insts=40", + #"-mllvm:-polly-invariant-load-hoisting", + "-mllvm:-polly-run-dce", + "-mllvm:-polly-vectorizer=stripmine", + ] + } else { + ldflags += [ + "-Wl,-mllvm,-polly", + "-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40", + #"-Wl,-mllvm,-polly-invariant-load-hoisting", + "-Wl,-mllvm,-polly-run-dce", + "-Wl,-mllvm,-polly-vectorizer=stripmine", + ] + } + } +} + # Turns up the optimization level. Used to explicitly enable -O2 instead of # -Os for select targets on platforms that use optimize_for_size. No-op # elsewhere. @@ -3062,6 +3066,7 @@ config("optimize_max") { } rustflags = [ "-Copt-level=3", ] } + configs = [ ":polly" ] } # This config can be used to override the default settings for per-component @@ -3098,6 +3103,7 @@ config("optimize_speed") { } rustflags = [ "-Copt-level=3", ] } + configs = [ ":polly" ] } config("optimize_fuzzing") { diff --git a/arm/third_party/libaom/BUILD.gn b/arm/third_party/libaom/BUILD.gn index 305c3bcc..250f5c51 100644 --- a/arm/third_party/libaom/BUILD.gn +++ b/arm/third_party/libaom/BUILD.gn @@ -97,6 +97,11 @@ if (current_cpu == "x86" || (current_cpu == "x64" && !is_msan)) { } defines = [ "CHROMIUM" ] include_dirs = libaom_include_dirs + inputs = [ + "$platform_include_dir/config/aom_config.asm", + "source/libaom/aom_ports/x86_abi_support.asm", + "source/libaom/third_party/x86inc/x86inc.asm", + ] } # The following targets are deliberately source_set rather than @@ -147,7 +152,6 @@ if (current_cpu == "x86" || (current_cpu == "x64" && !is_msan)) { cflags = [ "-mssse3" ] } sources = aom_av1_common_intrin_ssse3 - sources += aom_av1_encoder_intrin_ssse3 sources += aom_dsp_common_intrin_ssse3 sources += aom_dsp_encoder_intrin_ssse3 if (current_cpu == "x86") { diff --git a/arm/third_party/libaom/cmake_update.sh b/arm/third_party/libaom/cmake_update.sh index 8de5b822..59236b82 100755 --- a/arm/third_party/libaom/cmake_update.sh +++ b/arm/third_party/libaom/cmake_update.sh @@ -101,7 +101,6 @@ EOF # $1 - File to modify. function convert_to_windows() { sed -i.bak \ - -e 's/\(#define[[:space:]]INLINE[[:space:]]*\)inline/\1 __inline/' \ -e 's/\(#define[[:space:]]HAVE_PTHREAD_H[[:space:]]*\)1/\1 0/' \ -e 's/\(#define[[:space:]]HAVE_UNISTD_H[[:space:]]*\)1/\1 0/' \ -e 's/\(#define[[:space:]]CONFIG_GCC[[:space:]]*\)1/\1 0/' \ @@ -181,7 +180,7 @@ gen_config_files linux/arm \ reset_dirs linux/arm-neon gen_config_files linux/arm-neon \ - "${toolchain}/armv7-linux-gcc.cmake -DCONFIG_RUNTIME_CPU_DETECT=0 -DENABLE_ARM_CRC32=0 -DENABLE_NEON_DOTPROD=0 -DENABLE_NEON_I8MM=0 \ + "${toolchain}/armv7-linux-gcc.cmake -DENABLE_ARM_CRC32=0 -DENABLE_NEON_DOTPROD=0 -DENABLE_NEON_I8MM=0 \ ${all_platforms}" reset_dirs linux/arm-neon-cpu-detect diff --git a/arm/third_party/libvpx/BUILD.gn b/arm/third_party/libvpx/BUILD.gn index 98ab4aad..3568bf1b 100644 --- a/arm/third_party/libvpx/BUILD.gn +++ b/arm/third_party/libvpx/BUILD.gn @@ -121,30 +121,6 @@ source_set("libvpx_test_generic_headers") { sources = libvpx_test_srcs_generic_headers } -config("gtest_config") { - include_dirs = [ - "source/libvpx/third_party/googletest/src/include/", - "source/libvpx/third_party/googletest/src/", - ] -} - -source_set("gtest") { - sources = [ "source/libvpx/third_party/googletest/src/src/gtest-all.cc" ] - - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - - public_configs = [ ":gtest_config" ] - - # gtest-death-test dependency on fdio for fuchsia builds - if (is_fuchsia) { - deps = [ - "//third_party/fuchsia-sdk/sdk/pkg/fdio", - "//third_party/fuchsia-sdk/sdk/pkg/zx", - ] - } -} - executable("decode_encode_profile_test") { configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] @@ -166,9 +142,9 @@ executable("decode_encode_profile_test") { "tests/pgo/decode_encode_profile_test.cc", ] deps = [ - ":gtest", ":libvpx", ":libvpx_test_generic_headers", + "//testing/gtest", ] } @@ -179,7 +155,12 @@ if (current_cpu == "x86" || (current_cpu == "x64" && !is_msan)) { } else if (current_cpu == "x64") { sources = libvpx_srcs_x86_64_assembly } - + inputs = [ + "$platform_include_dir/vpx_config.asm", + "source/libvpx/third_party/x86inc/x86inc.asm", + "source/libvpx/vpx_dsp/x86/bitdepth_conversion_sse2.asm", + "source/libvpx/vpx_ports/x86_abi_support.asm", + ] defines = [ "CHROMIUM" ] if (is_android) { # On Android, define __ANDROID__ to use alternative standard library @@ -693,9 +674,9 @@ test("test_libvpx") { include_dirs = [ "source/libvpx/third_party/libwebm/" ] deps = [ - ":gtest", ":libvpx", ":libvpx_test_generic_headers", + "//testing/gtest", ] if (is_android) { diff --git a/other/thorium-2024-ui.patch b/other/thorium-2024-ui.patch index 6ef8cf79..284643c4 100644 --- a/other/thorium-2024-ui.patch +++ b/other/thorium-2024-ui.patch @@ -190,6 +190,18 @@ index fe2ce670da340..82bbda21a16e5 100644 // Used by LOG_IS_ON to lazy-evaluate stream arguments. BASE_EXPORT bool ShouldCreateLogMessage(int severity); +diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn +index c9a3ce41465b3..9203ec5c7c75c 100644 +--- a/build/config/BUILDCONFIG.gn ++++ b/build/config/BUILDCONFIG.gn +@@ -348,6 +348,7 @@ default_compiler_configs = [ + "//build/config/compiler:default_optimization", + "//build/config/compiler:default_stack_frames", + "//build/config/compiler:default_symbols", ++ "//build/config/compiler:emit-relocs", + "//build/config/compiler:libcxx_hardening", + "//build/config/compiler:libcxx_module", + "//build/config/compiler:no_exceptions", diff --git a/chrome/browser/extensions/api/messaging/launch_context_win.cc b/chrome/browser/extensions/api/messaging/launch_context_win.cc index b103bbe61303d..469611cb36e7a 100644 --- a/chrome/browser/extensions/api/messaging/launch_context_win.cc diff --git a/src/build/config/compiler/BUILD.gn b/src/build/config/compiler/BUILD.gn index 2e0cfdf6..f933f6cc 100644 --- a/src/build/config/compiler/BUILD.gn +++ b/src/build/config/compiler/BUILD.gn @@ -266,21 +266,6 @@ config("no_unresolved_symbols") { } } -# Emit relocations for BOLT -config("emit-relocs") { - if (!using_sanitizer && use_bolt) { - if (is_win) { - ldflags = [ - "-mllvm:--emit-relocs", - ] - } else { - ldflags = [ - "-Wl,--emit-relocs", - ] - } - } -} - # compiler --------------------------------------------------------------------- # # Base compiler configuration. @@ -2642,16 +2627,6 @@ if (is_win) { ] } - if (use_polly == true) { - common_optimize_on_ldflags += [ - "-mllvm:-polly", - "-mllvm:-polly-detect-profitability-min-per-loop-insts=40", - #"-mllvm:-polly-invariant-load-hoisting", - "-mllvm:-polly-run-dce", - "-mllvm:-polly-vectorizer=stripmine", - ] - } - # /OPT:ICF is not desirable in Debug builds, since code-folding can result in # misleading symbols in stack traces. if (!is_debug && !is_component_build) { @@ -2785,16 +2760,6 @@ if (is_win) { ] } - if (use_polly == true) { - common_optimize_on_ldflags += [ - "-Wl,-mllvm,-polly", - "-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40", - #"-Wl,-mllvm,-polly-invariant-load-hoisting", - "-Wl,-mllvm,-polly-run-dce", - "-Wl,-mllvm,-polly-vectorizer=stripmine", - ] - } - if (is_android) { # TODO(jdduke) Re-enable on mips after resolving linking # issues with libc++ (crbug.com/456380). @@ -3032,6 +2997,45 @@ config("no_optimize") { } } +# Emit relocs for BOLT +config("emit-relocs") { + if (!using_sanitizer && use_bolt) { + if (is_win) { + ldflags = [ + "-mllvm:--emit-relocs", + ] + } else { + ldflags = [ + "-Wl,--emit-relocs", + ] + } + } +} + +# Use LLVM's Polly optimizer +config("polly") { + if (use_polly == true) { + ldflags = common_optimize_on_ldflags + if (is_win) { + ldflags += [ + "-mllvm:-polly", + "-mllvm:-polly-detect-profitability-min-per-loop-insts=40", + #"-mllvm:-polly-invariant-load-hoisting", + "-mllvm:-polly-run-dce", + "-mllvm:-polly-vectorizer=stripmine", + ] + } else { + ldflags += [ + "-Wl,-mllvm,-polly", + "-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40", + #"-Wl,-mllvm,-polly-invariant-load-hoisting", + "-Wl,-mllvm,-polly-run-dce", + "-Wl,-mllvm,-polly-vectorizer=stripmine", + ] + } + } +} + # Turns up the optimization level. Used to explicitly enable -O2 instead of # -Os for select targets on platforms that use optimize_for_size. No-op # elsewhere. @@ -3062,6 +3066,7 @@ config("optimize_max") { } rustflags = [ "-Copt-level=3", ] } + configs = [ ":polly" ] } # This config can be used to override the default settings for per-component @@ -3098,6 +3103,7 @@ config("optimize_speed") { } rustflags = [ "-Copt-level=3", ] } + configs = [ ":polly" ] } config("optimize_fuzzing") { diff --git a/src/media/base/media_switches.cc b/src/media/base/media_switches.cc index d2f8bec3..0f528844 100644 --- a/src/media/base/media_switches.cc +++ b/src/media/base/media_switches.cc @@ -755,7 +755,7 @@ BASE_FEATURE(kVaapiVideoDecodeLinux, BASE_FEATURE(kVaapiVideoDecodeLinuxGL, "VaapiVideoDecodeLinuxGL", - base::FEATURE_ENABLED_BY_DEFAULT); + base::FEATURE_DISABLED_BY_DEFAULT); BASE_FEATURE(kVaapiVideoEncodeLinux, "VaapiVideoEncoder", diff --git a/tatus b/tatus new file mode 100644 index 00000000..d91153ab --- /dev/null +++ b/tatus @@ -0,0 +1,135 @@ +diff --git a/src/build/config/compiler/BUILD.gn b/src/build/config/compiler/BUILD.gn +index 2e0cfdf6..f933f6cc 100644 +--- a/src/build/config/compiler/BUILD.gn ++++ b/src/build/config/compiler/BUILD.gn +@@ -266,21 +266,6 @@ config("no_unresolved_symbols") { + } + } +  +-# Emit relocations for BOLT +-config("emit-relocs") { +- if (!using_sanitizer && use_bolt) { +- if (is_win) { +- ldflags = [ +- "-mllvm:--emit-relocs", +- ] +- } else { +- ldflags = [ +- "-Wl,--emit-relocs", +- ] +- } +- } +-} +- + # compiler --------------------------------------------------------------------- + # + # Base compiler configuration. +@@ -2642,16 +2627,6 @@ if (is_win) { + ] + } +  +- if (use_polly == true) { +- common_optimize_on_ldflags += [ +- "-mllvm:-polly", +- "-mllvm:-polly-detect-profitability-min-per-loop-insts=40", +- #"-mllvm:-polly-invariant-load-hoisting", +- "-mllvm:-polly-run-dce", +- "-mllvm:-polly-vectorizer=stripmine", +- ] +- } +- + # /OPT:ICF is not desirable in Debug builds, since code-folding can result in + # misleading symbols in stack traces. + if (!is_debug && !is_component_build) { +@@ -2785,16 +2760,6 @@ if (is_win) { + ] + } +  +- if (use_polly == true) { +- common_optimize_on_ldflags += [ +- "-Wl,-mllvm,-polly", +- "-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40", +- #"-Wl,-mllvm,-polly-invariant-load-hoisting", +- "-Wl,-mllvm,-polly-run-dce", +- "-Wl,-mllvm,-polly-vectorizer=stripmine", +- ] +- } +- + if (is_android) { + # TODO(jdduke) Re-enable on mips after resolving linking + # issues with libc++ (crbug.com/456380). +@@ -3032,6 +2997,45 @@ config("no_optimize") { + } + } +  ++# Emit relocs for BOLT ++config("emit-relocs") { ++ if (!using_sanitizer && use_bolt) { ++ if (is_win) { ++ ldflags = [ ++ "-mllvm:--emit-relocs", ++ ] ++ } else { ++ ldflags = [ ++ "-Wl,--emit-relocs", ++ ] ++ } ++ } ++} ++ ++# Use LLVM's Polly optimizer ++config("polly") { ++ if (use_polly == true) { ++ ldflags = common_optimize_on_ldflags ++ if (is_win) { ++ ldflags += [ ++ "-mllvm:-polly", ++ "-mllvm:-polly-detect-profitability-min-per-loop-insts=40", ++ #"-mllvm:-polly-invariant-load-hoisting", ++ "-mllvm:-polly-run-dce", ++ "-mllvm:-polly-vectorizer=stripmine", ++ ] ++ } else { ++ ldflags += [ ++ "-Wl,-mllvm,-polly", ++ "-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40", ++ #"-Wl,-mllvm,-polly-invariant-load-hoisting", ++ "-Wl,-mllvm,-polly-run-dce", ++ "-Wl,-mllvm,-polly-vectorizer=stripmine", ++ ] ++ } ++ } ++} ++ + # Turns up the optimization level. Used to explicitly enable -O2 instead of + # -Os for select targets on platforms that use optimize_for_size. No-op + # elsewhere. +@@ -3062,6 +3066,7 @@ config("optimize_max") { + } + rustflags = [ "-Copt-level=3", ] + } ++ configs = [ ":polly" ] + } +  + # This config can be used to override the default settings for per-component +@@ -3098,6 +3103,7 @@ config("optimize_speed") { + } + rustflags = [ "-Copt-level=3", ] + } ++ configs = [ ":polly" ] + } +  + config("optimize_fuzzing") { +diff --git a/src/media/base/media_switches.cc b/src/media/base/media_switches.cc +index d2f8bec3..0f528844 100644 +--- a/src/media/base/media_switches.cc ++++ b/src/media/base/media_switches.cc +@@ -755,7 +755,7 @@ BASE_FEATURE(kVaapiVideoDecodeLinux, +  + BASE_FEATURE(kVaapiVideoDecodeLinuxGL, + "VaapiVideoDecodeLinuxGL", +- base::FEATURE_ENABLED_BY_DEFAULT); ++ base::FEATURE_DISABLED_BY_DEFAULT); +  + BASE_FEATURE(kVaapiVideoEncodeLinux, + "VaapiVideoEncoder",