From 8fedaacddf1da926ab191245e2b22aac878eb691 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 12 Mar 2019 14:58:18 +0100 Subject: [PATCH] AV1 build patches --- firefox.spec | 4 +++ mozilla-1515641-av1-build-1.patch | 43 +++++++++++++++++++++++++++++++ mozilla-1515641-av1-build-2.patch | 32 +++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 mozilla-1515641-av1-build-1.patch create mode 100644 mozilla-1515641-av1-build-2.patch diff --git a/firefox.spec b/firefox.spec index 9909fd2..9fd574c 100644 --- a/firefox.spec +++ b/firefox.spec @@ -130,6 +130,8 @@ Patch37: build-jit-atomic-always-lucky.patch Patch38: build-cacheFlush-missing.patch Patch40: build-aarch64-skia.patch Patch41: build-disable-elfhack.patch +Patch42: mozilla-1515641-av1-build-1.patch +Patch43: mozilla-1515641-av1-build-2.patch # Fedora specific patches Patch215: firefox-enable-addons.patch @@ -326,6 +328,8 @@ This package contains results of tests executed during build. %patch41 -p1 -b .disable-elfhack %endif %patch3 -p1 -b .arm +%patch42 -p1 -b .mozilla-1515641 +%patch43 -p1 -b .mozilla-1515641 # Fedora patches %patch215 -p1 -b .addons diff --git a/mozilla-1515641-av1-build-1.patch b/mozilla-1515641-av1-build-1.patch new file mode 100644 index 0000000..c5b9ed8 --- /dev/null +++ b/mozilla-1515641-av1-build-1.patch @@ -0,0 +1,43 @@ + +# HG changeset patch +# User Mike Hommey +# Date 1549401545 0 +# Node ID 9820df609ddf5ecda41c78d2535eca1aa33e8234 +# Parent bdd5fb080b54e421753d6ab7587c91d8522c6690 +Bug 1515641 - Turn --enable-av1 around. r=nalexander + +AV1 is actually enabled everywhere by default (except 32-bits Windows +when building with MSVC), so let's make the option --disable-av1 rather +than --enable-av1. Also, since AV1 is backed by both libaom and +libdav1d, remove mentions to libaom. + +Differential Revision: https://phabricator.services.mozilla.com/D18294 + +diff --git a/toolkit/moz.configure b/toolkit/moz.configure +--- a/toolkit/moz.configure ++++ b/toolkit/moz.configure +@@ -415,20 +415,20 @@ def ffmpeg(value, target): + enabled = target.os not in ('Android', 'WINNT') + if enabled: + return True + + set_config('MOZ_FFMPEG', ffmpeg) + set_define('MOZ_FFMPEG', ffmpeg) + imply_option('--enable-fmp4', ffmpeg, '--enable-ffmpeg') + +-# Libaom AV1 Video Codec Support ++# AV1 Video Codec Support + # ============================================================== +-option('--enable-av1', +- help='Enable libaom for av1 video support') ++option('--disable-av1', ++ help='Disable av1 video support') + + @depends('--enable-av1', target, c_compiler) + def av1(value, target, c_compiler): + enabled = bool(value) + if value.origin == 'default': + if target.os == 'WINNT' and target.cpu == 'x86' and \ + c_compiler and c_compiler.type == 'msvc': + enabled = False + diff --git a/mozilla-1515641-av1-build-2.patch b/mozilla-1515641-av1-build-2.patch new file mode 100644 index 0000000..bcfc380 --- /dev/null +++ b/mozilla-1515641-av1-build-2.patch @@ -0,0 +1,32 @@ +diff -up firefox-66.0/media/libdav1d/moz.build.mozilla-1515641 firefox-66.0/media/libdav1d/moz.build +--- firefox-66.0/media/libdav1d/moz.build.mozilla-1515641 2019-03-12 14:51:09.102398904 +0100 ++++ firefox-66.0/media/libdav1d/moz.build 2019-03-12 14:52:12.601193367 +0100 +@@ -25,7 +25,7 @@ SOURCES += [ + ] + + # Enable ASM build only on Linux for now. +-if CONFIG['OS_TARGET'] == 'Linux' and (CONFIG['CPU_ARCH'] in ('x86', 'x86_64')): ++if CONFIG['MOZ_DAV1D_ASM']: + # Default stack aligment is 16 bytes + DIRS += ['asm'] + +diff -up firefox-66.0/toolkit/moz.configure.mozilla-1515641 firefox-66.0/toolkit/moz.configure +--- firefox-66.0/toolkit/moz.configure.mozilla-1515641 2019-03-12 14:51:09.101398907 +0100 ++++ firefox-66.0/toolkit/moz.configure 2019-03-12 14:51:09.103398901 +0100 +@@ -437,6 +437,16 @@ def av1(value, target, c_compiler): + if enabled: + return True + ++@depends(target, nasm_version, when=av1 & compile_environment) ++def dav1d_asm(target, nasm_version): ++ if target.os == 'GNU' and target.kernel == 'Linux' and target.cpu in ('x86', 'x86_64'): ++ if nasm_version < '2.13': ++ die('nasm 2.13 or greater is required for AV1 support. ' ++ 'Either install nasm or add --disable-av1 to your configure options.') ++ return True ++ ++ ++set_config('MOZ_DAV1D_ASM', dav1d_asm) + set_config('MOZ_AV1', av1) + set_define('MOZ_AV1', av1) +