Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Thomas Orgis (6c01ad4e91e29a13d6a86ffb87280bf021cef046)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Thomas Orgis <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Thomas Orgis (6c01ad4e91e29a13d6a86ffb87280bf021cef046)
  • Date: Fri, 1 Jul 2022 10:09:19 +0000

GIT changes to master grimoire by Thomas Orgis <sobukus AT sourcemage.org>:

http/firefox-esr/BUILD
| 20
http/firefox-esr/CONFIGURE
| 6
http/firefox-esr/CONFLICTS
| 10
http/firefox-esr/DEPENDS
| 82 +-
http/firefox-esr/DETAILS
| 6
http/firefox-esr/HISTORY
| 6
http/firefox-esr/INSTALL
| 4
http/firefox-esr/PRE_BUILD
| 1
http/firefox-esr/firefox
| 16
http/firefox-esr/mozconfig
| 5
http/firefox-esr/patches/.0026-Disable-FFVPX-with-VA-API.patch.swp
|binary
http/firefox-esr/patches/0001-Don-t-use-build-id.patch
| 54 +
http/firefox-esr/patches/0002-Fortify-sources-properly.patch
| 41 +
http/firefox-esr/patches/0003-Check-additional-plugins-dir.patch
| 58 ++
http/firefox-esr/patches/0004-bmo-847568-Support-system-harfbuzz.patch
| 181 ++++++
http/firefox-esr/patches/0005-bmo-847568-Support-system-graphite2.patch
| 208 +++++++
http/firefox-esr/patches/0006-bmo-1559213-Support-system-av1.patch
| 114 ++++

http/firefox-esr/patches/0007-bmo-878089-Don-t-fail-when-TERM-is-not-set.patch
| 36 +
http/firefox-esr/patches/0008-bmo-1516803-Fix-building-sandbox.patch
| 28 +

http/firefox-esr/patches/0009-musl-Add-alternate-name-for-private-siginfo-struct-m.patch
| 35 +
http/firefox-esr/patches/0010-musl-Fix-syscall-wrappers.patch
| 42 +

http/firefox-esr/patches/0011-musl-Only-use-system-heap-reporter-with-glibc.patch
| 33 +

http/firefox-esr/patches/0012-musl-Set-pthread-name-for-non-glibc-systems.patch
| 29 +

http/firefox-esr/patches/0013-musl-getcontext-is-only-avaliable-on-glibc-systems.patch
| 28 +

http/firefox-esr/patches/0014-musl-sys-auvx.h-avaliable-on-more-then-just-glibc-sy.patch
| 51 +

http/firefox-esr/patches/0015-musl-make-SYS_fork-non-fatal-musl-uses-it-for-fork-2.patch
| 28 +

http/firefox-esr/patches/0016-musl-include-net-if.h-before-linux-if.h-to-avoid-red.patch
| 27
http/firefox-esr/patches/0017-Make-PGO-use-toolchain.patch
| 33 +

http/firefox-esr/patches/0018-bmo-1516081-Disable-watchdog-during-PGO-builds.patch
| 55 +

http/firefox-esr/patches/0019-bmo-1516803-force-one-LTO-partition-for-sandbox-when.patch
| 32 +
http/firefox-esr/patches/0020-Fix-building-with-PGO-when-using-GCC.patch
| 84 +++

http/firefox-esr/patches/0021-libaom-Use-NEON_FLAGS-instead-of-VPX_ASFLAGS-for-lib.patch
| 28 +
http/firefox-esr/patches/0022-build-Disable-Werror.patch
| 13

http/firefox-esr/patches/0023-LTO-Only-enable-LTO-for-Rust-when-complete-build-use.patch
| 34 +
http/firefox-esr/patches/0024-Disable-FFVPX-with-VA-API.patch
| 91 +++

http/firefox-esr/patches/0025-Enable-FLAC-on-platforms-without-ffvpx-via-ffmpeg.patch
| 36 +

http/firefox-esr/patches/0026-bmo-1670333-OpenH264-Fix-decoding-if-it-starts-on-no.patch
| 96 +++

http/firefox-esr/patches/0027-bmo-1663844-OpenH264-Allow-using-OpenH264-GMP-decode.patch
| 35 +
http/firefox-esr/patches/0028-bgo-816975-fix-build-on-x86.patch
| 16
http/firefox-esr/patches/0029-bmo-1559213-fix-system-av1-libs.patch
| 22
http/firefox-esr/patches/0030-bmo-1196777-Set-GDK_FOCUS_CHANGE_MASK.patch
| 13
http/firefox-esr/patches/0031-bmo-1773259-cbindgen-root_clip_chain-fix.patch
| 16
http/firefox-esr/patches/0032-p03-bmo-1752494-vaapi-fixes-D147874.patch
| 64 ++
http/firefox-esr/patches/0033-bmo-1735929-webgl-nvidia-p1-D147635.patch
| 125 ++++
http/firefox-esr/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch
| 278 ++++++++++
http/firefox-esr/patches/0035-bmo-1735929-webgl-nvidia-p3-D147637.patch
| 139 +++++
http/firefox-esr/patches/0036-bmo-1773968-webgl-memory-leak.patch
| 80 ++
http/firefox-esr/patches/0037-bmo-1758948-vaapi-fixes-p2-p4.patch
| 28 +
http/firefox-esr/patches/0038-bmo-1773377-vaapi-fixes-p2-p2-D148946.patch
| 250 ++++++++
http/firefox-esr/patches/0039-bmo-1774075-vaapi-fixes-p2-p3-D149238.patch
| 34 +
http/firefox-esr/patches/0040-bmo-1774271-vaapi-fixes-p2-p5.patch
| 154 +++++
http/firefox-esr/patches/0041-p01-bmo-1772719-build-wayland-only.patch
| 36 +

http/firefox-esr/patches/0042-p02-bmo-1772721-build-wayland-only-D148496fixed.patch
| 84 +++
http/firefox-esr/patches/0043-p02-bmo-1772721-build-wayland-only.patch
| 25

http/firefox-esr/patches/0044-p03-bmo-1772513-build-wayland-only-D148256.patch
| 207 +++++++

http/firefox-esr/patches/0045-p04-bmo-1772513-build-wayland-only-D148257.patch
| 14

http/firefox-esr/patches/0046-p05-bmo-1776724-build-wayland-only-D150485.patch
| 115 ++++
http/firefox-esr/patches/0047-bmo-1754469-memory_mozalloc_throw.patch
| 69 ++
http/firefox-esr/patches/0048-bmo-1769631-python-3.11-compatibility.patch
| 208 +++++++
http/firefox-esr/patches/2003_blessings_TERM.patch
| 29 -
http/firefox-esr/patches/2004_fix_sandbox_lto.patch
| 26
http/firefox-esr/patches/2006_pgo_gcc_spellchecker.patch
| 21
http/firefox-esr/patches/2007_arm-fp-wasm-fixes.patch
| 34 -
http/firefox-esr/patches/2012_allow-non-ascii-chars.patch
| 15
http/firefox-esr/patches/6003_fix_syscall_wrappers_on_musl.patch
| 47 -
http/firefox-esr/patches/6004_musl_memory_report.patch
| 22
http/firefox-esr/patches/6006_musl_fix_tools.patch
| 17
http/firefox-esr/patches/7000_sys_auxv_non_glibc.patch
| 67 --
http/firefox-esr/patches/7001_make-pgo-use-toolchain.patch
| 32 -
69 files changed, 3596 insertions(+), 377 deletions(-)

New commits:
commit 6c01ad4e91e29a13d6a86ffb87280bf021cef046
Author: Thomas Orgis <sobukus AT sourcemage.org>
Commit: Thomas Orgis <sobukus AT sourcemage.org>

firefox-esr: version 102.0

This copies the current state of the firefox spell with small
modifications,
some of which are to be merged back. In future, the firefox-esr spell
should
come into existence as a simple copy of the firefox spell at the
appropriate
point in time, only excluding the DETAILS file, which we also might adapt
in future to have an ESR switch in it.

diff --git a/http/firefox-esr/BUILD b/http/firefox-esr/BUILD
index 6a2e829..525b1f3 100755
--- a/http/firefox-esr/BUILD
+++ b/http/firefox-esr/BUILD
@@ -11,9 +11,21 @@ unset DBUS_SESSION_BUS_ADDRESS \
XAUTHORITY &&
export LIBGL_ALWAYS_INDIRECT=1 &&

+# disable end of build notification
+export MOZ_NOSPAM=1 &&
+
# System rustc has no debuginfo
export RUSTFLAGS="-C debuginfo=0" &&

+export MOZBUILD_STATE_PATH="${SOURCE_DIRECTORY}/mozbuild" &&
+
+#
+# No fast optimization for Mozilla, bit us so many times...
+# This used to default to -O2, but that produces crashing firefox for
+# sobukus with gcc-5.2.0; -Os seems more safe.
+CFLAGS="${CFLAGS//-O[3s]/-O2}" &&
+CXXFLAGS="${CXXFLAGS//-O[3s]/-O2}" &&
+
# harden
LDFLAGS="$LDFLAGS -Wl,-z,now" &&

@@ -38,9 +50,15 @@ if [[ $gccmajor == "4" ]] && [[ $gccminor -ge "6" ]]; then
CXXFLAGS="${CXXFLAGS//-mavx} -mno-avx"
fi

+if test -z "$FIREFOX_AUDIO"; then
+ OPTS+=" --disable-audio-backends"
+else
+ OPTS+=" --enable-audio-backends=${FIREFOX_AUDIO// /,}"
+fi &&
+
for option in $OPTS; do
echo "ac_add_options $option" >> .mozconfig
done &&

echo "mk_add_options MOZ_MAKE_FLAGS=\"-j${MAKE_NJOBS:-1}\"" >> .mozconfig &&
-./mach build
+MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none ./mach build
diff --git a/http/firefox-esr/CONFIGURE b/http/firefox-esr/CONFIGURE
index c850756..2a0ad0c 100755
--- a/http/firefox-esr/CONFIGURE
+++ b/http/firefox-esr/CONFIGURE
@@ -16,6 +16,8 @@ config_query FIREFOX_SDK \
n &&
config_query FIREFOX_PGO \
'Enable profile guided optimizations (takes twice as
long to build)?' \
- n
+ n &&
config_query FIREFOX_WIDEVINE \
- 'Enable Widevine DRM' n
+ 'Enable Widevine DRM' n &&
+config_query_multi FIREFOX_AUDIO "Select the audio backends:" \
+ alsa pulse jack
diff --git a/http/firefox-esr/CONFLICTS b/http/firefox-esr/CONFLICTS
index db109b6..005c1da 100755
--- a/http/firefox-esr/CONFLICTS
+++ b/http/firefox-esr/CONFLICTS
@@ -1 +1,9 @@
-conflicts firefox
+# File should work unmodified for both firefox and firefox-esr.
+case "$SPELL" in
+ firefox)
+ conflicts firefox-esr
+ ;;
+ firefox-esr)
+ conflicts firefox
+ ;;
+esac
diff --git a/http/firefox-esr/DEPENDS b/http/firefox-esr/DEPENDS
index 1ba0ee0..76192da 100755
--- a/http/firefox-esr/DEPENDS
+++ b/http/firefox-esr/DEPENDS
@@ -5,11 +5,10 @@ depends -sub "CLANG" llvm
&&
depends perl &&
depends python3 &&

-#depends icu "--with-system-icu" &&
+depends icu "--with-system-icu" &&

depends glib2 &&
depends gtk+3 "--enable-default-toolkit=cairo-gtk3" &&
-depends gtk+2 &&
depends atk &&
depends libx11 &&
depends libxext &&
@@ -21,7 +20,7 @@ depends pango
&&
depends fontconfig &&
depends freetype2 &&
depends libxft &&
-
+
depends tar &&
depends unzip &&
depends zip &&
@@ -36,7 +35,7 @@ depends libwebp "--with-system-webp"
&&

depends nspr "--with-system-nspr" &&

-local NSS_BRANCH="3.56" &&
+local NSS_BRANCH="3.79" &&
if spell_ok nss &&
is_version_less "$(installed_version nss)" "${NSS_BRANCH}"; then
depends -sub "${NSS_BRANCH}" nss "--with-system-nss"
@@ -44,8 +43,8 @@ else
depends nss "--with-system-nss"
fi &&

-#depends -sub "TSAFE SECURE_DELETE ENABLE_UNLOCK_NOTIFY ENABLE_DBSTAT_VTAB
-#SQLITE_ENABLE_FTS3" sqlite "--enable-system-sqlite" &&
+depends -sub "TSAFE SECURE_DELETE ENABLE_UNLOCK_NOTIFY ENABLE_DBSTAT_VTAB
+SQLITE_ENABLE_FTS3" sqlite &&

depends libidl &&

@@ -71,24 +70,24 @@ optional_depends wireless_tools \
"--disable-necko-wifi" \
"for Necko WiFi scanning" &&

-optional_depends pulseaudio \
- "--enable-pulseaudio" \
- "--disable-pulseaudio" \
- "use pulseaudio for audio support" &&
-
-# Firefox is currently borked and does not compile without alsa-lib headers,
-# this should have been fixed when Firefox started using Mozilla core 23,
but it
-# wasn't see https://bugzilla.mozilla.org/show_bug.cgi?id=875268
-depends alsa-lib "--enable-alsa" &&
-#optional_depends alsa-lib \
-# '--enable-wave' \
-# '--disable-wave --disable-ogg --disable-webm
--disable-dash' \
-# 'for audio/video support' &&
-
-optional_depends JACK-DRIVER \
- "--enable-jack" \
- "--disable-jack" \
- "use JACK for audio support" &&
+for b in $FIREFOX_AUDIO
+do
+ case $b in
+ alsa)
+ depends alsa-lib
+ ;;
+ pulse)
+ depends pulseaudio
+ ;;
+ jack)
+ depends JACK-DRIVER
+ ;;
+ *)
+ message "${MESSAGE_COLOR}Bad audio choice: $b${DEFAULT_COLOR}"
+ exit 1
+ ;;
+ esac
+done &&

if is_depends_enabled $SPELL alsa-lib; then
# Firefox tries to use ogg/ogg.h even with --disable-ogg given
@@ -115,28 +114,27 @@ depends dbus-glib "--enable-dbus" &&
# 'for WebGL support' &&
depends OPENGL &&

-optional_depends LIBAVCODEC \
- "--enable-ffmpeg" \
- "--disable-ffmpeg" \
- "for fragmented H264/AAC decoding" &&
+depends LIBAVCODEC &&

suggest_depends_2 firefox-smglwiki "" "" \
"to enable searching the SMGL Wiki from the Search Bar"

-#optional_depends graphite2 \
-# "--with-system-graphite2" \
-# "--without-system-graphite2" \
-# "for system graphite2" &&
-#
-#optional_depends harfbuzz \
-# "--with-system-harfbuzz" \
-# "--without-system-harfbuzz" \
-# "for system harfbuzz" &&
-#
-optional_depends dav1d \
- "--enable-av1" \
- "--disable-av1" \
- "for AV1 video support" &&
+optional_depends graphite2 \
+ "--with-system-graphite2" \
+ "--without-system-graphite2" \
+ "for system graphite2" &&
+
+optional_depends harfbuzz \
+ "--with-system-harfbuzz" \
+ "--without-system-harfbuzz" \
+ "for system harfbuzz" &&
+
+# Seems FF wants libaom along with this. Package that, too,
+# or just roll with the vendored copy.
+#optional_depends dav1d \
+# "--with-system-av1" \
+# "--without-system-av1" \
+# "for AV1 video support" &&
if is_depends_enabled $SPELL dav1d; then
depends nasm
fi
diff --git a/http/firefox-esr/DETAILS b/http/firefox-esr/DETAILS
index d945a73..7ef2cb3 100755
--- a/http/firefox-esr/DETAILS
+++ b/http/firefox-esr/DETAILS
@@ -1,10 +1,10 @@
SPELL=firefox-esr
SPELLX=firefox
- VERSION=78.9.0esr
- SECURITY_PATCH=148
+ VERSION=102.0esr
+ SECURITY_PATCH=165
SOURCE="${SPELLX}-${VERSION}.source.tar.xz"

SOURCE_URL[0]="http://releases.mozilla.org/pub/${SPELLX}/releases/${VERSION}/source/${SOURCE}";
-
SOURCE_HASH="sha512:28582fc0a03fb50c0a817deb1083817bb7f2f5d38e98439bf655ed4ee18c83568b3002a59ef76edf357bfb11f55832a221d14130f116aac19d850768fba3ac8b"
+
SOURCE_HASH="sha512:76494363ffdbd33b61912ac72b5cc15450e4b2936898c84fcf3980ccfa6d7ecc05524a63a60827d6caba999ada5cfd6f121e893ba0587778ce11654d0daf21d7"
SOURCE_DIRECTORY="${BUILD_DIRECTORY}/${SPELLX}-${VERSION%esr}"
WEB_SITE=https://www.mozilla.org/en-US/firefox/fx/
GATHER_DOCS=off
diff --git a/http/firefox-esr/HISTORY b/http/firefox-esr/HISTORY
index 7d02d27..7077f67 100644
--- a/http/firefox-esr/HISTORY
+++ b/http/firefox-esr/HISTORY
@@ -1,3 +1,9 @@
+2022-07-01 Thomas Orgis <sobukus AT orgis.org>
+ * */: re-freshed from firefox spell for 102.0esr
+ INSTALL: also avoid downloading python stuff for install
+ CONFLICTS, INSTALL: prepare for merging back, unified files
+ for both firefox and firefox-esr
+
2021-05-05 Thomas Orgis <sobukus AT sourcemage.org>
* DETAILS: version 78.9.0, ++SECURITY_PATCH
* SCRIBBLED: get rid of that accident
diff --git a/http/firefox-esr/INSTALL b/http/firefox-esr/INSTALL
index 2899a7c..320ebb0 100755
--- a/http/firefox-esr/INSTALL
+++ b/http/firefox-esr/INSTALL
@@ -6,12 +6,12 @@ if spell_ok Firebird; then
dispel Firebird
fi &&

-./mach install &&
+MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none ./mach install &&

#
# Script to set MOZILLA_FIVE_HOME
#
-cp -v $SPELL_DIRECTORY/firefox.sh $INSTALL_ROOT/etc/profile.d &&
+cp -v $SPELL_DIRECTORY/${SPELL/-esr/}.sh $INSTALL_ROOT/etc/profile.d &&

#
# Create symlink to mozilla for hardwired applications
diff --git a/http/firefox-esr/PRE_BUILD b/http/firefox-esr/PRE_BUILD
index f6e1951..13d1943 100755
--- a/http/firefox-esr/PRE_BUILD
+++ b/http/firefox-esr/PRE_BUILD
@@ -16,6 +16,7 @@ if [[ "$FIREFOX_STRIP" == "y" ]]; then
else
echo 'ac_add_options --disable-install-strip'
echo 'ac_add_options --disable-strip'
+ echo 'ac_add_options --enable-debug'
echo 'ac_add_options --enable-debug-symbols'
fi >> .mozconfig &&

diff --git a/http/firefox-esr/firefox b/http/firefox-esr/firefox
deleted file mode 100644
index dd837b9..0000000
--- a/http/firefox-esr/firefox
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-#
-# Created by Eric Sandall 2004-12-09
-#
-# This script is here to set the correct LD_LIBRARY_PATH for firefox 1.0+
-# based on the information from this thread:
-# http://lists.freebsd.org/pipermail/freebsd-gnome/2004-October/008443.html
-#
-export LD_LIBRARY_PATH=/usr/lib/firefox
-
-if [ $USE_AOSS_WRAPPER ] &&
- [ -x /usr/bin/aoss ]; then
- /usr/bin/aoss /usr/lib/firefox/firefox-bin "$@"
-else
- /usr/lib/firefox/firefox-bin "$@"
-fi
diff --git a/http/firefox-esr/mozconfig b/http/firefox-esr/mozconfig
index c90cd0b..3b429b1 100644
--- a/http/firefox-esr/mozconfig
+++ b/http/firefox-esr/mozconfig
@@ -23,5 +23,10 @@ ac_add_options --prefix=${INSTALL_ROOT}/usr
ac_add_options --enable-release
ac_add_options --enable-optimize="${CXXFLAGS} -fno-fast-math"
ac_add_options --enable-rust-simd
+ac_add_options --disable-tests
+
+ac_add_options --with-distribution-id=org.sourcemage

ac_add_options --with-unsigned-addon-scopes=app,system
+
+ac_add_options --without-wasm-sandboxed-libraries
diff --git
a/http/firefox-esr/patches/.0026-Disable-FFVPX-with-VA-API.patch.swp
b/http/firefox-esr/patches/.0026-Disable-FFVPX-with-VA-API.patch.swp
new file mode 100644
index 0000000..73b00ef
Binary files /dev/null and
b/http/firefox-esr/patches/.0026-Disable-FFVPX-with-VA-API.patch.swp differ
diff --git a/http/firefox-esr/patches/0001-Don-t-use-build-id.patch
b/http/firefox-esr/patches/0001-Don-t-use-build-id.patch
new file mode 100644
index 0000000..27c2fc3
--- /dev/null
+++ b/http/firefox-esr/patches/0001-Don-t-use-build-id.patch
@@ -0,0 +1,54 @@
+From db2794973f8a5e580fbceacbfb1b6469c9f162d7 Mon Sep 17 00:00:00 2001
+From: "Jory A. Pratt" <anarchy AT gentoo.org>
+Date: Mon, 6 Apr 2020 19:14:26 +0200
+Subject: [PATCH 01/30] Don't use build id
+
+We must drop build id as it causes conflicts when merging
+thunderbird/firefox/seamonkey on same system when using
+splitdebug.
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ js/src/old-configure.in | 7 -------
+ old-configure.in | 7 -------
+ 2 files changed, 14 deletions(-)
+
+diff --git a/js/src/old-configure.in b/js/src/old-configure.in
+index 905494b784..15a7a2a852 100644
+--- a/js/src/old-configure.in
++++ b/js/src/old-configure.in
+@@ -350,13 +350,6 @@ if test "$GNU_CC"; then
+ AC_MSG_RESULT([no])
+ LDFLAGS=$_SAVE_LDFLAGS)
+
+- AC_MSG_CHECKING([for --build-id=sha1 option to ld])
+- _SAVE_LDFLAGS=$LDFLAGS
+- LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
+- AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
+- AC_MSG_RESULT([no])
+- LDFLAGS=$_SAVE_LDFLAGS)
+-
+ _DEFINES_CFLAGS="-include $jsconfdefs -DMOZILLA_CLIENT"
+ fi
+
+diff --git a/old-configure.in b/old-configure.in
+index d1479574d1..f69f5f5456 100644
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -337,13 +337,6 @@ if test "$GNU_CC"; then
+ AC_MSG_RESULT([no])
+ LDFLAGS=$_SAVE_LDFLAGS)
+
+- AC_MSG_CHECKING([for --build-id=sha1 option to ld])
+- _SAVE_LDFLAGS=$LDFLAGS
+- LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
+- AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
+- AC_MSG_RESULT([no])
+- LDFLAGS=$_SAVE_LDFLAGS)
+-
+ AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
+ HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
+ _SAVE_LDFLAGS=$LDFLAGS
+--
+2.34.1
+
diff --git a/http/firefox-esr/patches/0002-Fortify-sources-properly.patch
b/http/firefox-esr/patches/0002-Fortify-sources-properly.patch
new file mode 100644
index 0000000..3abe8b0
--- /dev/null
+++ b/http/firefox-esr/patches/0002-Fortify-sources-properly.patch
@@ -0,0 +1,41 @@
+From a1395e97ffdbc9404a343b76fd731dc7ef385ffc Mon Sep 17 00:00:00 2001
+From: "Jory A. Pratt" <anarchy AT gentoo.org>
+Date: Mon, 6 Apr 2020 19:16:36 +0200
+Subject: [PATCH 02/30] Fortify sources properly
+
+Ensure we fortify properly, features.h is pulled in via fortification.
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ config/system-headers.mozbuild | 1 -
+ third_party/sipcc/sdp_os_defs.h | 3 ---
+ 2 files changed, 4 deletions(-)
+
+diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
+index a1b58eb59b..ae0c9d6d7c 100644
+--- a/config/system-headers.mozbuild
++++ b/config/system-headers.mozbuild
+@@ -229,7 +229,6 @@ system_headers = [
+ 'execinfo.h',
+ 'extras.h',
+ 'fcntl.h',
+- 'features.h',
+ 'fenv.h',
+ 'ffi.h',
+ 'fibdef.h',
+diff --git a/third_party/sipcc/sdp_os_defs.h
b/third_party/sipcc/sdp_os_defs.h
+index 16c9b33329..df38d9336c 100644
+--- a/third_party/sipcc/sdp_os_defs.h
++++ b/third_party/sipcc/sdp_os_defs.h
+@@ -20,8 +20,5 @@
+ typedef uint8_t tinybool;
+ typedef unsigned short ushort;
+ typedef unsigned long ulong;
+-#ifndef __GNUC_STDC_INLINE__
+-#define inline
+-#endif
+
+ #endif /* _SDP_OS_DEFS_H_ */
+--
+2.34.1
+
diff --git a/http/firefox-esr/patches/0003-Check-additional-plugins-dir.patch
b/http/firefox-esr/patches/0003-Check-additional-plugins-dir.patch
new file mode 100644
index 0000000..ef66d9b
--- /dev/null
+++ b/http/firefox-esr/patches/0003-Check-additional-plugins-dir.patch
@@ -0,0 +1,58 @@
+From 4d5eb53fa2ca9eeeadbfcd2be832aa8e97d413fc Mon Sep 17 00:00:00 2001
+From: Arfrever Frehtes Taifersar Arahesis <Arfrever AT Apache.Org>
+Date: Mon, 6 Apr 2020 19:17:43 +0200
+Subject: [PATCH 03/30] Check additional plugins dir
+
+Check original plugins dir along with default plugins dir.
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ xpcom/io/nsAppFileLocationProvider.cpp | 18 +++++++++++++++++-
+ 1 file changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/xpcom/io/nsAppFileLocationProvider.cpp
b/xpcom/io/nsAppFileLocationProvider.cpp
+index ef974f9904..6261eafcc8 100644
+--- a/xpcom/io/nsAppFileLocationProvider.cpp
++++ b/xpcom/io/nsAppFileLocationProvider.cpp
+@@ -50,6 +50,7 @@
+ # define NS_MACOSX_LOCAL_PLUGIN_DIR "OSXLocalPlugins"
+ #elif XP_UNIX
+ # define NS_SYSTEM_PLUGINS_DIR "SysPlugins"
++# define NS_SYSTEM_NSBROWSER_PLUGINS_DIR "SysNsBrowserPlugins"
+ #endif
+
+ #define DEFAULTS_DIR_NAME "defaults"_ns
+@@ -172,6 +173,21 @@ nsAppFileLocationProvider::GetFile(const char* aProp,
bool* aPersistent,
+ getter_AddRefs(localFile));
+ # else
+ rv = NS_ERROR_FAILURE;
++# endif
++ } else if (nsCRT::strcmp(aProp, NS_SYSTEM_NSBROWSER_PLUGINS_DIR) == 0) {
++# ifdef ENABLE_SYSTEM_EXTENSION_DIRS
++ static const char* const sysLPlgDir =
++# if defined(HAVE_USR_LIB64_DIR) && defined(__LP64__)
++ "/usr/lib64/nsbrowser/plugins";
++# elif defined(__OpenBSD__) || defined(__FreeBSD__)
++ "/usr/local/lib/nsbrowser/plugins";
++# else
++ "/usr/lib/nsbrowser/plugins";
++# endif
++ rv = NS_NewNativeLocalFile(nsDependentCString(sysLPlgDir), false,
++ getter_AddRefs(localFile));
++# else
++ rv = NS_ERROR_FAILURE;
+ # endif
+ }
+ # endif
+@@ -418,7 +434,7 @@ nsAppFileLocationProvider::GetFiles(const char* aProp,
+ #else
+ # ifdef XP_UNIX
+ static const char* keys[] = {NS_USER_PLUGINS_DIR, NS_SYSTEM_PLUGINS_DIR,
+- nullptr};
++ NS_SYSTEM_NSBROWSER_PLUGINS_DIR, nullptr};
+ # else
+ static const char* keys[] = {NS_USER_PLUGINS_DIR, nullptr};
+ # endif
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0004-bmo-847568-Support-system-harfbuzz.patch
b/http/firefox-esr/patches/0004-bmo-847568-Support-system-harfbuzz.patch
new file mode 100644
index 0000000..37ecef5
--- /dev/null
+++ b/http/firefox-esr/patches/0004-bmo-847568-Support-system-harfbuzz.patch
@@ -0,0 +1,181 @@
+From 61e8f03c526a40dda89b57aad6aec3f37d7125cd Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Mon, 6 Apr 2020 19:32:39 +0200
+Subject: [PATCH 04/30] bmo#847568: Support system harfbuzz
+
+Allow building against system-wide harfbuzz.
+
+Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=847568
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ config/system-headers.mozbuild | 7 +++++++
+ dom/base/moz.build | 3 +++
+ gfx/moz.build | 4 +++-
+ gfx/skia/generate_mozbuild.py | 3 +++
+ gfx/skia/moz.build | 3 +++
+ gfx/thebes/moz.build | 3 +++
+ intl/unicharutil/util/moz.build | 3 +++
+ netwerk/dns/moz.build | 3 +++
+ toolkit/library/moz.build | 3 +++
+ toolkit/moz.configure | 9 +++++++++
+ 10 files changed, 40 insertions(+), 1 deletion(-)
+
+diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
+index ae0c9d6d7c..44d08cf06b 100644
+--- a/config/system-headers.mozbuild
++++ b/config/system-headers.mozbuild
+@@ -1237,6 +1237,13 @@ if CONFIG['OS_TARGET'] == 'Android':
+ 'vr/gvr/capi/include/gvr.h',
+ ]
+
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++ system_headers += [
++ 'harfbuzz/hb-glib.h',
++ 'harfbuzz/hb-ot.h',
++ 'harfbuzz/hb.h',
++ ]
++
+ if CONFIG['MOZ_JACK']:
+ system_headers += [
+ 'jack/jack.h',
+diff --git a/dom/base/moz.build b/dom/base/moz.build
+index d390adfc49..4508f19cb6 100644
+--- a/dom/base/moz.build
++++ b/dom/base/moz.build
+@@ -567,6 +567,9 @@ FINAL_LIBRARY = "xul"
+ if CONFIG["MOZ_X11"]:
+ CXXFLAGS += CONFIG["TK_CFLAGS"]
+
++if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
++ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
++
+ GeneratedFile(
+ "UseCounterList.h",
+ script="gen-usecounters.py",
+diff --git a/gfx/moz.build b/gfx/moz.build
+index 4d6d63da9d..8222b72333 100644
+--- a/gfx/moz.build
++++ b/gfx/moz.build
+@@ -10,6 +10,9 @@ with Files("**"):
+ with Files("wr/**"):
+ BUG_COMPONENT = ("Core", "Graphics: WebRender")
+
++if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
++ DIRS += ["harfbuzz/src"]
++
+ DIRS += [
+ "cairo",
+ "2d",
+@@ -20,7 +23,6 @@ DIRS += [
+ "gl",
+ "layers",
+ "graphite2/src",
+- "harfbuzz/src",
+ "ots/src",
+ "thebes",
+ "ipc",
+diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py
+index 5e0fd17d79..860b80af4f 100755
+--- a/gfx/skia/generate_mozbuild.py
++++ b/gfx/skia/generate_mozbuild.py
+@@ -96,6 +96,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
+ '-Wno-unused-private-field',
+ ]
+
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
++
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
+ LOCAL_INCLUDES += [
+ "/gfx/cairo/cairo/src",
+diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build
+index 524bd28dac..615c93b266 100755
+--- a/gfx/skia/moz.build
++++ b/gfx/skia/moz.build
+@@ -488,6 +488,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
+ '-Wno-unused-private-field',
+ ]
+
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
++
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
+ LOCAL_INCLUDES += [
+ "/gfx/cairo/cairo/src",
+diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
+index baa6f090a9..c51c36e2b4 100644
+--- a/gfx/thebes/moz.build
++++ b/gfx/thebes/moz.build
+@@ -288,6 +288,9 @@ LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
+
+ DEFINES["GRAPHITE2_STATIC"] = True
+
++if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
++ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
++
+ if CONFIG["CC_TYPE"] in ("clang", "clang-cl"):
+ # Suppress warnings from Skia header files.
+ SOURCES["gfxPlatform.cpp"].flags += ["-Wno-implicit-fallthrough"]
+diff --git a/intl/unicharutil/util/moz.build
b/intl/unicharutil/util/moz.build
+index 301eb9a854..7cece5e06c 100644
+--- a/intl/unicharutil/util/moz.build
++++ b/intl/unicharutil/util/moz.build
+@@ -25,6 +25,9 @@ UNIFIED_SOURCES += [
+ "nsUnicodeProperties.cpp",
+ ]
+
++if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
++ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
++
+ include("/ipc/chromium/chromium-config.mozbuild")
+
+ GeneratedFile(
+diff --git a/netwerk/dns/moz.build b/netwerk/dns/moz.build
+index f769e270fa..8f64710257 100644
+--- a/netwerk/dns/moz.build
++++ b/netwerk/dns/moz.build
+@@ -109,4 +109,7 @@ LOCAL_INCLUDES += [
+ "/netwerk/protocol/http",
+ ]
+
++if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
++ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
++
+ USE_LIBS += ["icu"]
+diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
+index 2c3f86948e..dd6901ba9a 100644
+--- a/toolkit/library/moz.build
++++ b/toolkit/library/moz.build
+@@ -260,6 +260,9 @@ if CONFIG["MOZ_ANDROID_GOOGLE_VR"]:
+ "-lgvr",
+ ]
+
++if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
++ OS_LIBS += CONFIG["MOZ_HARFBUZZ_LIBS"]
++
+ if CONFIG["MOZ_SYSTEM_JPEG"]:
+ OS_LIBS += CONFIG["MOZ_JPEG_LIBS"]
+
+diff --git a/toolkit/moz.configure b/toolkit/moz.configure
+index 00698656f6..1843188d11 100644
+--- a/toolkit/moz.configure
++++ b/toolkit/moz.configure
+@@ -460,6 +460,15 @@ add_old_configure_assignment(
+ )
+ set_define("MOZ_HAVE_FREETYPE2", depends_if(freetype2_info)(lambda _: True))
+
++# HarfBuzz
++# ==============================================================
++option('--with-system-harfbuzz', help="Use system harfbuzz (located with
pkgconfig)")
++
++system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 2.7.4',
++ when='--with-system-harfbuzz')
++
++set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _:
True))
++
+ # Apple platform decoder support
+ # ==============================================================
+ @depends(toolkit)
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0005-bmo-847568-Support-system-graphite2.patch
b/http/firefox-esr/patches/0005-bmo-847568-Support-system-graphite2.patch
new file mode 100644
index 0000000..74d9b24
--- /dev/null
+++ b/http/firefox-esr/patches/0005-bmo-847568-Support-system-graphite2.patch
@@ -0,0 +1,208 @@
+From a7761d4886498eaa0e83d1c9b4399632cdbf314e Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Mon, 6 Apr 2020 19:34:44 +0200
+Subject: [PATCH 05/30] bmo#847568: Support system graphite2
+
+Allow building against system-wide graphite2.
+
+Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=847568
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ config/system-headers.mozbuild | 6 ++++++
+ gfx/graphite2/geckoextra/moz.build | 21 +++++++++++++++++++++
+ gfx/graphite2/moz-gr-update.sh | 7 ++++++-
+ gfx/moz.build | 6 +++++-
+ gfx/thebes/moz.build | 5 ++++-
+ old-configure.in | 21 +++++++++++++++++++++
+ toolkit/library/moz.build | 3 +++
+ toolkit/moz.configure | 13 +++++++++++++
+ 8 files changed, 79 insertions(+), 3 deletions(-)
+ create mode 100644 gfx/graphite2/geckoextra/moz.build
+
+diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
+index 44d08cf06b..2f7ae39515 100644
+--- a/config/system-headers.mozbuild
++++ b/config/system-headers.mozbuild
+@@ -1244,6 +1244,12 @@ if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ 'harfbuzz/hb.h',
+ ]
+
++if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
++ system_headers += [
++ 'graphite2/Font.h',
++ 'graphite2/Segment.h',
++ ]
++
+ if CONFIG['MOZ_JACK']:
+ system_headers += [
+ 'jack/jack.h',
+diff --git a/gfx/graphite2/geckoextra/moz.build
b/gfx/graphite2/geckoextra/moz.build
+new file mode 100644
+index 0000000000..24e8d7a032
+--- /dev/null
++++ b/gfx/graphite2/geckoextra/moz.build
+@@ -0,0 +1,21 @@
++# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
++# vim: set filetype=python:
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distributed with this
++# file, You can obtain one at http://mozilla.org/MPL/2.0/.
++
++EXPORTS.graphite2 += [
++ 'include/GraphiteExtra.h',
++ 'include/GraphiteStructsForRLBox.h',
++]
++
++UNIFIED_SOURCES += [
++ '../geckoextra/src/GraphiteExtra.cpp',
++]
++
++CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
++
++# Match bundled graphite2 configuration
++AllowCompilerWarnings()
++
++FINAL_LIBRARY = 'gkmedias'
+diff --git a/gfx/graphite2/moz-gr-update.sh b/gfx/graphite2/moz-gr-update.sh
+index b91d9c161c..a97e6eb203 100755
+--- a/gfx/graphite2/moz-gr-update.sh
++++ b/gfx/graphite2/moz-gr-update.sh
+@@ -1,6 +1,7 @@
+ #!/bin/bash
+
+ # Script used to update the Graphite2 library in the mozilla source tree
++# and bump version for --with-system-graphite2
+
+ # This script lives in gfx/graphite2, along with the library source,
+ # but must be run from the top level of the mozilla-central tree.
+@@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >>
gfx/graphite2/README.mozilla
+ #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e
"s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
+ #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e
"s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
+
++# chase version for --with-system-graphite2
++perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
++ if /GR2_VERSION_REQUIRE/" old-configure.in
++
+ # summarize what's been touched
+ echo Updated to $RELEASE.
+ echo Here is what changed in the gfx/graphite2 directory:
+ echo
+
+-hg stat gfx/graphite2
++hg stat old-configure.in gfx/graphite2
+
+ echo
+ echo If gfx/graphite2/src/files.mk has changed, please make corresponding
+diff --git a/gfx/moz.build b/gfx/moz.build
+index 8222b72333..16a2b401db 100644
+--- a/gfx/moz.build
++++ b/gfx/moz.build
+@@ -10,6 +10,11 @@ with Files("**"):
+ with Files("wr/**"):
+ BUG_COMPONENT = ("Core", "Graphics: WebRender")
+
++if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
++ DIRS += ["graphite2/geckoextra"]
++else:
++ DIRS += ["graphite2/src"]
++
+ if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ DIRS += ["harfbuzz/src"]
+
+@@ -22,7 +27,6 @@ DIRS += [
+ "qcms",
+ "gl",
+ "layers",
+- "graphite2/src",
+ "ots/src",
+ "thebes",
+ "ipc",
+diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
+index c51c36e2b4..4f02a9e2a5 100644
+--- a/gfx/thebes/moz.build
++++ b/gfx/thebes/moz.build
+@@ -286,7 +286,10 @@ if CONFIG["MOZ_WAYLAND"]:
+
+ LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
+
+-DEFINES["GRAPHITE2_STATIC"] = True
++if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
++ CXXFLAGS += CONFIG["MOZ_GRAPHITE2_CFLAGS"]
++else:
++ DEFINES["GRAPHITE2_STATIC"] = True
+
+ if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
+diff --git a/old-configure.in b/old-configure.in
+index f69f5f5456..1c1c8ecef3 100644
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -2204,6 +2204,27 @@ if test "$USE_FC_FREETYPE"; then
+ fi
+ fi
+
++dnl ========================================================
++dnl Check for graphite2
++dnl ========================================================
++if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
++ dnl graphite2.pc has bogus version, check manually
++ _SAVE_CFLAGS=$CFLAGS
++ CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
++ AC_TRY_COMPILE([ #include <graphite2/Font.h>
++ #define GR2_VERSION_REQUIRE(major,minor,bugfix) \
++ ( GR2_VERSION_MAJOR * 10000 +
GR2_VERSION_MINOR \
++ * 100 + GR2_VERSION_BUGFIX >= \
++ (major) * 10000 + (minor) * 100 + (bugfix) )
++ ], [
++ #if !GR2_VERSION_REQUIRE(1,3,8)
++ #error "Insufficient graphite2 version."
++ #endif
++ ], [],
++ [AC_MSG_ERROR([--with-system-graphite2 requested but no
working libgraphite2 found])])
++ CFLAGS=$_SAVE_CFLAGS
++fi
++
+ dnl ========================================================
+ dnl Check if we need the 32-bit Linux SSE2 error dialog
+ dnl ========================================================
+diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
+index dd6901ba9a..be73ac4bee 100644
+--- a/toolkit/library/moz.build
++++ b/toolkit/library/moz.build
+@@ -260,6 +260,9 @@ if CONFIG["MOZ_ANDROID_GOOGLE_VR"]:
+ "-lgvr",
+ ]
+
++if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
++ OS_LIBS += CONFIG["MOZ_GRAPHITE2_LIBS"]
++
+ if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ OS_LIBS += CONFIG["MOZ_HARFBUZZ_LIBS"]
+
+diff --git a/toolkit/moz.configure b/toolkit/moz.configure
+index 1843188d11..a68e1b347d 100644
+--- a/toolkit/moz.configure
++++ b/toolkit/moz.configure
+@@ -460,6 +460,19 @@ add_old_configure_assignment(
+ )
+ set_define("MOZ_HAVE_FREETYPE2", depends_if(freetype2_info)(lambda _: True))
+
++# Graphite2
++# ==============================================================
++option('--with-system-graphite2', help="Use system graphite2 (located with
pkgconfig)")
++
++@depends('--with-system-graphite2')
++def check_for_graphite2(value):
++ return bool(value)
++
++system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2',
++ when=check_for_graphite2)
++
++set_config('MOZ_SYSTEM_GRAPHITE2', depends_if(system_graphite2)(lambda _:
True))
++
+ # HarfBuzz
+ # ==============================================================
+ option('--with-system-harfbuzz', help="Use system harfbuzz (located with
pkgconfig)")
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0006-bmo-1559213-Support-system-av1.patch
b/http/firefox-esr/patches/0006-bmo-1559213-Support-system-av1.patch
new file mode 100644
index 0000000..e894258
--- /dev/null
+++ b/http/firefox-esr/patches/0006-bmo-1559213-Support-system-av1.patch
@@ -0,0 +1,114 @@
+From 8a4627c0c910415b00bebeb976dc6ea8c3e0d5d0 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Mon, 6 Apr 2020 19:36:02 +0200
+Subject: [PATCH 06/30] bmo#1559213: Support system av1
+
+Allow building against system-wide av1.
+
+Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559213
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ config/external/moz.build | 5 +++--
+ config/system-headers.mozbuild | 8 ++++++++
+ dom/media/platforms/moz.build | 5 +++++
+ toolkit/moz.configure | 20 ++++++++++++++++++--
+ 4 files changed, 34 insertions(+), 4 deletions(-)
+
+diff --git a/config/external/moz.build b/config/external/moz.build
+index ab771212bf..75595d999c 100644
+--- a/config/external/moz.build
++++ b/config/external/moz.build
+@@ -49,8 +49,9 @@ if not CONFIG["MOZ_SYSTEM_LIBVPX"]:
+ external_dirs += ["media/libvpx"]
+
+ if CONFIG["MOZ_AV1"]:
+- external_dirs += ["media/libaom"]
+- external_dirs += ["media/libdav1d"]
++ if not CONFIG["MOZ_SYSTEM_AV1"]:
++ external_dirs += ["media/libaom"]
++ external_dirs += ["media/libdav1d"]
+
+ if not CONFIG["MOZ_SYSTEM_PNG"]:
+ external_dirs += ["media/libpng"]
+diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
+index 2f7ae39515..96ab3a6466 100644
+--- a/config/system-headers.mozbuild
++++ b/config/system-headers.mozbuild
+@@ -1301,6 +1301,14 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
+ 'proxy.h',
+ ]
+
++if CONFIG['MOZ_SYSTEM_AV1']:
++ system_headers += [
++ 'aom/aom_decoder.h',
++ 'aom/aomdx.h',
++ 'aom/aom_image.h',
++ 'dav1d/dav1d.h',
++ ]
++
+ if CONFIG['MOZ_SYSTEM_LIBVPX']:
+ system_headers += [
+ 'vpx_mem/vpx_mem.h',
+diff --git a/dom/media/platforms/moz.build b/dom/media/platforms/moz.build
+index 8509aec6ef..7c5a1df63d 100644
+--- a/dom/media/platforms/moz.build
++++ b/dom/media/platforms/moz.build
+@@ -78,6 +78,11 @@ if CONFIG["MOZ_AV1"]:
+ "agnostic/AOMDecoder.cpp",
+ "agnostic/DAV1DDecoder.cpp",
+ ]
++ if CONFIG["MOZ_SYSTEM_AV1"]:
++ CXXFLAGS += CONFIG["MOZ_SYSTEM_LIBAOM_CFLAGS"]
++ OS_LIBS += CONFIG["MOZ_SYSTEM_LIBAOM_LIBS"]
++ CXXFLAGS += CONFIG["MOZ_SYSTEM_LIBDAV1D_CFLAGS"]
++ OS_LIBS += CONFIG["MOZ_SYSTEM_LIBDAV1D_LIBS"]
+
+ if CONFIG["MOZ_OMX"]:
+ EXPORTS += [
+diff --git a/toolkit/moz.configure b/toolkit/moz.configure
+index a68e1b347d..7b7975bd12 100644
+--- a/toolkit/moz.configure
++++ b/toolkit/moz.configure
+@@ -544,14 +544,29 @@ def av1(value):
+ if value:
+ return True
+
++option("--with-system-av1", help="Use system av1 (located with pkg-config)")
+
+-@depends(target, when=av1 & compile_environment)
++system_libaom_info = pkg_check_modules('MOZ_SYSTEM_LIBAOM', 'aom >= 1.0.0',
++ when='--with-system-av1')
++
++system_libdav1d_info = pkg_check_modules('MOZ_SYSTEM_LIBDAV1D', 'dav1d >=
0.1.1',
++ when='--with-system-av1')
++
++@depends(system_libaom_info, system_libdav1d_info)
++def system_av1(system_libaom_info, system_libdav1d_info):
++ has_av1_libs = False
++ if system_libaom_info and system_libdav1d_info:
++ has_av1_libs = True
++ return has_av1_libs
++
++
++@depends(target, when=av1 & depends(system_av1)(lambda v: not v) &
compile_environment)
+ def dav1d_asm(target):
+ if target.cpu in ("aarch64", "x86", "x86_64"):
+ return True
+
+
+-@depends(target, when=av1 & compile_environment)
++@depends(target, when=av1 & depends(system_av1)(lambda v: not v) &
compile_environment)
+ def dav1d_nasm(target):
+ if target.cpu in ("x86", "x86_64"):
+ return namespace(version="2.14", what="AV1")
+@@ -561,6 +576,7 @@ set_config("MOZ_DAV1D_ASM", dav1d_asm)
+ set_define("MOZ_DAV1D_ASM", dav1d_asm)
+ set_config("MOZ_AV1", av1)
+ set_define("MOZ_AV1", av1)
++set_config("MOZ_SYSTEM_AV1", depends_if(system_av1)(lambda _: True))
+
+ # JXL Image Codec Support
+ # ==============================================================
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0007-bmo-878089-Don-t-fail-when-TERM-is-not-set.patch

b/http/firefox-esr/patches/0007-bmo-878089-Don-t-fail-when-TERM-is-not-set.patch
new file mode 100644
index 0000000..6b1cde0
--- /dev/null
+++
b/http/firefox-esr/patches/0007-bmo-878089-Don-t-fail-when-TERM-is-not-set.patch
@@ -0,0 +1,36 @@
+From e43f7431036904989cfd520f19de28a72be97ad9 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Mon, 6 Apr 2020 19:41:43 +0200
+Subject: [PATCH 08/30] bmo#878089: Don't fail when TERM is not set
+
+Link: https://github.com/erikrose/blessings/pull/137
+Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=878089
+Bug: https://bugs.gentoo.org/654316
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ third_party/python/blessings/blessings/__init__.py | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/third_party/python/blessings/blessings/__init__.py
b/third_party/python/blessings/blessings/__init__.py
+index 388cece0b8..1283460cc9 100644
+--- a/third_party/python/blessings/blessings/__init__.py
++++ b/third_party/python/blessings/blessings/__init__.py
+@@ -94,8 +94,13 @@ class Terminal(object):
+ # init sequences to the stream if it has a file descriptor, and
+ # send them to stdout as a fallback, since they have to go
+ # somewhere.
+- setupterm(kind or environ.get('TERM', 'unknown'),
+- self._init_descriptor)
++ try:
++ setupterm(kind or environ.get('TERM', 'dumb') or 'dumb',
++ self._init_descriptor)
++ except curses.error:
++ # There was an error setting up the terminal, either curses
is
++ # not supported or TERM is incorrectly set. Fall back to
dumb.
++ self._does_styling = False
+
+ self.stream = stream
+
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0008-bmo-1516803-Fix-building-sandbox.patch
b/http/firefox-esr/patches/0008-bmo-1516803-Fix-building-sandbox.patch
new file mode 100644
index 0000000..24333b2
--- /dev/null
+++ b/http/firefox-esr/patches/0008-bmo-1516803-Fix-building-sandbox.patch
@@ -0,0 +1,28 @@
+From 6eeeca1b673a60d3e51427b2a5cf3e916bdb012b Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Mon, 6 Apr 2020 19:44:28 +0200
+Subject: [PATCH 09/30] bmo#1516803: Fix building sandbox
+
+Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1516803
+Bug: https://bugs.gentoo.org/666580
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ security/sandbox/linux/moz.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/security/sandbox/linux/moz.build
b/security/sandbox/linux/moz.build
+index 573f667812..e62d1a99a4 100644
+--- a/security/sandbox/linux/moz.build
++++ b/security/sandbox/linux/moz.build
+@@ -116,7 +116,7 @@ if CONFIG["CC_TYPE"] in ("clang", "gcc"):
+ # forcing there to be only one partition.
+ for f in CONFIG["OS_CXXFLAGS"]:
+ if f.startswith("-flto") and CONFIG["CC_TYPE"] != "clang":
+- LDFLAGS += ["--param lto-partitions=1"]
++ LDFLAGS += ["--param", "lto-partitions=1"]
+
+ DEFINES["NS_NO_XPCOM"] = True
+ DisableStlWrapping()
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0009-musl-Add-alternate-name-for-private-siginfo-struct-m.patch

b/http/firefox-esr/patches/0009-musl-Add-alternate-name-for-private-siginfo-struct-m.patch
new file mode 100644
index 0000000..300846f
--- /dev/null
+++
b/http/firefox-esr/patches/0009-musl-Add-alternate-name-for-private-siginfo-struct-m.patch
@@ -0,0 +1,35 @@
+From d8ec0bd6f3b0ad2dfd8a97a864f08decaafdea69 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel AT sholland.org>
+Date: Sun, 8 Jan 2017 19:16:38 -0600
+Subject: [PATCH 10/30] musl: Add alternate name for private siginfo struct
+ member
+
+musl does not provide a macro for detecting its presence. For now,
+assume that it is the only non-glibc-based libc on Linux systems.
+
+Signed-off-by: Samuel Holland <samuel AT sholland.org>
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc
b/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc
+index 9884be8bb2..86d8f88e30 100644
+--- a/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc
++++ b/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc
+@@ -174,7 +174,11 @@ void Trap::SigSys(int nr, LinuxSigInfo* info,
ucontext_t* ctx) {
+ // If the version of glibc doesn't include this information in
+ // siginfo_t (older than 2.17), we need to explicitly copy it
+ // into an arch_sigsys structure.
+- memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
++#if defined(__GLIBC__)
++ memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
++#else
++ memcpy(&sigsys, &info->__si_fields, sizeof(sigsys));
++#endif
+ #endif
+
+ #if defined(__mips__)
+--
+2.34.1
+
diff --git a/http/firefox-esr/patches/0010-musl-Fix-syscall-wrappers.patch
b/http/firefox-esr/patches/0010-musl-Fix-syscall-wrappers.patch
new file mode 100644
index 0000000..d9dda49
--- /dev/null
+++ b/http/firefox-esr/patches/0010-musl-Fix-syscall-wrappers.patch
@@ -0,0 +1,42 @@
+From 1b46c0fc085fe93c36320d7ac1004c83efccdccc Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel AT sholland.org>
+Date: Sun, 8 Jan 2017 19:19:23 -0600
+Subject: [PATCH 11/30] musl: Fix syscall wrappers
+
+musl defines p{read,write}64 to their non-suffixed equivalents to avoid
+duplication in its syscall wrappers. This breaks macro expansion here,
+leading to errors such as:
+
+In function size_t sys_pread64(int, void*, size_t, off_t):
+ error: '__NR_pread' was not declared in this scope
+
+The fix here is to undefine the p{read,write}64 macros, so the syscall
+expands to (e.g.) __NR_pread64 instead.
+
+Signed-off-by: Samuel Holland <samuel AT sholland.org>
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ .../src/third_party/lss/linux_syscall_support.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git
a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h

b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
+index 1abe0ba5b0..d6087a1674 100644
+---
a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
++++
b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
+@@ -173,6 +173,13 @@ extern "C" {
+ # undef __NR_waitpid
+ #endif
+
++#ifdef pread64
++#undef pread64
++#endif
++#ifdef pwrite64
++#undef pwrite64
++#endif
++
+ /* As glibc often provides subtly incompatible data structures (and implicit
+ * wrapper functions that convert them), we provide our own kernel data
+ * structures for use by the system calls.
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0011-musl-Only-use-system-heap-reporter-with-glibc.patch

b/http/firefox-esr/patches/0011-musl-Only-use-system-heap-reporter-with-glibc.patch
new file mode 100644
index 0000000..08f0214
--- /dev/null
+++
b/http/firefox-esr/patches/0011-musl-Only-use-system-heap-reporter-with-glibc.patch
@@ -0,0 +1,33 @@
+From 68dd87a3dc06cf59396dccc3e031761f7237656e Mon Sep 17 00:00:00 2001
+From: "Jory A. Pratt" <anarchy AT gentoo.org>
+Date: Mon, 6 Apr 2020 20:09:26 +0200
+Subject: [PATCH 12/30] musl: Only use system heap reporter with glibc
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ xpcom/base/nsMemoryReporterManager.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/xpcom/base/nsMemoryReporterManager.cpp
b/xpcom/base/nsMemoryReporterManager.cpp
+index bd4629c785..b513f81216 100644
+--- a/xpcom/base/nsMemoryReporterManager.cpp
++++ b/xpcom/base/nsMemoryReporterManager.cpp
+@@ -647,6 +647,7 @@ static bool InSharedRegion(mach_vm_address_t aAddr,
cpu_type_t aType) {
+ return NS_OK;
+ }
+
++#ifdef __GLIBC__
+ # define HAVE_SYSTEM_HEAP_REPORTER 1
+ // Windows can have multiple separate heaps, but we should not touch
non-default
+ // heaps because they may be destroyed at anytime while we hold a handle.
So we
+@@ -679,6 +680,7 @@ static bool InSharedRegion(mach_vm_address_t aAddr,
cpu_type_t aType) {
+ *aSizeOut = heapSize;
+ return NS_OK;
+ }
++#endif
+
+ struct SegmentKind {
+ DWORD mState;
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0012-musl-Set-pthread-name-for-non-glibc-systems.patch

b/http/firefox-esr/patches/0012-musl-Set-pthread-name-for-non-glibc-systems.patch
new file mode 100644
index 0000000..fe74bb1
--- /dev/null
+++
b/http/firefox-esr/patches/0012-musl-Set-pthread-name-for-non-glibc-systems.patch
@@ -0,0 +1,29 @@
+From 70d47d18420fe9e3de8f896c08f97ef2596c9c84 Mon Sep 17 00:00:00 2001
+From: "Jory A. Pratt" <anarchy AT gentoo.org>
+Date: Mon, 6 Apr 2020 20:10:03 +0200
+Subject: [PATCH 13/30] musl: Set pthread name for non glibc systems
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ js/src/threading/posix/PosixThread.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/js/src/threading/posix/PosixThread.cpp
b/js/src/threading/posix/PosixThread.cpp
+index 35532e375b..983da45326 100644
+--- a/js/src/threading/posix/PosixThread.cpp
++++ b/js/src/threading/posix/PosixThread.cpp
+@@ -115,8 +115,10 @@ void ThisThread::SetName(const char* name) {
+ rv = 0;
+ #elif defined(__NetBSD__)
+ rv = pthread_setname_np(pthread_self(), "%s", (void*)name);
+-#else
++#elif defined(__GLIBC__)
+ rv = pthread_setname_np(pthread_self(), name);
++#else
++ rv = 0;
+ #endif
+ MOZ_RELEASE_ASSERT(!rv);
+ }
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0013-musl-getcontext-is-only-avaliable-on-glibc-systems.patch

b/http/firefox-esr/patches/0013-musl-getcontext-is-only-avaliable-on-glibc-systems.patch
new file mode 100644
index 0000000..e9cf02e
--- /dev/null
+++
b/http/firefox-esr/patches/0013-musl-getcontext-is-only-avaliable-on-glibc-systems.patch
@@ -0,0 +1,28 @@
+From 3283cc3981f99894dec1219fbf380489905827a9 Mon Sep 17 00:00:00 2001
+From: "Jory A. Pratt" <anarchy AT gentoo.org>
+Date: Mon, 6 Apr 2020 20:10:47 +0200
+Subject: [PATCH 14/30] musl: getcontext is only avaliable on glibc systems
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ tools/profiler/core/platform-linux-android.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tools/profiler/core/platform-linux-android.cpp
b/tools/profiler/core/platform-linux-android.cpp
+index d065387552..aaca9e81e4 100644
+--- a/tools/profiler/core/platform-linux-android.cpp
++++ b/tools/profiler/core/platform-linux-android.cpp
+@@ -603,8 +603,10 @@ static void PlatformInit(PSLockRef aLock) {}
+
+ #if defined(HAVE_NATIVE_UNWIND)
+ void Registers::SyncPopulate() {
++#if defined(__GLIBC__)
+ if (!getcontext(&mContextSyncStorage)) {
+ PopulateRegsFromContext(*this, &mContextSyncStorage);
+ }
++#endif
+ }
+ #endif
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0014-musl-sys-auvx.h-avaliable-on-more-then-just-glibc-sy.patch

b/http/firefox-esr/patches/0014-musl-sys-auvx.h-avaliable-on-more-then-just-glibc-sy.patch
new file mode 100644
index 0000000..121c8cd
--- /dev/null
+++
b/http/firefox-esr/patches/0014-musl-sys-auvx.h-avaliable-on-more-then-just-glibc-sy.patch
@@ -0,0 +1,51 @@
+From beed745f96bbc18a3c22a728095c9a2eef7435ee Mon Sep 17 00:00:00 2001
+From: "Jory A. Pratt" <anarchy AT gentoo.org>
+Date: Mon, 6 Apr 2020 20:12:09 +0200
+Subject: [PATCH 15/30] musl: sys/auvx.h avaliable on more then just glibc
+ systems
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ .../system_wrappers/source/cpu_features_linux.cc | 12 +++---------
+ 1 file changed, 3 insertions(+), 9 deletions(-)
+
+diff --git
a/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc
b/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc
+index 335bed4da3..c2c98dae8a 100644
+--- a/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc
++++ b/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc
+@@ -12,13 +12,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+
+-#ifdef __GLIBC_PREREQ
+-#define WEBRTC_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
+-#else
+-#define WEBRTC_GLIBC_PREREQ(a, b) 0
+-#endif
+-
+-#if WEBRTC_GLIBC_PREREQ(2, 16)
++#if defined(__linux__)
+ #include <sys/auxv.h>
+ #else
+ #include <errno.h>
+@@ -40,7 +34,7 @@ uint64_t GetCPUFeaturesARM(void) {
+ int architecture = 0;
+ uint64_t hwcap = 0;
+ const char* platform = NULL;
+-#if WEBRTC_GLIBC_PREREQ(2, 16)
++#if defined(__linux__)
+ hwcap = getauxval(AT_HWCAP);
+ platform = (const char*)getauxval(AT_PLATFORM);
+ #else
+@@ -64,7 +58,7 @@ uint64_t GetCPUFeaturesARM(void) {
+ }
+ close(fd);
+ }
+-#endif // WEBRTC_GLIBC_PREREQ(2, 16)
++#endif // (__linux__)
+ #if defined(__aarch64__)
+ architecture = 8;
+ if ((hwcap & HWCAP_FP) != 0)
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0015-musl-make-SYS_fork-non-fatal-musl-uses-it-for-fork-2.patch

b/http/firefox-esr/patches/0015-musl-make-SYS_fork-non-fatal-musl-uses-it-for-fork-2.patch
new file mode 100644
index 0000000..9de0db7
--- /dev/null
+++
b/http/firefox-esr/patches/0015-musl-make-SYS_fork-non-fatal-musl-uses-it-for-fork-2.patch
@@ -0,0 +1,28 @@
+From 6d36ed9e971861321bb381e25516500069314eb6 Mon Sep 17 00:00:00 2001
+From: Johannes <johannes.brechtmann AT gmail.com>
+Date: Fri, 1 May 2020 17:20:29 +0200
+Subject: [PATCH 16/30] musl: make SYS_fork non-fatal, musl uses it for
fork(2)
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ security/sandbox/linux/SandboxFilter.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/security/sandbox/linux/SandboxFilter.cpp
b/security/sandbox/linux/SandboxFilter.cpp
+index eb72d944c8..8ce22d6f65 100644
+--- a/security/sandbox/linux/SandboxFilter.cpp
++++ b/security/sandbox/linux/SandboxFilter.cpp
+@@ -1537,6 +1537,10 @@ class ContentSandboxPolicy : public
SandboxPolicyCommon {
+ // usually do something reasonable on error.
+ case __NR_clone:
+ return ClonePolicy(Error(EPERM));
++# ifdef __NR_fork
++ case __NR_fork:
++ return Error(ENOSYS);
++# endif
+
+ case __NR_clone3:
+ return Error(ENOSYS);
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0016-musl-include-net-if.h-before-linux-if.h-to-avoid-red.patch

b/http/firefox-esr/patches/0016-musl-include-net-if.h-before-linux-if.h-to-avoid-red.patch
new file mode 100644
index 0000000..de77780
--- /dev/null
+++
b/http/firefox-esr/patches/0016-musl-include-net-if.h-before-linux-if.h-to-avoid-red.patch
@@ -0,0 +1,27 @@
+From 08a7a0d7fa52e1bdacdcb47e847cf5ecd980ee6f Mon Sep 17 00:00:00 2001
+From: Rasmus Thomsen <oss AT cogitri.dev>
+Date: Wed, 28 Oct 2020 17:50:24 +0100
+Subject: [PATCH 17/30] musl: include net/if.h before linux/if.h to avoid
+ redefinition
+
+Bug: https://bugs.gentoo.org/751469
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ .../webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git
a/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c
b/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c
+index 73e85c6ccc..9eca548638 100644
+--- a/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c
++++ b/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c
+@@ -31,6 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
+ */
+
+ #if defined(LINUX)
++#include <net/if.h>
+ #include "addrs-netlink.h"
+ #include <csi_platform.h>
+ #include <assert.h>
+--
+2.34.1
+
diff --git a/http/firefox-esr/patches/0017-Make-PGO-use-toolchain.patch
b/http/firefox-esr/patches/0017-Make-PGO-use-toolchain.patch
new file mode 100644
index 0000000..3f72b05
--- /dev/null
+++ b/http/firefox-esr/patches/0017-Make-PGO-use-toolchain.patch
@@ -0,0 +1,33 @@
+From 45d43bb2dc1c1c033c860951c93261e98647f851 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Mon, 6 Apr 2020 20:13:34 +0200
+Subject: [PATCH 18/30] Make PGO use toolchain
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ build/unix/mozconfig.unix | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/build/unix/mozconfig.unix b/build/unix/mozconfig.unix
+index 9ca9c97fce..9f86fe0940 100644
+--- a/build/unix/mozconfig.unix
++++ b/build/unix/mozconfig.unix
+@@ -4,6 +4,15 @@ if [ -n "$FORCE_GCC" ]; then
+ CC="$MOZ_FETCHES_DIR/gcc/bin/gcc"
+ CXX="$MOZ_FETCHES_DIR/gcc/bin/g++"
+
++ if [ -n "$MOZ_PGO" ]; then
++ if [ -z "$USE_ARTIFACT" ]; then
++ ac_add_options --enable-lto
++ fi
++ export AR="$topsrcdir/gcc/bin/gcc-ar"
++ export NM="$topsrcdir/gcc/bin/gcc-nm"
++ export RANLIB="$topsrcdir/gcc/bin/gcc-ranlib"
++ fi
++
+ # We want to make sure we use binutils and other binaries in the
tooltool
+ # package.
+ mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$PATH"
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0018-bmo-1516081-Disable-watchdog-during-PGO-builds.patch

b/http/firefox-esr/patches/0018-bmo-1516081-Disable-watchdog-during-PGO-builds.patch
new file mode 100644
index 0000000..70cf5c3
--- /dev/null
+++
b/http/firefox-esr/patches/0018-bmo-1516081-Disable-watchdog-during-PGO-builds.patch
@@ -0,0 +1,55 @@
+From 2502829abc1a02a08cc1934538c3d30e6f4f6fae Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Mon, 6 Apr 2020 20:27:06 +0200
+Subject: [PATCH 19/30] bmo#1516081: Disable watchdog during PGO builds
+
+Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1516081
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ build/moz.configure/lto-pgo.configure | 4 ++--
+ toolkit/components/terminator/nsTerminator.cpp | 7 +++++++
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/build/moz.configure/lto-pgo.configure
b/build/moz.configure/lto-pgo.configure
+index e5a4e6f913..567ccf0ba4 100644
+--- a/build/moz.configure/lto-pgo.configure
++++ b/build/moz.configure/lto-pgo.configure
+@@ -84,7 +84,7 @@ set_config("PGO_PROFILE_PATH", pgo_profile_path)
+ def pgo_flags(compiler, profdata, target_is_windows):
+ if compiler.type == "gcc":
+ return namespace(
+- gen_cflags=["-fprofile-generate"],
++ gen_cflags=["-fprofile-generate",
"-DMOZ_PROFILE_INSTRUMENTATION"],
+ gen_ldflags=["-fprofile-generate"],
+ use_cflags=["-fprofile-use", "-fprofile-correction",
"-Wcoverage-mismatch"],
+ use_ldflags=["-fprofile-use"],
+@@ -98,7 +98,7 @@ def pgo_flags(compiler, profdata, target_is_windows):
+ else:
+ gen_ldflags = ["-fprofile-generate"]
+
+- gen_cflags = [prefix + "-fprofile-generate"]
++ gen_cflags = [prefix + "-fprofile-generate",
"-DMOZ_PROFILE_INSTRUMENTATION"]
+ if target_is_windows:
+ # native llvm-profdata.exe on Windows can't read profile data
+ # if name compression is enabled (which cross-compiling enables
+diff --git a/toolkit/components/terminator/nsTerminator.cpp
b/toolkit/components/terminator/nsTerminator.cpp
+index 194bb36e2d..c960d44137 100644
+--- a/toolkit/components/terminator/nsTerminator.cpp
++++ b/toolkit/components/terminator/nsTerminator.cpp
+@@ -466,6 +466,13 @@ void nsTerminator::StartWatchdog() {
+ }
+ #endif
+
++ // Disable watchdog for PGO train builds - writting profile information at
++ // exit may take time and it is better to make build hang rather than
++ // silently produce poorly performing binary.
++#ifdef MOZ_PROFILE_INSTRUMENTATION
++ crashAfterMS = INT32_MAX;
++#endif
++
+ UniquePtr<Options> options(new Options());
+ const PRIntervalTime ticksDuration =
+ PR_MillisecondsToInterval(HEARTBEAT_INTERVAL_MS);
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0019-bmo-1516803-force-one-LTO-partition-for-sandbox-when.patch

b/http/firefox-esr/patches/0019-bmo-1516803-force-one-LTO-partition-for-sandbox-when.patch
new file mode 100644
index 0000000..ef8f9b2
--- /dev/null
+++
b/http/firefox-esr/patches/0019-bmo-1516803-force-one-LTO-partition-for-sandbox-when.patch
@@ -0,0 +1,32 @@
+From 0501ed4bbdbf8d16a69a4460d2ada33ac259365d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Wed, 15 Apr 2020 00:27:25 +0200
+Subject: [PATCH 20/30] bmo#1516803: force one LTO partition for sandbox when
+ using GCC
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ security/sandbox/linux/moz.build | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/security/sandbox/linux/moz.build
b/security/sandbox/linux/moz.build
+index e62d1a99a4..913b9ba2ce 100644
+--- a/security/sandbox/linux/moz.build
++++ b/security/sandbox/linux/moz.build
+@@ -114,9 +114,10 @@ if CONFIG["CC_TYPE"] in ("clang", "gcc"):
+ # gcc lto likes to put the top level asm in syscall.cc in a different
partition
+ # from the function using it which breaks the build. Work around that by
+ # forcing there to be only one partition.
+-for f in CONFIG["OS_CXXFLAGS"]:
+- if f.startswith("-flto") and CONFIG["CC_TYPE"] != "clang":
+- LDFLAGS += ["--param", "lto-partitions=1"]
++if CONFIG["CC_TYPE"] != "clang" and CONFIG["MOZ_LTO_LDFLAGS"] is not None:
++ for f in CONFIG["MOZ_LTO_LDFLAGS"]:
++ if f.startswith("-flto"):
++ LDFLAGS += ["--param", "lto-partitions=1"]
+
+ DEFINES["NS_NO_XPCOM"] = True
+ DisableStlWrapping()
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0020-Fix-building-with-PGO-when-using-GCC.patch
b/http/firefox-esr/patches/0020-Fix-building-with-PGO-when-using-GCC.patch
new file mode 100644
index 0000000..81de54b
--- /dev/null
+++ b/http/firefox-esr/patches/0020-Fix-building-with-PGO-when-using-GCC.patch
@@ -0,0 +1,84 @@
+From 98e1e605c8fdf7b021d6f1888ce6baed5c1097b5 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Thu, 2 Jul 2020 18:05:03 +0200
+Subject: [PATCH 22/30] Fix building with PGO when using GCC
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ build/moz.configure/lto-pgo.configure | 5 +++--
+ build/pgo/profileserver.py | 26 ++++++++++++++++++++++----
+ 2 files changed, 25 insertions(+), 6 deletions(-)
+
+diff --git a/build/moz.configure/lto-pgo.configure
b/build/moz.configure/lto-pgo.configure
+index 567ccf0ba4..c6470ef829 100644
+--- a/build/moz.configure/lto-pgo.configure
++++ b/build/moz.configure/lto-pgo.configure
+@@ -83,11 +83,12 @@ set_config("PGO_PROFILE_PATH", pgo_profile_path)
+ @imports("multiprocessing")
+ def pgo_flags(compiler, profdata, target_is_windows):
+ if compiler.type == "gcc":
++ profile_use = "-fprofile-use"
+ return namespace(
+ gen_cflags=["-fprofile-generate",
"-DMOZ_PROFILE_INSTRUMENTATION"],
+ gen_ldflags=["-fprofile-generate"],
+- use_cflags=["-fprofile-use", "-fprofile-correction",
"-Wcoverage-mismatch"],
+- use_ldflags=["-fprofile-use"],
++ use_cflags=[profile_use, "-fprofile-correction",
"-Wcoverage-mismatch"],
++ use_ldflags=[profile_use],
+ )
+
+ if compiler.type in ("clang-cl", "clang"):
+diff --git a/build/pgo/profileserver.py b/build/pgo/profileserver.py
+index 7f3de106ab..89289a7756 100755
+--- a/build/pgo/profileserver.py
++++ b/build/pgo/profileserver.py
+@@ -11,7 +11,7 @@ import glob
+ import subprocess
+
+ import mozcrash
+-from mozbuild.base import MozbuildObject, BinaryNotFoundException
++from mozbuild.base import MozbuildObject, BinaryNotFoundException,
BuildEnvironmentNotFoundException
+ from mozfile import TemporaryDirectory
+ from mozhttpd import MozHttpd
+ from mozprofile import FirefoxProfile, Preferences
+@@ -87,9 +87,22 @@ if __name__ == "__main__":
+ locations = ServerLocations()
+ locations.add_host(host="127.0.0.1", port=PORT,
options="primary,privileged")
+
+- old_profraw_files = glob.glob("*.profraw")
+- for f in old_profraw_files:
+- os.remove(f)
++ using_gcc = False
++ try:
++ if build.config_environment.substs.get("CC_TYPE") == "gcc":
++ using_gcc = True
++ except BuildEnvironmentNotFoundException:
++ pass
++
++ if using_gcc:
++ for dirpath, _, filenames in os.walk("."):
++ for f in filenames:
++ if f.endswith(".gcda"):
++ os.remove(os.path.join(dirpath, f))
++ else:
++ old_profraw_files = glob.glob("*.profraw")
++ for f in old_profraw_files:
++ os.remove(f)
+
+ with TemporaryDirectory() as profilePath:
+ # TODO: refactor this into mozprofile
+@@ -212,6 +225,11 @@ if __name__ == "__main__":
+ print("Firefox exited successfully, but produced a crashreport")
+ sys.exit(1)
+
++ if using_gcc:
++ print("Copying profile data...")
++ os.system("pwd");
++ os.system('tar cf profdata.tar.gz `find . -name "*.gcda"`; cd
..; tar xf instrumented/profdata.tar.gz;');
++
+ llvm_profdata = env.get("LLVM_PROFDATA")
+ if llvm_profdata:
+ profraw_files = glob.glob("*.profraw")
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0021-libaom-Use-NEON_FLAGS-instead-of-VPX_ASFLAGS-for-lib.patch

b/http/firefox-esr/patches/0021-libaom-Use-NEON_FLAGS-instead-of-VPX_ASFLAGS-for-lib.patch
new file mode 100644
index 0000000..85c305f
--- /dev/null
+++
b/http/firefox-esr/patches/0021-libaom-Use-NEON_FLAGS-instead-of-VPX_ASFLAGS-for-lib.patch
@@ -0,0 +1,28 @@
+From 6e220b49aee7dbdcafd255f6260517c5c551f9b1 Mon Sep 17 00:00:00 2001
+From: Mike Hommey <mh AT glandium.org>
+Date: Mon, 26 Nov 2018 09:59:56 +0900
+Subject: [PATCH 23/30] libaom: Use NEON_FLAGS instead of VPX_ASFLAGS for
+ libaom neon code
+
+Bug: https://bugs.gentoo.org/730606
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ media/libaom/moz.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/media/libaom/moz.build b/media/libaom/moz.build
+index fd8c7f2b33..db3f9ca6ec 100644
+--- a/media/libaom/moz.build
++++ b/media/libaom/moz.build
+@@ -55,7 +55,7 @@ elif CONFIG['CPU_ARCH'] == 'arm':
+
+ for f in SOURCES:
+ if f.endswith('neon.c'):
+- SOURCES[f].flags += CONFIG['VPX_ASFLAGS']
++ SOURCES[f].flags += CONFIG['NEON_FLAGS']
+
+ if CONFIG['OS_TARGET'] == 'Android':
+ # For cpu-features.h
+--
+2.34.1
+
diff --git a/http/firefox-esr/patches/0022-build-Disable-Werror.patch
b/http/firefox-esr/patches/0022-build-Disable-Werror.patch
new file mode 100644
index 0000000..1e831ae
--- /dev/null
+++ b/http/firefox-esr/patches/0022-build-Disable-Werror.patch
@@ -0,0 +1,13 @@
+diff -Naur a/build/moz.configure/warnings.configure
b/build/moz.configure/warnings.configure
+--- a/build/moz.configure/warnings.configure 2022-05-27 02:16:52.000000000
+0300
++++ b/build/moz.configure/warnings.configure 2022-05-31 10:48:22.990378071
+0300
+@@ -293,7 +293,8 @@
+ check_and_add_warning("-Wno-gnu-zero-variadic-macro-arguments")
+
+ # Make it an error to be missing function declarations for C code.
+-check_and_add_warning("-Werror=implicit-function-declaration", c_compiler)
++check_and_add_warning("-Werror=implicit-function-declaration",
++ when="--enable-warnings-as-errors")
+
+ # New in clang 11. We can't really do anything about this warning.
+ check_and_add_warning("-Wno-psabi")
diff --git
a/http/firefox-esr/patches/0023-LTO-Only-enable-LTO-for-Rust-when-complete-build-use.patch

b/http/firefox-esr/patches/0023-LTO-Only-enable-LTO-for-Rust-when-complete-build-use.patch
new file mode 100644
index 0000000..32bd0eb
--- /dev/null
+++
b/http/firefox-esr/patches/0023-LTO-Only-enable-LTO-for-Rust-when-complete-build-use.patch
@@ -0,0 +1,34 @@
+From 685e82ac82921720c6cd9c6c45703ff034f081e7 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Sat, 29 Aug 2020 22:30:59 +0200
+Subject: [PATCH 25/30] LTO: Only enable LTO for Rust when complete build uses
+ LTO
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ config/makefiles/rust.mk | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk
+index 75570d32b9..924722a506 100644
+--- a/config/makefiles/rust.mk
++++ b/config/makefiles/rust.mk
+@@ -87,6 +87,7 @@ endif
+ # These flags are passed via `cargo rustc` and only apply to the final rustc
+ # invocation (i.e., only the top-level crate, not its dependencies).
+ cargo_rustc_flags = $(CARGO_RUSTCFLAGS)
++ifdef MOZ_LTO
+ ifndef DEVELOPER_OPTIONS
+ ifndef MOZ_DEBUG_RUST
+ # Enable link-time optimization for release builds, but not when linking
+@@ -106,6 +107,7 @@ endif
+ endif
+ endif
+ endif
++endif
+
+ ifdef CARGO_INCREMENTAL
+ export CARGO_INCREMENTAL
+--
+2.34.1
+
diff --git a/http/firefox-esr/patches/0024-Disable-FFVPX-with-VA-API.patch
b/http/firefox-esr/patches/0024-Disable-FFVPX-with-VA-API.patch
new file mode 100644
index 0000000..42d639f
--- /dev/null
+++ b/http/firefox-esr/patches/0024-Disable-FFVPX-with-VA-API.patch
@@ -0,0 +1,91 @@
+From 38068d0801ad85ba36673ab2ad6a53e0fd3ffdde Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Thu, 29 Apr 2021 18:22:48 +0200
+Subject: [PATCH 27/30] Disable FFVPX with VA-API
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ dom/media/platforms/PDMFactory.cpp | 32 +++++++++++++++---------------
+ 1 file changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/dom/media/platforms/PDMFactory.cpp
b/dom/media/platforms/PDMFactory.cpp
+index 9b0342ce82..4e377082ae 100644
+--- a/dom/media/platforms/PDMFactory.cpp
++++ b/dom/media/platforms/PDMFactory.cpp
+@@ -486,12 +486,6 @@ void PDMFactory::CreateRddPDMs() {
+ CreateAndStartupPDM<AppleDecoderModule>();
+ }
+ #endif
+-#ifdef MOZ_FFVPX
+- if (StaticPrefs::media_ffvpx_enabled() &&
+- StaticPrefs::media_rdd_ffvpx_enabled()) {
+- CreateAndStartupPDM<FFVPXRuntimeLinker>();
+- }
+-#endif
+ #ifdef MOZ_FFMPEG
+ if (StaticPrefs::media_ffmpeg_enabled() &&
+ StaticPrefs::media_rdd_ffmpeg_enabled() &&
+@@ -499,6 +493,12 @@ void PDMFactory::CreateRddPDMs() {
+ mFailureFlags += GetFailureFlagBasedOnFFmpegStatus(
+ FFmpegRuntimeLinker::LinkStatusCode());
+ }
++#endif
++#ifdef MOZ_FFVPX
++ if (StaticPrefs::media_ffvpx_enabled() &&
++ StaticPrefs::media_rdd_ffvpx_enabled()) {
++ CreateAndStartupPDM<FFVPXRuntimeLinker>();
++ }
+ #endif
+ CreateAndStartupPDM<AgnosticDecoderModule>();
+ }
+@@ -535,11 +535,6 @@ void PDMFactory::CreateContentPDMs() {
+ CreateAndStartupPDM<OmxDecoderModule>();
+ }
+ #endif
+-#ifdef MOZ_FFVPX
+- if (StaticPrefs::media_ffvpx_enabled()) {
+- CreateAndStartupPDM<FFVPXRuntimeLinker>();
+- }
+-#endif
+ #ifdef MOZ_FFMPEG
+ if (StaticPrefs::media_ffmpeg_enabled() &&
+ !CreateAndStartupPDM<FFmpegRuntimeLinker>()) {
+@@ -547,6 +542,11 @@ void PDMFactory::CreateContentPDMs() {
+ FFmpegRuntimeLinker::LinkStatusCode());
+ }
+ #endif
++#ifdef MOZ_FFVPX
++ if (StaticPrefs::media_ffvpx_enabled()) {
++ CreateAndStartupPDM<FFVPXRuntimeLinker>();
++ }
++#endif
+ #ifdef MOZ_WIDGET_ANDROID
+ if (StaticPrefs::media_android_media_codec_enabled()) {
+ StartupPDM(AndroidDecoderModule::Create(),
+@@ -581,11 +581,6 @@ void PDMFactory::CreateDefaultPDMs() {
+ CreateAndStartupPDM<OmxDecoderModule>();
+ }
+ #endif
+-#ifdef MOZ_FFVPX
+- if (StaticPrefs::media_ffvpx_enabled()) {
+- CreateAndStartupPDM<FFVPXRuntimeLinker>();
+- }
+-#endif
+ #ifdef MOZ_FFMPEG
+ if (StaticPrefs::media_ffmpeg_enabled() &&
+ !CreateAndStartupPDM<FFmpegRuntimeLinker>()) {
+@@ -593,6 +588,11 @@ void PDMFactory::CreateDefaultPDMs() {
+ FFmpegRuntimeLinker::LinkStatusCode());
+ }
+ #endif
++#ifdef MOZ_FFVPX
++ if (StaticPrefs::media_ffvpx_enabled()) {
++ CreateAndStartupPDM<FFVPXRuntimeLinker>();
++ }
++#endif
+ #ifdef MOZ_WIDGET_ANDROID
+ if (StaticPrefs::media_android_media_codec_enabled()) {
+ StartupPDM(AndroidDecoderModule::Create(),
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0025-Enable-FLAC-on-platforms-without-ffvpx-via-ffmpeg.patch

b/http/firefox-esr/patches/0025-Enable-FLAC-on-platforms-without-ffvpx-via-ffmpeg.patch
new file mode 100644
index 0000000..2c6a271
--- /dev/null
+++
b/http/firefox-esr/patches/0025-Enable-FLAC-on-platforms-without-ffvpx-via-ffmpeg.patch
@@ -0,0 +1,36 @@
+From 58b0385412c6d96eb745e2fc5902df347e629f6d Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Thu, 29 Apr 2021 18:48:06 +0200
+Subject: [PATCH 28/30] Enable FLAC on platforms without ffvpx via ffmpeg
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ dom/media/flac/FlacDecoder.cpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/dom/media/flac/FlacDecoder.cpp b/dom/media/flac/FlacDecoder.cpp
+index 2f205c9aae..68847b0952 100644
+--- a/dom/media/flac/FlacDecoder.cpp
++++ b/dom/media/flac/FlacDecoder.cpp
+@@ -7,6 +7,7 @@
+ #include "FlacDecoder.h"
+ #include "MediaContainerType.h"
+ #include "mozilla/StaticPrefs_media.h"
++#include "PDMFactory.h"
+
+ namespace mozilla {
+
+@@ -14,6 +15,10 @@ namespace mozilla {
+ bool FlacDecoder::IsEnabled() {
+ #ifdef MOZ_FFVPX
+ return StaticPrefs::media_flac_enabled();
++#elif defined(MOZ_FFMPEG)
++ RefPtr<PDMFactory> platform = new PDMFactory();
++ return StaticPrefs::media_flac_enabled() &&
++ platform->SupportsMimeType("audio/flac"_ns);
+ #else
+ return false;
+ #endif
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0026-bmo-1670333-OpenH264-Fix-decoding-if-it-starts-on-no.patch

b/http/firefox-esr/patches/0026-bmo-1670333-OpenH264-Fix-decoding-if-it-starts-on-no.patch
new file mode 100644
index 0000000..856361d
--- /dev/null
+++
b/http/firefox-esr/patches/0026-bmo-1670333-OpenH264-Fix-decoding-if-it-starts-on-no.patch
@@ -0,0 +1,96 @@
+From 0b53fcfa8ee76ccc2d77abb947810f631efaecd9 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi AT gentoo.org>
+Date: Fri, 11 Dec 2020 15:37:38 +0100
+Subject: [PATCH 29/30] bmo#1670333: OpenH264: Fix decoding if it starts on
non
+ IDR I-frame
+
+Signed-off-by: Thomas Deutschmann <whissi AT gentoo.org>
+---
+ dom/media/mp4/MP4Demuxer.cpp | 8 ++++++++
+ dom/media/platforms/PDMFactory.cpp | 15 ++++++++++-----
+ dom/media/platforms/PDMFactory.h | 2 ++
+ 3 files changed, 20 insertions(+), 5 deletions(-)
+
+diff --git a/dom/media/mp4/MP4Demuxer.cpp b/dom/media/mp4/MP4Demuxer.cpp
+index 59bba16577..0304e3e89f 100644
+--- a/dom/media/mp4/MP4Demuxer.cpp
++++ b/dom/media/mp4/MP4Demuxer.cpp
+@@ -31,6 +31,8 @@ mozilla::LogModule* GetDemuxerLog() { return
gMediaDemuxerLog; }
+ DDMOZ_LOG(gMediaDemuxerLog, mozilla::LogLevel::Debug, "::%s: " arg, \
+ __func__, ##__VA_ARGS__)
+
++extern bool gUseKeyframeFromContainer;
++
+ namespace mozilla {
+
+ DDLoggedTypeDeclNameAndBase(MP4TrackDemuxer, MediaTrackDemuxer);
+@@ -394,6 +396,12 @@ already_AddRefed<MediaRawData>
MP4TrackDemuxer::GetNextSample() {
+ [[fallthrough]];
+ case H264::FrameType::OTHER: {
+ bool keyframe = type == H264::FrameType::I_FRAME;
++ if (gUseKeyframeFromContainer) {
++ if (sample->mKeyframe && sample->mKeyframe != keyframe) {
++ sample->mKeyframe = keyframe;
++ }
++ break;
++ }
+ if (sample->mKeyframe != keyframe) {
+ NS_WARNING(nsPrintfCString("Frame incorrectly marked as
%skeyframe "
+ "@ pts:%" PRId64 " dur:%" PRId64
+diff --git a/dom/media/platforms/PDMFactory.cpp
b/dom/media/platforms/PDMFactory.cpp
+index 4e377082ae..e778eb9948 100644
+--- a/dom/media/platforms/PDMFactory.cpp
++++ b/dom/media/platforms/PDMFactory.cpp
+@@ -58,6 +58,8 @@
+
+ #include <functional>
+
++bool gUseKeyframeFromContainer = false;
++
+ namespace mozilla {
+
+ #define PDM_INIT_LOG(msg, ...) \
+@@ -536,10 +538,12 @@ void PDMFactory::CreateContentPDMs() {
+ }
+ #endif
+ #ifdef MOZ_FFMPEG
+- if (StaticPrefs::media_ffmpeg_enabled() &&
+- !CreateAndStartupPDM<FFmpegRuntimeLinker>()) {
+- mFailureFlags += GetFailureFlagBasedOnFFmpegStatus(
+- FFmpegRuntimeLinker::LinkStatusCode());
++ if (StaticPrefs::media_ffmpeg_enabled()) {
++ mFFmpegUsed = CreateAndStartupPDM<FFmpegRuntimeLinker>();
++ if (!mFFmpegUsed) {
++ mFailureFlags += GetFailureFlagBasedOnFFmpegStatus(
++ FFmpegRuntimeLinker::LinkStatusCode());
++ }
+ }
+ #endif
+ #ifdef MOZ_FFVPX
+@@ -556,8 +560,9 @@ void PDMFactory::CreateContentPDMs() {
+
+ CreateAndStartupPDM<AgnosticDecoderModule>();
+
+- if (StaticPrefs::media_gmp_decoder_enabled() &&
++ if (StaticPrefs::media_gmp_decoder_enabled() && !mFFmpegUsed &&
+ !CreateAndStartupPDM<GMPDecoderModule>()) {
++ gUseKeyframeFromContainer = true;
+ mFailureFlags += DecoderDoctorDiagnostics::Flags::GMPPDMFailedToStartup;
+ }
+ }
+diff --git a/dom/media/platforms/PDMFactory.h
b/dom/media/platforms/PDMFactory.h
+index 4fc81c0b37..72f3255b6f 100644
+--- a/dom/media/platforms/PDMFactory.h
++++ b/dom/media/platforms/PDMFactory.h
+@@ -122,6 +122,8 @@ class PDMFactory final {
+
+ DecoderDoctorDiagnostics::FlagsSet mFailureFlags;
+
++ bool mFFmpegUsed = false;
++
+ friend class RemoteVideoDecoderParent;
+ static void EnsureInit();
+ };
+--
+2.34.1
+
diff --git
a/http/firefox-esr/patches/0027-bmo-1663844-OpenH264-Allow-using-OpenH264-GMP-decode.patch

b/http/firefox-esr/patches/0027-bmo-1663844-OpenH264-Allow-using-OpenH264-GMP-decode.patch
new file mode 100644
index 0000000..d356425
--- /dev/null
+++
b/http/firefox-esr/patches/0027-bmo-1663844-OpenH264-Allow-using-OpenH264-GMP-decode.patch
@@ -0,0 +1,35 @@
+diff -up firefox-101.0/dom/media/gmp/GMPSharedMemManager.h.1663844
firefox-101.0/dom/media/gmp/GMPSharedMemManager.h
+--- firefox-101.0/dom/media/gmp/GMPSharedMemManager.h.1663844 2022-05-27
01:16:53.000000000 +0200
++++ firefox-101.0/dom/media/gmp/GMPSharedMemManager.h 2022-05-30
21:15:20.989993419 +0200
+@@ -27,7 +27,7 @@ class GMPSharedMem {
+ // returned to the parent pool (which is not included). If more than
+ // this are needed, we presume the client has either crashed or hung
+ // (perhaps temporarily).
+- static const uint32_t kGMPBufLimit = 20;
++ static const uint32_t kGMPBufLimit = 40;
+
+ GMPSharedMem() {
+ for (size_t i = 0; i < sizeof(mGmpAllocated) / sizeof(mGmpAllocated[0]);
+diff -up
firefox-101.0/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp.1663844
firefox-101.0/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
+---
firefox-101.0/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp.1663844
2022-05-30 21:15:20.989993419 +0200
++++ firefox-101.0/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp
2022-05-30 21:24:16.615282035 +0200
+@@ -66,6 +66,7 @@ media::DecodeSupportSet GMPDecoderModule
+
+ nsCString api = nsLiteralCString(CHROMIUM_CDM_API);
+
++ // TODO: Do we enable it here?
+ if (MP4Decoder::IsH264(aMimeType)) {
+ isSupported = HaveGMPFor(api, {"h264"_ns, aGMP.value()});
+ } else if (VPXDecoder::IsVP9(aMimeType)) {
+diff -up
firefox-101.0/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp.1663844
firefox-101.0/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
+---
firefox-101.0/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp.1663844
2022-05-27 01:16:53.000000000 +0200
++++ firefox-101.0/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
2022-05-30 21:15:20.989993419 +0200
+@@ -70,6 +70,8 @@ void GMPVideoDecoder::Decoded(GMPVideoi4
+ RefPtr<GMPVideoDecoder> self = this;
+ if (v) {
+ mDecodedData.AppendElement(std::move(v));
++ mDecodePromise.ResolveIfExists(std::move(mDecodedData), __func__);
++ mDecodedData = DecodedData();
+ } else {
+ mDecodedData.Clear();
+ mDecodePromise.RejectIfExists(
diff --git a/http/firefox-esr/patches/0028-bgo-816975-fix-build-on-x86.patch
b/http/firefox-esr/patches/0028-bgo-816975-fix-build-on-x86.patch
new file mode 100644
index 0000000..4b2289f
--- /dev/null
+++ b/http/firefox-esr/patches/0028-bgo-816975-fix-build-on-x86.patch
@@ -0,0 +1,16 @@
+diff --git a/modules/fdlibm/src/math_private.h
b/modules/fdlibm/src/math_private.h
+index 51d79f9c2ec59..fafd7d6fc1e0d 100644
+--- a/modules/fdlibm/src/math_private.h
++++ b/modules/fdlibm/src/math_private.h
+@@ -30,7 +30,11 @@
+ * Adapted from https://github.com/freebsd/freebsd-src/search?q=__double_t
+ */
+
++#if defined __FLT_EVAL_METHOD__ && (__FLT_EVAL_METHOD__ == 2)
++typedef long double __double_t;
++#else
+ typedef double __double_t;
++#endif
+ typedef __double_t double_t;
+
+ /*
diff --git
a/http/firefox-esr/patches/0029-bmo-1559213-fix-system-av1-libs.patch
b/http/firefox-esr/patches/0029-bmo-1559213-fix-system-av1-libs.patch
new file mode 100644
index 0000000..2423cca
--- /dev/null
+++ b/http/firefox-esr/patches/0029-bmo-1559213-fix-system-av1-libs.patch
@@ -0,0 +1,22 @@
+diff --git a/media/ffvpx/libavcodec/moz.build
b/media/ffvpx/libavcodec/moz.build
+index 0069865..e806fc8 100644
+--- a/media/ffvpx/libavcodec/moz.build
++++ b/media/ffvpx/libavcodec/moz.build
+@@ -112,9 +112,15 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']:
+ 'vaapi_vp8.c',
+ 'vaapi_vp9.c',
+ ]
++ if CONFIG["MOZ_SYSTEM_AV1"]:
++ CFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
++ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
++ else:
++ USE_LIBS += [
++ 'dav1d',
++ 'media_libdav1d_asm',
++ ]
+ USE_LIBS += [
+- 'dav1d',
+- 'media_libdav1d_asm',
+ 'mozva'
+ ]
+
diff --git
a/http/firefox-esr/patches/0030-bmo-1196777-Set-GDK_FOCUS_CHANGE_MASK.patch
b/http/firefox-esr/patches/0030-bmo-1196777-Set-GDK_FOCUS_CHANGE_MASK.patch
new file mode 100644
index 0000000..864741e
--- /dev/null
+++
b/http/firefox-esr/patches/0030-bmo-1196777-Set-GDK_FOCUS_CHANGE_MASK.patch
@@ -0,0 +1,13 @@
+diff -up firefox-100.0/widget/gtk/nsWindow.cpp.1196777
firefox-100.0/widget/gtk/nsWindow.cpp
+--- firefox-100.0/widget/gtk/nsWindow.cpp.1196777 2022-05-02
11:29:06.763325015 +0200
++++ firefox-100.0/widget/gtk/nsWindow.cpp 2022-05-02 11:30:49.100717334
+0200
+@@ -163,7 +163,8 @@ const gint kEvents = GDK_TOUCHPAD_GESTUR
+ GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
+ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
+ GDK_SMOOTH_SCROLL_MASK | GDK_TOUCH_MASK |
GDK_SCROLL_MASK |
+- GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK;
++ GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK |
++ GDK_FOCUS_CHANGE_MASK;
+
+ /* utility functions */
+ static bool is_mouse_in_window(GdkWindow* aWindow, gdouble aMouseX,
diff --git
a/http/firefox-esr/patches/0031-bmo-1773259-cbindgen-root_clip_chain-fix.patch

b/http/firefox-esr/patches/0031-bmo-1773259-cbindgen-root_clip_chain-fix.patch
new file mode 100644
index 0000000..a996d35
--- /dev/null
+++
b/http/firefox-esr/patches/0031-bmo-1773259-cbindgen-root_clip_chain-fix.patch
@@ -0,0 +1,16 @@
+Description: Remove an extra constant definition that is now being generated
by newer versions of cbindgen (0.24), and causing build failures because it
is defined in several places.
+Author: Olivier Tilloy <olivier.tilloy AT canonical.com>
+Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1773259
+Forwarded: not-needed
+
+--- a/gfx/webrender_bindings/webrender_ffi.h
++++ b/gfx/webrender_bindings/webrender_ffi.h
+@@ -73,8 +73,6 @@ struct WrPipelineInfo;
+ struct WrPipelineIdAndEpoch;
+ using WrPipelineIdEpochs = nsTArray<WrPipelineIdAndEpoch>;
+
+-const uint64_t ROOT_CLIP_CHAIN = ~0;
+-
+ } // namespace wr
+ } // namespace mozilla
+
diff --git
a/http/firefox-esr/patches/0032-p03-bmo-1752494-vaapi-fixes-D147874.patch
b/http/firefox-esr/patches/0032-p03-bmo-1752494-vaapi-fixes-D147874.patch
new file mode 100644
index 0000000..f0c57dd
--- /dev/null
+++ b/http/firefox-esr/patches/0032-p03-bmo-1752494-vaapi-fixes-D147874.patch
@@ -0,0 +1,64 @@
+diff -up firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp.D147874.diff
firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp
+--- firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp.D147874.diff 2022-05-27
01:16:54.000000000 +0200
++++ firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp 2022-06-07
11:16:03.791419558 +0200
+@@ -233,13 +233,7 @@ void gfxPlatformGtk::InitDmabufConfig()
+ void gfxPlatformGtk::InitVAAPIConfig() {
+ FeatureState& feature = gfxConfig::GetFeature(Feature::VAAPI);
+ #ifdef MOZ_WAYLAND
+- feature.DisableByDefault(FeatureStatus::Disabled,
+- "VAAPI is disabled by default",
+- "FEATURE_VAAPI_DISABLED"_ns);
+-
+- if (StaticPrefs::media_ffmpeg_vaapi_enabled()) {
+- feature.UserForceEnable("Force enabled by pref");
+- }
++ feature.EnableByDefault();
+
+ nsCString failureId;
+ int32_t status;
+@@ -253,6 +247,10 @@ void gfxPlatformGtk::InitVAAPIConfig() {
+ failureId);
+ }
+
++ if (StaticPrefs::media_ffmpeg_vaapi_enabled()) {
++ feature.UserForceEnable("Force enabled by pref");
++ }
++
+ if (!gfxVars::UseEGL()) {
+ feature.ForceDisable(FeatureStatus::Unavailable, "Requires EGL",
+ "FEATURE_FAILURE_REQUIRES_EGL"_ns);
+diff -up firefox-101.0/widget/gtk/GfxInfo.cpp.D147874.diff
firefox-101.0/widget/gtk/GfxInfo.cpp
+--- firefox-101.0/widget/gtk/GfxInfo.cpp.D147874.diff 2022-05-27
01:17:06.000000000 +0200
++++ firefox-101.0/widget/gtk/GfxInfo.cpp 2022-06-07 09:52:54.416701418
+0200
+@@ -843,6 +843,31 @@ const nsTArray<GfxDriverInfo>& GfxInfo::
+ V(495, 44, 0, 0), "FEATURE_FAILURE_NO_GBM", "495.44.0");
+
+ ////////////////////////////////////
++ // FEATURE_VAAPI
++ APPEND_TO_DRIVER_BLOCKLIST_EXT(
++ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
++ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaAll,
++ DeviceFamily::All, nsIGfxInfo::FEATURE_VAAPI,
++ nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
++ V(21, 0, 0, 0), "FEATURE_ROLLOUT_VAAPI_MESA", "Mesa 21.0.0.0");
++
++ // Disable on all NVIDIA hardware
++ APPEND_TO_DRIVER_BLOCKLIST_EXT(
++ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
++ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::All,
++ DeviceFamily::NvidiaAll, nsIGfxInfo::FEATURE_VAAPI,
++ nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
++ V(0, 0, 0, 0), "FEATURE_FAILURE_VAAPI_NO_LINUX_NVIDIA", "");
++
++ // Disable on all AMD devices not using Mesa.
++ APPEND_TO_DRIVER_BLOCKLIST_EXT(
++ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
++ DesktopEnvironment::All, WindowProtocol::All,
DriverVendor::NonMesaAll,
++ DeviceFamily::AtiAll, nsIGfxInfo::FEATURE_VAAPI,
++ nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
++ V(0, 0, 0, 0), "FEATURE_FAILURE_VAAPI_NO_LINUX_AMD", "");
++
++ ////////////////////////////////////
+ // FEATURE_WEBRENDER_PARTIAL_PRESENT
+ APPEND_TO_DRIVER_BLOCKLIST_EXT(
+ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
diff --git
a/http/firefox-esr/patches/0033-bmo-1735929-webgl-nvidia-p1-D147635.patch
b/http/firefox-esr/patches/0033-bmo-1735929-webgl-nvidia-p1-D147635.patch
new file mode 100644
index 0000000..1d4bb58
--- /dev/null
+++ b/http/firefox-esr/patches/0033-bmo-1735929-webgl-nvidia-p1-D147635.patch
@@ -0,0 +1,125 @@
+diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h
+--- a/gfx/gl/GLLibraryEGL.h
++++ b/gfx/gl/GLLibraryEGL.h
+@@ -106,10 +106,13 @@
+ KHR_swap_buffers_with_damage,
+ EXT_buffer_age,
+ KHR_partial_update,
+ NV_robustness_video_memory_purge,
+ MESA_platform_surfaceless,
++ EXT_image_dma_buf_import,
++ EXT_image_dma_buf_import_modifiers,
++ MESA_image_dma_buf_export,
+ Max
+ };
+
+ // -
+
+@@ -461,10 +464,23 @@
+ // EGL_KHR_partial_update
+ EGLBoolean fSetDamageRegion(EGLDisplay dpy, EGLSurface surface,
+ const EGLint* rects, EGLint n_rects) {
+ WRAP(fSetDamageRegion(dpy, surface, rects, n_rects));
+ }
++ // EGL_MESA_image_dma_buf_export
++ EGLBoolean fExportDMABUFImageQuery(EGLDisplay dpy, EGLImage image,
++ int* fourcc, int* num_planes,
++ uint64_t* modifiers) {
++ WRAP(
++ fExportDMABUFImageQueryMESA(dpy, image, fourcc, num_planes,
modifiers));
++ }
++ EGLBoolean fExportDMABUFImage(EGLDisplay dpy, EGLImage image, int* fds,
++ EGLint* strides, EGLint* offsets) {
++ WRAP(fExportDMABUFImageMESA(dpy, image, fds, strides, offsets));
++ }
++
++#undef WRAP
+
+ #undef WRAP
+ #undef PROFILE_CALL
+ #undef BEFORE_CALL
+ #undef AFTER_CALL
+@@ -593,10 +609,22 @@
+ EGLBoolean(GLAPIENTRY* fSetDamageRegion)(EGLDisplay dpy, EGLSurface
surface,
+ const EGLint* rects,
+ EGLint n_rects);
+ EGLClientBuffer(GLAPIENTRY* fGetNativeClientBufferANDROID)(
+ const struct AHardwareBuffer* buffer);
++
++ // EGL_MESA_image_dma_buf_export
++ EGLBoolean(GLAPIENTRY* fExportDMABUFImageQueryMESA)(EGLDisplay dpy,
++ EGLImage image,
++ int* fourcc,
++ int* num_planes,
++ uint64_t*
modifiers);
++ EGLBoolean(GLAPIENTRY* fExportDMABUFImageMESA)(EGLDisplay dpy,
++ EGLImage image, int* fds,
++ EGLint* strides,
++ EGLint* offsets);
++
+ } mSymbols = {};
+ };
+
+ class EglDisplay final {
+ public:
+@@ -852,10 +880,23 @@
+ EGLBoolean fSetDamageRegion(EGLSurface surface, const EGLint* rects,
+ EGLint n_rects) {
+ MOZ_ASSERT(IsExtensionSupported(EGLExtension::KHR_partial_update));
+ return mLib->fSetDamageRegion(mDisplay, surface, rects, n_rects);
+ }
++
++ EGLBoolean fExportDMABUFImageQuery(EGLImage image, int* fourcc,
++ int* num_planes,
++ uint64_t* modifiers) const {
++
MOZ_ASSERT(IsExtensionSupported(EGLExtension::MESA_image_dma_buf_export));
++ return mLib->fExportDMABUFImageQuery(mDisplay, image, fourcc,
num_planes,
++ modifiers);
++ }
++ EGLBoolean fExportDMABUFImage(EGLImage image, int* fds, EGLint* strides,
++ EGLint* offsets) const {
++
MOZ_ASSERT(IsExtensionSupported(EGLExtension::MESA_image_dma_buf_export));
++ return mLib->fExportDMABUFImage(mDisplay, image, fds, strides, offsets);
++ }
+ };
+
+ } /* namespace gl */
+ } /* namespace mozilla */
+
+diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp
+--- a/gfx/gl/GLLibraryEGL.cpp
++++ b/gfx/gl/GLLibraryEGL.cpp
+@@ -82,11 +82,14 @@
+ "EGL_EXT_swap_buffers_with_damage",
+ "EGL_KHR_swap_buffers_with_damage",
+ "EGL_EXT_buffer_age",
+ "EGL_KHR_partial_update",
+ "EGL_NV_robustness_video_memory_purge",
+- "EGL_MESA_platform_surfaceless"};
++ "EGL_MESA_platform_surfaceless",
++ "EGL_EXT_image_dma_buf_import",
++ "EGL_EXT_image_dma_buf_import_modifiers",
++ "EGL_MESA_image_dma_buf_export"};
+
+ PRLibrary* LoadApitraceLibrary() {
+ const char* path = nullptr;
+
+ #ifdef ANDROID
+@@ -647,10 +650,16 @@
+ {
+ const SymLoadStruct symbols[] = {SYMBOL(GetPlatformDisplay),
+ END_OF_SYMBOLS};
+ (void)fnLoadSymbols(symbols);
+ }
++ {
++ const SymLoadStruct symbols[] = {SYMBOL(ExportDMABUFImageQueryMESA),
++ SYMBOL(ExportDMABUFImageMESA),
++ END_OF_SYMBOLS};
++ (void)fnLoadSymbols(symbols);
++ }
+
+ return true;
+ }
+
+ // -
+
diff --git
a/http/firefox-esr/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch
b/http/firefox-esr/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch
new file mode 100644
index 0000000..52462f2
--- /dev/null
+++ b/http/firefox-esr/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch
@@ -0,0 +1,278 @@
+diff --git a/widget/gtk/DMABufSurface.h b/widget/gtk/DMABufSurface.h
+--- a/widget/gtk/DMABufSurface.h
++++ b/widget/gtk/DMABufSurface.h
+@@ -173,13 +173,13 @@
+ SurfaceType mSurfaceType;
+ uint64_t mBufferModifiers[DMABUF_BUFFER_PLANES];
+
+ int mBufferPlaneCount;
+ int mDmabufFds[DMABUF_BUFFER_PLANES];
+- uint32_t mDrmFormats[DMABUF_BUFFER_PLANES];
+- uint32_t mStrides[DMABUF_BUFFER_PLANES];
+- uint32_t mOffsets[DMABUF_BUFFER_PLANES];
++ int32_t mDrmFormats[DMABUF_BUFFER_PLANES];
++ int32_t mStrides[DMABUF_BUFFER_PLANES];
++ int32_t mOffsets[DMABUF_BUFFER_PLANES];
+
+ struct gbm_bo* mGbmBufferObject[DMABUF_BUFFER_PLANES];
+ void* mMappedRegion[DMABUF_BUFFER_PLANES];
+ void* mMappedRegionData[DMABUF_BUFFER_PLANES];
+ uint32_t mMappedRegionStride[DMABUF_BUFFER_PLANES];
+@@ -198,10 +198,14 @@
+ class DMABufSurfaceRGBA : public DMABufSurface {
+ public:
+ static already_AddRefed<DMABufSurfaceRGBA> CreateDMABufSurface(
+ int aWidth, int aHeight, int aDMABufSurfaceFlags);
+
++ static already_AddRefed<DMABufSurface> CreateDMABufSurface(
++ mozilla::gl::GLContext* aGLContext, const EGLImageKHR aEGLImage,
++ int aWidth, int aHeight);
++
+ bool Serialize(mozilla::layers::SurfaceDescriptor& aOutDescriptor);
+
+ DMABufSurfaceRGBA* GetAsDMABufSurfaceRGBA() { return this; }
+
+ void Clear();
+@@ -247,10 +251,12 @@
+ private:
+ ~DMABufSurfaceRGBA();
+
+ bool Create(int aWidth, int aHeight, int aDMABufSurfaceFlags);
+ bool Create(const mozilla::layers::SurfaceDescriptor& aDesc);
++ bool Create(mozilla::gl::GLContext* aGLContext, const EGLImageKHR
aEGLImage,
++ int aWidth, int aHeight);
+
+ bool ImportSurfaceDescriptor(const mozilla::layers::SurfaceDescriptor&
aDesc);
+
+ bool OpenFileDescriptorForPlane(const mozilla::MutexAutoLock&
aProofOfLock,
+ int aPlane);
+diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
+--- a/widget/gtk/DMABufSurface.cpp
++++ b/widget/gtk/DMABufSurface.cpp
+@@ -204,10 +204,12 @@
+ }
+ }
+
+ void DMABufSurface::FenceSet() {
+ if (!mGL || !mGL->MakeCurrent()) {
++ MOZ_DIAGNOSTIC_ASSERT(mGL,
++ "DMABufSurface::FenceSet(): missing GL context!");
+ return;
+ }
+ const auto& gle = gl::GLContextEGL::Cast(mGL);
+ const auto& egl = gle->mEgl;
+
+@@ -228,21 +230,23 @@
+ mGL->fFinish();
+ }
+
+ void DMABufSurface::FenceWait() {
+ if (!mGL || mSyncFd < 0) {
++ MOZ_DIAGNOSTIC_ASSERT(mGL,
++ "DMABufSurface::FenceWait() missing GL context!");
+ return;
+ }
+
+ const auto& gle = gl::GLContextEGL::Cast(mGL);
+ const auto& egl = gle->mEgl;
+
+ const EGLint attribs[] = {LOCAL_EGL_SYNC_NATIVE_FENCE_FD_ANDROID, mSyncFd,
+ LOCAL_EGL_NONE};
+ EGLSync sync = egl->fCreateSync(LOCAL_EGL_SYNC_NATIVE_FENCE_ANDROID,
attribs);
+ if (!sync) {
+- MOZ_ASSERT(false, "Failed to create GLFence!");
++ MOZ_ASSERT(false, "DMABufSurface::FenceWait(): Failed to create
GLFence!");
+ // We failed to create GLFence so clear mSyncFd to avoid another try.
+ close(mSyncFd);
+ mSyncFd = -1;
+ return;
+ }
+@@ -338,17 +342,18 @@
+ mGmbFormat = GetDMABufDevice()->GetGbmFormat(mSurfaceFlags &
DMABUF_ALPHA);
+ if (!mGmbFormat) {
+ // Requested DRM format is not supported.
+ return false;
+ }
++ mDrmFormats[0] = mGmbFormat->mFormat;
+
+ bool useModifiers = (aDMABufSurfaceFlags & DMABUF_USE_MODIFIERS) &&
+ mGmbFormat->mModifiersCount > 0;
+ if (useModifiers) {
+ LOGDMABUF((" Creating with modifiers\n"));
+ mGbmBufferObject[0] = nsGbmLib::CreateWithModifiers(
+- GetDMABufDevice()->GetGbmDevice(), mWidth, mHeight,
mGmbFormat->mFormat,
++ GetDMABufDevice()->GetGbmDevice(), mWidth, mHeight, mDrmFormats[0],
+ mGmbFormat->mModifiers, mGmbFormat->mModifiersCount);
+ if (mGbmBufferObject[0]) {
+ mBufferModifiers[0] = nsGbmLib::GetModifier(mGbmBufferObject[0]);
+ }
+ }
+@@ -356,11 +361,11 @@
+ if (!mGbmBufferObject[0]) {
+ LOGDMABUF((" Creating without modifiers\n"));
+ mGbmBufferFlags = GBM_BO_USE_LINEAR;
+ mGbmBufferObject[0] =
+ nsGbmLib::Create(GetDMABufDevice()->GetGbmDevice(), mWidth, mHeight,
+- mGmbFormat->mFormat, mGbmBufferFlags);
++ mDrmFormats[0], mGbmBufferFlags);
+ mBufferModifiers[0] = DRM_FORMAT_MOD_INVALID;
+ }
+
+ if (!mGbmBufferObject[0]) {
+ LOGDMABUF((" Failed to create GbmBufferObject\n"));
+@@ -386,22 +391,51 @@
+
+ LOGDMABUF((" Success\n"));
+ return true;
+ }
+
++bool DMABufSurfaceRGBA::Create(mozilla::gl::GLContext* aGLContext,
++ const EGLImageKHR aEGLImage, int aWidth,
++ int aHeight) {
++ LOGDMABUF(("DMABufSurfaceRGBA::Create() from EGLImage UID = %d\n", mUID));
++ if (!aGLContext) {
++ return false;
++ }
++ const auto& gle = gl::GLContextEGL::Cast(aGLContext);
++ const auto& egl = gle->mEgl;
++
++ mGL = aGLContext;
++ mWidth = aWidth;
++ mHeight = aHeight;
++ mEGLImage = aEGLImage;
++ if (!egl->fExportDMABUFImageQuery(mEGLImage, mDrmFormats,
&mBufferPlaneCount,
++ mBufferModifiers)) {
++ LOGDMABUF((" ExportDMABUFImageQueryMESA failed, quit\n"));
++ return false;
++ }
++ if (mBufferPlaneCount > DMABUF_BUFFER_PLANES) {
++ LOGDMABUF((" wrong plane count %d, quit\n", mBufferPlaneCount));
++ return false;
++ }
++ if (!egl->fExportDMABUFImage(mEGLImage, mDmabufFds, mStrides, mOffsets)) {
++ LOGDMABUF((" ExportDMABUFImageMESA failed, quit\n"));
++ return false;
++ }
++
++ LOGDMABUF((" imported size %d x %d format %x planes %d", mWidth, mHeight,
++ mDrmFormats[0], mBufferPlaneCount));
++ return true;
++}
++
+ bool DMABufSurfaceRGBA::ImportSurfaceDescriptor(
+ const SurfaceDescriptor& aDesc) {
+ const SurfaceDescriptorDMABuf& desc = aDesc.get_SurfaceDescriptorDMABuf();
+
+ mWidth = desc.width()[0];
+ mHeight = desc.height()[0];
+ mBufferModifiers[0] = desc.modifier()[0];
+- if (mBufferModifiers[0] != DRM_FORMAT_MOD_INVALID) {
+- mGmbFormat = GetDMABufDevice()->GetExactGbmFormat(desc.format()[0]);
+- } else {
+- mDrmFormats[0] = desc.format()[0];
+- }
++ mDrmFormats[0] = desc.format()[0];
+ mBufferPlaneCount = desc.fds().Length();
+ mGbmBufferFlags = desc.flags();
+ MOZ_RELEASE_ASSERT(mBufferPlaneCount <= DMABUF_BUFFER_PLANES);
+ mUID = desc.uid();
+
+@@ -431,10 +465,12 @@
+
+ if (desc.refCount().Length() > 0) {
+
GlobalRefCountImport(desc.refCount()[0].ClonePlatformHandle().release());
+ }
+
++ LOGDMABUF((" imported size %d x %d format %x planes %d", mWidth, mHeight,
++ mDrmFormats[0], mBufferPlaneCount));
+ return true;
+ }
+
+ bool DMABufSurfaceRGBA::Create(const SurfaceDescriptor& aDesc) {
+ return ImportSurfaceDescriptor(aDesc);
+@@ -460,11 +496,11 @@
+ return false;
+ }
+
+ width.AppendElement(mWidth);
+ height.AppendElement(mHeight);
+- format.AppendElement(mGmbFormat->mFormat);
++ format.AppendElement(mDrmFormats[0]);
+ modifiers.AppendElement(mBufferModifiers[0]);
+ for (int i = 0; i < mBufferPlaneCount; i++) {
+ fds.AppendElement(ipc::FileDescriptor(mDmabufFds[i]));
+ strides.AppendElement(mStrides[i]);
+ offsets.AppendElement(mOffsets[i]);
+@@ -486,23 +522,20 @@
+ fenceFDs, mUID, refCountFDs);
+ return true;
+ }
+
+ bool DMABufSurfaceRGBA::CreateTexture(GLContext* aGLContext, int aPlane) {
++ LOGDMABUF(("DMABufSurfaceRGBA::CreateTexture() UID %d\n", mUID));
+ MOZ_ASSERT(!mEGLImage && !mTexture, "EGLImage is already created!");
+
+ nsTArray<EGLint> attribs;
+ attribs.AppendElement(LOCAL_EGL_WIDTH);
+ attribs.AppendElement(mWidth);
+ attribs.AppendElement(LOCAL_EGL_HEIGHT);
+ attribs.AppendElement(mHeight);
+ attribs.AppendElement(LOCAL_EGL_LINUX_DRM_FOURCC_EXT);
+- if (mGmbFormat) {
+- attribs.AppendElement(mGmbFormat->mFormat);
+- } else {
+- attribs.AppendElement(mDrmFormats[0]);
+- }
++ attribs.AppendElement(mDrmFormats[0]);
+ #define ADD_PLANE_ATTRIBS(plane_idx)
\
+ {
\
+ attribs.AppendElement(LOCAL_EGL_DMA_BUF_PLANE##plane_idx##_FD_EXT);
\
+ attribs.AppendElement(mDmabufFds[plane_idx]);
\
+ attribs.AppendElement(LOCAL_EGL_DMA_BUF_PLANE##plane_idx##_OFFSET_EXT);
\
+@@ -560,10 +593,11 @@
+
+ return true;
+ }
+
+ void DMABufSurfaceRGBA::ReleaseTextures() {
++ LOGDMABUF(("DMABufSurfaceRGBA::ReleaseTextures() UID %d\n", mUID));
+ FenceDelete();
+
+ if (!mTexture) {
+ return;
+ }
+@@ -618,11 +652,11 @@
+ zwp_linux_buffer_params_v1_add(params, mDmabufFds[0], 0, mOffsets[0],
+ mStrides[0], mBufferModifiers[0] >> 32,
+ mBufferModifiers[0] & 0xffffffff);
+
+ mWlBuffer = zwp_linux_buffer_params_v1_create_immed(
+- params, GetWidth(), GetHeight(), mGmbFormat->mFormat, 0);
++ params, GetWidth(), GetHeight(), mDrmFormats[0], 0);
+
+ CloseFileDescriptors(lockFD);
+
+ return mWlBuffer != nullptr;
+ }
+@@ -806,10 +840,20 @@
+ return nullptr;
+ }
+ return surf.forget();
+ }
+
++already_AddRefed<DMABufSurface> DMABufSurfaceRGBA::CreateDMABufSurface(
++ mozilla::gl::GLContext* aGLContext, const EGLImageKHR aEGLImage, int
aWidth,
++ int aHeight) {
++ RefPtr<DMABufSurfaceRGBA> surf = new DMABufSurfaceRGBA();
++ if (!surf->Create(aGLContext, aEGLImage, aWidth, aHeight)) {
++ return nullptr;
++ }
++ return surf.forget();
++}
++
+ already_AddRefed<DMABufSurfaceYUV> DMABufSurfaceYUV::CreateYUVSurface(
+ const VADRMPRIMESurfaceDescriptor& aDesc, int aWidth, int aHeight) {
+ RefPtr<DMABufSurfaceYUV> surf = new DMABufSurfaceYUV();
+ LOGDMABUF(("DMABufSurfaceYUV::CreateYUVSurface() UID %d from desc\n",
+ surf->GetUID()));
+
diff --git
a/http/firefox-esr/patches/0035-bmo-1735929-webgl-nvidia-p3-D147637.patch
b/http/firefox-esr/patches/0035-bmo-1735929-webgl-nvidia-p3-D147637.patch
new file mode 100644
index 0000000..89bb25e
--- /dev/null
+++ b/http/firefox-esr/patches/0035-bmo-1735929-webgl-nvidia-p3-D147637.patch
@@ -0,0 +1,139 @@
+diff -up firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff
firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp
+--- firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff 2022-06-23
09:08:46.000000000 +0200
++++ firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp 2022-06-28
16:37:52.264835137 +0200
+@@ -9,25 +9,58 @@
+ #include "GLContextEGL.h"
+ #include "MozFramebuffer.h"
+ #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
++#include "mozilla/gfx/gfxVars.h"
+
+ namespace mozilla::gl {
+
++static bool HasDmaBufExtensions(const GLContextEGL* gl) {
++ const auto& egl = *(gl->mEgl);
++ return egl.IsExtensionSupported(EGLExtension::EXT_image_dma_buf_import) &&
++ egl.IsExtensionSupported(
++ EGLExtension::EXT_image_dma_buf_import_modifiers) &&
++ egl.IsExtensionSupported(EGLExtension::MESA_image_dma_buf_export);
++}
++
+ /*static*/
+ UniquePtr<SharedSurface_DMABUF> SharedSurface_DMABUF::Create(
+ const SharedSurfaceDesc& desc) {
+- const auto flags = static_cast<DMABufSurfaceFlags>(
+- DMABUF_TEXTURE | DMABUF_USE_MODIFIERS | DMABUF_ALPHA);
+- const RefPtr<DMABufSurface> surface =
DMABufSurfaceRGBA::CreateDMABufSurface(
+- desc.size.width, desc.size.height, flags);
+- if (!surface || !surface->CreateTexture(desc.gl)) {
+- return nullptr;
++ const auto& gle = GLContextEGL::Cast(desc.gl);
++ const auto& context = gle->mContext;
++ const auto& egl = *(gle->mEgl);
++
++ RefPtr<DMABufSurface> surface;
++ UniquePtr<MozFramebuffer> fb;
++
++ if (!HasDmaBufExtensions(gle) || !gfx::gfxVars::UseDMABufSurfaceExport())
{
++ // Use MESA_image_dma_buf_export is not supported or it's broken.
++ // Create dmabuf surface directly via. GBM and create
++ // EGLImage/framebuffer over it.
++ const auto flags = static_cast<DMABufSurfaceFlags>(
++ DMABUF_TEXTURE | DMABUF_USE_MODIFIERS | DMABUF_ALPHA);
++ surface = DMABufSurfaceRGBA::CreateDMABufSurface(desc.size.width,
++ desc.size.height,
flags);
++ if (!surface || !surface->CreateTexture(desc.gl)) {
++ return nullptr;
++ }
++ const auto tex = surface->GetTexture();
++ fb = MozFramebuffer::CreateForBacking(desc.gl, desc.size, 0, false,
++ LOCAL_GL_TEXTURE_2D, tex);
++ if (!fb) return nullptr;
++ } else {
++ // Use MESA_image_dma_buf_export so create EGLImage/framebuffer directly
++ // and derive dmabuf from it.
++ fb = MozFramebuffer::Create(desc.gl, desc.size, 0, false);
++ if (!fb) return nullptr;
++
++ const auto buffer = reinterpret_cast<EGLClientBuffer>(fb->ColorTex());
++ const auto image =
++ egl.fCreateImage(context, LOCAL_EGL_GL_TEXTURE_2D, buffer, nullptr);
++ if (!image) return nullptr;
++
++ surface = DMABufSurfaceRGBA::CreateDMABufSurface(
++ desc.gl, image, desc.size.width, desc.size.height);
++ if (!surface) return nullptr;
+ }
+-
+- const auto tex = surface->GetTexture();
+- auto fb = MozFramebuffer::CreateForBacking(desc.gl, desc.size, 0, false,
+- LOCAL_GL_TEXTURE_2D, tex);
+- if (!fb) return nullptr;
+-
+ return AsUnique(new SharedSurface_DMABUF(desc, std::move(fb), surface));
+ }
+
+@@ -61,7 +94,7 @@ UniquePtr<SurfaceFactory_DMABUF> Surface
+ }
+
+ auto dmabufFactory = MakeUnique<SurfaceFactory_DMABUF>(gl);
+- if (dmabufFactory->CanCreateSurface()) {
++ if (dmabufFactory->CanCreateSurface(gl)) {
+ return dmabufFactory;
+ }
+
+@@ -71,8 +104,38 @@ UniquePtr<SurfaceFactory_DMABUF> Surface
+ return nullptr;
+ }
+
++bool SurfaceFactory_DMABUF::CanCreateSurface(GLContext& gl) {
++ UniquePtr<SharedSurface> test =
++ CreateShared(gfx::IntSize(1, 1), gfx::ColorSpace2::SRGB);
++ if (!test) {
++ LOGDMABUF((
++ "SurfaceFactory_DMABUF::CanCreateSurface() failed to create
surface."));
++ return false;
++ }
++ auto desc = test->ToSurfaceDescriptor();
++ if (!desc) {
++ LOGDMABUF(
++ ("SurfaceFactory_DMABUF::CanCreateSurface() failed to serialize "
++ "surface."));
++ return false;
++ }
++ RefPtr<DMABufSurface> importedSurface =
++ DMABufSurface::CreateDMABufSurface(*desc);
++ if (!importedSurface) {
++ LOGDMABUF((
++ "SurfaceFactory_DMABUF::CanCreateSurface() failed to import
surface."));
++ return false;
++ }
++ if (!importedSurface->CreateTexture(&gl)) {
++ LOGDMABUF(
++ ("SurfaceFactory_DMABUF::CanCreateSurface() failed to create
texture "
++ "over surface."));
++ return false;
++ }
++ return true;
++}
++
+ SurfaceFactory_DMABUF::SurfaceFactory_DMABUF(GLContext& gl)
+ : SurfaceFactory({&gl, SharedSurfaceType::EGLSurfaceDMABUF,
+ layers::TextureType::DMABUF, true}) {}
+-
+ } // namespace mozilla::gl
+diff -up firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h.D147637.diff
firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h
+--- firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h.D147637.diff 2022-06-23
09:08:47.000000000 +0200
++++ firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h 2022-06-28 15:00:20.339991965
+0200
+@@ -59,11 +59,7 @@ class SurfaceFactory_DMABUF : public Sur
+ return SharedSurface_DMABUF::Create(desc);
+ }
+
+- bool CanCreateSurface() {
+- UniquePtr<SharedSurface> test =
+- CreateShared(gfx::IntSize(1, 1), gfx::ColorSpace2::SRGB);
+- return test != nullptr;
+- }
++ bool CanCreateSurface(GLContext& gl);
+ };
+
+ } // namespace gl
diff --git
a/http/firefox-esr/patches/0036-bmo-1773968-webgl-memory-leak.patch
b/http/firefox-esr/patches/0036-bmo-1773968-webgl-memory-leak.patch
new file mode 100644
index 0000000..6e93f2b
--- /dev/null
+++ b/http/firefox-esr/patches/0036-bmo-1773968-webgl-memory-leak.patch
@@ -0,0 +1,80 @@
+diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
+--- a/widget/gtk/DMABufSurface.cpp
++++ b/widget/gtk/DMABufSurface.cpp
+@@ -642,11 +642,11 @@
+
+ void DMABufSurfaceRGBA::ReleaseTextures() {
+ LOGDMABUF(("DMABufSurfaceRGBA::ReleaseTextures() UID %d\n", mUID));
+ FenceDelete();
+
+- if (!mTexture) {
++ if (!mTexture && mEGLImage == LOCAL_EGL_NO_IMAGE) {
+ return;
+ }
+
+ if (!mGL) {
+ #ifdef NIGHTLY
+@@ -663,17 +663,17 @@
+ const auto& egl = gle->mEgl;
+
+ if (mTexture && mGL->MakeCurrent()) {
+ mGL->fDeleteTextures(1, &mTexture);
+ mTexture = 0;
+- mGL = nullptr;
+ }
+
+ if (mEGLImage != LOCAL_EGL_NO_IMAGE) {
+ egl->fDestroyImage(mEGLImage);
+ mEGLImage = LOCAL_EGL_NO_IMAGE;
+ }
++ mGL = nullptr;
+ }
+
+ void DMABufSurfaceRGBA::ReleaseSurface() {
+ MOZ_ASSERT(!IsMapped(), "We can't release mapped buffer!");
+
+@@ -1325,11 +1325,11 @@
+
+ FenceDelete();
+
+ bool textureActive = false;
+ for (int i = 0; i < mBufferPlaneCount; i++) {
+- if (mTexture[i]) {
++ if (mTexture[i] || mEGLImage[i] != LOCAL_EGL_NO_IMAGE) {
+ textureActive = true;
+ break;
+ }
+ }
+
+@@ -1346,18 +1346,23 @@
+ "leaking textures!");
+ return;
+ #endif
+ }
+
+- if (textureActive && mGL->MakeCurrent()) {
+- mGL->fDeleteTextures(DMABUF_BUFFER_PLANES, mTexture);
+- for (int i = 0; i < DMABUF_BUFFER_PLANES; i++) {
+- mTexture[i] = 0;
+- }
+- ReleaseEGLImages(mGL);
+- mGL = nullptr;
++ if (!mGL->MakeCurrent()) {
++ NS_WARNING(
++ "DMABufSurfaceYUV::ReleaseTextures(): Failed to create GL context "
++ "current. We're leaking textures!");
++ return;
+ }
++
++ mGL->fDeleteTextures(DMABUF_BUFFER_PLANES, mTexture);
++ for (int i = 0; i < DMABUF_BUFFER_PLANES; i++) {
++ mTexture[i] = 0;
++ }
++ ReleaseEGLImages(mGL);
++ mGL = nullptr;
+ }
+
+ bool DMABufSurfaceYUV::VerifyTextureCreation() {
+ LOGDMABUF(("DMABufSurfaceYUV::VerifyTextureCreation() UID %d", mUID));
+
+
diff --git
a/http/firefox-esr/patches/0037-bmo-1758948-vaapi-fixes-p2-p4.patch
b/http/firefox-esr/patches/0037-bmo-1758948-vaapi-fixes-p2-p4.patch
new file mode 100644
index 0000000..7bc99e4
--- /dev/null
+++ b/http/firefox-esr/patches/0037-bmo-1758948-vaapi-fixes-p2-p4.patch
@@ -0,0 +1,28 @@
+changeset: 623785:a6b80ee8c35f
+tag: tip
+parent: 623782:b1ed2fa50612
+user: stransky <stransky AT redhat.com>
+date: Wed Jun 15 14:54:19 2022 +0200
+files: dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+description:
+Bug 1758948 [FFmpeg] Use AVFrame::pts instead of AVFrame::pkt_pts on ffmpeg
4.x r?alwu
+
+AVFrame::pkt_pts has been deprecated and gives us wrong values for AV1
VA-API. Let's use AVFrame::pts instead on ffmpeg 4.x
+as well as we use on ffmpeg 5.0 where AVFrame::pkt_pts is removed.
+
+Differential Revision: https://phabricator.services.mozilla.com/D149386
+
+
+diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
++++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+@@ -774,7 +774,7 @@ void FFmpegVideoDecoder<LIBAV_VER>::Init
+ #endif
+
+ static int64_t GetFramePts(AVFrame* aFrame) {
+-#if LIBAVCODEC_VERSION_MAJOR > 58
++#if LIBAVCODEC_VERSION_MAJOR > 57
+ return aFrame->pts;
+ #else
+ return aFrame->pkt_pts;
+
diff --git
a/http/firefox-esr/patches/0038-bmo-1773377-vaapi-fixes-p2-p2-D148946.patch
b/http/firefox-esr/patches/0038-bmo-1773377-vaapi-fixes-p2-p2-D148946.patch
new file mode 100644
index 0000000..0ab7380
--- /dev/null
+++
b/http/firefox-esr/patches/0038-bmo-1773377-vaapi-fixes-p2-p2-D148946.patch
@@ -0,0 +1,250 @@
+diff -up firefox-102.0/gfx/gl/GLContextProviderEGL.cpp.D148946.diff
firefox-102.0/gfx/gl/GLContextProviderEGL.cpp
+--- firefox-102.0/gfx/gl/GLContextProviderEGL.cpp.D148946.diff 2022-06-23
09:08:47.000000000 +0200
++++ firefox-102.0/gfx/gl/GLContextProviderEGL.cpp 2022-06-28
14:47:40.904700050 +0200
+@@ -1182,42 +1182,16 @@ RefPtr<GLContextEGL> GLContextEGL::Creat
+ }
+
+ /*static*/
+-RefPtr<GLContextEGL> GLContextEGL::CreateEGLSurfacelessContext(
+- const std::shared_ptr<EglDisplay> display, const GLContextCreateDesc&
desc,
+- nsACString* const out_failureId) {
+- const EGLConfig config = {};
+- auto fullDesc = GLContextDesc{desc};
+- fullDesc.isOffscreen = true;
+- RefPtr<GLContextEGL> gl = GLContextEGL::CreateGLContext(
+- display, fullDesc, config, EGL_NO_SURFACE, false, out_failureId);
+- if (!gl) {
+- NS_WARNING("Failed to create surfaceless GL context");
+- return nullptr;
+- }
+- return gl;
+-}
+-
+-/*static*/
+ already_AddRefed<GLContext> GLContextProviderEGL::CreateHeadless(
+ const GLContextCreateDesc& desc, nsACString* const out_failureId) {
+ const auto display = DefaultEglDisplay(out_failureId);
+ if (!display) {
+ return nullptr;
+ }
+- RefPtr<GLContextEGL> gl;
+-#ifdef MOZ_WAYLAND
+- if (!gdk_display_get_default() &&
+-
display->IsExtensionSupported(EGLExtension::MESA_platform_surfaceless)) {
+- gl =
+- GLContextEGL::CreateEGLSurfacelessContext(display, desc,
out_failureId);
+- } else
+-#endif
+- {
+- mozilla::gfx::IntSize dummySize = mozilla::gfx::IntSize(16, 16);
+- gl = GLContextEGL::CreateEGLPBufferOffscreenContext(
+- display, desc, dummySize, out_failureId);
+- }
+- return gl.forget();
++ mozilla::gfx::IntSize dummySize = mozilla::gfx::IntSize(16, 16);
++ auto ret = GLContextEGL::CreateEGLPBufferOffscreenContext(
++ display, desc, dummySize, out_failureId);
++ return ret.forget();
+ }
+
+ // Don't want a global context on Android as 1) share groups across 2
threads
+diff -up firefox-102.0/gfx/gl/GLDefs.h.D148946.diff
firefox-102.0/gfx/gl/GLDefs.h
+--- firefox-102.0/gfx/gl/GLDefs.h.D148946.diff 2022-06-23 09:08:47.000000000
+0200
++++ firefox-102.0/gfx/gl/GLDefs.h 2022-06-28 14:47:40.904700050 +0200
+@@ -104,9 +104,6 @@ bool CheckContextLost(const GLContext* g
+ // EGL_ANGLE_image_d3d11_texture
+ #define LOCAL_EGL_D3D11_TEXTURE_ANGLE 0x3484
+
+-// EGL_MESA_platform_surfaceless
+-#define LOCAL_EGL_PLATFORM_SURFACELESS_MESA 0x31DD
+-
+ // clang-format on
+
+ #endif
+diff -up firefox-102.0/gfx/gl/GLLibraryEGL.cpp.D148946.diff
firefox-102.0/gfx/gl/GLLibraryEGL.cpp
+--- firefox-102.0/gfx/gl/GLLibraryEGL.cpp.D148946.diff 2022-06-28
14:47:40.900699918 +0200
++++ firefox-102.0/gfx/gl/GLLibraryEGL.cpp 2022-06-28 14:49:47.810911199
+0200
+@@ -54,9 +54,15 @@ StaticRefPtr<GLLibraryEGL> GLLibraryEGL:
+
+ // should match the order of EGLExtensions, and be null-terminated.
+ static const char* sEGLLibraryExtensionNames[] = {
+- "EGL_ANDROID_get_native_client_buffer", "EGL_ANGLE_device_creation",
+- "EGL_ANGLE_device_creation_d3d11", "EGL_ANGLE_platform_angle",
+- "EGL_ANGLE_platform_angle_d3d", "EGL_EXT_device_query"};
++ "EGL_ANDROID_get_native_client_buffer",
++ "EGL_ANGLE_device_creation",
++ "EGL_ANGLE_device_creation_d3d11",
++ "EGL_ANGLE_platform_angle",
++ "EGL_ANGLE_platform_angle_d3d",
++ "EGL_EXT_device_enumeration",
++ "EGL_EXT_device_query",
++ "EGL_EXT_platform_device",
++ "EGL_MESA_platform_surfaceless"};
+
+ // should match the order of EGLExtensions, and be null-terminated.
+ static const char* sEGLExtensionNames[] = {
+@@ -84,7 +90,6 @@ static const char* sEGLExtensionNames[]
+ "EGL_EXT_buffer_age",
+ "EGL_KHR_partial_update",
+ "EGL_NV_robustness_video_memory_purge",
+- "EGL_MESA_platform_surfaceless",
+ "EGL_EXT_image_dma_buf_import",
+ "EGL_EXT_image_dma_buf_import_modifiers",
+ "EGL_MESA_image_dma_buf_export"};
+@@ -157,8 +162,52 @@ static std::shared_ptr<EglDisplay> GetAn
+ }
+
+ #ifdef MOZ_WAYLAND
++static std::shared_ptr<EglDisplay> GetAndInitDeviceDisplay(
++ GLLibraryEGL& egl, const StaticMutexAutoLock& aProofOfLock) {
++ nsAutoCString drmRenderDevice(gfx::gfxVars::DrmRenderDevice());
++ if (drmRenderDevice.IsEmpty() ||
++ !egl.IsExtensionSupported(EGLLibExtension::EXT_platform_device) ||
++ !egl.IsExtensionSupported(EGLLibExtension::EXT_device_enumeration)) {
++ return nullptr;
++ }
++
++ EGLint maxDevices;
++ if (!egl.fQueryDevicesEXT(0, nullptr, &maxDevices)) {
++ return nullptr;
++ }
++
++ std::vector<EGLDeviceEXT> devices(maxDevices);
++ EGLint numDevices;
++ if (!egl.fQueryDevicesEXT(devices.size(), devices.data(), &numDevices)) {
++ return nullptr;
++ }
++ devices.resize(numDevices);
++
++ EGLDisplay display = EGL_NO_DISPLAY;
++ for (const auto& device : devices) {
++ const char* renderNodeString =
++ egl.fQueryDeviceStringEXT(device,
LOCAL_EGL_DRM_RENDER_NODE_FILE_EXT);
++ if (renderNodeString &&
++ strcmp(renderNodeString, drmRenderDevice.get()) == 0) {
++ const EGLAttrib attrib_list[] = {LOCAL_EGL_NONE};
++ display = egl.fGetPlatformDisplay(LOCAL_EGL_PLATFORM_DEVICE_EXT,
device,
++ attrib_list);
++ break;
++ }
++ }
++ if (!display) {
++ return nullptr;
++ }
++
++ return EglDisplay::Create(egl, display, true, aProofOfLock);
++}
++
+ static std::shared_ptr<EglDisplay> GetAndInitSurfacelessDisplay(
+ GLLibraryEGL& egl, const StaticMutexAutoLock& aProofOfLock) {
++ if
(!egl.IsExtensionSupported(EGLLibExtension::MESA_platform_surfaceless)) {
++ return nullptr;
++ }
++
+ const EGLAttrib attrib_list[] = {LOCAL_EGL_NONE};
+ const EGLDisplay display = egl.fGetPlatformDisplay(
+ LOCAL_EGL_PLATFORM_SURFACELESS_MESA, EGL_DEFAULT_DISPLAY,
attrib_list);
+@@ -611,9 +660,9 @@ bool GLLibraryEGL::Init(nsACString* cons
+ (void)fnLoadSymbols(symbols);
+ }
+ {
+- const SymLoadStruct symbols[] = {SYMBOL(QueryDisplayAttribEXT),
+- SYMBOL(QueryDeviceAttribEXT),
+- END_OF_SYMBOLS};
++ const SymLoadStruct symbols[] = {
++ SYMBOL(QueryDisplayAttribEXT), SYMBOL(QueryDeviceAttribEXT),
++ SYMBOL(QueryDeviceStringEXT), END_OF_SYMBOLS};
+ (void)fnLoadSymbols(symbols);
+ }
+ {
+@@ -658,6 +707,10 @@ bool GLLibraryEGL::Init(nsACString* cons
+ END_OF_SYMBOLS};
+ (void)fnLoadSymbols(symbols);
+ }
++ {
++ const SymLoadStruct symbols[] = {SYMBOL(QueryDevicesEXT),
END_OF_SYMBOLS};
++ (void)fnLoadSymbols(symbols);
++ }
+
+ return true;
+ }
+@@ -835,7 +888,10 @@ std::shared_ptr<EglDisplay> GLLibraryEGL
+ #ifdef MOZ_WAYLAND
+ GdkDisplay* gdkDisplay = gdk_display_get_default();
+ if (!gdkDisplay) {
+- ret = GetAndInitSurfacelessDisplay(*this, aProofOfLock);
++ ret = GetAndInitDeviceDisplay(*this, aProofOfLock);
++ if (!ret) {
++ ret = GetAndInitSurfacelessDisplay(*this, aProofOfLock);
++ }
+ } else if (widget::GdkIsWaylandDisplay(gdkDisplay)) {
+ // Wayland does not support EGL_DEFAULT_DISPLAY
+ nativeDisplay = widget::WaylandDisplayGetWLDisplay(gdkDisplay);
+diff -up firefox-102.0/gfx/gl/GLLibraryEGL.h.D148946.diff
firefox-102.0/gfx/gl/GLLibraryEGL.h
+--- firefox-102.0/gfx/gl/GLLibraryEGL.h.D148946.diff 2022-06-28
14:47:40.899699885 +0200
++++ firefox-102.0/gfx/gl/GLLibraryEGL.h 2022-06-28 14:47:40.904700050
+0200
+@@ -71,7 +71,10 @@ enum class EGLLibExtension {
+ ANGLE_device_creation_d3d11,
+ ANGLE_platform_angle,
+ ANGLE_platform_angle_d3d,
++ EXT_device_enumeration,
+ EXT_device_query,
++ EXT_platform_device,
++ MESA_platform_surfaceless,
+ Max
+ };
+
+@@ -107,7 +110,6 @@ enum class EGLExtension {
+ EXT_buffer_age,
+ KHR_partial_update,
+ NV_robustness_video_memory_purge,
+- MESA_platform_surfaceless,
+ EXT_image_dma_buf_import,
+ EXT_image_dma_buf_import_modifiers,
+ MESA_image_dma_buf_export,
+@@ -436,6 +438,10 @@ class GLLibraryEGL final {
+ WRAP(fQueryDeviceAttribEXT(device, attribute, value));
+ }
+
++ const char* fQueryDeviceStringEXT(EGLDeviceEXT device, EGLint name) {
++ WRAP(fQueryDeviceStringEXT(device, name));
++ }
++
+ private:
+ // NV_stream_consumer_gltexture_yuv
+ EGLBoolean fStreamConsumerGLTextureExternalAttribsNV(
+@@ -478,6 +484,13 @@ class GLLibraryEGL final {
+ WRAP(fExportDMABUFImageMESA(dpy, image, fds, strides, offsets));
+ }
+
++ public:
++ // EGL_EXT_device_enumeration
++ EGLBoolean fQueryDevicesEXT(EGLint max_devices, EGLDeviceEXT* devices,
++ EGLint* num_devices) {
++ WRAP(fQueryDevicesEXT(max_devices, devices, num_devices));
++ }
++
+ #undef WRAP
+
+ #undef WRAP
+@@ -586,6 +599,9 @@ class GLLibraryEGL final {
+ EGLBoolean(GLAPIENTRY* fQueryDeviceAttribEXT)(EGLDeviceEXT device,
+ EGLint attribute,
+ EGLAttrib* value);
++ const char*(GLAPIENTRY* fQueryDeviceStringEXT)(EGLDeviceEXT device,
++ EGLint name);
++
+ // NV_stream_consumer_gltexture_yuv
+ EGLBoolean(GLAPIENTRY* fStreamConsumerGLTextureExternalAttribsNV)(
+ EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib* attrib_list);
+@@ -623,6 +639,10 @@ class GLLibraryEGL final {
+ EGLint* strides,
+ EGLint* offsets);
+
++ EGLBoolean(GLAPIENTRY* fQueryDevicesEXT)(EGLint max_devices,
++ EGLDeviceEXT* devices,
++ EGLint* num_devices);
++
+ } mSymbols = {};
+ };
+
diff --git
a/http/firefox-esr/patches/0039-bmo-1774075-vaapi-fixes-p2-p3-D149238.patch
b/http/firefox-esr/patches/0039-bmo-1774075-vaapi-fixes-p2-p3-D149238.patch
new file mode 100644
index 0000000..e89c1bf
--- /dev/null
+++
b/http/firefox-esr/patches/0039-bmo-1774075-vaapi-fixes-p2-p3-D149238.patch
@@ -0,0 +1,34 @@
+diff -up firefox-102.0/gfx/config/gfxVars.h.D149238.diff
firefox-102.0/gfx/config/gfxVars.h
+--- firefox-102.0/gfx/config/gfxVars.h.D149238.diff 2022-06-23
09:08:47.000000000 +0200
++++ firefox-102.0/gfx/config/gfxVars.h 2022-06-28 16:40:54.130895063 +0200
+@@ -91,7 +91,8 @@ class gfxVarReceiver;
+ _(AllowWebGPU, bool, false) \
+ _(UseVP8HwDecode, bool, false) \
+ _(UseVP9HwDecode, bool, false) \
+- _(HwDecodedVideoZeroCopy, bool, false)
++ _(HwDecodedVideoZeroCopy, bool, false) \
++ _(UseDMABufSurfaceExport, bool, true)
+
+ /* Add new entries above this line. */
+
+diff -up firefox-102.0/gfx/thebes/gfxPlatform.cpp.D149238.diff
firefox-102.0/gfx/thebes/gfxPlatform.cpp
+--- firefox-102.0/gfx/thebes/gfxPlatform.cpp.D149238.diff 2022-06-23
09:08:47.000000000 +0200
++++ firefox-102.0/gfx/thebes/gfxPlatform.cpp 2022-06-28 16:40:54.130895063
+0200
+@@ -2861,6 +2861,17 @@ void gfxPlatform::InitWebGLConfig() {
+ gfxVars::SetAllowEglRbab(false);
+ }
+ }
++
++ if (kIsWayland || kIsX11) {
++ // Disable EGL_MESA_image_dma_buf_export on mesa/radeonsi due to
++ // https://gitlab.freedesktop.org/mesa/mesa/-/issues/6666
++ nsString adapterDriverVendor;
++ gfxInfo->GetAdapterDriverVendor(adapterDriverVendor);
++ if (adapterDriverVendor.Find("mesa") != -1 &&
++ adapterDriverVendor.Find("radeonsi") != -1) {
++ gfxVars::SetUseDMABufSurfaceExport(false);
++ }
++ }
+ }
+
+ void gfxPlatform::InitWebGPUConfig() {
diff --git
a/http/firefox-esr/patches/0040-bmo-1774271-vaapi-fixes-p2-p5.patch
b/http/firefox-esr/patches/0040-bmo-1774271-vaapi-fixes-p2-p5.patch
new file mode 100644
index 0000000..689e584
--- /dev/null
+++ b/http/firefox-esr/patches/0040-bmo-1774271-vaapi-fixes-p2-p5.patch
@@ -0,0 +1,154 @@
+
+# HG changeset patch
+# User Martin Stransky <stransky AT redhat.com>
+# Date 1656309292 0
+# Node ID 6dce488087f13c4ffe6ba0c758362968a8e60704
+# Parent 00ef31a00437f25556606342668f1125e86c55b4
+Bug 1774271 [Linux] Use DMABUF_SURFACE_EXPORT feature to control dmabuf
surface export from EGLImage and disable that on Mesa/Intel and Mesa/AMD
r=jgilbert
+
+Differential Revision: https://phabricator.services.mozilla.com/D149984
+
+diff --git a/gfx/config/gfxFeature.h b/gfx/config/gfxFeature.h
+--- a/gfx/config/gfxFeature.h
++++ b/gfx/config/gfxFeature.h
+@@ -38,17 +38,18 @@ namespace gfx {
+ _(WEBGPU, Feature, "WebGPU")
\
+ _(X11_EGL, Feature, "X11 EGL")
\
+ _(DMABUF, Feature, "DMABUF")
\
+ _(WINDOW_OCCLUSION, Feature, "WINDOW_OCCLUSION")
\
+ _(VAAPI, Feature, "VA-API video decoding")
\
+ _(VIDEO_OVERLAY, Feature, "video overlay")
\
+ _(HW_DECODED_VIDEO_ZERO_COPY, Feature, "Hardware decoded video zero
copy") \
+ _(VP8_HW_DECODE, Feature, "VP8 hardware decoding")
\
+- _(VP9_HW_DECODE, Feature, "VP9 hardware decoding")
++ _(VP9_HW_DECODE, Feature, "VP9 hardware decoding")
\
++ _(DMABUF_SURFACE_EXPORT, Feature, "WebGL DMABuf surface export")
+ /* Add new entries above this comment */
+
+ enum class Feature : uint32_t {
+ #define MAKE_ENUM(name, type, desc) name,
+ GFX_FEATURE_MAP(MAKE_ENUM)
+ #undef MAKE_ENUM
+ NumValues
+ };
+diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp
+--- a/gfx/thebes/gfxPlatform.cpp
++++ b/gfx/thebes/gfxPlatform.cpp
+@@ -2806,23 +2806,29 @@ void gfxPlatform::InitWebGLConfig() {
+ nsAutoString renderer;
+ gfxInfo->GetAdapterDeviceID(renderer);
+ if (renderer.Find("Adreno (TM) 630") != -1) {
+ gfxVars::SetAllowEglRbab(false);
+ }
+ }
+
+ if (kIsWayland || kIsX11) {
+- // Disable EGL_MESA_image_dma_buf_export on mesa/radeonsi due to
+- // https://gitlab.freedesktop.org/mesa/mesa/-/issues/6666
+- nsString adapterDriverVendor;
+- gfxInfo->GetAdapterDriverVendor(adapterDriverVendor);
+- if (adapterDriverVendor.Find("mesa") != -1 &&
+- adapterDriverVendor.Find("radeonsi") != -1) {
++ nsCString discardFailureId;
++ int32_t status;
++ FeatureState& feature =
++ gfxConfig::GetFeature(Feature::DMABUF_SURFACE_EXPORT);
++ if (NS_FAILED(
++
gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DMABUF_SURFACE_EXPORT,
++ discardFailureId, &status)) ||
++ status != nsIGfxInfo::FEATURE_STATUS_OK) {
++ feature.DisableByDefault(FeatureStatus::Blocked, "Blocklisted by
gfxInfo",
++ discardFailureId);
+ gfxVars::SetUseDMABufSurfaceExport(false);
++ } else {
++ feature.EnableByDefault();
+ }
+ }
+ }
+
+ void gfxPlatform::InitWebGPUConfig() {
+ if (!XRE_IsParentProcess()) {
+ return;
+ }
+diff --git a/widget/GfxInfoBase.cpp b/widget/GfxInfoBase.cpp
+--- a/widget/GfxInfoBase.cpp
++++ b/widget/GfxInfoBase.cpp
+@@ -249,16 +249,19 @@ static const char* GetPrefNameForFeature
+ name = BLOCKLIST_PREF_BRANCH "hw-video-zero-copy";
+ break;
+ case nsIGfxInfo::FEATURE_WEBRENDER_SHADER_CACHE:
+ name = BLOCKLIST_PREF_BRANCH "webrender.program-binary-disk";
+ break;
+ case nsIGfxInfo::FEATURE_WEBRENDER_PARTIAL_PRESENT:
+ name = BLOCKLIST_PREF_BRANCH "webrender.partial-present";
+ break;
++ case nsIGfxInfo::FEATURE_DMABUF_SURFACE_EXPORT:
++ name = BLOCKLIST_PREF_BRANCH "dmabuf.surface-export";
++ break;
+ default:
+ MOZ_ASSERT_UNREACHABLE("Unexpected nsIGfxInfo feature?!");
+ break;
+ }
+
+ return name;
+ }
+
+diff --git a/widget/gtk/GfxInfo.cpp b/widget/gtk/GfxInfo.cpp
+--- a/widget/gtk/GfxInfo.cpp
++++ b/widget/gtk/GfxInfo.cpp
+@@ -822,16 +822,32 @@ const nsTArray<GfxDriverInfo>& GfxInfo::
+ APPEND_TO_DRIVER_BLOCKLIST_EXT(
+ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
+ DesktopEnvironment::All, WindowProtocol::All,
DriverVendor::NonMesaAll,
+ DeviceFamily::NvidiaAll, nsIGfxInfo::FEATURE_DMABUF,
+ nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
+ V(495, 44, 0, 0), "FEATURE_FAILURE_NO_GBM", "495.44.0");
+
+ ////////////////////////////////////
++ // FEATURE_DMABUF_SURFACE_EXPORT
++ APPEND_TO_DRIVER_BLOCKLIST_EXT(
++ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
++ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaAll,
++ DeviceFamily::AtiAll, nsIGfxInfo::FEATURE_DMABUF_SURFACE_EXPORT,
++ nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
++ V(21, 1, 2, 0), "FEATURE_FAILURE_BROKEN_MESA", "22.1.2");
++
++ APPEND_TO_DRIVER_BLOCKLIST_EXT(
++ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
++ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaAll,
++ DeviceFamily::IntelAll, nsIGfxInfo::FEATURE_DMABUF_SURFACE_EXPORT,
++ nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
++ V(0, 0, 0, 0), "FEATURE_FAILURE_BROKEN_DRIVER", "");
++
++ ////////////////////////////////////
+ // FEATURE_VAAPI
+ APPEND_TO_DRIVER_BLOCKLIST_EXT(
+ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
+ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaAll,
+ DeviceFamily::All, nsIGfxInfo::FEATURE_VAAPI,
+ nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
+ V(21, 0, 0, 0), "FEATURE_ROLLOUT_VAAPI_MESA", "Mesa 21.0.0.0");
+
+diff --git a/widget/nsIGfxInfo.idl b/widget/nsIGfxInfo.idl
+--- a/widget/nsIGfxInfo.idl
++++ b/widget/nsIGfxInfo.idl
+@@ -171,16 +171,18 @@ interface nsIGfxInfo : nsISupports
+ /* Whether VA-API is supported, starting in 96. */
+ const long FEATURE_VAAPI = 37;
+ /* Whether WebGPU is supported, starting in 100. */
+ const long FEATURE_WEBGPU = 38;
+ /* Whether video overlay is supported, starting in 100. */
+ const long FEATURE_VIDEO_OVERLAY = 39;
+ /* Whether hardware decoded video zero copy is supported, starting in
101. */
+ const long FEATURE_HW_DECODED_VIDEO_ZERO_COPY = 40;
++ /* Whether DMABUF export is supported, starting in 103. */
++ const long FEATURE_DMABUF_SURFACE_EXPORT = 41;
+ /* the maximum feature value. */
+ const long FEATURE_MAX_VALUE = FEATURE_HW_DECODED_VIDEO_ZERO_COPY;
+
+ /*
+ * A set of return values from GetFeatureStatus
+ */
+
+ /* The driver is safe to the best of our knowledge */
+
diff --git
a/http/firefox-esr/patches/0041-p01-bmo-1772719-build-wayland-only.patch
b/http/firefox-esr/patches/0041-p01-bmo-1772719-build-wayland-only.patch
new file mode 100644
index 0000000..697d608
--- /dev/null
+++ b/http/firefox-esr/patches/0041-p01-bmo-1772719-build-wayland-only.patch
@@ -0,0 +1,36 @@
+
+# HG changeset patch
+# User ganguin <ganguin>
+# Date 1654600180 0
+# Node ID 2e739b8c44c72cfcd603a34217c7ca8d8a99c6e3
+# Parent 4d909088d95c2addd0309c2d81d89dae0c4537ea
+Bug 1772719 - fix wayland-only build with mesa X11 support r=stransky
+
+this patch fixes building firefox with
+--enable-default-toolkit=cairo-gtk3-wayland-only when system mesa is build
+with X11 support.
+
+Without this patch, it only builds with mesa built without X11 support.
+
+Differential Revision: https://phabricator.services.mozilla.com/D148347
+
+diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp
+--- a/widget/gtk/nsClipboard.cpp
++++ b/widget/gtk/nsClipboard.cpp
+@@ -34,12 +34,15 @@
+ #include "mozilla/SchedulerGroup.h"
+ #include "mozilla/StaticPrefs_widget.h"
+ #include "mozilla/TimeStamp.h"
++#include "GRefPtr.h"
+ #include "WidgetUtilsGtk.h"
+
+ #include "imgIContainer.h"
+
+ #include <gtk/gtk.h>
+-#include <gtk/gtkx.h>
++#if defined(MOZ_X11)
++# include <gtk/gtkx.h>
++#endif
+
+ #include "mozilla/Encoding.h"
+
diff --git
a/http/firefox-esr/patches/0042-p02-bmo-1772721-build-wayland-only-D148496fixed.patch

b/http/firefox-esr/patches/0042-p02-bmo-1772721-build-wayland-only-D148496fixed.patch
new file mode 100644
index 0000000..22a9cb0
--- /dev/null
+++
b/http/firefox-esr/patches/0042-p02-bmo-1772721-build-wayland-only-D148496fixed.patch
@@ -0,0 +1,84 @@
+diff --git a/widget/gtk/mozgtk/moz.build b/widget/gtk/mozgtk/moz.build
+--- a/widget/gtk/mozgtk/moz.build
++++ b/widget/gtk/mozgtk/moz.build
+@@ -9,10 +9,11 @@
+ SOURCES += [
+ "mozgtk.c",
+ ]
+
+ CFLAGS += CONFIG["MOZ_X11_CFLAGS"]
++CFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
+
+ # If LDFLAGS contains -Wl,--as-needed or if it's the default for the
toolchain,
+ # we need to add -Wl,--no-as-needed before the gtk libraries, otherwise the
+ # linker will drop those dependencies because no symbols are used from them.
+ # But those dependencies need to be kept for things to work properly.
+diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
+--- a/widget/gtk/mozgtk/mozgtk.c
++++ b/widget/gtk/mozgtk/mozgtk.c
+@@ -4,10 +4,17 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ #include "mozilla/Types.h"
+
++#include <gdk/gdk.h>
++
++// Dummy call to gtk3 library to prevent the linker from removing
++// the gtk3 dependency with --as-needed.
++// see toolkit/library/moz.build for details.
++MOZ_EXPORT void mozgtk_linker_holder() { gdk_display_get_default(); }
++
+ #ifdef MOZ_X11
+ # include <X11/Xlib.h>
+ // Bug 1271100
+ // We need to trick system Cairo into not using the XShm extension due to
+ // a race condition in it that results in frequent BadAccess errors. Cairo
+diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
+--- a/widget/gtk/nsWindow.cpp
++++ b/widget/gtk/nsWindow.cpp
+@@ -266,10 +266,13 @@
+ return sTimeConverterSingleton;
+ }
+
+ bool nsWindow::sTransparentMainWindow = false;
+
++// forward declare from mozgtk
++extern "C" MOZ_EXPORT void mozgtk_linker_holder();
++
+ namespace mozilla {
+
+ #ifdef MOZ_X11
+ class CurrentX11TimeGetter {
+ public:
+@@ -426,10 +429,14 @@
+ do_GetService("@mozilla.org/widget/clipboard;1");
+ NS_ASSERTION(clipboard, "Failed to init clipboard!");
+ }
+ #endif
+ }
++ // Dummy call to mozgtk to prevent the linker from removing
++ // the dependency with --as-needed.
++ // see toolkit/library/moz.build for details.
++ mozgtk_linker_holder();
+ }
+
+ nsWindow::~nsWindow() {
+ LOG("nsWindow::~nsWindow()");
+
+@@ -5332,14 +5339,10 @@
+ //
+ // If the window were to get unredirected, there could be visible
+ // tearing because Gecko does not align its framebuffer updates with
+ // vblank.
+ SetCompositorHint(GTK_WIDGET_COMPOSIDED_ENABLED);
+-
+- // Dummy call to a function in mozgtk to prevent the linker from
removing
+- // the dependency with --as-needed.
+- XShmQueryExtension(DefaultXDisplay());
+ }
+ #endif
+ #ifdef MOZ_WAYLAND
+ if (GdkIsWaylandDisplay()) {
+ mSurfaceProvider.Initialize(this);
+
diff --git
a/http/firefox-esr/patches/0043-p02-bmo-1772721-build-wayland-only.patch
b/http/firefox-esr/patches/0043-p02-bmo-1772721-build-wayland-only.patch
new file mode 100644
index 0000000..63907fd
--- /dev/null
+++ b/http/firefox-esr/patches/0043-p02-bmo-1772721-build-wayland-only.patch
@@ -0,0 +1,25 @@
+diff -Naur a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
+--- a/widget/gtk/mozgtk/mozgtk.c 2022-06-18 19:17:31.464160229 -0000
++++ b/widget/gtk/mozgtk/mozgtk.c 2022-06-18 19:24:34.966749520 -0000
+@@ -8,6 +8,8 @@
+
+ #include <gdk/gdk.h>
+
++MOZ_EXPORT unsigned int gtk_get_debug_flags(void) { return 0; }
++
+ // Dummy call to gtk3 library to prevent the linker from removing
+ // the gtk3 dependency with --as-needed.
+ // see toolkit/library/moz.build for details.
+diff -Naur a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
+--- a/widget/gtk/nsWindow.cpp 2022-06-18 19:17:31.464160229 -0000
++++ b/widget/gtk/nsWindow.cpp 2022-06-18 19:26:47.689851900 -0000
+@@ -5312,6 +5312,9 @@
+ SetCompositorHint(GTK_WIDGET_COMPOSIDED_ENABLED);
+ }
+ #endif
++// Dummy call to a function in mozgtk to prevent the linker from removing
++// the dependency with --as-needed.
++gtk_get_debug_flags();
+ #ifdef MOZ_WAYLAND
+ if (GdkIsWaylandDisplay()) {
+ mSurfaceProvider.Initialize(this);
diff --git
a/http/firefox-esr/patches/0044-p03-bmo-1772513-build-wayland-only-D148256.patch

b/http/firefox-esr/patches/0044-p03-bmo-1772513-build-wayland-only-D148256.patch
new file mode 100644
index 0000000..6caf6eb
--- /dev/null
+++
b/http/firefox-esr/patches/0044-p03-bmo-1772513-build-wayland-only-D148256.patch
@@ -0,0 +1,207 @@
+diff --git a/widget/gtk/CompositorWidgetParent.cpp
b/widget/gtk/CompositorWidgetParent.cpp
+--- a/widget/gtk/CompositorWidgetParent.cpp
++++ b/widget/gtk/CompositorWidgetParent.cpp
+@@ -4,13 +4,13 @@
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ #include "CompositorWidgetParent.h"
+ #include "mozilla/Unused.h"
+ #include "mozilla/widget/PlatformWidgetTypes.h"
++#include "nsWindow.h"
+
+-namespace mozilla {
+-namespace widget {
++namespace mozilla::widget {
+
+ CompositorWidgetParent::CompositorWidgetParent(
+ const CompositorWidgetInitData& aInitData,
+ const layers::CompositorOptions& aOptions)
+ : GtkCompositorWidget(aInitData.get_GtkCompositorWidgetInitData(),
aOptions,
+@@ -49,7 +49,6 @@
+ const uintptr_t& aXWindow, const bool& aShaped) {
+ EnableRendering(aXWindow, aShaped);
+ return IPC_OK();
+ }
+
+-} // namespace widget
+-} // namespace mozilla
++} // namespace mozilla::widget
+diff --git a/widget/gtk/GtkCompositorWidget.cpp
b/widget/gtk/GtkCompositorWidget.cpp
+--- a/widget/gtk/GtkCompositorWidget.cpp
++++ b/widget/gtk/GtkCompositorWidget.cpp
+@@ -3,10 +3,11 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ #include "GtkCompositorWidget.h"
+
++#include "mozilla/gfx/gfxVars.h"
+ #include "mozilla/layers/CompositorThread.h"
+ #include "mozilla/widget/InProcessCompositorWidget.h"
+ #include "mozilla/widget/PlatformWidgetTypes.h"
+ #include "nsWindow.h"
+
+diff --git a/widget/gtk/IMContextWrapper.cpp
b/widget/gtk/IMContextWrapper.cpp
+--- a/widget/gtk/IMContextWrapper.cpp
++++ b/widget/gtk/IMContextWrapper.cpp
+@@ -5,10 +5,11 @@
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ #include "mozilla/Logging.h"
+ #include "nsString.h"
+ #include "prtime.h"
++#include "prenv.h"
+
+ #include "IMContextWrapper.h"
+ #include "nsGtkKeyUtils.h"
+ #include "nsWindow.h"
+ #include "mozilla/AutoRestore.h"
+diff --git a/widget/gtk/InProcessGtkCompositorWidget.cpp
b/widget/gtk/InProcessGtkCompositorWidget.cpp
+--- a/widget/gtk/InProcessGtkCompositorWidget.cpp
++++ b/widget/gtk/InProcessGtkCompositorWidget.cpp
+@@ -6,14 +6,14 @@
+ #include "HeadlessCompositorWidget.h"
+ #include "HeadlessWidget.h"
+ #include "mozilla/widget/PlatformWidgetTypes.h"
+
+ #include "InProcessGtkCompositorWidget.h"
++#include "VsyncDispatcher.h"
+ #include "nsWindow.h"
+
+-namespace mozilla {
+-namespace widget {
++namespace mozilla::widget {
+
+ /* static */
+ RefPtr<CompositorWidget> CompositorWidget::CreateLocal(
+ const CompositorWidgetInitData& aInitData,
+ const layers::CompositorOptions& aOptions, nsIWidget* aWidget) {
+@@ -39,7 +39,6 @@
+ mWidget->GetCompositorVsyncDispatcher()) {
+ cvd->SetCompositorVsyncObserver(aObserver);
+ }
+ }
+
+-} // namespace widget
+-} // namespace mozilla
++} // namespace mozilla::widget
+diff --git a/widget/gtk/MPRISServiceHandler.cpp
b/widget/gtk/MPRISServiceHandler.cpp
+--- a/widget/gtk/MPRISServiceHandler.cpp
++++ b/widget/gtk/MPRISServiceHandler.cpp
+@@ -10,10 +10,11 @@
+ #include <inttypes.h>
+ #include <unordered_map>
+
+ #include "MPRISInterfaceDescription.h"
+ #include "mozilla/dom/MediaControlUtils.h"
++#include "mozilla/GRefPtr.h"
+ #include "mozilla/GUniquePtr.h"
+ #include "mozilla/UniquePtrExtensions.h"
+ #include "mozilla/Maybe.h"
+ #include "mozilla/ScopeExit.h"
+ #include "mozilla/Sprintf.h"
+diff --git a/widget/gtk/WindowSurfaceX11.h b/widget/gtk/WindowSurfaceX11.h
+--- a/widget/gtk/WindowSurfaceX11.h
++++ b/widget/gtk/WindowSurfaceX11.h
+@@ -11,13 +11,13 @@
+
+ # include "mozilla/widget/WindowSurface.h"
+ # include "mozilla/gfx/Types.h"
+
+ # include <X11/Xlib.h>
++# include "X11UndefineNone.h"
+
+-namespace mozilla {
+-namespace widget {
++namespace mozilla::widget {
+
+ class WindowSurfaceX11 : public WindowSurface {
+ public:
+ WindowSurfaceX11(Display* aDisplay, Window aWindow, Visual* aVisual,
+ unsigned int aDepth);
+@@ -31,10 +31,9 @@
+ Visual* const mVisual;
+ const unsigned int mDepth;
+ const gfx::SurfaceFormat mFormat;
+ };
+
+-} // namespace widget
+-} // namespace mozilla
++} // namespace mozilla::widget
+
+ #endif // MOZ_X11
+ #endif // _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_X11_H
+diff --git a/widget/gtk/WindowSurfaceX11.cpp
b/widget/gtk/WindowSurfaceX11.cpp
+--- a/widget/gtk/WindowSurfaceX11.cpp
++++ b/widget/gtk/WindowSurfaceX11.cpp
+@@ -4,14 +4,12 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ #include "WindowSurfaceX11.h"
+ #include "gfxPlatform.h"
+-#include "X11UndefineNone.h"
+
+-namespace mozilla {
+-namespace widget {
++namespace mozilla::widget {
+
+ WindowSurfaceX11::WindowSurfaceX11(Display* aDisplay, Window aWindow,
+ Visual* aVisual, unsigned int aDepth)
+ : mDisplay(aDisplay),
+ mWindow(aWindow),
+@@ -44,7 +42,6 @@
+ }
+
+ return gfx::SurfaceFormat::UNKNOWN;
+ }
+
+-} // namespace widget
+-} // namespace mozilla
++} // namespace mozilla::widget
+diff --git a/widget/gtk/nsApplicationChooser.cpp
b/widget/gtk/nsApplicationChooser.cpp
+--- a/widget/gtk/nsApplicationChooser.cpp
++++ b/widget/gtk/nsApplicationChooser.cpp
+@@ -9,10 +9,11 @@
+
+ #include "nsApplicationChooser.h"
+ #include "WidgetUtils.h"
+ #include "nsIMIMEInfo.h"
+ #include "nsIWidget.h"
++#include "nsIFile.h"
+ #include "nsCExternalHandlerService.h"
+ #include "nsComponentManagerUtils.h"
+ #include "nsGtkUtils.h"
+ #include "nsPIDOMWindow.h"
+
+diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp
+--- a/widget/gtk/nsClipboard.cpp
++++ b/widget/gtk/nsClipboard.cpp
+@@ -29,10 +29,11 @@
+ #include "nsStringStream.h"
+ #include "nsIFileURL.h"
+ #include "nsIObserverService.h"
+ #include "mozilla/Services.h"
+ #include "mozilla/RefPtr.h"
++#include "mozilla/GRefPtr.h"
+ #include "mozilla/SchedulerGroup.h"
+ #include "mozilla/StaticPrefs_widget.h"
+ #include "mozilla/TimeStamp.h"
+ #include "WidgetUtilsGtk.h"
+
+diff --git a/widget/gtk/nsGtkKeyUtils.h b/widget/gtk/nsGtkKeyUtils.h
+--- a/widget/gtk/nsGtkKeyUtils.h
++++ b/widget/gtk/nsGtkKeyUtils.h
+@@ -18,10 +18,11 @@
+ #endif
+ #ifdef MOZ_WAYLAND
+ # include <gdk/gdkwayland.h>
+ # include <xkbcommon/xkbcommon.h>
+ #endif
++#include "X11UndefineNone.h"
+
+ class nsWindow;
+
+ namespace mozilla {
+ namespace widget {
+
diff --git
a/http/firefox-esr/patches/0045-p04-bmo-1772513-build-wayland-only-D148257.patch

b/http/firefox-esr/patches/0045-p04-bmo-1772513-build-wayland-only-D148257.patch
new file mode 100644
index 0000000..e6696a4
--- /dev/null
+++
b/http/firefox-esr/patches/0045-p04-bmo-1772513-build-wayland-only-D148257.patch
@@ -0,0 +1,14 @@
+diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
+--- a/widget/gtk/moz.build
++++ b/widget/gtk/moz.build
+@@ -185,8 +185,7 @@
+ ]
+ UNIFIED_SOURCES += [
+ "AsyncDBus.cpp",
+ ]
+ CXXFLAGS += CONFIG["MOZ_DBUS_GLIB_CFLAGS"]
++
+ CXXFLAGS += ["-Werror=switch"]
+-
+-REQUIRES_UNIFIED_BUILD = True
+
diff --git
a/http/firefox-esr/patches/0046-p05-bmo-1776724-build-wayland-only-D150485.patch

b/http/firefox-esr/patches/0046-p05-bmo-1776724-build-wayland-only-D150485.patch
new file mode 100644
index 0000000..1c27926
--- /dev/null
+++
b/http/firefox-esr/patches/0046-p05-bmo-1776724-build-wayland-only-D150485.patch
@@ -0,0 +1,115 @@
+diff --git a/gfx/gl/GLContextProviderEGL.cpp
b/gfx/gl/GLContextProviderEGL.cpp
+--- a/gfx/gl/GLContextProviderEGL.cpp
++++ b/gfx/gl/GLContextProviderEGL.cpp
+@@ -77,10 +77,11 @@
+ #if defined(MOZ_WIDGET_GTK)
+ # include "mozilla/widget/GtkCompositorWidget.h"
+ # if defined(MOZ_WAYLAND)
+ # include <gdk/gdkwayland.h>
+ # include <wayland-egl.h>
++# include "mozilla/WidgetUtilsGtk.h"
+ # include "mozilla/widget/nsWaylandDisplay.h"
+ # endif
+ #endif
+
+ struct wl_egl_window;
+diff --git a/gfx/gl/GLContextProviderLinux.cpp
b/gfx/gl/GLContextProviderLinux.cpp
+--- a/gfx/gl/GLContextProviderLinux.cpp
++++ b/gfx/gl/GLContextProviderLinux.cpp
+@@ -11,49 +11,59 @@
+ namespace mozilla::gl {
+
+ using namespace mozilla::gfx;
+ using namespace mozilla::widget;
+
++#ifdef MOZ_X11
+ static class GLContextProviderGLX sGLContextProviderGLX;
++#endif
+ static class GLContextProviderEGL sGLContextProviderEGL;
+
+ already_AddRefed<GLContext>
GLContextProviderLinux::CreateForCompositorWidget(
+ CompositorWidget* aCompositorWidget, bool aHardwareWebRender,
+ bool aForceAccelerated) {
+ if (gfxVars::UseEGL()) {
+ return sGLContextProviderEGL.CreateForCompositorWidget(
+ aCompositorWidget, aHardwareWebRender, aForceAccelerated);
++#ifdef MOZ_X11
+ } else {
+ return sGLContextProviderGLX.CreateForCompositorWidget(
+ aCompositorWidget, aHardwareWebRender, aForceAccelerated);
++#endif
+ }
+ }
+
+ /*static*/
+ already_AddRefed<GLContext> GLContextProviderLinux::CreateHeadless(
+ const GLContextCreateDesc& desc, nsACString* const out_failureId) {
+ if (gfxVars::UseEGL()) {
+ return sGLContextProviderEGL.CreateHeadless(desc, out_failureId);
++#ifdef MOZ_X11
+ } else {
+ return sGLContextProviderGLX.CreateHeadless(desc, out_failureId);
++#endif
+ }
+ }
+
+ /*static*/
+ GLContext* GLContextProviderLinux::GetGlobalContext() {
+ if (gfxVars::UseEGL()) {
+ return sGLContextProviderEGL.GetGlobalContext();
++#ifdef MOZ_X11
+ } else {
+ return sGLContextProviderGLX.GetGlobalContext();
++#endif
+ }
+ }
+
+ /*static*/
+ void GLContextProviderLinux::Shutdown() {
+ if (gfxVars::UseEGL()) {
+ sGLContextProviderEGL.Shutdown();
++#ifdef MOZ_X11
+ } else {
+ sGLContextProviderGLX.Shutdown();
++#endif
+ }
+ }
+
+ } // namespace mozilla::gl
+diff --git a/gfx/gl/moz.build b/gfx/gl/moz.build
+--- a/gfx/gl/moz.build
++++ b/gfx/gl/moz.build
+@@ -105,14 +105,15 @@
+
+ elif gl_provider == "Linux":
+ # GLContextProviderGLX.cpp needs to be kept out of UNIFIED_SOURCES
+ # as it includes X11 headers which cause conflicts.
+ SOURCES += [
+- "GLContextProviderGLX.cpp",
+ "GLContextProviderLinux.cpp",
+ ]
+ EXPORTS += ["GLContextGLX.h", "GLXLibrary.h"]
++ if CONFIG["MOZ_X11"]:
++ SOURCES += ["GLContextProviderGLX.cpp"]
+
+ if CONFIG["MOZ_WAYLAND"]:
+ SOURCES += ["SharedSurfaceDMABUF.cpp"]
+
+ UNIFIED_SOURCES += [
+diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
+--- a/gfx/thebes/gfxPlatformGtk.cpp
++++ b/gfx/thebes/gfxPlatformGtk.cpp
+@@ -991,11 +991,11 @@
+ }
+
+ RefPtr<VsyncSource> softwareVsync = new XrandrSoftwareVsyncSource();
+ return softwareVsync.forget();
+ #else
+- return CreateSoftwareVsyncSource();
++ return GetSoftwareVsyncSource();
+ #endif
+ }
+
+ void gfxPlatformGtk::BuildContentDeviceData(ContentDeviceData* aOut) {
+ gfxPlatform::BuildContentDeviceData(aOut);
+
diff --git
a/http/firefox-esr/patches/0047-bmo-1754469-memory_mozalloc_throw.patch
b/http/firefox-esr/patches/0047-bmo-1754469-memory_mozalloc_throw.patch
new file mode 100644
index 0000000..634892be
--- /dev/null
+++ b/http/firefox-esr/patches/0047-bmo-1754469-memory_mozalloc_throw.patch
@@ -0,0 +1,69 @@
+--- a/memory/mozalloc/throw_gcc.h 2022-02-02 17:33:38 UTC
++++ b/memory/mozalloc/throw_gcc.h
+@@ -74,50 +74,66 @@ __throw_bad_function_call(void) {
+ mozalloc_abort("fatal: STL threw bad_function_call");
+ }
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_logic_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_domain_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_invalid_argument(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_length_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_out_of_range(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_runtime_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_range_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_overflow_error(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_underflow_error(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_ios_failure(
+ const char* msg) {
diff --git
a/http/firefox-esr/patches/0048-bmo-1769631-python-3.11-compatibility.patch
b/http/firefox-esr/patches/0048-bmo-1769631-python-3.11-compatibility.patch
new file mode 100644
index 0000000..8dcd0e2
--- /dev/null
+++
b/http/firefox-esr/patches/0048-bmo-1769631-python-3.11-compatibility.patch
@@ -0,0 +1,208 @@
+
+# HG changeset patch
+# User ahochheiden <ahochheiden AT mozilla.com>
+# Date 1654151264 0
+# Node ID f54162b2c1f2fe52c6137ab2c3469a1944f58b27
+# Parent 6e7776492240c27732840d65a33dcc440fa1aba0
+Bug 1769631 - Remove 'U' from 'mode' parameters for various 'open' calls to
ensure Python3.11 compatibility r=firefox-build-system-reviewers,glandium
+
+The 'U' flag represents "universal newline". It has been deprecated
+since Python3.3. Since then "universal newline" is the default when a
+file is opened in text mode (not bytes). In Python3.11 using the 'U'
+flag throws errors. There should be no harm in removing 'U' from 'open'
+everywhere it is used, and doing allows the use of Python3.11.
+
+For more reading see:
https://docs.python.org/3.11/whatsnew/3.11.html#changes-in-the-python-api
+
+Differential Revision: https://phabricator.services.mozilla.com/D147721
+
+diff --git a/dom/base/usecounters.py b/dom/base/usecounters.py
+--- a/dom/base/usecounters.py
++++ b/dom/base/usecounters.py
+@@ -3,17 +3,17 @@
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ import collections
+ import re
+
+
+ def read_conf(conf_filename):
+ # Can't read/write from a single StringIO, so make a new one for
reading.
+- stream = open(conf_filename, "rU")
++ stream = open(conf_filename, "r")
+
+ def parse_counters(stream):
+ for line_num, line in enumerate(stream):
+ line = line.rstrip("\n")
+ if not line or line.startswith("//"):
+ # empty line or comment
+ continue
+ m = re.match(r"method ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$", line)
+diff --git a/python/mozbuild/mozbuild/action/process_define_files.py
b/python/mozbuild/mozbuild/action/process_define_files.py
+--- a/python/mozbuild/mozbuild/action/process_define_files.py
++++ b/python/mozbuild/mozbuild/action/process_define_files.py
+@@ -31,17 +31,17 @@ def process_define_file(output, input):
+
+ config = PartialConfigEnvironment(topobjdir)
+
+ if mozpath.basedir(
+ path, [mozpath.join(topsrcdir, "js/src")]
+ ) and not config.substs.get("JS_STANDALONE"):
+ config = PartialConfigEnvironment(mozpath.join(topobjdir, "js",
"src"))
+
+- with open(path, "rU") as input:
++ with open(path, "r") as input:
+ r = re.compile(
+
"^\s*#\s*(?P<cmd>[a-z]+)(?:\s+(?P<name>\S+)(?:\s+(?P<value>\S+))?)?", re.U
+ )
+ for l in input:
+ m = r.match(l)
+ if m:
+ cmd = m.group("cmd")
+ name = m.group("name")
+diff --git a/python/mozbuild/mozbuild/backend/base.py
b/python/mozbuild/mozbuild/backend/base.py
+--- a/python/mozbuild/mozbuild/backend/base.py
++++ b/python/mozbuild/mozbuild/backend/base.py
+@@ -267,17 +267,17 @@ class BuildBackend(LoggingMixin):
+ If an exception is raised, |mach build| will fail with a
+ non-zero exit code.
+ """
+ self._write_purgecaches(config)
+
+ return status
+
+ @contextmanager
+- def _write_file(self, path=None, fh=None, readmode="rU"):
++ def _write_file(self, path=None, fh=None, readmode="r"):
+ """Context manager to write a file.
+
+ This is a glorified wrapper around FileAvoidWrite with integration
to
+ update the summary data on this instance.
+
+ Example usage:
+
+ with self._write_file('foo.txt') as fh:
+diff --git a/python/mozbuild/mozbuild/preprocessor.py
b/python/mozbuild/mozbuild/preprocessor.py
+--- a/python/mozbuild/mozbuild/preprocessor.py
++++ b/python/mozbuild/mozbuild/preprocessor.py
+@@ -526,17 +526,17 @@ class Preprocessor:
+ if not options.output:
+ raise Preprocessor.Error(
+ self, "--depend doesn't work with stdout", None
+ )
+ depfile = get_output_file(options.depend)
+
+ if args:
+ for f in args:
+- with io.open(f, "rU", encoding="utf-8") as input:
++ with io.open(f, "r", encoding="utf-8") as input:
+ self.processFile(input=input, output=out)
+ if depfile:
+ mk = Makefile()
+
mk.create_rule([six.ensure_text(options.output)]).add_dependencies(
+ self.includes
+ )
+ mk.dump(depfile)
+ depfile.close()
+@@ -855,17 +855,17 @@ class Preprocessor:
+ self.checkLineNumbers = False
+ if isName:
+ try:
+ args = _to_text(args)
+ if filters:
+ args = self.applyFilters(args)
+ if not os.path.isabs(args):
+ args = os.path.join(self.curdir, args)
+- args = io.open(args, "rU", encoding="utf-8")
++ args = io.open(args, "r", encoding="utf-8")
+ except Preprocessor.Error:
+ raise
+ except Exception:
+ raise Preprocessor.Error(self, "FILE_NOT_FOUND",
_to_text(args))
+ self.checkLineNumbers = bool(
+ re.search("\.(js|jsm|java|webidl)(?:\.in)?$", args.name)
+ )
+ oldFile = self.context["FILE"]
+@@ -909,17 +909,17 @@ class Preprocessor:
+
+ def do_error(self, args):
+ raise Preprocessor.Error(self, "Error: ", _to_text(args))
+
+
+ def preprocess(includes=[sys.stdin], defines={}, output=sys.stdout,
marker="#"):
+ pp = Preprocessor(defines=defines, marker=marker)
+ for f in includes:
+- with io.open(f, "rU", encoding="utf-8") as input:
++ with io.open(f, "r", encoding="utf-8") as input:
+ pp.processFile(input=input, output=output)
+ return pp.includes
+
+
+ # Keep this module independently executable.
+ if __name__ == "__main__":
+ pp = Preprocessor()
+ pp.handleCommandLine(None, True)
+diff --git a/python/mozbuild/mozbuild/util.py
b/python/mozbuild/mozbuild/util.py
+--- a/python/mozbuild/mozbuild/util.py
++++ b/python/mozbuild/mozbuild/util.py
+@@ -231,17 +231,17 @@ class FileAvoidWrite(BytesIO):
+ enabled by default because it a) doesn't make sense for binary files b)
+ could add unwanted overhead to calls.
+
+ Additionally, there is dry run mode where the file is not actually
written
+ out, but reports whether the file was existing and would have been
updated
+ still occur, as well as diff capture if requested.
+ """
+
+- def __init__(self, filename, capture_diff=False, dry_run=False,
readmode="rU"):
++ def __init__(self, filename, capture_diff=False, dry_run=False,
readmode="r"):
+ BytesIO.__init__(self)
+ self.name = filename
+ assert type(capture_diff) == bool
+ assert type(dry_run) == bool
+ assert "r" in readmode
+ self._capture_diff = capture_diff
+ self._write_to_file = not dry_run
+ self.diff = None
+diff --git a/python/mozbuild/mozpack/files.py
b/python/mozbuild/mozpack/files.py
+--- a/python/mozbuild/mozpack/files.py
++++ b/python/mozbuild/mozpack/files.py
+@@ -549,17 +549,17 @@ class PreprocessedFile(BaseFile):
+ self.defines = defines
+ self.extra_depends = list(extra_depends or [])
+ self.silence_missing_directive_warnings =
silence_missing_directive_warnings
+
+ def inputs(self):
+ pp = Preprocessor(defines=self.defines, marker=self.marker)
+
pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings)
+
+- with _open(self.path, "rU") as input:
++ with _open(self.path, "r") as input:
+ with _open(os.devnull, "w") as output:
+ pp.processFile(input=input, output=output)
+
+ # This always yields at least self.path.
+ return pp.includes
+
+ def copy(self, dest, skip_if_older=True):
+ """
+@@ -606,17 +606,17 @@ class PreprocessedFile(BaseFile):
+ return False
+
+ deps_out = None
+ if self.depfile:
+ deps_out = FileAvoidWrite(self.depfile)
+ pp = Preprocessor(defines=self.defines, marker=self.marker)
+
pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings)
+
+- with _open(self.path, "rU") as input:
++ with _open(self.path, "r") as input:
+ pp.processFile(input=input, output=dest, depfile=deps_out)
+
+ dest.close()
+ if self.depfile:
+ deps_out.close()
+
+ return True
+
+
diff --git a/http/firefox-esr/patches/2003_blessings_TERM.patch
b/http/firefox-esr/patches/2003_blessings_TERM.patch
deleted file mode 100644
index 838aa05..0000000
--- a/http/firefox-esr/patches/2003_blessings_TERM.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-https://github.com/erikrose/blessings/pull/137
-
-Fixes: https://bugs.gentoo.org/654316
-
-From 5fefc65c306cf9ec492e7b422d6bb4842385afbc
-[PATCH 1/2] Fix error when TERM is unset or improperly set
-
-From d885df78c6f931abf3259343aaaa897e16c8cba1
-[PATCH 2/2] Explicitly catch curses.error
-
-
---- a/third_party/python/blessings/blessings/__init__.py
-+++ b/third_party/python/blessings/blessings/__init__.py
-@@ -94,8 +94,13 @@ class Terminal(object):
- # init sequences to the stream if it has a file descriptor, and
- # send them to stdout as a fallback, since they have to go
- # somewhere.
-- setupterm(kind or environ.get('TERM', 'unknown'),
-- self._init_descriptor)
-+ try:
-+ setupterm(kind or environ.get('TERM', 'dumb') or 'dumb',
-+ self._init_descriptor)
-+ except curses.error:
-+ # There was an error setting up the terminal, either curses
is
-+ # not supported or TERM is incorrectly set. Fall back to
dumb.
-+ self._does_styling = False
-
- self.stream = stream
-
diff --git a/http/firefox-esr/patches/2004_fix_sandbox_lto.patch
b/http/firefox-esr/patches/2004_fix_sandbox_lto.patch
deleted file mode 100644
index ed1f8c9..0000000
--- a/http/firefox-esr/patches/2004_fix_sandbox_lto.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-# HG changeset patch
-# Parent b8e6418f771de6a3a183d0bb37d313512b61bbab
-https://bugs.gentoo.org/666580
-
-diff --git a/security/sandbox/linux/moz.build
b/security/sandbox/linux/moz.build
---- a/security/sandbox/linux/moz.build
-+++ b/security/sandbox/linux/moz.build
-@@ -96,17 +96,17 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc')
- '-Wno-empty-body',
- ]
-
- # gcc lto likes to put the top level asm in syscall.cc in a different
partition
- # from the function using it which breaks the build. Work around that by
- # forcing there to be only one partition.
- for f in CONFIG['OS_CXXFLAGS']:
- if f.startswith('-flto') and CONFIG['CC_TYPE'] != 'clang':
-- LDFLAGS += ['--param lto-partitions=1']
-+ LDFLAGS += ['--param', 'lto-partitions=1']
-
- DEFINES['NS_NO_XPCOM'] = True
- DisableStlWrapping()
-
- LOCAL_INCLUDES += ['/security/sandbox/linux']
- LOCAL_INCLUDES += ['/security/sandbox/chromium-shim']
- LOCAL_INCLUDES += ['/security/sandbox/chromium']
- LOCAL_INCLUDES += ['/nsprpub']
diff --git a/http/firefox-esr/patches/2006_pgo_gcc_spellchecker.patch
b/http/firefox-esr/patches/2006_pgo_gcc_spellchecker.patch
deleted file mode 100644
index 2ecfa46..0000000
--- a/http/firefox-esr/patches/2006_pgo_gcc_spellchecker.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-# HG changeset patch
-# Parent dad467be4860095b6bd0efdf58e60e975e12d3c5
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88561
-
-diff --git a/extensions/spellcheck/src/moz.build
b/extensions/spellcheck/src/moz.build
---- a/extensions/spellcheck/src/moz.build
-+++ b/extensions/spellcheck/src/moz.build
-@@ -26,8 +26,13 @@ LOCAL_INCLUDES += [
- ]
- EXPORTS.mozilla += [
- 'mozInlineSpellChecker.h',
- 'mozSpellChecker.h',
- ]
-
- if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
- CXXFLAGS += ['-Wno-error=shadow']
-+
-+# spell checker triggers bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88561
-+# in gcc 7 and 8. It will be fixed in GCC 7.5 and 8.3
-+if CONFIG['CC_TYPE'] in ('gcc'):
-+ CXXFLAGS += ['-fno-devirtualize']
diff --git a/http/firefox-esr/patches/2007_arm-fp-wasm-fixes.patch
b/http/firefox-esr/patches/2007_arm-fp-wasm-fixes.patch
deleted file mode 100644
index 8c66657..0000000
--- a/http/firefox-esr/patches/2007_arm-fp-wasm-fixes.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-# HG changeset patch
-# Parent 869216461f5985d028e679b86e0afd1642dd2b82
-
-diff --git a/js/src/wasm/WasmSignalHandlers.cpp
b/js/src/wasm/WasmSignalHandlers.cpp
---- a/js/src/wasm/WasmSignalHandlers.cpp
-+++ b/js/src/wasm/WasmSignalHandlers.cpp
-@@ -243,17 +243,26 @@ using mozilla::DebugOnly;
- // If you run into compile problems on a tier-3 platform, you can disable
the
- // emulation here.
-
- #if defined(__linux__) && defined(__arm__)
- # define WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS
- #endif
-
- #ifdef WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS
--# include <sys/user.h>
-+struct user_vfp {
-+ unsigned long long fpregs[32];
-+ unsigned long fpscr;
-+};
-+
-+struct user_vfp_exc {
-+ unsigned long fpexc;
-+ unsigned long fpinst;
-+ unsigned long fpinst2;
-+};
- #endif
-
- #if defined(ANDROID)
- // Not all versions of the Android NDK define ucontext_t or mcontext_t.
- // Detect this and provide custom but compatible definitions. Note that
these
- // follow the GLibc naming convention to access register values from
- // mcontext_t.
- //
diff --git a/http/firefox-esr/patches/2012_allow-non-ascii-chars.patch
b/http/firefox-esr/patches/2012_allow-non-ascii-chars.patch
deleted file mode 100644
index 59937dd..0000000
--- a/http/firefox-esr/patches/2012_allow-non-ascii-chars.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-https://bugs.gentoo.org/666948
-
-and required for rust-1.33 patch
-
---- a/python/mozbuild/mozbuild/controller/building.py
-+++ b/python/mozbuild/mozbuild/controller/building.py
-@@ -571,7 +571,7 @@ class TerminalLoggingHandler(logging.Handler):
- if self.footer:
- self.footer.clear()
-
-- self.fh.write(msg)
-+ self.fh.write(msg.encode("utf-8"))
- self.fh.write('\n')
-
- if self.footer:
diff --git a/http/firefox-esr/patches/6003_fix_syscall_wrappers_on_musl.patch
b/http/firefox-esr/patches/6003_fix_syscall_wrappers_on_musl.patch
deleted file mode 100644
index 3fbea01..0000000
--- a/http/firefox-esr/patches/6003_fix_syscall_wrappers_on_musl.patch
+++ /dev/null
@@ -1,47 +0,0 @@
->From 0b1e174fa3acdde982a051ee0a030566ea8368cb Mon Sep 17 00:00:00 2001
-From: Samuel Holland <samuel AT sholland.org>
-Date: Sun, 8 Jan 2017 19:19:23 -0600
-Subject: [PATCH 4/4] Fix syscall wrappers on musl
-
-musl defines p{read,write}64 to their non-suffixed equivalents to avoid
-duplication in its syscall wrappers. This breaks macro expansion here,
-leading to errors such as:
-
-In function size_t sys_pread64(int, void*, size_t, off_t):
- error: '__NR_pread' was not declared in this scope
-
-The fix here is to undefine the p{read,write}64 macros, so the syscall
-expands to (e.g.) __NR_pread64 instead.
-
-Signed-off-by: Samuel Holland <samuel AT sholland.org>
----
- .../google-breakpad/src/third_party/lss/linux_syscall_support.h | 7
+++++++
- 1 file changed, 7 insertions(+)
-
-diff --git
a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h

b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
----
a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
-+++
b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
-@@ -161,16 +161,23 @@ extern "C" {
- # undef __NR_pipe
- #endif
-
- #if defined(__ANDROID__)
- // waitpid is blocked by seccomp on all architectures on recent Android.
- # undef __NR_waitpid
- #endif
-
-+#ifdef pread64
-+#undef pread64
-+#endif
-+#ifdef pwrite64
-+#undef pwrite64
-+#endif
-+
- /* As glibc often provides subtly incompatible data structures (and implicit
- * wrapper functions that convert them), we provide our own kernel data
- * structures for use by the system calls.
- * These structures have been developed by using Linux 2.6.23 headers for
- * reference. Note though, we do not care about exact API compatibility
- * with the kernel, and in fact the kernel often does not have a single
- * API that works across architectures. Instead, we try to mimic the glibc
- * API where reasonable, and only guarantee ABI compatibility with the
diff --git a/http/firefox-esr/patches/6004_musl_memory_report.patch
b/http/firefox-esr/patches/6004_musl_memory_report.patch
deleted file mode 100644
index cebaa99..0000000
--- a/http/firefox-esr/patches/6004_musl_memory_report.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From: Jory A. Pratt <anarchy AT gentoo.org>
-
-Only use system heap reporter with glibc
-
---- a/xpcom/base/nsMemoryReporterManager.cpp
-+++ b/xpcom/base/nsMemoryReporterManager.cpp
-@@ -642,6 +642,7 @@ static MOZ_MUST_USE nsresult
PrivateDistinguishedAmount(int64_t* aN) {
- return NS_OK;
- }
-
-+#ifdef __GLIBC__
- # define HAVE_SYSTEM_HEAP_REPORTER 1
- // Windows can have multiple separate heaps. During testing there were
multiple
- // heaps present but the non-default ones had sizes no more than a few 10s
of
-@@ -698,6 +699,7 @@ static MOZ_MUST_USE nsresult SystemHeapSize(int64_t*
aSizeOut) {
- *aSizeOut = heapsSize;
- return NS_OK;
- }
-+#endif
-
- struct SegmentKind {
- DWORD mState;
diff --git a/http/firefox-esr/patches/6006_musl_fix_tools.patch
b/http/firefox-esr/patches/6006_musl_fix_tools.patch
deleted file mode 100644
index 26293a8..0000000
--- a/http/firefox-esr/patches/6006_musl_fix_tools.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-From: Jory A. Pratt <anarchy AT gentoo.org>
-
-getcontext is only avaliable on glibc systems
-
---- a/tools/profiler/core/platform-linux-android.cpp
-+++ b/tools/profiler/core/platform-linux-android.cpp
-@@ -497,8 +497,10 @@ static void PlatformInit(PSLockRef aLock) {}
- ucontext_t sSyncUContext;
-
- void Registers::SyncPopulate() {
-+#if defined(__GLIBC__)
- if (!getcontext(&sSyncUContext)) {
- PopulateRegsFromContext(*this, &sSyncUContext);
- }
-+#endif
- }
- #endif
diff --git a/http/firefox-esr/patches/7000_sys_auxv_non_glibc.patch
b/http/firefox-esr/patches/7000_sys_auxv_non_glibc.patch
deleted file mode 100644
index ffc6b85..0000000
--- a/http/firefox-esr/patches/7000_sys_auxv_non_glibc.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From: Jory A. Pratt <anarchy AT gentoo.org>
-
-sys/auvx.h avaliable on more then just glibc systems
-
-diff --git
a/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c
b/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c
---- a/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c
-+++ b/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_features_linux.c
-@@ -6,20 +6,17 @@
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
- #include <stdlib.h>
- #include <string.h>
- #include <features.h>
--#ifndef __GLIBC_PREREQ
--#define __GLIBC_PREREQ(a, b) 0
--#endif
--#if __GLIBC_PREREQ(2, 16)
-+#if defined(__linux__)
- #include <sys/auxv.h>
- #else
- #include <fcntl.h>
- #include <unistd.h>
- #include <errno.h>
- #include <link.h>
- #endif
- #include "system_wrappers/include/cpu_features_wrapper.h"
-@@ -27,17 +24,17 @@
- #if defined(WEBRTC_ARCH_ARM_FAMILY)
- #include <asm/hwcap.h>
-
- uint64_t WebRtc_GetCPUFeaturesARM(void) {
- uint64_t result = 0;
- int architecture = 0;
- unsigned long hwcap = 0;
- const char* platform = NULL;
--#if __GLIBC_PREREQ(2, 16)
-+#if defined(__linux__)
- hwcap = getauxval(AT_HWCAP);
- platform = (const char*)getauxval(AT_PLATFORM);
- #else
- ElfW(auxv_t) auxv;
- int fd = open("/proc/self/auxv", O_RDONLY);
- if (fd >= 0) {
- while (hwcap == 0 || platform == NULL) {
- if (read(fd, &auxv, sizeof(auxv)) < (ssize_t)sizeof(auxv)) {
-@@ -51,17 +48,17 @@ uint64_t WebRtc_GetCPUFeaturesARM(void)
- break;
- case AT_PLATFORM:
- platform = (const char*)auxv.a_un.a_val;
- break;
- }
- }
- close(fd);
- }
--#endif // __GLIBC_PREREQ(2,16)
-+#endif // (__linux__)
- #if defined(__aarch64__)
- architecture = 8;
- if ((hwcap & HWCAP_FP) != 0)
- result |= kCPUFeatureVFPv3;
- if ((hwcap & HWCAP_ASIMD) != 0)
- result |= kCPUFeatureNEON;
- #else
- if (platform != NULL) {
diff --git a/http/firefox-esr/patches/7001_make-pgo-use-toolchain.patch
b/http/firefox-esr/patches/7001_make-pgo-use-toolchain.patch
deleted file mode 100644
index bccc226..0000000
--- a/http/firefox-esr/patches/7001_make-pgo-use-toolchain.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-# HG changeset patch
-# Parent 19684dd9010f6e104af6997b67baef6c4c633337
-
-diff --git a/build/unix/mozconfig.unix b/build/unix/mozconfig.unix
---- a/build/unix/mozconfig.unix
-+++ b/build/unix/mozconfig.unix
-@@ -1,16 +1,25 @@
- . "$topsrcdir/build/mozconfig.common"
-
- TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
-
- if [ -n "$FORCE_GCC" ]; then
- CC="$MOZ_FETCHES_DIR/gcc/bin/gcc"
- CXX="$MOZ_FETCHES_DIR/gcc/bin/g++"
-
-+ if [ -n "$MOZ_PGO" ]; then
-+ if [ -z "$USE_ARTIFACT" ]; then
-+ ac_add_options --enable-lto
-+ fi
-+ export AR="$topsrcdir/gcc/bin/gcc-ar"
-+ export NM="$topsrcdir/gcc/bin/gcc-nm"
-+ export RANLIB="$topsrcdir/gcc/bin/gcc-ranlib"
-+ fi
-+
- # We want to make sure we use binutils and other binaries in the
tooltool
- # package.
- mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$PATH"
- ac_add_options --with-clang-path=$MOZ_FETCHES_DIR/clang/bin/clang
- else
- CC="$MOZ_FETCHES_DIR/clang/bin/clang"
- CXX="$MOZ_FETCHES_DIR/clang/bin/clang++"
- export ENABLE_CLANG_PLUGIN=1



  • [SM-Commit] GIT changes to master grimoire by Thomas Orgis (6c01ad4e91e29a13d6a86ffb87280bf021cef046), Thomas Orgis, 07/01/2022

Archive powered by MHonArc 2.6.24.

Top of Page