Bug 1364840 - Part 2. Generate aarch64 build rule to add CRC32 feature on aarch64. r=lsalzman
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Mon, 15 May 2017 18:30:19 +0900
changeset 358902 bc320d3634ee049c5ee19cc177232efe51b1b507
parent 358901 de97b072fede1dbf82759b819515b35af3fd1790
child 358903 fdd37b2a2451cbd91a193de9bacc8ee647a55d68
push id42889
push userm_kato@ga2.so-net.ne.jp
push dateThu, 18 May 2017 03:59:48 +0000
treeherderautoland@bc320d3634ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1364840
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1364840 - Part 2. Generate aarch64 build rule to add CRC32 feature on aarch64. r=lsalzman SkOpts.cpp will call Init_crc32() on aarch64 build. So we should add SkOpts_crc32.cpp to aarch64 sources. MozReview-Commit-ID: BInjMXYA1jH
gfx/skia/generate_mozbuild.py
gfx/skia/moz.build
--- a/gfx/skia/generate_mozbuild.py
+++ b/gfx/skia/generate_mozbuild.py
@@ -91,16 +91,18 @@ elif CONFIG['_MSC_VER']:
     SOURCES['skia/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=20']
     SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=31']
     SOURCES['skia/src/opts/SkOpts_sse41.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=41']
     SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=42']
     SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=51']
     SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=52']
 elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC']:
     CXXFLAGS += CONFIG['NEON_FLAGS']
+elif CONFIG['CPU_ARCH'] == 'aarch64' and CONFIG['GNU_CC']:
+    SOURCES['skia/src/opts/SkOpts_crc32.cpp'].flags += ['-march=armv8-a+crc']
 
 DEFINES['SKIA_IMPLEMENTATION'] = 1
 
 if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY'] and CONFIG['ENABLE_INTL_API']:
     DEFINES['SK_PDF_USE_SFNTLY'] = 1
 
 if not CONFIG['MOZ_ENABLE_SKIA_GPU']:
     DEFINES['SK_SUPPORT_GPU'] = 0
@@ -147,16 +149,17 @@ import json
 platforms = ['linux', 'mac', 'android', 'win']
 
 def parse_sources(output):
   return set(v.replace('//', 'skia/') for v in output.split() if v.endswith('.cpp') or v.endswith('.S'))
 
 def generate_opt_sources():
   cpus = [('intel', 'x86', [':sse2', ':ssse3', ':sse41', ':sse42', ':avx', ':hsw']),
           ('arm', 'arm', [':armv7']),
+          ('arm64', 'arm64', [':arm64', ':crc32']),
           ('none', 'none', [':none'])]
 
   opt_sources = {}
   for key, cpu, deps in cpus:
     subprocess.check_output('cd skia && bin/gn gen out/{0} --args=\'target_cpu="{1}"\''.format(key, cpu), shell=True)
     opt_sources[key] = set()
     for dep in deps:
         output = subprocess.check_output('cd skia && bin/gn desc out/{0} {1} sources'.format(key, dep), shell=True)
@@ -256,16 +259,17 @@ def generate_separated_sources(platform_
       # 'skia/src/utils/SkThreadUtils_pthread.cpp',
     },
     'linux': {
       'skia/src/ports/SkFontHost_cairo.cpp',
       'skia/src/ports/SkFontHost_FreeType_common.cpp',
     },
     'intel': set(),
     'arm': set(),
+    'arm64': set(),
     'none': set(),
     'pdf': {
       'skia/src/core/SkMD5.cpp',
     },
     'gpu': set()
   })
 
   for plat in platform_sources.keys():
@@ -432,20 +436,24 @@ def write_mozbuild(sources):
   # Windows-specific files don't get unification because of nasty headers.
   # Luckily there are not many files in this.
   write_list(f, "SOURCES", sources['win'], 4)
 
   f.write("if CONFIG['INTEL_ARCHITECTURE']:\n")
   write_sources(f, sources['intel'], 4)
   write_cflags(f, sources['intel'], opt_whitelist, 'skia_opt_flags', 4)
 
-  f.write("elif CONFIG['CPU_ARCH'] in ('arm', 'aarch64') and CONFIG['GNU_CC']:\n")
+  f.write("elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC']:\n")
   write_sources(f, sources['arm'], 4)
   write_cflags(f, sources['arm'], opt_whitelist, 'skia_opt_flags', 4)
- 
+
+  f.write("elif CONFIG['CPU_ARCH'] == 'aarch64' and CONFIG['GNU_CC']:\n")
+  write_sources(f, sources['arm64'], 4)
+  write_cflags(f, sources['arm64'], opt_whitelist, 'skia_opt_flags', 4)
+
   f.write("else:\n")
   write_sources(f, sources['none'], 4)
 
   f.write(footer)
 
   f.close()
 
   print 'Wrote ' + filename
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -626,33 +626,52 @@ if CONFIG['INTEL_ARCHITECTURE']:
     SOURCES['skia/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkOpts_sse41.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += skia_opt_flags
-elif CONFIG['CPU_ARCH'] in ('arm', 'aarch64') and CONFIG['GNU_CC']:
+elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC']:
     SOURCES += [
         'skia/src/opts/SkBitmapProcState_arm_neon.cpp',
         'skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
         'skia/src/opts/SkBitmapProcState_opts_none.cpp',
         'skia/src/opts/SkBlitMask_opts_arm.cpp',
         'skia/src/opts/SkBlitMask_opts_arm_neon.cpp',
         'skia/src/opts/SkBlitRow_opts_arm.cpp',
         'skia/src/opts/SkBlitRow_opts_arm_neon.cpp',
     ]
     SOURCES['skia/src/opts/SkBitmapProcState_arm_neon.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkBitmapProcState_opts_none.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkBlitMask_opts_arm.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkBlitMask_opts_arm_neon.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkBlitRow_opts_arm.cpp'].flags += skia_opt_flags
     SOURCES['skia/src/opts/SkBlitRow_opts_arm_neon.cpp'].flags += skia_opt_flags
+elif CONFIG['CPU_ARCH'] == 'aarch64' and CONFIG['GNU_CC']:
+    SOURCES += [
+        'skia/src/opts/SkBitmapProcState_arm_neon.cpp',
+        'skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
+        'skia/src/opts/SkBitmapProcState_opts_none.cpp',
+        'skia/src/opts/SkBlitMask_opts_arm.cpp',
+        'skia/src/opts/SkBlitMask_opts_arm_neon.cpp',
+        'skia/src/opts/SkBlitRow_opts_arm.cpp',
+        'skia/src/opts/SkBlitRow_opts_arm_neon.cpp',
+        'skia/src/opts/SkOpts_crc32.cpp',
+    ]
+    SOURCES['skia/src/opts/SkBitmapProcState_arm_neon.cpp'].flags += skia_opt_flags
+    SOURCES['skia/src/opts/SkBitmapProcState_matrixProcs_neon.cpp'].flags += skia_opt_flags
+    SOURCES['skia/src/opts/SkBitmapProcState_opts_none.cpp'].flags += skia_opt_flags
+    SOURCES['skia/src/opts/SkBlitMask_opts_arm.cpp'].flags += skia_opt_flags
+    SOURCES['skia/src/opts/SkBlitMask_opts_arm_neon.cpp'].flags += skia_opt_flags
+    SOURCES['skia/src/opts/SkBlitRow_opts_arm.cpp'].flags += skia_opt_flags
+    SOURCES['skia/src/opts/SkBlitRow_opts_arm_neon.cpp'].flags += skia_opt_flags
+    SOURCES['skia/src/opts/SkOpts_crc32.cpp'].flags += skia_opt_flags
 else:
     SOURCES += [
         'skia/src/opts/SkBitmapProcState_opts_none.cpp',
         'skia/src/opts/SkBlitMask_opts_none.cpp',
         'skia/src/opts/SkBlitRow_opts_none.cpp',
     ]
 
 
@@ -714,16 +733,18 @@ elif CONFIG['_MSC_VER']:
     SOURCES['skia/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=20']
     SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=31']
     SOURCES['skia/src/opts/SkOpts_sse41.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=41']
     SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=42']
     SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=51']
     SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=52']
 elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC']:
     CXXFLAGS += CONFIG['NEON_FLAGS']
+elif CONFIG['CPU_ARCH'] == 'aarch64' and CONFIG['GNU_CC']:
+    SOURCES['skia/src/opts/SkOpts_crc32.cpp'].flags += ['-march=armv8-a+crc']
 
 DEFINES['SKIA_IMPLEMENTATION'] = 1
 
 if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY'] and CONFIG['ENABLE_INTL_API']:
     DEFINES['SK_PDF_USE_SFNTLY'] = 1
 
 if not CONFIG['MOZ_ENABLE_SKIA_GPU']:
     DEFINES['SK_SUPPORT_GPU'] = 0