When targetting iOS and using gyp to generate the build files, it is not
possible to select files to build depending on the architecture. Due to
that, the skia code was disabling all optimisation when SK_BUILD_FOR_IOS
was defined.
Since it is possible to select the correct optimised version when using
gn, this pessimisation is hurting the build. Introduce a new define to
disable the optimisation SK_BUILD_NO_OPTS. It will be used by Chromium
when building skia for iOS with gyp but not gn.
Define SK_BUILD_NO_OPTS along-side SK_BUILD_FOR_IOS for all files that
look like build configuration (Xcode projects, gyp configuration files,
public.bzl) in order to avoid introducing breakage on those builds.
BUG=607933
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=
2002423002
Review-Url: https://codereview.chromium.org/
2002423002
typedef Benchmark INHERITED;
};
-#if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS)
+#if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS)
#define BENCHES(fileName) \
DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsBruteForce>(fileName); ) \
DEF_BENCH( return new LinearSrcOverBench<SrcOverVSkOptsTrivial>(fileName); ) \
//
#include "SkiOSSampleApp-Base"
-GCC_PREPROCESSOR_DEFINITIONS=SK_DEBUG SK_BUILD_FOR_IOS
+GCC_PREPROCESSOR_DEFINITIONS=SK_DEBUG SK_BUILD_FOR_IOS SK_BUILD_NO_OPTS
GCC_OPTIMIZATION_LEVEL=0
// found in the LICENSE file.
//
#include "SkiOSSampleApp-Base"
-GCC_PREPROCESSOR_DEFINITIONS=SK_RELEASE SK_BUILD_FOR_IOS
+GCC_PREPROCESSOR_DEFINITIONS=SK_RELEASE SK_BUILD_FOR_IOS SK_BUILD_NO_OPTS
GCC_OPTIMIZATION_LEVEL=s
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
SK_BUILD_FOR_IOS,
+ SK_BUILD_NO_OPTS,
SK_DEBUG,
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
SK_RELEASE,
SK_BUILD_FOR_IOS,
+ SK_BUILD_NO_OPTS,
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = NO;
[ 'skia_os == "ios"',
{
'defines': [
+ # When targetting iOS and using gyp to generate the build files, it is
+ # not possible to select files to build depending on the architecture
+ # (i.e. it is not possible to use hand optimized assembly version). In
+ # that configuration, disable all optimisation.
'SK_BUILD_FOR_IOS',
+ 'SK_BUILD_NO_OPTS',
],
'conditions' : [
[ 'skia_warnings_as_errors', {
#define SK_CPU_SSE_LEVEL_AVX 51
#define SK_CPU_SSE_LEVEL_AVX2 52
-#ifdef SK_BUILD_FOR_IOS
- #define SK_CPU_SSE_LEVEL 0 // We're tired of fighting with opts/ and iOS simulator.
+// When targetting iOS and using gyp to generate the build files, it is not
+// possible to select files to build depending on the architecture (i.e. it
+// is not possible to use hand optimized assembly implementation). In that
+// configuration SK_BUILD_NO_OPTS is defined. Remove optimisation then.
+#ifdef SK_BUILD_NO_OPTS
+ #define SK_CPU_SSE_LEVEL 0
#endif
// Are we in GCC?
#endif
#endif
-// Disable ARM64 optimizations for iOS due to complications regarding gyp and iOS.
-#if defined(__aarch64__) && !defined(SK_BUILD_FOR_IOS)
+#if defined(__aarch64__) && !defined(SK_BUILD_NO_OPTS)
#define SK_CPU_ARM64
#endif
// All 64-bit ARM chips have NEON. Many 32-bit ARM chips do too.
-// TODO: Why don't we want NEON on iOS?
-#if !defined(SK_ARM_HAS_NEON) && !defined(SK_BUILD_FOR_IOS) && (defined(__ARM_NEON__) || defined(__ARM_NEON))
+#if !defined(SK_ARM_HAS_NEON) && !defined(SK_BUILD_NO_OPTS) && (defined(__ARM_NEON__) || defined(__ARM_NEON))
#define SK_ARM_HAS_NEON
#endif
DEFINES_IOS = [
"SK_BUILD_FOR_IOS",
+ "SK_BUILD_NO_OPTS",
"SK_IGNORE_ETC1_SUPPORT",
"SKNX_NO_SIMD",
]
void Init_avx2() {}
static void init() {
- // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug or feature?
- #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS)
+ #if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS)
if (SkCpu::Supports(SkCpu::SSSE3)) { Init_ssse3(); }
if (SkCpu::Supports(SkCpu::SSE41)) { Init_sse41(); }
if (SkCpu::Supports(SkCpu::SSE42)) { Init_sse42(); }
uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
}
-#if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS)
+#if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS)
namespace sk_sse41 {
extern void srcover_srgb_srgb(
uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
Spec{sk_default::best_non_simd_srcover_srgb_srgb, "best_non_simd"},
Spec{sk_default::srcover_srgb_srgb, "default"},
};
- #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS)
+ #if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS)
if (SkCpu::Supports(SkCpu::SSE41)) {
specs.push_back(Spec{sk_sse41::srcover_srgb_srgb, "sse41", });
}