Bug 1520174 - Update build files after dav1d import and add ASM build for Linux x86_32. r=TD-Linux
authorAlex Chronopoulos <achronop@gmail.com>
Wed, 16 Jan 2019 07:50:17 +0000
changeset 514047 e56368888bd4d684992e58ba4c67b4c75b262712
parent 514046 a0588068456ca1002798e5d358dfade5d7879bc3
child 514048 bdc982dd78300d5f3ef14101440a415289d6be71
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTD-Linux
bugs1520174
milestone66.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 1520174 - Update build files after dav1d import and add ASM build for Linux x86_32. r=TD-Linux Differential Revision: https://phabricator.services.mozilla.com/D16563
media/libdav1d/asm/moz.build
media/libdav1d/asm/x86_32/config.asm
media/libdav1d/asm/x86_64/config.asm
media/libdav1d/config.h
media/libdav1d/moz.build
--- a/media/libdav1d/asm/moz.build
+++ b/media/libdav1d/asm/moz.build
@@ -16,27 +16,30 @@ LOCAL_INCLUDES += [
     '/third_party/dav1d/src/',
 ]
 
 CFLAGS += [
     # find the config.h file.
     '-I%s/dist/include/dav1d/' % TOPOBJDIR,
 ]
 
-if CONFIG['CC_TYPE'] == 'clang':
-    CFLAGS += ['-mstack-alignment=32']
-elif CONFIG['CC_TYPE'] == 'gcc':
-    CFLAGS += ['-mpreferred-stack-boundary=5']
+# This is Linux only for now
 
 # Attaching config.asm file
 if CONFIG['CPU_ARCH'] == 'x86':
     ASFLAGS += ['-I%s/media/libdav1d/asm/x86_32/' % TOPSRCDIR]
     SOURCES += ['x86_32/config.asm']
 
 if CONFIG['CPU_ARCH'] == 'x86_64':
+    # Change the default stack aligment (16) to 32
+    if CONFIG['CC_TYPE'] == 'clang':
+        CFLAGS += ['-mstack-alignment=32']
+    elif CONFIG['CC_TYPE'] == 'gcc':
+        CFLAGS += ['-mpreferred-stack-boundary=5']
+
     if CONFIG['OS_TARGET'] == 'Darwin':
         ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/osx/' % TOPSRCDIR]
         SOURCES += ['x86_64/osx/config.asm']
     else:
         ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/' % TOPSRCDIR]
         SOURCES += ['x86_64/config.asm']
 
 if CONFIG['CPU_ARCH'] in ('x86', 'x86_64'):
--- a/media/libdav1d/asm/x86_32/config.asm
+++ b/media/libdav1d/asm/x86_32/config.asm
@@ -1,9 +1,11 @@
 ; Autogenerated by the Meson build system.
 ; Do not edit, your changes will be lost.
 
 %define ARCH_X86_32 1
 
 %define ARCH_X86_64 0
 
-%define STACK_ALIGNMENT 32
+%define PIC 1
 
+%define STACK_ALIGNMENT 16
+
--- a/media/libdav1d/asm/x86_64/config.asm
+++ b/media/libdav1d/asm/x86_64/config.asm
@@ -1,11 +1,9 @@
 ; Autogenerated by the Meson build system.
 ; Do not edit, your changes will be lost.
 
 %define ARCH_X86_32 0
 
 %define ARCH_X86_64 1
 
-%define PIC 1
-
 %define STACK_ALIGNMENT 32
 
--- a/media/libdav1d/config.h
+++ b/media/libdav1d/config.h
@@ -31,35 +31,39 @@
 #define ARCH_X86 0
 #endif
 
 // Set both bitdepeth in every case
 #define CONFIG_16BPC 1
 #define CONFIG_8BPC 1
 
 // Enable asm
-#if ARCH_X86_64 == 1 && defined(__linux__) && !defined(__ANDROID__)
+#if (ARCH_x86_32 == 1 || ARCH_X86_64 == 1) && defined(__linux__) && \
+    !defined(__ANDROID__)
 #define HAVE_ASM 1
 #else
 #define HAVE_ASM 0
 #endif
 
 // Set memory aligment
 #if defined(__ANDROID__) && (ARCH_ARM == 1 || ARCH_X86_32 == 1)
 #define HAVE_MEMALIGN 1
 #elif ARCH_X86_64 == 1 && (defined(_WIN32) || defined(__CYGWIN__)) && \
     defined(MOZ_ASAN)
 #define HAVE_ALIGNED_MALLOC 1
 #else
 #define HAVE_POSIX_MEMALIGN 1
 #endif
 
 // unistd.h is used by tools, which we do not
-// built, so we do not really care.
+// build, so we do not really care.
 #define HAVE_UNISTD_H 1
 
 // Important when asm is enabled
 #if defined(__APPLE__)
 #define PREFIX 1
 #endif
 
-// aligment is 32 in evry case
+#if ARCH_X86_32 == 1 && defined(__linux__) && !defined(__ANDROID__)
+#define STACK_ALIGNMENT 16
+#else
 #define STACK_ALIGNMENT 32
+#endif
--- a/media/libdav1d/moz.build
+++ b/media/libdav1d/moz.build
@@ -20,26 +20,29 @@ EXPORTS.dav1d += [
 
 # entrypoint source files
 SOURCES += [
     '../../third_party/dav1d/src/lib.c',
     '../../third_party/dav1d/src/thread_task.c',
 ]
 
 # Enable ASM on Linux for now.
-if CONFIG['OS_TARGET'] == 'Linux' and CONFIG['CPU_ARCH'] == 'x86_64':
+if CONFIG['OS_TARGET'] == 'Linux' and (CONFIG['CPU_ARCH'] in ('x86', 'x86_64')):
+    # Default stack aligment is 16 bytes
     DIRS += ['asm']
-    if CONFIG['CC_TYPE'] == 'clang':
-        CFLAGS += ['-mstack-alignment=32']
-        SOURCES['../../third_party/dav1d/src/lib.c'].flags += ['-mstackrealign']
-        SOURCES['../../third_party/dav1d/src/thread_task.c'].flags += ['-mstackrealign']
-    elif CONFIG['CC_TYPE'] == 'gcc':
-        CFLAGS += ['-mpreferred-stack-boundary=5']
-        SOURCES['../../third_party/dav1d/src/lib.c'].flags += ['-mincoming-stack-boundary=4']
-        SOURCES['../../third_party/dav1d/src/thread_task.c'].flags += ['-mincoming-stack-boundary=4']
+    if CONFIG['CPU_ARCH'] == 'x86_64':
+        # Update stack aligment to 32 bytes
+        if CONFIG['CC_TYPE'] == 'clang':
+            CFLAGS += ['-mstack-alignment=32']
+            SOURCES['../../third_party/dav1d/src/lib.c'].flags += ['-mstackrealign']
+            SOURCES['../../third_party/dav1d/src/thread_task.c'].flags += ['-mstackrealign']
+        elif CONFIG['CC_TYPE'] == 'gcc':
+            CFLAGS += ['-mpreferred-stack-boundary=5']
+            SOURCES['../../third_party/dav1d/src/lib.c'].flags += ['-mincoming-stack-boundary=4']
+            SOURCES['../../third_party/dav1d/src/thread_task.c'].flags += ['-mincoming-stack-boundary=4']
 
 # common sources
 SOURCES += [
     '../../third_party/dav1d/src/cdf.c',
     '../../third_party/dav1d/src/cpu.c',
     '../../third_party/dav1d/src/data.c',
     '../../third_party/dav1d/src/decode.c',
     '../../third_party/dav1d/src/dequant_tables.c',