diff options
author | Pavel Vinogradov | 2021-07-04 13:30:44 -0400 |
---|---|---|
committer | Pavel Vinogradov | 2021-07-04 13:30:44 -0400 |
commit | 180a488d95d895ca50aea7783a87eee3a403eae4 (patch) | |
tree | 23e121a34f673c314f3e34df6e5bf9540afa448d /http | |
parent | 642bff6d1f0e1a66fa603da15bbae99841850660 (diff) |
http/firefox: version 89.0.2, SECURITY_PATCH++
Diffstat (limited to 'http')
46 files changed, 3560 insertions, 254 deletions
diff --git a/http/firefox/DEPENDS b/http/firefox/DEPENDS index fd88d3662d..e58b3fee95 100755 --- a/http/firefox/DEPENDS +++ b/http/firefox/DEPENDS @@ -5,7 +5,7 @@ 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" && @@ -36,7 +36,7 @@ depends libwebp "--with-system-webp" && depends nspr "--with-system-nspr" && -local NSS_BRANCH="3.57" && +local NSS_BRANCH="3.64" && if spell_ok nss && is_version_less "$(installed_version nss)" "${NSS_BRANCH}"; then depends -sub "${NSS_BRANCH}" nss "--with-system-nss" @@ -44,8 +44,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 && @@ -123,16 +123,16 @@ optional_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 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" \ diff --git a/http/firefox/DETAILS b/http/firefox/DETAILS index 620b8004aa..dbeced25a4 100755 --- a/http/firefox/DETAILS +++ b/http/firefox/DETAILS @@ -1,6 +1,6 @@ SPELL=firefox - VERSION=81.0.1 - SECURITY_PATCH=148 + VERSION=89.0.2 + SECURITY_PATCH=149 SOURCE="${SPELL}-${VERSION}.source.tar.xz" SOURCE_URL[0]="http://releases.mozilla.org/pub/${SPELL}/releases/${VERSION}/source/${SOURCE}" SOURCE2="${SOURCE}.asc" diff --git a/http/firefox/HISTORY b/http/firefox/HISTORY index c2537d683c..1b0b98c4c1 100644 --- a/http/firefox/HISTORY +++ b/http/firefox/HISTORY @@ -1,3 +1,8 @@ +2021-07-04 Pavel Vinogradov <public@sourcemage.org> + * DETAILS: version 89.0.2, SECURITY_PATCH++ + * DEPENDS: reenabled icu, sqlite, graphite2 and harfbuzz; nss >= 3.64 + * patches/*: updated + 2020-12-31 Florian Franzmann <bwlf@bandrate.org> * mozconfig: set distribution id diff --git a/http/firefox/patches/0001-Don-t-use-build-id.patch b/http/firefox/patches/0001-Don-t-use-build-id.patch new file mode 100644 index 0000000000..e0b0d4945c --- /dev/null +++ b/http/firefox/patches/0001-Don-t-use-build-id.patch @@ -0,0 +1,54 @@ +From a13f3e4baeb647cdabe4b73ac639cae16d9c42a4 Mon Sep 17 00:00:00 2001 +From: "Jory A. Pratt" <anarchy@gentoo.org> +Date: Mon, 6 Apr 2020 19:14:26 +0200 +Subject: [PATCH 01/37] 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@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 636321f598..e848bd321e 100644 +--- a/js/src/old-configure.in ++++ b/js/src/old-configure.in +@@ -361,13 +361,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 a05ac13cd1..4ddc3f5b45 100644 +--- a/old-configure.in ++++ b/old-configure.in +@@ -349,13 +349,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.31.1 + diff --git a/http/firefox/patches/0002-Fortify-sources-properly.patch b/http/firefox/patches/0002-Fortify-sources-properly.patch new file mode 100644 index 0000000000..9f9079d324 --- /dev/null +++ b/http/firefox/patches/0002-Fortify-sources-properly.patch @@ -0,0 +1,41 @@ +From abfce26e906bcb727320ef33294f4fa9102c1ade Mon Sep 17 00:00:00 2001 +From: "Jory A. Pratt" <anarchy@gentoo.org> +Date: Mon, 6 Apr 2020 19:16:36 +0200 +Subject: [PATCH 02/37] Fortify sources properly + +Ensure we fortify properly, features.h is pulled in via fortification. + +Signed-off-by: Thomas Deutschmann <whissi@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 6e017df20f..5f7b5bb23e 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.31.1 + diff --git a/http/firefox/patches/0003-Check-additional-plugins-dir.patch b/http/firefox/patches/0003-Check-additional-plugins-dir.patch new file mode 100644 index 0000000000..e0977cb96f --- /dev/null +++ b/http/firefox/patches/0003-Check-additional-plugins-dir.patch @@ -0,0 +1,58 @@ +From 13a73ac916e8ca4864d661f3bbb682ed7f55c25c Mon Sep 17 00:00:00 2001 +From: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> +Date: Mon, 6 Apr 2020 19:17:43 +0200 +Subject: [PATCH 03/37] Check additional plugins dir + +Check original plugins dir along with default plugins dir. + +Signed-off-by: Thomas Deutschmann <whissi@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.31.1 + diff --git a/http/firefox/patches/0004-bmo-847568-Support-system-harfbuzz.patch b/http/firefox/patches/0004-bmo-847568-Support-system-harfbuzz.patch new file mode 100644 index 0000000000..c1d1878065 --- /dev/null +++ b/http/firefox/patches/0004-bmo-847568-Support-system-harfbuzz.patch @@ -0,0 +1,183 @@ +From 0cd112325bbe3a31bb32ca36074203d6aeba20e5 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Mon, 6 Apr 2020 19:32:39 +0200 +Subject: [PATCH 04/37] 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@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 5f7b5bb23e..449328ffaa 100644 +--- a/config/system-headers.mozbuild ++++ b/config/system-headers.mozbuild +@@ -1236,6 +1236,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 cadd80e624..4083d9c3fe 100644 +--- a/dom/base/moz.build ++++ b/dom/base/moz.build +@@ -556,6 +556,9 @@ if CONFIG["MOZ_BUILD_APP"] in ["browser", "mobile/android", "xulrunner"]: + 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 6d6274e636..c9cb3d592a 100644 +--- a/gfx/moz.build ++++ b/gfx/moz.build +@@ -13,6 +13,9 @@ with Files("wr/**"): + if CONFIG["MOZ_TREE_CAIRO"]: + DIRS += ["cairo"] + ++if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]: ++ DIRS += ["harfbuzz/src"] ++ + DIRS += [ + "2d", + "ycbcr", +@@ -22,7 +25,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 d5c409b657..9ad751e321 100755 +--- a/gfx/skia/generate_mozbuild.py ++++ b/gfx/skia/generate_mozbuild.py +@@ -98,6 +98,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'): + CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] + CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] +diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build +index 66b21aec25..6f0c015d09 100755 +--- a/gfx/skia/moz.build ++++ b/gfx/skia/moz.build +@@ -490,6 +490,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'): + CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] + CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] +diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build +index c284127164..fb2ad5bf34 100644 +--- a/gfx/thebes/moz.build ++++ b/gfx/thebes/moz.build +@@ -290,6 +290,9 @@ LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"] + + DEFINES["GRAPHITE2_STATIC"] = True + ++if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: ++ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"] ++ + if CONFIG["CC_TYPE"] == "clang": + # 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 897bfad92a..5a83cdb2c1 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"] ++ + GeneratedFile( + "BaseChars.h", + script="base_chars.py", +diff --git a/netwerk/dns/moz.build b/netwerk/dns/moz.build +index 31dd7c81b8..08bf561429 100644 +--- a/netwerk/dns/moz.build ++++ b/netwerk/dns/moz.build +@@ -104,6 +104,9 @@ LOCAL_INCLUDES += [ + "/netwerk/protocol/http", + ] + ++if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: ++ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"] ++ + USE_LIBS += ["icu"] + + if CONFIG["CC_TYPE"] in ("clang", "gcc"): +diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build +index 94e5474248..3f393f3316 100644 +--- a/toolkit/library/moz.build ++++ b/toolkit/library/moz.build +@@ -241,6 +241,9 @@ if CONFIG["MOZ_ANDROID_GOOGLE_VR"]: + OS_LIBS += CONFIG["MOZ_CAIRO_OSLIBS"] + OS_LIBS += CONFIG["MOZ_WEBRTC_X11_LIBS"] + ++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 0717b912ef..c934a661bd 100644 +--- a/toolkit/moz.configure ++++ b/toolkit/moz.configure +@@ -475,6 +475,15 @@ add_old_configure_assignment( + "_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.31.1 + diff --git a/http/firefox/patches/0005-bmo-847568-Support-system-graphite2.patch b/http/firefox/patches/0005-bmo-847568-Support-system-graphite2.patch new file mode 100644 index 0000000000..41da670401 --- /dev/null +++ b/http/firefox/patches/0005-bmo-847568-Support-system-graphite2.patch @@ -0,0 +1,208 @@ +From ffc7b194ef0fb5509d27a34063c52048912b8002 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Mon, 6 Apr 2020 19:34:44 +0200 +Subject: [PATCH 05/37] 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@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 449328ffaa..27b5171d0a 100644 +--- a/config/system-headers.mozbuild ++++ b/config/system-headers.mozbuild +@@ -1243,6 +1243,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 c9cb3d592a..2e822f0134 100644 +--- a/gfx/moz.build ++++ b/gfx/moz.build +@@ -13,6 +13,11 @@ with Files("wr/**"): + if CONFIG["MOZ_TREE_CAIRO"]: + DIRS += ["cairo"] + ++if CONFIG["MOZ_SYSTEM_GRAPHITE2"]: ++ DIRS += ["graphite2/geckoextra"] ++else: ++ DIRS += ["graphite2/src"] ++ + if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + DIRS += ["harfbuzz/src"] + +@@ -24,7 +29,6 @@ DIRS += [ + "qcms", + "gl", + "layers", +- "graphite2/src", + "ots/src", + "thebes", + "ipc", +diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build +index fb2ad5bf34..c6ce6f8417 100644 +--- a/gfx/thebes/moz.build ++++ b/gfx/thebes/moz.build +@@ -288,7 +288,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 4ddc3f5b45..de727a48bd 100644 +--- a/old-configure.in ++++ b/old-configure.in +@@ -2283,6 +2283,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 3f393f3316..df178bc6cf 100644 +--- a/toolkit/library/moz.build ++++ b/toolkit/library/moz.build +@@ -241,6 +241,9 @@ if CONFIG["MOZ_ANDROID_GOOGLE_VR"]: + OS_LIBS += CONFIG["MOZ_CAIRO_OSLIBS"] + OS_LIBS += CONFIG["MOZ_WEBRTC_X11_LIBS"] + ++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 c934a661bd..0783019981 100644 +--- a/toolkit/moz.configure ++++ b/toolkit/moz.configure +@@ -475,6 +475,19 @@ add_old_configure_assignment( + "_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.31.1 + diff --git a/http/firefox/patches/0006-bmo-1559213-Support-system-av1.patch b/http/firefox/patches/0006-bmo-1559213-Support-system-av1.patch new file mode 100644 index 0000000000..b82d4388b1 --- /dev/null +++ b/http/firefox/patches/0006-bmo-1559213-Support-system-av1.patch @@ -0,0 +1,114 @@ +From e09538bda8756e737af01edbd4aed9975280ca45 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Mon, 6 Apr 2020 19:36:02 +0200 +Subject: [PATCH 06/37] 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@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 4e9888f365..bf1e255107 100644 +--- a/config/external/moz.build ++++ b/config/external/moz.build +@@ -40,8 +40,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 27b5171d0a..c6213f1d96 100644 +--- a/config/system-headers.mozbuild ++++ b/config/system-headers.mozbuild +@@ -1300,6 +1300,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 16ca8a9cbc..b349dcbe6d 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 0783019981..de0a44bf27 100644 +--- a/toolkit/moz.configure ++++ b/toolkit/moz.configure +@@ -559,14 +559,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") +@@ -576,6 +591,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)) + + # Built-in fragmented MP4 support. + # ============================================================== +-- +2.31.1 + diff --git a/http/firefox/patches/0007-Support-sndio-audio-framework.patch b/http/firefox/patches/0007-Support-sndio-audio-framework.patch new file mode 100644 index 0000000000..373d4a4f73 --- /dev/null +++ b/http/firefox/patches/0007-Support-sndio-audio-framework.patch @@ -0,0 +1,75 @@ +From 09703df20bed8110f898ea3101e2a4eceaeb0712 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Thu, 29 Apr 2021 18:54:42 +0200 +Subject: [PATCH 07/37] Support sndio audio framework + +Bug: https://bugs.gentoo.org/785613 +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + build/moz.configure/old.configure | 1 + + media/libcubeb/src/moz.build | 4 +++- + old-configure.in | 17 +++++++++++++++++ + 3 files changed, 21 insertions(+), 1 deletion(-) + +diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure +index 35ab75df3a..134ecfb2b0 100644 +--- a/build/moz.configure/old.configure ++++ b/build/moz.configure/old.configure +@@ -87,6 +87,7 @@ def old_configure_options(*options): + @old_configure_options( + "--cache-file", + "--datadir", ++ "--enable-sndio", + "--enable-crashreporter", + "--enable-dbus", + "--enable-debug-js-modules", +diff --git a/media/libcubeb/src/moz.build b/media/libcubeb/src/moz.build +index 872484c311..28994a693d 100644 +--- a/media/libcubeb/src/moz.build ++++ b/media/libcubeb/src/moz.build +@@ -46,11 +46,13 @@ if CONFIG['OS_ARCH'] in ('DragonFly', 'FreeBSD', 'SunOS'): + ] + DEFINES['USE_OSS'] = True + +-if CONFIG['OS_ARCH'] == 'OpenBSD': ++if CONFIG['MOZ_SNDIO']: + SOURCES += [ + 'cubeb_sndio.c', + ] + DEFINES['USE_SNDIO'] = True ++ ++if CONFIG['OS_ARCH'] == 'OpenBSD': + DEFINES['DISABLE_LIBSNDIO_DLOPEN'] = True + + if CONFIG['OS_TARGET'] == 'Darwin': +diff --git a/old-configure.in b/old-configure.in +index de727a48bd..f0ecc39961 100644 +--- a/old-configure.in ++++ b/old-configure.in +@@ -2473,6 +2473,23 @@ fi + AC_SUBST(NECKO_WIFI) + AC_SUBST(NECKO_WIFI_DBUS) + ++ ++dnl ================================== ++dnl = Check sndio availability ++dnl ================================== ++ ++MOZ_ARG_ENABLE_BOOL(sndio, ++[ --enable-sndio Enable sndio support], ++ MOZ_SNDIO=1, ++ MOZ_SNDIO=) ++ ++if test -n "$MOZ_SNDIO"; then ++ MOZ_SNDIO_LIBS="-lsndio" ++ AC_SUBST_LIST(MOZ_SNDIO_LIBS) ++fi ++ ++AC_SUBST(MOZ_SNDIO) ++ + dnl ======================================================== + dnl = + dnl = Maintainer debug option (no --enable equivalent) +-- +2.31.1 + diff --git a/http/firefox/patches/2003_blessings_TERM.patch b/http/firefox/patches/0008-bmo-878089-Don-t-fail-when-TERM-is-not-set.patch index 838aa05f24..531ca09491 100644 --- a/http/firefox/patches/2003_blessings_TERM.patch +++ b/http/firefox/patches/0008-bmo-878089-Don-t-fail-when-TERM-is-not-set.patch @@ -1,14 +1,18 @@ -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 +From ea37aa3783c34119f13cc869cebe527030a696f4 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Mon, 6 Apr 2020 19:41:43 +0200 +Subject: [PATCH 08/37] 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@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): @@ -27,3 +31,6 @@ From d885df78c6f931abf3259343aaaa897e16c8cba1 self.stream = stream +-- +2.31.1 + diff --git a/http/firefox/patches/0009-bmo-1516803-Fix-building-sandbox.patch b/http/firefox/patches/0009-bmo-1516803-Fix-building-sandbox.patch new file mode 100644 index 0000000000..e9852fbc30 --- /dev/null +++ b/http/firefox/patches/0009-bmo-1516803-Fix-building-sandbox.patch @@ -0,0 +1,28 @@ +From b91d735d3dc25dd4a5ab89c45fbf810dbdcba8a5 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Mon, 6 Apr 2020 19:44:28 +0200 +Subject: [PATCH 09/37] 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@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 29b53f12f7..31d2e24118 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.31.1 + diff --git a/http/firefox/patches/0010-Fix-building-spellchecker-when-using-GCC-and-PGO.patch b/http/firefox/patches/0010-Fix-building-spellchecker-when-using-GCC-and-PGO.patch new file mode 100644 index 0000000000..f81849ac41 --- /dev/null +++ b/http/firefox/patches/0010-Fix-building-spellchecker-when-using-GCC-and-PGO.patch @@ -0,0 +1,27 @@ +From e5793d37db3c95bebbba1b9babededdb10282d1a Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Mon, 6 Apr 2020 19:51:22 +0200 +Subject: [PATCH 10/37] Fix building spellchecker when using GCC and PGO + +Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88561 +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + extensions/spellcheck/src/moz.build | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/extensions/spellcheck/src/moz.build b/extensions/spellcheck/src/moz.build +index dcc1d54f74..06a2ad5a15 100644 +--- a/extensions/spellcheck/src/moz.build ++++ b/extensions/spellcheck/src/moz.build +@@ -31,3 +31,8 @@ EXPORTS.mozilla += [ + + 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"] +-- +2.31.1 + diff --git a/http/firefox/patches/0011-bmo-1526653-Include-struct-definitions-for-user_vfp-.patch b/http/firefox/patches/0011-bmo-1526653-Include-struct-definitions-for-user_vfp-.patch new file mode 100644 index 0000000000..366f5c8037 --- /dev/null +++ b/http/firefox/patches/0011-bmo-1526653-Include-struct-definitions-for-user_vfp-.patch @@ -0,0 +1,38 @@ +From 2fc03ca254baa4d624a7b4b67656be94b63f89e9 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Mon, 6 Apr 2020 19:57:42 +0200 +Subject: [PATCH 11/37] bmo#1526653: Include struct definitions for user_vfp + and user_vfp_exc + +Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1526653 +Bug: https://bugs.gentoo.org/681036 +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + js/src/wasm/WasmSignalHandlers.cpp | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp +index 37bc5a9c19..67b43ada29 100644 +--- a/js/src/wasm/WasmSignalHandlers.cpp ++++ b/js/src/wasm/WasmSignalHandlers.cpp +@@ -252,7 +252,16 @@ using mozilla::DebugOnly; + #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) +-- +2.31.1 + diff --git a/http/firefox/patches/0013-musl-Add-alternate-name-for-private-siginfo-struct-m.patch b/http/firefox/patches/0013-musl-Add-alternate-name-for-private-siginfo-struct-m.patch new file mode 100644 index 0000000000..a00174a034 --- /dev/null +++ b/http/firefox/patches/0013-musl-Add-alternate-name-for-private-siginfo-struct-m.patch @@ -0,0 +1,35 @@ +From 179237ec97ccfb589236400846e99d0e59d4919a Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Sun, 8 Jan 2017 19:16:38 -0600 +Subject: [PATCH 13/37] 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@sholland.org> +Signed-off-by: Thomas Deutschmann <whissi@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.31.1 + diff --git a/http/firefox/patches/6003_fix_syscall_wrappers_on_musl.patch b/http/firefox/patches/0014-musl-Fix-syscall-wrappers.patch index 3fbea01ca8..e4833ab5d5 100644 --- a/http/firefox/patches/6003_fix_syscall_wrappers_on_musl.patch +++ b/http/firefox/patches/0014-musl-Fix-syscall-wrappers.patch @@ -1,7 +1,7 @@ ->From 0b1e174fa3acdde982a051ee0a030566ea8368cb Mon Sep 17 00:00:00 2001 +From 47318a554b6f94f8ad46839ddeb70d95cb950c11 Mon Sep 17 00:00:00 2001 From: Samuel Holland <samuel@sholland.org> Date: Sun, 8 Jan 2017 19:19:23 -0600 -Subject: [PATCH 4/4] Fix syscall wrappers on musl +Subject: [PATCH 14/37] 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, @@ -14,19 +14,16 @@ 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@sholland.org> +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> --- - .../google-breakpad/src/third_party/lss/linux_syscall_support.h | 7 +++++++ + .../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 -@@ -161,16 +161,23 @@ extern "C" { - # undef __NR_pipe - #endif - - #if defined(__ANDROID__) - // waitpid is blocked by seccomp on all architectures on recent Android. +@@ -173,6 +173,13 @@ extern "C" { # undef __NR_waitpid #endif @@ -40,8 +37,6 @@ diff --git a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_sys /* 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 +-- +2.31.1 + diff --git a/http/firefox/patches/0015-musl-Only-use-system-heap-reporter-with-glibc.patch b/http/firefox/patches/0015-musl-Only-use-system-heap-reporter-with-glibc.patch new file mode 100644 index 0000000000..0327f733d2 --- /dev/null +++ b/http/firefox/patches/0015-musl-Only-use-system-heap-reporter-with-glibc.patch @@ -0,0 +1,33 @@ +From f6577f5dcd75e65e58dd008edd2dc84dbd1a9624 Mon Sep 17 00:00:00 2001 +From: "Jory A. Pratt" <anarchy@gentoo.org> +Date: Mon, 6 Apr 2020 20:09:26 +0200 +Subject: [PATCH 15/37] musl: Only use system heap reporter with glibc + +Signed-off-by: Thomas Deutschmann <whissi@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 6aa934812f..ccb8d5255a 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.31.1 + diff --git a/http/firefox/patches/0016-musl-Set-pthread-name-for-non-glibc-systems.patch b/http/firefox/patches/0016-musl-Set-pthread-name-for-non-glibc-systems.patch new file mode 100644 index 0000000000..8cb83d764b --- /dev/null +++ b/http/firefox/patches/0016-musl-Set-pthread-name-for-non-glibc-systems.patch @@ -0,0 +1,29 @@ +From 6cf6da0082d9b01778e671c684659480e91537c7 Mon Sep 17 00:00:00 2001 +From: "Jory A. Pratt" <anarchy@gentoo.org> +Date: Mon, 6 Apr 2020 20:10:03 +0200 +Subject: [PATCH 16/37] musl: Set pthread name for non glibc systems + +Signed-off-by: Thomas Deutschmann <whissi@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.31.1 + diff --git a/http/firefox/patches/0017-musl-getcontext-is-only-avaliable-on-glibc-systems.patch b/http/firefox/patches/0017-musl-getcontext-is-only-avaliable-on-glibc-systems.patch new file mode 100644 index 0000000000..644cb4a5ab --- /dev/null +++ b/http/firefox/patches/0017-musl-getcontext-is-only-avaliable-on-glibc-systems.patch @@ -0,0 +1,28 @@ +From e12b7cfccddbe7e26589597a2dda433c177062bd Mon Sep 17 00:00:00 2001 +From: "Jory A. Pratt" <anarchy@gentoo.org> +Date: Mon, 6 Apr 2020 20:10:47 +0200 +Subject: [PATCH 17/37] musl: getcontext is only avaliable on glibc systems + +Signed-off-by: Thomas Deutschmann <whissi@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 e7538e50e9..9a08835481 100644 +--- a/tools/profiler/core/platform-linux-android.cpp ++++ b/tools/profiler/core/platform-linux-android.cpp +@@ -604,8 +604,10 @@ static void PlatformInit(PSLockRef aLock) {} + ucontext_t sSyncUContext; + + void Registers::SyncPopulate() { ++#if defined(__GLIBC__) + if (!getcontext(&sSyncUContext)) { + PopulateRegsFromContext(*this, &sSyncUContext); + } ++#endif + } + #endif +-- +2.31.1 + diff --git a/http/firefox/patches/0018-musl-sys-auvx.h-avaliable-on-more-then-just-glibc-sy.patch b/http/firefox/patches/0018-musl-sys-auvx.h-avaliable-on-more-then-just-glibc-sy.patch new file mode 100644 index 0000000000..5a8695e70f --- /dev/null +++ b/http/firefox/patches/0018-musl-sys-auvx.h-avaliable-on-more-then-just-glibc-sy.patch @@ -0,0 +1,48 @@ +From 5487455c6aefff54ca038405a227fe0c33c08159 Mon Sep 17 00:00:00 2001 +From: "Jory A. Pratt" <anarchy@gentoo.org> +Date: Mon, 6 Apr 2020 20:12:09 +0200 +Subject: [PATCH 18/37] musl: sys/auvx.h avaliable on more then just glibc + systems + +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + .../webrtc/system_wrappers/source/cpu_features_linux.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/third_party/libwebrtc/webrtc/system_wrappers/source/cpu_features_linux.c b/third_party/libwebrtc/webrtc/system_wrappers/source/cpu_features_linux.c +index 9c5645068a..05fea37ee0 100644 +--- a/third_party/libwebrtc/webrtc/system_wrappers/source/cpu_features_linux.c ++++ b/third_party/libwebrtc/webrtc/system_wrappers/source/cpu_features_linux.c +@@ -11,10 +11,7 @@ + #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> +@@ -32,7 +29,7 @@ uint64_t WebRtc_GetCPUFeaturesARM(void) { + 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 +@@ -56,7 +53,7 @@ uint64_t WebRtc_GetCPUFeaturesARM(void) { + } + close(fd); + } +-#endif // __GLIBC_PREREQ(2,16) ++#endif // (__linux__) + #if defined(__aarch64__) + architecture = 8; + if ((hwcap & HWCAP_FP) != 0) +-- +2.31.1 + diff --git a/http/firefox/patches/0019-musl-make-SYS_fork-non-fatal-musl-uses-it-for-fork-2.patch b/http/firefox/patches/0019-musl-make-SYS_fork-non-fatal-musl-uses-it-for-fork-2.patch new file mode 100644 index 0000000000..8d25717f67 --- /dev/null +++ b/http/firefox/patches/0019-musl-make-SYS_fork-non-fatal-musl-uses-it-for-fork-2.patch @@ -0,0 +1,28 @@ +From 9410f62391ae3eb1022b807731abdc4f59f947de Mon Sep 17 00:00:00 2001 +From: Johannes <johannes.brechtmann@gmail.com> +Date: Fri, 1 May 2020 17:20:29 +0200 +Subject: [PATCH 19/37] musl: make SYS_fork non-fatal, musl uses it for fork(2) + +Signed-off-by: Thomas Deutschmann <whissi@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 515b11dec4..388add4391 100644 +--- a/security/sandbox/linux/SandboxFilter.cpp ++++ b/security/sandbox/linux/SandboxFilter.cpp +@@ -1473,6 +1473,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 + + # ifdef __NR_fadvise64 + case __NR_fadvise64: +-- +2.31.1 + diff --git a/http/firefox/patches/0020-musl-include-net-if.h-before-linux-if.h-to-avoid-red.patch b/http/firefox/patches/0020-musl-include-net-if.h-before-linux-if.h-to-avoid-red.patch new file mode 100644 index 0000000000..1faa406638 --- /dev/null +++ b/http/firefox/patches/0020-musl-include-net-if.h-before-linux-if.h-to-avoid-red.patch @@ -0,0 +1,27 @@ +From 577ad5ff7d023bc4080f61880efd63839ffa3d31 Mon Sep 17 00:00:00 2001 +From: Rasmus Thomsen <oss@cogitri.dev> +Date: Wed, 28 Oct 2020 17:50:24 +0100 +Subject: [PATCH 20/37] musl: include net/if.h before linux/if.h to avoid + redefinition + +Bug: https://bugs.gentoo.org/751469 +Signed-off-by: Thomas Deutschmann <whissi@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.31.1 + diff --git a/http/firefox/patches/7001_make-pgo-use-toolchain.patch b/http/firefox/patches/0021-Make-PGO-use-toolchain.patch index bccc22642e..e020fb4e12 100644 --- a/http/firefox/patches/7001_make-pgo-use-toolchain.patch +++ b/http/firefox/patches/0021-Make-PGO-use-toolchain.patch @@ -1,15 +1,18 @@ -# HG changeset patch -# Parent 19684dd9010f6e104af6997b67baef6c4c633337 +From 665e9833bc25fdcd8f7bfff50bd447de8abf50fd Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Mon, 6 Apr 2020 20:13:34 +0200 +Subject: [PATCH 21/37] Make PGO use toolchain + +Signed-off-by: Thomas Deutschmann <whissi@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 3927dd907b..cb4819b230 100644 --- 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 +@@ -4,6 +4,15 @@ if [ -n "$FORCE_GCC" ]; then CC="$MOZ_FETCHES_DIR/gcc/bin/gcc" CXX="$MOZ_FETCHES_DIR/gcc/bin/g++" @@ -25,8 +28,6 @@ diff --git a/build/unix/mozconfig.unix b/build/unix/mozconfig.unix # 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 +-- +2.31.1 + diff --git a/http/firefox/patches/0022-bmo-1516081-Disable-watchdog-during-PGO-builds.patch b/http/firefox/patches/0022-bmo-1516081-Disable-watchdog-during-PGO-builds.patch new file mode 100644 index 0000000000..3d02ac32af --- /dev/null +++ b/http/firefox/patches/0022-bmo-1516081-Disable-watchdog-during-PGO-builds.patch @@ -0,0 +1,55 @@ +From ead0d88e0e338c7c3a22f0e5e6e54138e16d0f5d Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Mon, 6 Apr 2020 20:27:06 +0200 +Subject: [PATCH 22/37] bmo#1516081: Disable watchdog during PGO builds + +Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1516081 +Signed-off-by: Thomas Deutschmann <whissi@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 1fe5a1ab73..30b8b27fc4 100644 +--- a/build/moz.configure/lto-pgo.configure ++++ b/build/moz.configure/lto-pgo.configure +@@ -85,7 +85,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"], +@@ -99,7 +99,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 f0d2a08c29..c8797bf12d 100644 +--- a/toolkit/components/terminator/nsTerminator.cpp ++++ b/toolkit/components/terminator/nsTerminator.cpp +@@ -456,6 +456,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.31.1 + diff --git a/http/firefox/patches/0023-bmo-1516803-force-one-LTO-partition-for-sandbox-when.patch b/http/firefox/patches/0023-bmo-1516803-force-one-LTO-partition-for-sandbox-when.patch new file mode 100644 index 0000000000..96abb0bed5 --- /dev/null +++ b/http/firefox/patches/0023-bmo-1516803-force-one-LTO-partition-for-sandbox-when.patch @@ -0,0 +1,32 @@ +From 76549ac67ab84e5a2ddeca467ae315de3128cf4e Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Wed, 15 Apr 2020 00:27:25 +0200 +Subject: [PATCH 23/37] bmo#1516803: force one LTO partition for sandbox when + using GCC + +Signed-off-by: Thomas Deutschmann <whissi@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 31d2e24118..88d9a2dc6f 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.31.1 + diff --git a/http/firefox/patches/0024-bmo-1196777-Set-GDK_FOCUS_CHANGE_MASK.patch b/http/firefox/patches/0024-bmo-1196777-Set-GDK_FOCUS_CHANGE_MASK.patch new file mode 100644 index 0000000000..cd089601aa --- /dev/null +++ b/http/firefox/patches/0024-bmo-1196777-Set-GDK_FOCUS_CHANGE_MASK.patch @@ -0,0 +1,28 @@ +From 2ff0554bbd24db1e49d9057182ff49be92395280 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Mon, 6 Apr 2020 20:47:13 +0200 +Subject: [PATCH 24/37] bmo#1196777: Set GDK_FOCUS_CHANGE_MASK + +Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1196777 +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + widget/gtk/nsWindow.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +index 828f5062a3..a159f32456 100644 +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -198,7 +198,8 @@ const gint kEvents = GDK_TOUCHPAD_GESTURE_MASK | GDK_EXPOSURE_MASK | + 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; + + #if !GTK_CHECK_VERSION(3, 22, 0) + typedef enum { +-- +2.31.1 + diff --git a/http/firefox/patches/0025-Fix-building-with-PGO-when-using-GCC.patch b/http/firefox/patches/0025-Fix-building-with-PGO-when-using-GCC.patch new file mode 100644 index 0000000000..a870d01868 --- /dev/null +++ b/http/firefox/patches/0025-Fix-building-with-PGO-when-using-GCC.patch @@ -0,0 +1,84 @@ +From 9b403dc8840d1f16ace76a9410fe003434a96e1b Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Thu, 2 Jul 2020 18:05:03 +0200 +Subject: [PATCH 25/37] Fix building with PGO when using GCC + +Signed-off-by: Thomas Deutschmann <whissi@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 30b8b27fc4..95852d7c21 100644 +--- a/build/moz.configure/lto-pgo.configure ++++ b/build/moz.configure/lto-pgo.configure +@@ -84,11 +84,12 @@ set_config("PGO_PROFILE_PATH", pgo_profile_path) + @imports(_from="__builtin__", _import="min") + 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.31.1 + diff --git a/http/firefox/patches/0026-libaom-Use-NEON_FLAGS-instead-of-VPX_ASFLAGS-for-lib.patch b/http/firefox/patches/0026-libaom-Use-NEON_FLAGS-instead-of-VPX_ASFLAGS-for-lib.patch new file mode 100644 index 0000000000..b84931932a --- /dev/null +++ b/http/firefox/patches/0026-libaom-Use-NEON_FLAGS-instead-of-VPX_ASFLAGS-for-lib.patch @@ -0,0 +1,28 @@ +From 9621c47f6218e08608f489fe3fcc66a93682d474 Mon Sep 17 00:00:00 2001 +From: Mike Hommey <mh@glandium.org> +Date: Mon, 26 Nov 2018 09:59:56 +0900 +Subject: [PATCH 26/37] libaom: Use NEON_FLAGS instead of VPX_ASFLAGS for + libaom neon code + +Bug: https://bugs.gentoo.org/730606 +Signed-off-by: Thomas Deutschmann <whissi@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.31.1 + diff --git a/http/firefox/patches/0027-build-Disable-Werror.patch b/http/firefox/patches/0027-build-Disable-Werror.patch new file mode 100644 index 0000000000..23b45c3d94 --- /dev/null +++ b/http/firefox/patches/0027-build-Disable-Werror.patch @@ -0,0 +1,28 @@ +From e56b9b14238305b82c32cc58c71d1263feab9710 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Sat, 29 Aug 2020 22:06:15 +0200 +Subject: [PATCH 27/37] build: Disable -Werror + +Bug: https://bugzilla.mozilla.org/822978 +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + build/moz.configure/warnings.configure | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure +index d0db70f6d3..a2b1f78a5d 100755 +--- a/build/moz.configure/warnings.configure ++++ b/build/moz.configure/warnings.configure +@@ -234,7 +234,8 @@ with only_when(depends(target)(lambda t: t.kernel == "WINNT")): + check_and_add_gcc_warning("-Wno-gnu-zero-variadic-macro-arguments") + + # Make it an error to be missing function declarations for C code. +-check_and_add_gcc_warning("-Werror=implicit-function-declaration", c_compiler) ++check_and_add_gcc_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_gcc_warning("-Wno-psabi") +-- +2.31.1 + diff --git a/http/firefox/patches/0028-LTO-Only-enable-LTO-for-Rust-when-complete-build-use.patch b/http/firefox/patches/0028-LTO-Only-enable-LTO-for-Rust-when-complete-build-use.patch new file mode 100644 index 0000000000..ec6e6eda5e --- /dev/null +++ b/http/firefox/patches/0028-LTO-Only-enable-LTO-for-Rust-when-complete-build-use.patch @@ -0,0 +1,34 @@ +From fc0da069a26acffede07ab50317f6520b5c4d6de Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Sat, 29 Aug 2020 22:30:59 +0200 +Subject: [PATCH 28/37] LTO: Only enable LTO for Rust when complete build uses + LTO + +Signed-off-by: Thomas Deutschmann <whissi@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 38e647c101..e683f5ec7e 100644 +--- a/config/makefiles/rust.mk ++++ b/config/makefiles/rust.mk +@@ -64,6 +64,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 +@@ -77,6 +78,7 @@ RUSTFLAGS += -Cembed-bitcode=yes + endif + endif + endif ++endif + + ifdef CARGO_INCREMENTAL + export CARGO_INCREMENTAL +-- +2.31.1 + diff --git a/http/firefox/patches/0029-Make-elfhack-use-toolchain.patch b/http/firefox/patches/0029-Make-elfhack-use-toolchain.patch new file mode 100644 index 0000000000..5b41b2c07b --- /dev/null +++ b/http/firefox/patches/0029-Make-elfhack-use-toolchain.patch @@ -0,0 +1,26 @@ +From 22639bcf27d94b1dea4458a50415370fb71126e8 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Mon, 28 Sep 2020 20:52:24 +0200 +Subject: [PATCH 29/37] Make elfhack use toolchain + +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + build/unix/elfhack/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/build/unix/elfhack/Makefile.in b/build/unix/elfhack/Makefile.in +index 08cc3d6852..c2b575d87a 100644 +--- a/build/unix/elfhack/Makefile.in ++++ b/build/unix/elfhack/Makefile.in +@@ -20,7 +20,7 @@ test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX) + # Fail if the backup file doesn't exist + [ -f '$@.bak' ] + # Fail if the new library doesn't contain less relocations +- [ $$($(TOOLCHAIN_PREFIX)objdump -R $@.bak | wc -l) -gt $$(objdump -R $@ | wc -l) ] ++ [ $$($(TOOLCHAIN_PREFIX)objdump -R $@.bak | wc -l) -gt $$($(TOOLCHAIN_PREFIX)objdump -R $@ | wc -l) ] + + test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): DSO_SONAME=$@ + test-array$(DLL_SUFFIX): DT_TYPE=INIT_ARRAY +-- +2.31.1 + diff --git a/http/firefox/patches/0030-Disable-FFVPX-with-VA-API.patch b/http/firefox/patches/0030-Disable-FFVPX-with-VA-API.patch new file mode 100644 index 0000000000..d02e2a5dd1 --- /dev/null +++ b/http/firefox/patches/0030-Disable-FFVPX-with-VA-API.patch @@ -0,0 +1,91 @@ +From 4933cb13af644a56b2fcfdd529e548ad44713135 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Thu, 29 Apr 2021 18:22:48 +0200 +Subject: [PATCH 30/37] Disable FFVPX with VA-API + +Signed-off-by: Thomas Deutschmann <whissi@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 6e84abde70..fab21747f5 100644 +--- a/dom/media/platforms/PDMFactory.cpp ++++ b/dom/media/platforms/PDMFactory.cpp +@@ -481,12 +481,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() && +@@ -494,6 +488,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>(); + } +@@ -525,11 +525,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>()) { +@@ -537,6 +532,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(), +@@ -571,11 +571,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>()) { +@@ -583,6 +578,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.31.1 + diff --git a/http/firefox/patches/0031-Enable-FLAC-on-platforms-without-ffvpx-via-ffmpeg.patch b/http/firefox/patches/0031-Enable-FLAC-on-platforms-without-ffvpx-via-ffmpeg.patch new file mode 100644 index 0000000000..a0026445ed --- /dev/null +++ b/http/firefox/patches/0031-Enable-FLAC-on-platforms-without-ffvpx-via-ffmpeg.patch @@ -0,0 +1,36 @@ +From 78bec2b0927a1065d9c38fb3014b84d75586c4f5 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Thu, 29 Apr 2021 18:48:06 +0200 +Subject: [PATCH 31/37] Enable FLAC on platforms without ffvpx via ffmpeg + +Signed-off-by: Thomas Deutschmann <whissi@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.31.1 + diff --git a/http/firefox/patches/0032-bmo-1670333-OpenH264-Fix-decoding-if-it-starts-on-no.patch b/http/firefox/patches/0032-bmo-1670333-OpenH264-Fix-decoding-if-it-starts-on-no.patch new file mode 100644 index 0000000000..942c7f1f79 --- /dev/null +++ b/http/firefox/patches/0032-bmo-1670333-OpenH264-Fix-decoding-if-it-starts-on-no.patch @@ -0,0 +1,96 @@ +From 8fc91e34b5b8421af6ccac800ba40dac983bef05 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Fri, 11 Dec 2020 15:37:38 +0100 +Subject: [PATCH 32/37] bmo#1670333: OpenH264: Fix decoding if it starts on non + IDR I-frame + +Signed-off-by: Thomas Deutschmann <whissi@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 fab21747f5..cceaa944aa 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, ...) \ +@@ -526,10 +528,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 +@@ -546,8 +550,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.31.1 + diff --git a/http/firefox/patches/0033-bmo-1663844-OpenH264-Allow-using-OpenH264-GMP-decode.patch b/http/firefox/patches/0033-bmo-1663844-OpenH264-Allow-using-OpenH264-GMP-decode.patch new file mode 100644 index 0000000000..6257baa55f --- /dev/null +++ b/http/firefox/patches/0033-bmo-1663844-OpenH264-Allow-using-OpenH264-GMP-decode.patch @@ -0,0 +1,55 @@ +From 23d2a0a96875e1e20f6320a76a093ecb1238c8f9 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Fri, 11 Dec 2020 15:46:25 +0100 +Subject: [PATCH 33/37] bmo#1663844: OpenH264: Allow using OpenH264 GMP decoder + as fallback for video decoding + +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + dom/media/gmp/GMPSharedMemManager.h | 2 +- + dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp | 2 +- + dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp | 2 ++ + 3 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/dom/media/gmp/GMPSharedMemManager.h b/dom/media/gmp/GMPSharedMemManager.h +index 44c660f6ca..3a2eff3294 100644 +--- a/dom/media/gmp/GMPSharedMemManager.h ++++ b/dom/media/gmp/GMPSharedMemManager.h +@@ -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 --git a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp +index 641f52a58b..6bd8235073 100644 +--- a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp ++++ b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp +@@ -82,7 +82,7 @@ bool GMPDecoderModule::SupportsMimeType(const nsACString& aMimeType, + + bool GMPDecoderModule::SupportsMimeType( + const nsACString& aMimeType, DecoderDoctorDiagnostics* aDiagnostics) const { +- return false; ++ return MP4Decoder::IsH264(aMimeType); + } + + /* static */ +diff --git a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp +index 5019ff5a2d..4ee0ef4518 100644 +--- a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp ++++ b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp +@@ -68,6 +68,8 @@ void GMPVideoDecoder::Decoded(GMPVideoi420Frame* aDecodedFrame) { + RefPtr<GMPVideoDecoder> self = this; + if (v) { + mDecodedData.AppendElement(std::move(v)); ++ mDecodePromise.ResolveIfExists(std::move(mDecodedData), __func__); ++ mDecodedData = DecodedData(); + } else { + mDecodedData.Clear(); + mDecodePromise.RejectIfExists( +-- +2.31.1 + diff --git a/http/firefox/patches/0034-bmo-1580595-Wayland-Add-support-for-pointer-lock-via.patch b/http/firefox/patches/0034-bmo-1580595-Wayland-Add-support-for-pointer-lock-via.patch new file mode 100644 index 0000000000..6b3ae38d21 --- /dev/null +++ b/http/firefox/patches/0034-bmo-1580595-Wayland-Add-support-for-pointer-lock-via.patch @@ -0,0 +1,1691 @@ +From 2ff38bfc4cd87f6588b946a3026523dfd6b27c2a Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Thu, 29 Apr 2021 18:31:05 +0200 +Subject: [PATCH 34/37] bmo#1580595: Wayland: Add support for pointer lock via + relative-pointer and pointer-constraints + +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + dom/events/EventStateManager.cpp | 8 + + dom/ipc/BrowserParent.cpp | 40 +- + dom/ipc/BrowserParent.h | 12 + + dom/ipc/PBrowser.ipdl | 3 + + widget/PuppetWidget.cpp | 14 + + widget/PuppetWidget.h | 3 + + widget/gtk/mozgtk/mozgtk.c | 1 + + widget/gtk/mozwayland/mozwayland.c | 1 + + widget/gtk/nsWaylandDisplay.cpp | 25 + + widget/gtk/nsWaylandDisplay.h | 13 + + widget/gtk/nsWindow.cpp | 110 +++ + widget/gtk/nsWindow.h | 10 + + widget/gtk/wayland/moz.build | 4 + + ...-constraints-unstable-v1-client-protocol.h | 650 ++++++++++++++++++ + ...pointer-constraints-unstable-v1-protocol.c | 97 +++ + ...tive-pointer-unstable-v1-client-protocol.h | 293 ++++++++ + .../relative-pointer-unstable-v1-protocol.c | 69 ++ + widget/nsIWidget.h | 10 + + 18 files changed, 1362 insertions(+), 1 deletion(-) + create mode 100644 widget/gtk/wayland/pointer-constraints-unstable-v1-client-protocol.h + create mode 100644 widget/gtk/wayland/pointer-constraints-unstable-v1-protocol.c + create mode 100644 widget/gtk/wayland/relative-pointer-unstable-v1-client-protocol.h + create mode 100644 widget/gtk/wayland/relative-pointer-unstable-v1-protocol.c + +diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp +index 6bd7e2d822..20da36811d 100644 +--- a/dom/events/EventStateManager.cpp ++++ b/dom/events/EventStateManager.cpp +@@ -4816,7 +4816,15 @@ void EventStateManager::SetPointerLock(nsIWidget* aWidget, + if (dragService) { + dragService->Suppress(); + } ++ ++ // Activate native pointer lock on platforms where it is required (Wayland) ++ aWidget->LockNativePointer(); + } else { ++ if (aWidget) { ++ // Deactivate native pointer lock on platforms where it is required ++ aWidget->UnlockNativePointer(); ++ } ++ + // Unlocking, so return pointer to the original position by firing a + // synthetic mouse event. We first reset sLastRefPoint to its + // pre-pointerlock position, so that the synthetic mouse event reports +diff --git a/dom/ipc/BrowserParent.cpp b/dom/ipc/BrowserParent.cpp +index 9bb819f0ee..d7354c9cdd 100644 +--- a/dom/ipc/BrowserParent.cpp ++++ b/dom/ipc/BrowserParent.cpp +@@ -229,7 +229,8 @@ BrowserParent::BrowserParent(ContentParent* aManager, const TabId& aTabId, + mHasLayers(false), + mHasPresented(false), + mIsReadyToHandleInputEvents(false), +- mIsMouseEnterIntoWidgetEventSuppressed(false) { ++ mIsMouseEnterIntoWidgetEventSuppressed(false), ++ mLockedNativePointer(false) { + MOZ_ASSERT(aManager); + // When the input event queue is disabled, we don't need to handle the case + // that some input events are dispatched before PBrowserConstructor. +@@ -594,6 +595,7 @@ void BrowserParent::RemoveWindowListeners() { + } + + void BrowserParent::Deactivated() { ++ UnlockNativePointer(); + UnsetTopLevelWebFocus(this); + UnsetLastMouseRemoteTarget(this); + PointerLockManager::ReleaseLockedRemoteTarget(this); +@@ -1078,6 +1080,7 @@ void BrowserParent::UpdateDimensions(const nsIntRect& rect, + mChromeOffset = chromeOffset; + + Unused << SendUpdateDimensions(GetDimensionInfo()); ++ UpdateNativePointerLockCenter(widget); + } + } + +@@ -1098,6 +1101,17 @@ DimensionInfo BrowserParent::GetDimensionInfo() { + return di; + } + ++void BrowserParent::UpdateNativePointerLockCenter(nsIWidget* aWidget) { ++ if (!mLockedNativePointer) { ++ return; ++ } ++ LayoutDeviceIntRect dims( ++ {0, 0}, ++ ViewAs<LayoutDevicePixel>( ++ mDimensions, PixelCastJustification::LayoutDeviceIsScreenForTabDims)); ++ aWidget->SetNativePointerLockCenter((dims + mChromeOffset).Center()); ++} ++ + void BrowserParent::SizeModeChanged(const nsSizeMode& aSizeMode) { + if (!mIsDestroyed && aSizeMode != mSizeMode) { + mSizeMode = aSizeMode; +@@ -1899,6 +1913,30 @@ mozilla::ipc::IPCResult BrowserParent::RecvSynthesizeNativeTouchpadDoubleTap( + return IPC_OK(); + } + ++mozilla::ipc::IPCResult BrowserParent::RecvLockNativePointer() { ++ if (nsCOMPtr<nsIWidget> widget = GetWidget()) { ++ mLockedNativePointer = true; // do before updating the center ++ UpdateNativePointerLockCenter(widget); ++ widget->LockNativePointer(); ++ } ++ return IPC_OK(); ++} ++ ++void BrowserParent::UnlockNativePointer() { ++ if (!mLockedNativePointer) { ++ return; ++ } ++ if (nsCOMPtr<nsIWidget> widget = GetWidget()) { ++ widget->UnlockNativePointer(); ++ mLockedNativePointer = false; ++ } ++} ++ ++mozilla::ipc::IPCResult BrowserParent::RecvUnlockNativePointer() { ++ UnlockNativePointer(); ++ return IPC_OK(); ++} ++ + void BrowserParent::SendRealKeyEvent(WidgetKeyboardEvent& aEvent) { + if (mIsDestroyed || !mIsReadyToHandleInputEvents) { + return; +diff --git a/dom/ipc/BrowserParent.h b/dom/ipc/BrowserParent.h +index 5b53b13e27..2f92129d7e 100644 +--- a/dom/ipc/BrowserParent.h ++++ b/dom/ipc/BrowserParent.h +@@ -547,6 +547,10 @@ class BrowserParent final : public PBrowserParent, + mozilla::ipc::IPCResult RecvSynthesizeNativeTouchpadDoubleTap( + const LayoutDeviceIntPoint& aPoint, const uint32_t& aModifierFlags); + ++ mozilla::ipc::IPCResult RecvLockNativePointer(); ++ ++ mozilla::ipc::IPCResult RecvUnlockNativePointer(); ++ + void SendMouseEvent(const nsAString& aType, float aX, float aY, + int32_t aButton, int32_t aClickCount, int32_t aModifiers); + +@@ -794,6 +798,10 @@ class BrowserParent final : public PBrowserParent, + // and have to ensure that the child did not modify links to be loaded. + bool QueryDropLinksForVerification(); + ++ void UnlockNativePointer(); ++ ++ void UpdateNativePointerLockCenter(nsIWidget* aWidget); ++ + private: + // This is used when APZ needs to find the BrowserParent associated with a + // layer to dispatch events. +@@ -977,6 +985,10 @@ class BrowserParent final : public PBrowserParent, + // BrowserChild was not ready to handle it. We will resend it when the next + // time we fire a mouse event and the BrowserChild is ready. + bool mIsMouseEnterIntoWidgetEventSuppressed : 1; ++ ++ // True after RecvLockNativePointer has been called and until ++ // UnlockNativePointer has been called. ++ bool mLockedNativePointer : 1; + }; + + struct MOZ_STACK_CLASS BrowserParent::AutoUseNewTab final { +diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl +index 4bbd6dcfdd..5447912941 100644 +--- a/dom/ipc/PBrowser.ipdl ++++ b/dom/ipc/PBrowser.ipdl +@@ -538,6 +538,9 @@ parent: + async SynthesizeNativeTouchpadDoubleTap(LayoutDeviceIntPoint aPoint, + uint32_t aModifierFlags); + ++ async LockNativePointer(); ++ async UnlockNativePointer(); ++ + async AccessKeyNotHandled(WidgetKeyboardEvent event); + + async RegisterProtocolHandler(nsString scheme, nsIURI handlerURI, nsString title, +diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp +index 085fef6642..db71c13594 100644 +--- a/widget/PuppetWidget.cpp ++++ b/widget/PuppetWidget.cpp +@@ -533,6 +533,20 @@ nsresult PuppetWidget::SynthesizeNativeTouchpadDoubleTap( + return NS_OK; + } + ++void PuppetWidget::LockNativePointer() { ++ if (!mBrowserChild) { ++ return; ++ } ++ mBrowserChild->SendLockNativePointer(); ++} ++ ++void PuppetWidget::UnlockNativePointer() { ++ if (!mBrowserChild) { ++ return; ++ } ++ mBrowserChild->SendUnlockNativePointer(); ++} ++ + void PuppetWidget::SetConfirmedTargetAPZC( + uint64_t aInputBlockId, + const nsTArray<ScrollableLayerGuid>& aTargets) const { +diff --git a/widget/PuppetWidget.h b/widget/PuppetWidget.h +index c34f7f4b85..afbea5fe5d 100644 +--- a/widget/PuppetWidget.h ++++ b/widget/PuppetWidget.h +@@ -281,6 +281,9 @@ class PuppetWidget : public nsBaseWidget, + virtual nsresult SynthesizeNativeTouchpadDoubleTap( + LayoutDeviceIntPoint aPoint, uint32_t aModifierFlags) override; + ++ virtual void LockNativePointer() override; ++ virtual void UnlockNativePointer() override; ++ + virtual void StartAsyncScrollbarDrag( + const AsyncDragMetrics& aDragMetrics) override; + +diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c +index 54f5d08efe..02e5db6e9e 100644 +--- a/widget/gtk/mozgtk/mozgtk.c ++++ b/widget/gtk/mozgtk/mozgtk.c +@@ -647,6 +647,7 @@ STUB(gtk_color_chooser_get_type) + STUB(gtk_color_chooser_set_rgba) + STUB(gtk_color_chooser_get_rgba) + STUB(gtk_color_chooser_set_use_alpha) ++STUB(gdk_wayland_device_get_wl_pointer) + #endif + + #ifdef GTK2_SYMBOLS +diff --git a/widget/gtk/mozwayland/mozwayland.c b/widget/gtk/mozwayland/mozwayland.c +index 8a79d87865..7a448e6321 100644 +--- a/widget/gtk/mozwayland/mozwayland.c ++++ b/widget/gtk/mozwayland/mozwayland.c +@@ -23,6 +23,7 @@ const struct wl_interface wl_callback_interface; + const struct wl_interface wl_data_device_interface; + const struct wl_interface wl_data_device_manager_interface; + const struct wl_interface wl_keyboard_interface; ++const struct wl_interface wl_pointer_interface; + const struct wl_interface wl_region_interface; + const struct wl_interface wl_registry_interface; + const struct wl_interface wl_shm_interface; +diff --git a/widget/gtk/nsWaylandDisplay.cpp b/widget/gtk/nsWaylandDisplay.cpp +index 55ca07fc37..49addfeecc 100644 +--- a/widget/gtk/nsWaylandDisplay.cpp ++++ b/widget/gtk/nsWaylandDisplay.cpp +@@ -119,6 +119,16 @@ void nsWaylandDisplay::SetViewporter(wp_viewporter* aViewporter) { + mViewporter = aViewporter; + } + ++void nsWaylandDisplay::SetRelativePointerManager( ++ zwp_relative_pointer_manager_v1* aRelativePointerManager) { ++ mRelativePointerManager = aRelativePointerManager; ++} ++ ++void nsWaylandDisplay::SetPointerConstraints( ++ zwp_pointer_constraints_v1* aPointerConstraints) { ++ mPointerConstraints = aPointerConstraints; ++} ++ + static void global_registry_handler(void* data, wl_registry* registry, + uint32_t id, const char* interface, + uint32_t version) { +@@ -167,6 +177,19 @@ static void global_registry_handler(void* data, wl_registry* registry, + wl_proxy_set_queue((struct wl_proxy*)idle_inhibit_manager, + display->GetEventQueue()); + display->SetIdleInhibitManager(idle_inhibit_manager); ++ } else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) { ++ auto* relative_pointer_manager = ++ WaylandRegistryBind<zwp_relative_pointer_manager_v1>( ++ registry, id, &zwp_relative_pointer_manager_v1_interface, 1); ++ wl_proxy_set_queue((struct wl_proxy*)relative_pointer_manager, ++ display->GetEventQueue()); ++ display->SetRelativePointerManager(relative_pointer_manager); ++ } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) { ++ auto* pointer_constraints = WaylandRegistryBind<zwp_pointer_constraints_v1>( ++ registry, id, &zwp_pointer_constraints_v1_interface, 1); ++ wl_proxy_set_queue((struct wl_proxy*)pointer_constraints, ++ display->GetEventQueue()); ++ display->SetPointerConstraints(pointer_constraints); + } else if (strcmp(interface, "wl_compositor") == 0) { + // Requested wl_compositor version 4 as we need wl_surface_damage_buffer(). + auto* compositor = WaylandRegistryBind<wl_compositor>( +@@ -285,6 +308,8 @@ nsWaylandDisplay::nsWaylandDisplay(wl_display* aDisplay, bool aLighWrapper) + mPrimarySelectionDeviceManagerGtk(nullptr), + mPrimarySelectionDeviceManagerZwpV1(nullptr), + mIdleInhibitManager(nullptr), ++ mRelativePointerManager(nullptr), ++ mPointerConstraints(nullptr), + mRegistry(nullptr), + mViewporter(nullptr), + mExplicitSync(false) { +diff --git a/widget/gtk/nsWaylandDisplay.h b/widget/gtk/nsWaylandDisplay.h +index 0f94ae14f7..bc68b27b11 100644 +--- a/widget/gtk/nsWaylandDisplay.h ++++ b/widget/gtk/nsWaylandDisplay.h +@@ -14,6 +14,8 @@ + #include "mozilla/widget/gbm.h" + #include "mozilla/widget/gtk-primary-selection-client-protocol.h" + #include "mozilla/widget/idle-inhibit-unstable-v1-client-protocol.h" ++#include "mozilla/widget/relative-pointer-unstable-v1-client-protocol.h" ++#include "mozilla/widget/pointer-constraints-unstable-v1-client-protocol.h" + #include "mozilla/widget/linux-dmabuf-unstable-v1-client-protocol.h" + #include "mozilla/widget/primary-selection-unstable-v1-client-protocol.h" + #include "mozilla/widget/viewporter-client-protocol.h" +@@ -62,6 +64,12 @@ class nsWaylandDisplay { + zwp_idle_inhibit_manager_v1* GetIdleInhibitManager(void) { + return mIdleInhibitManager; + } ++ zwp_relative_pointer_manager_v1* GetRelativePointerManager(void) { ++ return mRelativePointerManager; ++ } ++ zwp_pointer_constraints_v1* GetPointerConstraints(void) { ++ return mPointerConstraints; ++ } + wp_viewporter* GetViewporter(void) { return mViewporter; }; + + bool IsMainThreadDisplay() { return mEventQueue == nullptr; } +@@ -78,6 +86,9 @@ class nsWaylandDisplay { + void SetIdleInhibitManager(zwp_idle_inhibit_manager_v1* aIdleInhibitManager); + void SetViewporter(wp_viewporter* aViewporter); + ++ void SetRelativePointerManager( ++ zwp_relative_pointer_manager_v1* aRelativePointerManager); ++ void SetPointerConstraints(zwp_pointer_constraints_v1* aPointerConstraints); + bool IsExplicitSyncEnabled() { return mExplicitSync; } + + private: +@@ -95,6 +106,8 @@ class nsWaylandDisplay { + gtk_primary_selection_device_manager* mPrimarySelectionDeviceManagerGtk; + zwp_primary_selection_device_manager_v1* mPrimarySelectionDeviceManagerZwpV1; + zwp_idle_inhibit_manager_v1* mIdleInhibitManager; ++ zwp_relative_pointer_manager_v1* mRelativePointerManager; ++ zwp_pointer_constraints_v1* mPointerConstraints; + wl_registry* mRegistry; + wp_viewporter* mViewporter; + bool mExplicitSync; +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +index a159f32456..8d06f91f89 100644 +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -506,6 +506,9 @@ nsWindow::nsWindow() { + #ifdef MOZ_WAYLAND + mNeedsCompositorResume = false; + mCompositorInitiallyPaused = false; ++ mNativePointerLockCenter = LayoutDeviceIntPoint(); ++ mRelativePointer = nullptr; ++ mLockedPointer = nullptr; + #endif + mWaitingForMoveToRectCB = false; + mPendingSizeRect = LayoutDeviceIntRect(0, 0, 0, 0); +@@ -8018,6 +8021,13 @@ nsresult nsWindow::SynthesizeNativeMouseEvent( + // all other cases we'll synthesize a motion event that will be emitted by + // gdk_display_warp_pointer(). + // XXX How to activate native modifier for the other events? ++#ifdef MOZ_WAYLAND ++ // Impossible to warp the pointer on Wayland. ++ // For pointer lock, pointer-constraints and relative-pointer are used. ++ if (GdkIsWaylandDisplay()) { ++ return NS_OK; ++ } ++#endif + GdkScreen* screen = gdk_window_get_screen(mGdkWindow); + GdkPoint point = DevicePixelsToGdkPointRoundDown(aPoint); + gdk_display_warp_pointer(display, screen, point.x, point.y); +@@ -8441,6 +8451,106 @@ already_AddRefed<nsIWidget> nsIWidget::CreateChildWindow() { + } + + #ifdef MOZ_WAYLAND ++static void relative_pointer_handle_relative_motion( ++ void* data, struct zwp_relative_pointer_v1* pointer, uint32_t time_hi, ++ uint32_t time_lo, wl_fixed_t dx_w, wl_fixed_t dy_w, wl_fixed_t dx_unaccel_w, ++ wl_fixed_t dy_unaccel_w) { ++ RefPtr<nsWindow> window(reinterpret_cast<nsWindow*>(data)); ++ ++ WidgetMouseEvent event(true, eMouseMove, window, WidgetMouseEvent::eReal); ++ ++ event.mRefPoint = window->GetNativePointerLockCenter(); ++ event.mRefPoint.x += wl_fixed_to_double(dx_unaccel_w); ++ event.mRefPoint.y += wl_fixed_to_double(dy_unaccel_w); ++ ++ event.AssignEventTime(window->GetWidgetEventTime(time_lo)); ++ window->DispatchInputEvent(&event); ++} ++ ++static const struct zwp_relative_pointer_v1_listener relative_pointer_listener = ++ { ++ relative_pointer_handle_relative_motion, ++}; ++ ++void nsWindow::SetNativePointerLockCenter( ++ const LayoutDeviceIntPoint& aLockCenter) { ++ mNativePointerLockCenter = aLockCenter; ++} ++ ++void nsWindow::LockNativePointer() { ++ if (!GdkIsWaylandDisplay()) { ++ return; ++ } ++ ++ auto waylandDisplay = WaylandDisplayGet(); ++ ++ auto* pointerConstraints = waylandDisplay->GetPointerConstraints(); ++ if (!pointerConstraints) { ++ return; ++ } ++ ++ auto* relativePointerMgr = waylandDisplay->GetRelativePointerManager(); ++ if (!relativePointerMgr) { ++ return; ++ } ++ ++ GdkDisplay* display = gdk_display_get_default(); ++ ++ GdkDeviceManager* manager = gdk_display_get_device_manager(display); ++ MOZ_ASSERT(manager); ++ ++ GdkDevice* device = gdk_device_manager_get_client_pointer(manager); ++ if (!device) { ++ NS_WARNING("Could not find Wayland pointer to lock"); ++ return; ++ } ++ wl_pointer* pointer = gdk_wayland_device_get_wl_pointer(device); ++ MOZ_ASSERT(pointer); ++ ++ wl_surface* surface = ++ gdk_wayland_window_get_wl_surface(gtk_widget_get_window(GetGtkWidget())); ++ if (!surface) { ++ /* Can be null when the window is hidden. ++ * Though it's unlikely that a lock request comes in that case, be ++ * defensive. */ ++ return; ++ } ++ ++ mLockedPointer = zwp_pointer_constraints_v1_lock_pointer( ++ pointerConstraints, surface, pointer, nullptr, ++ ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); ++ if (!mLockedPointer) { ++ NS_WARNING("Could not lock Wayland pointer"); ++ return; ++ } ++ ++ mRelativePointer = zwp_relative_pointer_manager_v1_get_relative_pointer( ++ relativePointerMgr, pointer); ++ if (!mRelativePointer) { ++ NS_WARNING("Could not create relative Wayland pointer"); ++ zwp_locked_pointer_v1_destroy(mLockedPointer); ++ mLockedPointer = nullptr; ++ return; ++ } ++ ++ zwp_relative_pointer_v1_add_listener(mRelativePointer, ++ &relative_pointer_listener, this); ++} ++ ++void nsWindow::UnlockNativePointer() { ++ if (!GdkIsWaylandDisplay()) { ++ return; ++ } ++ if (mRelativePointer) { ++ zwp_relative_pointer_v1_destroy(mRelativePointer); ++ mRelativePointer = nullptr; ++ } ++ if (mLockedPointer) { ++ zwp_locked_pointer_v1_destroy(mLockedPointer); ++ mLockedPointer = nullptr; ++ } ++} ++ + nsresult nsWindow::GetScreenRect(LayoutDeviceIntRect* aRect) { + typedef struct _GdkMonitor GdkMonitor; + static auto s_gdk_display_get_monitor_at_window = +diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h +index e2721d0e5b..aa340f4ee0 100644 +--- a/widget/gtk/nsWindow.h ++++ b/widget/gtk/nsWindow.h +@@ -423,6 +423,13 @@ class nsWindow final : public nsBaseWidget { + static bool GetTopLevelWindowActiveState(nsIFrame* aFrame); + static bool TitlebarUseShapeMask(); + #ifdef MOZ_WAYLAND ++ LayoutDeviceIntPoint GetNativePointerLockCenter() { ++ return mNativePointerLockCenter; ++ } ++ virtual void SetNativePointerLockCenter( ++ const LayoutDeviceIntPoint& aLockCenter) override; ++ virtual void LockNativePointer() override; ++ virtual void UnlockNativePointer() override; + virtual nsresult GetScreenRect(LayoutDeviceIntRect* aRect) override; + virtual nsRect GetPreferredPopupRect() override { + return mPreferredPopupRect; +@@ -480,6 +487,7 @@ class nsWindow final : public nsBaseWidget { + #ifdef MOZ_WAYLAND + bool mNeedsCompositorResume; + bool mCompositorInitiallyPaused; ++ LayoutDeviceIntPoint mNativePointerLockCenter; + #endif + bool mWindowScaleFactorChanged; + int mWindowScaleFactor; +@@ -561,6 +569,8 @@ class nsWindow final : public nsBaseWidget { + #endif + #ifdef MOZ_WAYLAND + RefPtr<mozilla::gfx::VsyncSource> mWaylandVsyncSource; ++ zwp_locked_pointer_v1* mLockedPointer; ++ zwp_relative_pointer_v1* mRelativePointer; + #endif + + // Upper bound on pending ConfigureNotify events to be dispatched to the +diff --git a/widget/gtk/wayland/moz.build b/widget/gtk/wayland/moz.build +index 21a5bee855..c3959760da 100644 +--- a/widget/gtk/wayland/moz.build ++++ b/widget/gtk/wayland/moz.build +@@ -11,7 +11,9 @@ SOURCES += [ + "gtk-primary-selection-protocol.c", + "idle-inhibit-unstable-v1-protocol.c", + "linux-dmabuf-unstable-v1-protocol.c", ++ "pointer-constraints-unstable-v1-protocol.c", + "primary-selection-unstable-v1-protocol.c", ++ "relative-pointer-unstable-v1-protocol.c", + "viewporter-protocol.c", + "xdg-output-unstable-v1-protocol.c", + ] +@@ -21,7 +23,9 @@ EXPORTS.mozilla.widget += [ + "gtk-primary-selection-client-protocol.h", + "idle-inhibit-unstable-v1-client-protocol.h", + "linux-dmabuf-unstable-v1-client-protocol.h", ++ "pointer-constraints-unstable-v1-client-protocol.h", + "primary-selection-unstable-v1-client-protocol.h", ++ "relative-pointer-unstable-v1-client-protocol.h", + "va_drmcommon.h", + "viewporter-client-protocol.h", + "xdg-output-unstable-v1-client-protocol.h", +diff --git a/widget/gtk/wayland/pointer-constraints-unstable-v1-client-protocol.h b/widget/gtk/wayland/pointer-constraints-unstable-v1-client-protocol.h +new file mode 100644 +index 0000000000..0f38dee226 +--- /dev/null ++++ b/widget/gtk/wayland/pointer-constraints-unstable-v1-client-protocol.h +@@ -0,0 +1,650 @@ ++/* Generated by wayland-scanner 1.18.0 */ ++ ++#ifndef POINTER_CONSTRAINTS_UNSTABLE_V1_CLIENT_PROTOCOL_H ++#define POINTER_CONSTRAINTS_UNSTABLE_V1_CLIENT_PROTOCOL_H ++ ++#include <stdint.h> ++#include <stddef.h> ++#include "wayland-client.h" ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/** ++ * @page page_pointer_constraints_unstable_v1 The ++ * pointer_constraints_unstable_v1 protocol protocol for constraining pointer ++ * motions ++ * ++ * @section page_desc_pointer_constraints_unstable_v1 Description ++ * ++ * This protocol specifies a set of interfaces used for adding constraints to ++ * the motion of a pointer. Possible constraints include confining pointer ++ * motions to a given region, or locking it to its current position. ++ * ++ * In order to constrain the pointer, a client must first bind the global ++ * interface "wp_pointer_constraints" which, if a compositor supports pointer ++ * constraints, is exposed by the registry. Using the bound global object, the ++ * client uses the request that corresponds to the type of constraint it wants ++ * to make. See wp_pointer_constraints for more details. ++ * ++ * Warning! The protocol described in this file is experimental and backward ++ * incompatible changes may be made. Backward compatible changes may be added ++ * together with the corresponding interface version bump. Backward ++ * incompatible changes are done by bumping the version number in the protocol ++ * and interface names and resetting the interface version. Once the protocol ++ * is to be declared stable, the 'z' prefix and the version number in the ++ * protocol and interface names are removed and the interface version number is ++ * reset. ++ * ++ * @section page_ifaces_pointer_constraints_unstable_v1 Interfaces ++ * - @subpage page_iface_zwp_pointer_constraints_v1 - constrain the movement of ++ * a pointer ++ * - @subpage page_iface_zwp_locked_pointer_v1 - receive relative pointer motion ++ * events ++ * - @subpage page_iface_zwp_confined_pointer_v1 - confined pointer object ++ * @section page_copyright_pointer_constraints_unstable_v1 Copyright ++ * <pre> ++ * ++ * Copyright © 2014 Jonas Ådahl ++ * Copyright © 2015 Red Hat Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the next ++ * paragraph) shall be included in all copies or substantial portions of the ++ * Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ * </pre> ++ */ ++struct wl_pointer; ++struct wl_region; ++struct wl_surface; ++struct zwp_confined_pointer_v1; ++struct zwp_locked_pointer_v1; ++struct zwp_pointer_constraints_v1; ++ ++/** ++ * @page page_iface_zwp_pointer_constraints_v1 zwp_pointer_constraints_v1 ++ * @section page_iface_zwp_pointer_constraints_v1_desc Description ++ * ++ * The global interface exposing pointer constraining functionality. It ++ * exposes two requests: lock_pointer for locking the pointer to its ++ * position, and confine_pointer for locking the pointer to a region. ++ * ++ * The lock_pointer and confine_pointer requests create the objects ++ * wp_locked_pointer and wp_confined_pointer respectively, and the client can ++ * use these objects to interact with the lock. ++ * ++ * For any surface, only one lock or confinement may be active across all ++ * wl_pointer objects of the same seat. If a lock or confinement is requested ++ * when another lock or confinement is active or requested on the same surface ++ * and with any of the wl_pointer objects of the same seat, an ++ * 'already_constrained' error will be raised. ++ * @section page_iface_zwp_pointer_constraints_v1_api API ++ * See @ref iface_zwp_pointer_constraints_v1. ++ */ ++/** ++ * @defgroup iface_zwp_pointer_constraints_v1 The zwp_pointer_constraints_v1 ++ * interface ++ * ++ * The global interface exposing pointer constraining functionality. It ++ * exposes two requests: lock_pointer for locking the pointer to its ++ * position, and confine_pointer for locking the pointer to a region. ++ * ++ * The lock_pointer and confine_pointer requests create the objects ++ * wp_locked_pointer and wp_confined_pointer respectively, and the client can ++ * use these objects to interact with the lock. ++ * ++ * For any surface, only one lock or confinement may be active across all ++ * wl_pointer objects of the same seat. If a lock or confinement is requested ++ * when another lock or confinement is active or requested on the same surface ++ * and with any of the wl_pointer objects of the same seat, an ++ * 'already_constrained' error will be raised. ++ */ ++extern const struct wl_interface zwp_pointer_constraints_v1_interface; ++/** ++ * @page page_iface_zwp_locked_pointer_v1 zwp_locked_pointer_v1 ++ * @section page_iface_zwp_locked_pointer_v1_desc Description ++ * ++ * The wp_locked_pointer interface represents a locked pointer state. ++ * ++ * While the lock of this object is active, the wl_pointer objects of the ++ * associated seat will not emit any wl_pointer.motion events. ++ * ++ * This object will send the event 'locked' when the lock is activated. ++ * Whenever the lock is activated, it is guaranteed that the locked surface ++ * will already have received pointer focus and that the pointer will be ++ * within the region passed to the request creating this object. ++ * ++ * To unlock the pointer, send the destroy request. This will also destroy ++ * the wp_locked_pointer object. ++ * ++ * If the compositor decides to unlock the pointer the unlocked event is ++ * sent. See wp_locked_pointer.unlock for details. ++ * ++ * When unlocking, the compositor may warp the cursor position to the set ++ * cursor position hint. If it does, it will not result in any relative ++ * motion events emitted via wp_relative_pointer. ++ * ++ * If the surface the lock was requested on is destroyed and the lock is not ++ * yet activated, the wp_locked_pointer object is now defunct and must be ++ * destroyed. ++ * @section page_iface_zwp_locked_pointer_v1_api API ++ * See @ref iface_zwp_locked_pointer_v1. ++ */ ++/** ++ * @defgroup iface_zwp_locked_pointer_v1 The zwp_locked_pointer_v1 interface ++ * ++ * The wp_locked_pointer interface represents a locked pointer state. ++ * ++ * While the lock of this object is active, the wl_pointer objects of the ++ * associated seat will not emit any wl_pointer.motion events. ++ * ++ * This object will send the event 'locked' when the lock is activated. ++ * Whenever the lock is activated, it is guaranteed that the locked surface ++ * will already have received pointer focus and that the pointer will be ++ * within the region passed to the request creating this object. ++ * ++ * To unlock the pointer, send the destroy request. This will also destroy ++ * the wp_locked_pointer object. ++ * ++ * If the compositor decides to unlock the pointer the unlocked event is ++ * sent. See wp_locked_pointer.unlock for details. ++ * ++ * When unlocking, the compositor may warp the cursor position to the set ++ * cursor position hint. If it does, it will not result in any relative ++ * motion events emitted via wp_relative_pointer. ++ * ++ * If the surface the lock was requested on is destroyed and the lock is not ++ * yet activated, the wp_locked_pointer object is now defunct and must be ++ * destroyed. ++ */ ++extern const struct wl_interface zwp_locked_pointer_v1_interface; ++/** ++ * @page page_iface_zwp_confined_pointer_v1 zwp_confined_pointer_v1 ++ * @section page_iface_zwp_confined_pointer_v1_desc Description ++ * ++ * The wp_confined_pointer interface represents a confined pointer state. ++ * ++ * This object will send the event 'confined' when the confinement is ++ * activated. Whenever the confinement is activated, it is guaranteed that ++ * the surface the pointer is confined to will already have received pointer ++ * focus and that the pointer will be within the region passed to the request ++ * creating this object. It is up to the compositor to decide whether this ++ * requires some user interaction and if the pointer will warp to within the ++ * passed region if outside. ++ * ++ * To unconfine the pointer, send the destroy request. This will also destroy ++ * the wp_confined_pointer object. ++ * ++ * If the compositor decides to unconfine the pointer the unconfined event is ++ * sent. The wp_confined_pointer object is at this point defunct and should ++ * be destroyed. ++ * @section page_iface_zwp_confined_pointer_v1_api API ++ * See @ref iface_zwp_confined_pointer_v1. ++ */ ++/** ++ * @defgroup iface_zwp_confined_pointer_v1 The zwp_confined_pointer_v1 interface ++ * ++ * The wp_confined_pointer interface represents a confined pointer state. ++ * ++ * This object will send the event 'confined' when the confinement is ++ * activated. Whenever the confinement is activated, it is guaranteed that ++ * the surface the pointer is confined to will already have received pointer ++ * focus and that the pointer will be within the region passed to the request ++ * creating this object. It is up to the compositor to decide whether this ++ * requires some user interaction and if the pointer will warp to within the ++ * passed region if outside. ++ * ++ * To unconfine the pointer, send the destroy request. This will also destroy ++ * the wp_confined_pointer object. ++ * ++ * If the compositor decides to unconfine the pointer the unconfined event is ++ * sent. The wp_confined_pointer object is at this point defunct and should ++ * be destroyed. ++ */ ++extern const struct wl_interface zwp_confined_pointer_v1_interface; ++ ++#ifndef ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM ++# define ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM ++/** ++ * @ingroup iface_zwp_pointer_constraints_v1 ++ * wp_pointer_constraints error values ++ * ++ * These errors can be emitted in response to wp_pointer_constraints ++ * requests. ++ */ ++enum zwp_pointer_constraints_v1_error { ++ /** ++ * pointer constraint already requested on that surface ++ */ ++ ZWP_POINTER_CONSTRAINTS_V1_ERROR_ALREADY_CONSTRAINED = 1, ++}; ++#endif /* ZWP_POINTER_CONSTRAINTS_V1_ERROR_ENUM */ ++ ++#ifndef ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM ++# define ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM ++/** ++ * @ingroup iface_zwp_pointer_constraints_v1 ++ * the pointer constraint may reactivate ++ * ++ * A persistent pointer constraint may again reactivate once it has ++ * been deactivated. See the corresponding deactivation event ++ * (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for ++ * details. ++ */ ++enum zwp_pointer_constraints_v1_lifetime { ++ ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT = 1, ++ ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT = 2, ++}; ++#endif /* ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ENUM */ ++ ++#define ZWP_POINTER_CONSTRAINTS_V1_DESTROY 0 ++#define ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER 1 ++#define ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER 2 ++ ++/** ++ * @ingroup iface_zwp_pointer_constraints_v1 ++ */ ++#define ZWP_POINTER_CONSTRAINTS_V1_DESTROY_SINCE_VERSION 1 ++/** ++ * @ingroup iface_zwp_pointer_constraints_v1 ++ */ ++#define ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER_SINCE_VERSION 1 ++/** ++ * @ingroup iface_zwp_pointer_constraints_v1 ++ */ ++#define ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER_SINCE_VERSION 1 ++ ++/** @ingroup iface_zwp_pointer_constraints_v1 */ ++static inline void zwp_pointer_constraints_v1_set_user_data( ++ struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1, ++ void* user_data) { ++ wl_proxy_set_user_data((struct wl_proxy*)zwp_pointer_constraints_v1, ++ user_data); ++} ++ ++/** @ingroup iface_zwp_pointer_constraints_v1 */ ++static inline void* zwp_pointer_constraints_v1_get_user_data( ++ struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1) { ++ return wl_proxy_get_user_data((struct wl_proxy*)zwp_pointer_constraints_v1); ++} ++ ++static inline uint32_t zwp_pointer_constraints_v1_get_version( ++ struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1) { ++ return wl_proxy_get_version((struct wl_proxy*)zwp_pointer_constraints_v1); ++} ++ ++/** ++ * @ingroup iface_zwp_pointer_constraints_v1 ++ * ++ * Used by the client to notify the server that it will no longer use this ++ * pointer constraints object. ++ */ ++static inline void zwp_pointer_constraints_v1_destroy( ++ struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1) { ++ wl_proxy_marshal((struct wl_proxy*)zwp_pointer_constraints_v1, ++ ZWP_POINTER_CONSTRAINTS_V1_DESTROY); ++ ++ wl_proxy_destroy((struct wl_proxy*)zwp_pointer_constraints_v1); ++} ++ ++/** ++ * @ingroup iface_zwp_pointer_constraints_v1 ++ * ++ * The lock_pointer request lets the client request to disable movements of ++ * the virtual pointer (i.e. the cursor), effectively locking the pointer ++ * to a position. This request may not take effect immediately; in the ++ * future, when the compositor deems implementation-specific constraints ++ * are satisfied, the pointer lock will be activated and the compositor ++ * sends a locked event. ++ * ++ * The protocol provides no guarantee that the constraints are ever ++ * satisfied, and does not require the compositor to send an error if the ++ * constraints cannot ever be satisfied. It is thus possible to request a ++ * lock that will never activate. ++ * ++ * There may not be another pointer constraint of any kind requested or ++ * active on the surface for any of the wl_pointer objects of the seat of ++ * the passed pointer when requesting a lock. If there is, an error will be ++ * raised. See general pointer lock documentation for more details. ++ * ++ * The intersection of the region passed with this request and the input ++ * region of the surface is used to determine where the pointer must be ++ * in order for the lock to activate. It is up to the compositor whether to ++ * warp the pointer or require some kind of user interaction for the lock ++ * to activate. If the region is null the surface input region is used. ++ * ++ * A surface may receive pointer focus without the lock being activated. ++ * ++ * The request creates a new object wp_locked_pointer which is used to ++ * interact with the lock as well as receive updates about its state. See ++ * the the description of wp_locked_pointer for further information. ++ * ++ * Note that while a pointer is locked, the wl_pointer objects of the ++ * corresponding seat will not emit any wl_pointer.motion events, but ++ * relative motion events will still be emitted via wp_relative_pointer ++ * objects of the same seat. wl_pointer.axis and wl_pointer.button events ++ * are unaffected. ++ */ ++static inline struct zwp_locked_pointer_v1* ++zwp_pointer_constraints_v1_lock_pointer( ++ struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1, ++ struct wl_surface* surface, struct wl_pointer* pointer, ++ struct wl_region* region, uint32_t lifetime) { ++ struct wl_proxy* id; ++ ++ id = wl_proxy_marshal_constructor( ++ (struct wl_proxy*)zwp_pointer_constraints_v1, ++ ZWP_POINTER_CONSTRAINTS_V1_LOCK_POINTER, &zwp_locked_pointer_v1_interface, ++ NULL, surface, pointer, region, lifetime); ++ ++ return (struct zwp_locked_pointer_v1*)id; ++} ++ ++/** ++ * @ingroup iface_zwp_pointer_constraints_v1 ++ * ++ * The confine_pointer request lets the client request to confine the ++ * pointer cursor to a given region. This request may not take effect ++ * immediately; in the future, when the compositor deems implementation- ++ * specific constraints are satisfied, the pointer confinement will be ++ * activated and the compositor sends a confined event. ++ * ++ * The intersection of the region passed with this request and the input ++ * region of the surface is used to determine where the pointer must be ++ * in order for the confinement to activate. It is up to the compositor ++ * whether to warp the pointer or require some kind of user interaction for ++ * the confinement to activate. If the region is null the surface input ++ * region is used. ++ * ++ * The request will create a new object wp_confined_pointer which is used ++ * to interact with the confinement as well as receive updates about its ++ * state. See the the description of wp_confined_pointer for further ++ * information. ++ */ ++static inline struct zwp_confined_pointer_v1* ++zwp_pointer_constraints_v1_confine_pointer( ++ struct zwp_pointer_constraints_v1* zwp_pointer_constraints_v1, ++ struct wl_surface* surface, struct wl_pointer* pointer, ++ struct wl_region* region, uint32_t lifetime) { ++ struct wl_proxy* id; ++ ++ id = ++ wl_proxy_marshal_constructor((struct wl_proxy*)zwp_pointer_constraints_v1, ++ ZWP_POINTER_CONSTRAINTS_V1_CONFINE_POINTER, ++ &zwp_confined_pointer_v1_interface, NULL, ++ surface, pointer, region, lifetime); ++ ++ return (struct zwp_confined_pointer_v1*)id; ++} ++ ++/** ++ * @ingroup iface_zwp_locked_pointer_v1 ++ * @struct zwp_locked_pointer_v1_listener ++ */ ++struct zwp_locked_pointer_v1_listener { ++ /** ++ * lock activation event ++ * ++ * Notification that the pointer lock of the seat's pointer is ++ * activated. ++ */ ++ void (*locked)(void* data, ++ struct zwp_locked_pointer_v1* zwp_locked_pointer_v1); ++ /** ++ * lock deactivation event ++ * ++ * Notification that the pointer lock of the seat's pointer is no ++ * longer active. If this is a oneshot pointer lock (see ++ * wp_pointer_constraints.lifetime) this object is now defunct and ++ * should be destroyed. If this is a persistent pointer lock (see ++ * wp_pointer_constraints.lifetime) this pointer lock may again ++ * reactivate in the future. ++ */ ++ void (*unlocked)(void* data, ++ struct zwp_locked_pointer_v1* zwp_locked_pointer_v1); ++}; ++ ++/** ++ * @ingroup iface_zwp_locked_pointer_v1 ++ */ ++static inline int zwp_locked_pointer_v1_add_listener( ++ struct zwp_locked_pointer_v1* zwp_locked_pointer_v1, ++ const struct zwp_locked_pointer_v1_listener* listener, void* data) { ++ return wl_proxy_add_listener((struct wl_proxy*)zwp_locked_pointer_v1, ++ (void (**)(void))listener, data); ++} ++ ++#define ZWP_LOCKED_POINTER_V1_DESTROY 0 ++#define ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT 1 ++#define ZWP_LOCKED_POINTER_V1_SET_REGION 2 ++ ++/** ++ * @ingroup iface_zwp_locked_pointer_v1 ++ */ ++#define ZWP_LOCKED_POINTER_V1_LOCKED_SINCE_VERSION 1 ++/** ++ * @ingroup iface_zwp_locked_pointer_v1 ++ */ ++#define ZWP_LOCKED_POINTER_V1_UNLOCKED_SINCE_VERSION 1 ++ ++/** ++ * @ingroup iface_zwp_locked_pointer_v1 ++ */ ++#define ZWP_LOCKED_POINTER_V1_DESTROY_SINCE_VERSION 1 ++/** ++ * @ingroup iface_zwp_locked_pointer_v1 ++ */ ++#define ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT_SINCE_VERSION 1 ++/** ++ * @ingroup iface_zwp_locked_pointer_v1 ++ */ ++#define ZWP_LOCKED_POINTER_V1_SET_REGION_SINCE_VERSION 1 ++ ++/** @ingroup iface_zwp_locked_pointer_v1 */ ++static inline void zwp_locked_pointer_v1_set_user_data( ++ struct zwp_locked_pointer_v1* zwp_locked_pointer_v1, void* user_data) { ++ wl_proxy_set_user_data((struct wl_proxy*)zwp_locked_pointer_v1, user_data); ++} ++ ++/** @ingroup iface_zwp_locked_pointer_v1 */ ++static inline void* zwp_locked_pointer_v1_get_user_data( ++ struct zwp_locked_pointer_v1* zwp_locked_pointer_v1) { ++ return wl_proxy_get_user_data((struct wl_proxy*)zwp_locked_pointer_v1); ++} ++ ++static inline uint32_t zwp_locked_pointer_v1_get_version( ++ struct zwp_locked_pointer_v1* zwp_locked_pointer_v1) { ++ return wl_proxy_get_version((struct wl_proxy*)zwp_locked_pointer_v1); ++} ++ ++/** ++ * @ingroup iface_zwp_locked_pointer_v1 ++ * ++ * Destroy the locked pointer object. If applicable, the compositor will ++ * unlock the pointer. ++ */ ++static inline void zwp_locked_pointer_v1_destroy( ++ struct zwp_locked_pointer_v1* zwp_locked_pointer_v1) { ++ wl_proxy_marshal((struct wl_proxy*)zwp_locked_pointer_v1, ++ ZWP_LOCKED_POINTER_V1_DESTROY); ++ ++ wl_proxy_destroy((struct wl_proxy*)zwp_locked_pointer_v1); ++} ++ ++/** ++ * @ingroup iface_zwp_locked_pointer_v1 ++ * ++ * Set the cursor position hint relative to the top left corner of the ++ * surface. ++ * ++ * If the client is drawing its own cursor, it should update the position ++ * hint to the position of its own cursor. A compositor may use this ++ * information to warp the pointer upon unlock in order to avoid pointer ++ * jumps. ++ * ++ * The cursor position hint is double buffered. The new hint will only take ++ * effect when the associated surface gets it pending state applied. See ++ * wl_surface.commit for details. ++ */ ++static inline void zwp_locked_pointer_v1_set_cursor_position_hint( ++ struct zwp_locked_pointer_v1* zwp_locked_pointer_v1, wl_fixed_t surface_x, ++ wl_fixed_t surface_y) { ++ wl_proxy_marshal((struct wl_proxy*)zwp_locked_pointer_v1, ++ ZWP_LOCKED_POINTER_V1_SET_CURSOR_POSITION_HINT, surface_x, ++ surface_y); ++} ++ ++/** ++ * @ingroup iface_zwp_locked_pointer_v1 ++ * ++ * Set a new region used to lock the pointer. ++ * ++ * The new lock region is double-buffered. The new lock region will ++ * only take effect when the associated surface gets its pending state ++ * applied. See wl_surface.commit for details. ++ * ++ * For details about the lock region, see wp_locked_pointer. ++ */ ++static inline void zwp_locked_pointer_v1_set_region( ++ struct zwp_locked_pointer_v1* zwp_locked_pointer_v1, ++ struct wl_region* region) { ++ wl_proxy_marshal((struct wl_proxy*)zwp_locked_pointer_v1, ++ ZWP_LOCKED_POINTER_V1_SET_REGION, region); ++} ++ ++/** ++ * @ingroup iface_zwp_confined_pointer_v1 ++ * @struct zwp_confined_pointer_v1_listener ++ */ ++struct zwp_confined_pointer_v1_listener { ++ /** ++ * pointer confined ++ * ++ * Notification that the pointer confinement of the seat's ++ * pointer is activated. ++ */ ++ void (*confined)(void* data, ++ struct zwp_confined_pointer_v1* zwp_confined_pointer_v1); ++ /** ++ * pointer unconfined ++ * ++ * Notification that the pointer confinement of the seat's ++ * pointer is no longer active. If this is a oneshot pointer ++ * confinement (see wp_pointer_constraints.lifetime) this object is ++ * now defunct and should be destroyed. If this is a persistent ++ * pointer confinement (see wp_pointer_constraints.lifetime) this ++ * pointer confinement may again reactivate in the future. ++ */ ++ void (*unconfined)(void* data, ++ struct zwp_confined_pointer_v1* zwp_confined_pointer_v1); ++}; ++ ++/** ++ * @ingroup iface_zwp_confined_pointer_v1 ++ */ ++static inline int zwp_confined_pointer_v1_add_listener( ++ struct zwp_confined_pointer_v1* zwp_confined_pointer_v1, ++ const struct zwp_confined_pointer_v1_listener* listener, void* data) { ++ return wl_proxy_add_listener((struct wl_proxy*)zwp_confined_pointer_v1, ++ (void (**)(void))listener, data); ++} ++ ++#define ZWP_CONFINED_POINTER_V1_DESTROY 0 ++#define ZWP_CONFINED_POINTER_V1_SET_REGION 1 ++ ++/** ++ * @ingroup iface_zwp_confined_pointer_v1 ++ */ ++#define ZWP_CONFINED_POINTER_V1_CONFINED_SINCE_VERSION 1 ++/** ++ * @ingroup iface_zwp_confined_pointer_v1 ++ */ ++#define ZWP_CONFINED_POINTER_V1_UNCONFINED_SINCE_VERSION 1 ++ ++/** ++ * @ingroup iface_zwp_confined_pointer_v1 ++ */ ++#define ZWP_CONFINED_POINTER_V1_DESTROY_SINCE_VERSION 1 ++/** ++ * @ingroup iface_zwp_confined_pointer_v1 ++ */ ++#define ZWP_CONFINED_POINTER_V1_SET_REGION_SINCE_VERSION 1 ++ ++/** @ingroup iface_zwp_confined_pointer_v1 */ ++static inline void zwp_confined_pointer_v1_set_user_data( ++ struct zwp_confined_pointer_v1* zwp_confined_pointer_v1, void* user_data) { ++ wl_proxy_set_user_data((struct wl_proxy*)zwp_confined_pointer_v1, user_data); ++} ++ ++/** @ingroup iface_zwp_confined_pointer_v1 */ ++static inline void* zwp_confined_pointer_v1_get_user_data( ++ struct zwp_confined_pointer_v1* zwp_confined_pointer_v1) { ++ return wl_proxy_get_user_data((struct wl_proxy*)zwp_confined_pointer_v1); ++} ++ ++static inline uint32_t zwp_confined_pointer_v1_get_version( ++ struct zwp_confined_pointer_v1* zwp_confined_pointer_v1) { ++ return wl_proxy_get_version((struct wl_proxy*)zwp_confined_pointer_v1); ++} ++ ++/** ++ * @ingroup iface_zwp_confined_pointer_v1 ++ * ++ * Destroy the confined pointer object. If applicable, the compositor will ++ * unconfine the pointer. ++ */ ++static inline void zwp_confined_pointer_v1_destroy( ++ struct zwp_confined_pointer_v1* zwp_confined_pointer_v1) { ++ wl_proxy_marshal((struct wl_proxy*)zwp_confined_pointer_v1, ++ ZWP_CONFINED_POINTER_V1_DESTROY); ++ ++ wl_proxy_destroy((struct wl_proxy*)zwp_confined_pointer_v1); ++} ++ ++/** ++ * @ingroup iface_zwp_confined_pointer_v1 ++ * ++ * Set a new region used to confine the pointer. ++ * ++ * The new confine region is double-buffered. The new confine region will ++ * only take effect when the associated surface gets its pending state ++ * applied. See wl_surface.commit for details. ++ * ++ * If the confinement is active when the new confinement region is applied ++ * and the pointer ends up outside of newly applied region, the pointer may ++ * warped to a position within the new confinement region. If warped, a ++ * wl_pointer.motion event will be emitted, but no ++ * wp_relative_pointer.relative_motion event. ++ * ++ * The compositor may also, instead of using the new region, unconfine the ++ * pointer. ++ * ++ * For details about the confine region, see wp_confined_pointer. ++ */ ++static inline void zwp_confined_pointer_v1_set_region( ++ struct zwp_confined_pointer_v1* zwp_confined_pointer_v1, ++ struct wl_region* region) { ++ wl_proxy_marshal((struct wl_proxy*)zwp_confined_pointer_v1, ++ ZWP_CONFINED_POINTER_V1_SET_REGION, region); ++} ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif +diff --git a/widget/gtk/wayland/pointer-constraints-unstable-v1-protocol.c b/widget/gtk/wayland/pointer-constraints-unstable-v1-protocol.c +new file mode 100644 +index 0000000000..c28ddf6918 +--- /dev/null ++++ b/widget/gtk/wayland/pointer-constraints-unstable-v1-protocol.c +@@ -0,0 +1,97 @@ ++/* Generated by wayland-scanner 1.18.0 */ ++ ++/* ++ * Copyright © 2014 Jonas Ådahl ++ * Copyright © 2015 Red Hat Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the next ++ * paragraph) shall be included in all copies or substantial portions of the ++ * Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ */ ++ ++#include <stdlib.h> ++#include <stdint.h> ++#include "wayland-util.h" ++ ++#pragma GCC visibility push(default) ++extern const struct wl_interface wl_pointer_interface; ++extern const struct wl_interface wl_region_interface; ++extern const struct wl_interface wl_surface_interface; ++extern const struct wl_interface zwp_confined_pointer_v1_interface; ++extern const struct wl_interface zwp_locked_pointer_v1_interface; ++#pragma GCC visibility pop ++ ++static const struct wl_interface* pointer_constraints_unstable_v1_types[] = { ++ NULL, ++ NULL, ++ &zwp_locked_pointer_v1_interface, ++ &wl_surface_interface, ++ &wl_pointer_interface, ++ &wl_region_interface, ++ NULL, ++ &zwp_confined_pointer_v1_interface, ++ &wl_surface_interface, ++ &wl_pointer_interface, ++ &wl_region_interface, ++ NULL, ++ &wl_region_interface, ++ &wl_region_interface, ++}; ++ ++static const struct wl_message zwp_pointer_constraints_v1_requests[] = { ++ {"destroy", "", pointer_constraints_unstable_v1_types + 0}, ++ {"lock_pointer", "noo?ou", pointer_constraints_unstable_v1_types + 2}, ++ {"confine_pointer", "noo?ou", pointer_constraints_unstable_v1_types + 7}, ++}; ++ ++WL_EXPORT const struct wl_interface zwp_pointer_constraints_v1_interface = { ++ "zwp_pointer_constraints_v1", 1, 3, ++ zwp_pointer_constraints_v1_requests, 0, NULL, ++}; ++ ++static const struct wl_message zwp_locked_pointer_v1_requests[] = { ++ {"destroy", "", pointer_constraints_unstable_v1_types + 0}, ++ {"set_cursor_position_hint", "ff", ++ pointer_constraints_unstable_v1_types + 0}, ++ {"set_region", "?o", pointer_constraints_unstable_v1_types + 12}, ++}; ++ ++static const struct wl_message zwp_locked_pointer_v1_events[] = { ++ {"locked", "", pointer_constraints_unstable_v1_types + 0}, ++ {"unlocked", "", pointer_constraints_unstable_v1_types + 0}, ++}; ++ ++WL_EXPORT const struct wl_interface zwp_locked_pointer_v1_interface = { ++ "zwp_locked_pointer_v1", 1, 3, ++ zwp_locked_pointer_v1_requests, 2, zwp_locked_pointer_v1_events, ++}; ++ ++static const struct wl_message zwp_confined_pointer_v1_requests[] = { ++ {"destroy", "", pointer_constraints_unstable_v1_types + 0}, ++ {"set_region", "?o", pointer_constraints_unstable_v1_types + 13}, ++}; ++ ++static const struct wl_message zwp_confined_pointer_v1_events[] = { ++ {"confined", "", pointer_constraints_unstable_v1_types + 0}, ++ {"unconfined", "", pointer_constraints_unstable_v1_types + 0}, ++}; ++ ++WL_EXPORT const struct wl_interface zwp_confined_pointer_v1_interface = { ++ "zwp_confined_pointer_v1", 1, 2, ++ zwp_confined_pointer_v1_requests, 2, zwp_confined_pointer_v1_events, ++}; +diff --git a/widget/gtk/wayland/relative-pointer-unstable-v1-client-protocol.h b/widget/gtk/wayland/relative-pointer-unstable-v1-client-protocol.h +new file mode 100644 +index 0000000000..dbae8081f4 +--- /dev/null ++++ b/widget/gtk/wayland/relative-pointer-unstable-v1-client-protocol.h +@@ -0,0 +1,293 @@ ++/* Generated by wayland-scanner 1.18.0 */ ++ ++#ifndef RELATIVE_POINTER_UNSTABLE_V1_CLIENT_PROTOCOL_H ++#define RELATIVE_POINTER_UNSTABLE_V1_CLIENT_PROTOCOL_H ++ ++#include <stdint.h> ++#include <stddef.h> ++#include "wayland-client.h" ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++/** ++ * @page page_relative_pointer_unstable_v1 The relative_pointer_unstable_v1 ++ * protocol protocol for relative pointer motion events ++ * ++ * @section page_desc_relative_pointer_unstable_v1 Description ++ * ++ * This protocol specifies a set of interfaces used for making clients able to ++ * receive relative pointer events not obstructed by barriers (such as the ++ * monitor edge or other pointer barriers). ++ * ++ * To start receiving relative pointer events, a client must first bind the ++ * global interface "wp_relative_pointer_manager" which, if a compositor ++ * supports relative pointer motion events, is exposed by the registry. After ++ * having created the relative pointer manager proxy object, the client uses ++ * it to create the actual relative pointer object using the ++ * "get_relative_pointer" request given a wl_pointer. The relative pointer ++ * motion events will then, when applicable, be transmitted via the proxy of ++ * the newly created relative pointer object. See the documentation of the ++ * relative pointer interface for more details. ++ * ++ * Warning! The protocol described in this file is experimental and backward ++ * incompatible changes may be made. Backward compatible changes may be added ++ * together with the corresponding interface version bump. Backward ++ * incompatible changes are done by bumping the version number in the protocol ++ * and interface names and resetting the interface version. Once the protocol ++ * is to be declared stable, the 'z' prefix and the version number in the ++ * protocol and interface names are removed and the interface version number is ++ * reset. ++ * ++ * @section page_ifaces_relative_pointer_unstable_v1 Interfaces ++ * - @subpage page_iface_zwp_relative_pointer_manager_v1 - get relative pointer ++ * objects ++ * - @subpage page_iface_zwp_relative_pointer_v1 - relative pointer object ++ * @section page_copyright_relative_pointer_unstable_v1 Copyright ++ * <pre> ++ * ++ * Copyright © 2014 Jonas Ådahl ++ * Copyright © 2015 Red Hat Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the next ++ * paragraph) shall be included in all copies or substantial portions of the ++ * Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ * </pre> ++ */ ++struct wl_pointer; ++struct zwp_relative_pointer_manager_v1; ++struct zwp_relative_pointer_v1; ++ ++/** ++ * @page page_iface_zwp_relative_pointer_manager_v1 ++ * zwp_relative_pointer_manager_v1 ++ * @section page_iface_zwp_relative_pointer_manager_v1_desc Description ++ * ++ * A global interface used for getting the relative pointer object for a ++ * given pointer. ++ * @section page_iface_zwp_relative_pointer_manager_v1_api API ++ * See @ref iface_zwp_relative_pointer_manager_v1. ++ */ ++/** ++ * @defgroup iface_zwp_relative_pointer_manager_v1 The ++ * zwp_relative_pointer_manager_v1 interface ++ * ++ * A global interface used for getting the relative pointer object for a ++ * given pointer. ++ */ ++extern const struct wl_interface zwp_relative_pointer_manager_v1_interface; ++/** ++ * @page page_iface_zwp_relative_pointer_v1 zwp_relative_pointer_v1 ++ * @section page_iface_zwp_relative_pointer_v1_desc Description ++ * ++ * A wp_relative_pointer object is an extension to the wl_pointer interface ++ * used for emitting relative pointer events. It shares the same focus as ++ * wl_pointer objects of the same seat and will only emit events when it has ++ * focus. ++ * @section page_iface_zwp_relative_pointer_v1_api API ++ * See @ref iface_zwp_relative_pointer_v1. ++ */ ++/** ++ * @defgroup iface_zwp_relative_pointer_v1 The zwp_relative_pointer_v1 interface ++ * ++ * A wp_relative_pointer object is an extension to the wl_pointer interface ++ * used for emitting relative pointer events. It shares the same focus as ++ * wl_pointer objects of the same seat and will only emit events when it has ++ * focus. ++ */ ++extern const struct wl_interface zwp_relative_pointer_v1_interface; ++ ++#define ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY 0 ++#define ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER 1 ++ ++/** ++ * @ingroup iface_zwp_relative_pointer_manager_v1 ++ */ ++#define ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY_SINCE_VERSION 1 ++/** ++ * @ingroup iface_zwp_relative_pointer_manager_v1 ++ */ ++#define ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER_SINCE_VERSION 1 ++ ++/** @ingroup iface_zwp_relative_pointer_manager_v1 */ ++static inline void zwp_relative_pointer_manager_v1_set_user_data( ++ struct zwp_relative_pointer_manager_v1* zwp_relative_pointer_manager_v1, ++ void* user_data) { ++ wl_proxy_set_user_data((struct wl_proxy*)zwp_relative_pointer_manager_v1, ++ user_data); ++} ++ ++/** @ingroup iface_zwp_relative_pointer_manager_v1 */ ++static inline void* zwp_relative_pointer_manager_v1_get_user_data( ++ struct zwp_relative_pointer_manager_v1* zwp_relative_pointer_manager_v1) { ++ return wl_proxy_get_user_data( ++ (struct wl_proxy*)zwp_relative_pointer_manager_v1); ++} ++ ++static inline uint32_t zwp_relative_pointer_manager_v1_get_version( ++ struct zwp_relative_pointer_manager_v1* zwp_relative_pointer_manager_v1) { ++ return wl_proxy_get_version( ++ (struct wl_proxy*)zwp_relative_pointer_manager_v1); ++} ++ ++/** ++ * @ingroup iface_zwp_relative_pointer_manager_v1 ++ * ++ * Used by the client to notify the server that it will no longer use this ++ * relative pointer manager object. ++ */ ++static inline void zwp_relative_pointer_manager_v1_destroy( ++ struct zwp_relative_pointer_manager_v1* zwp_relative_pointer_manager_v1) { ++ wl_proxy_marshal((struct wl_proxy*)zwp_relative_pointer_manager_v1, ++ ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY); ++ ++ wl_proxy_destroy((struct wl_proxy*)zwp_relative_pointer_manager_v1); ++} ++ ++/** ++ * @ingroup iface_zwp_relative_pointer_manager_v1 ++ * ++ * Create a relative pointer interface given a wl_pointer object. See the ++ * wp_relative_pointer interface for more details. ++ */ ++static inline struct zwp_relative_pointer_v1* ++zwp_relative_pointer_manager_v1_get_relative_pointer( ++ struct zwp_relative_pointer_manager_v1* zwp_relative_pointer_manager_v1, ++ struct wl_pointer* pointer) { ++ struct wl_proxy* id; ++ ++ id = wl_proxy_marshal_constructor( ++ (struct wl_proxy*)zwp_relative_pointer_manager_v1, ++ ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER, ++ &zwp_relative_pointer_v1_interface, NULL, pointer); ++ ++ return (struct zwp_relative_pointer_v1*)id; ++} ++ ++/** ++ * @ingroup iface_zwp_relative_pointer_v1 ++ * @struct zwp_relative_pointer_v1_listener ++ */ ++struct zwp_relative_pointer_v1_listener { ++ /** ++ * relative pointer motion ++ * ++ * Relative x/y pointer motion from the pointer of the seat ++ * associated with this object. ++ * ++ * A relative motion is in the same dimension as regular wl_pointer ++ * motion events, except they do not represent an absolute ++ * position. For example, moving a pointer from (x, y) to (x', y') ++ * would have the equivalent relative motion (x' - x, y' - y). If a ++ * pointer motion caused the absolute pointer position to be ++ * clipped by for example the edge of the monitor, the relative ++ * motion is unaffected by the clipping and will represent the ++ * unclipped motion. ++ * ++ * This event also contains non-accelerated motion deltas. The ++ * non-accelerated delta is, when applicable, the regular pointer ++ * motion delta as it was before having applied motion acceleration ++ * and other transformations such as normalization. ++ * ++ * Note that the non-accelerated delta does not represent 'raw' ++ * events as they were read from some device. Pointer motion ++ * acceleration is device- and configuration-specific and ++ * non-accelerated deltas and accelerated deltas may have the same ++ * value on some devices. ++ * ++ * Relative motions are not coupled to wl_pointer.motion events, ++ * and can be sent in combination with such events, but also ++ * independently. There may also be scenarios where ++ * wl_pointer.motion is sent, but there is no relative motion. The ++ * order of an absolute and relative motion event originating from ++ * the same physical motion is not guaranteed. ++ * ++ * If the client needs button events or focus state, it can receive ++ * them from a wl_pointer object of the same seat that the ++ * wp_relative_pointer object is associated with. ++ * @param utime_hi high 32 bits of a 64 bit timestamp with microsecond ++ * granularity ++ * @param utime_lo low 32 bits of a 64 bit timestamp with microsecond ++ * granularity ++ * @param dx the x component of the motion vector ++ * @param dy the y component of the motion vector ++ * @param dx_unaccel the x component of the unaccelerated motion vector ++ * @param dy_unaccel the y component of the unaccelerated motion vector ++ */ ++ void (*relative_motion)( ++ void* data, struct zwp_relative_pointer_v1* zwp_relative_pointer_v1, ++ uint32_t utime_hi, uint32_t utime_lo, wl_fixed_t dx, wl_fixed_t dy, ++ wl_fixed_t dx_unaccel, wl_fixed_t dy_unaccel); ++}; ++ ++/** ++ * @ingroup iface_zwp_relative_pointer_v1 ++ */ ++static inline int zwp_relative_pointer_v1_add_listener( ++ struct zwp_relative_pointer_v1* zwp_relative_pointer_v1, ++ const struct zwp_relative_pointer_v1_listener* listener, void* data) { ++ return wl_proxy_add_listener((struct wl_proxy*)zwp_relative_pointer_v1, ++ (void (**)(void))listener, data); ++} ++ ++#define ZWP_RELATIVE_POINTER_V1_DESTROY 0 ++ ++/** ++ * @ingroup iface_zwp_relative_pointer_v1 ++ */ ++#define ZWP_RELATIVE_POINTER_V1_RELATIVE_MOTION_SINCE_VERSION 1 ++ ++/** ++ * @ingroup iface_zwp_relative_pointer_v1 ++ */ ++#define ZWP_RELATIVE_POINTER_V1_DESTROY_SINCE_VERSION 1 ++ ++/** @ingroup iface_zwp_relative_pointer_v1 */ ++static inline void zwp_relative_pointer_v1_set_user_data( ++ struct zwp_relative_pointer_v1* zwp_relative_pointer_v1, void* user_data) { ++ wl_proxy_set_user_data((struct wl_proxy*)zwp_relative_pointer_v1, user_data); ++} ++ ++/** @ingroup iface_zwp_relative_pointer_v1 */ ++static inline void* zwp_relative_pointer_v1_get_user_data( ++ struct zwp_relative_pointer_v1* zwp_relative_pointer_v1) { ++ return wl_proxy_get_user_data((struct wl_proxy*)zwp_relative_pointer_v1); ++} ++ ++static inline uint32_t zwp_relative_pointer_v1_get_version( ++ struct zwp_relative_pointer_v1* zwp_relative_pointer_v1) { ++ return wl_proxy_get_version((struct wl_proxy*)zwp_relative_pointer_v1); ++} ++ ++/** ++ * @ingroup iface_zwp_relative_pointer_v1 ++ */ ++static inline void zwp_relative_pointer_v1_destroy( ++ struct zwp_relative_pointer_v1* zwp_relative_pointer_v1) { ++ wl_proxy_marshal((struct wl_proxy*)zwp_relative_pointer_v1, ++ ZWP_RELATIVE_POINTER_V1_DESTROY); ++ ++ wl_proxy_destroy((struct wl_proxy*)zwp_relative_pointer_v1); ++} ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif +diff --git a/widget/gtk/wayland/relative-pointer-unstable-v1-protocol.c b/widget/gtk/wayland/relative-pointer-unstable-v1-protocol.c +new file mode 100644 +index 0000000000..3534686a3d +--- /dev/null ++++ b/widget/gtk/wayland/relative-pointer-unstable-v1-protocol.c +@@ -0,0 +1,69 @@ ++/* Generated by wayland-scanner 1.18.0 */ ++ ++/* ++ * Copyright © 2014 Jonas Ådahl ++ * Copyright © 2015 Red Hat Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the next ++ * paragraph) shall be included in all copies or substantial portions of the ++ * Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ */ ++ ++#include <stdlib.h> ++#include <stdint.h> ++#include "wayland-util.h" ++ ++#pragma GCC visibility push(default) ++extern const struct wl_interface wl_pointer_interface; ++extern const struct wl_interface zwp_relative_pointer_v1_interface; ++#pragma GCC visibility pop ++ ++static const struct wl_interface* relative_pointer_unstable_v1_types[] = { ++ NULL, ++ NULL, ++ NULL, ++ NULL, ++ NULL, ++ NULL, ++ &zwp_relative_pointer_v1_interface, ++ &wl_pointer_interface, ++}; ++ ++static const struct wl_message zwp_relative_pointer_manager_v1_requests[] = { ++ {"destroy", "", relative_pointer_unstable_v1_types + 0}, ++ {"get_relative_pointer", "no", relative_pointer_unstable_v1_types + 6}, ++}; ++ ++WL_EXPORT const struct wl_interface zwp_relative_pointer_manager_v1_interface = ++ { ++ "zwp_relative_pointer_manager_v1", 1, 2, ++ zwp_relative_pointer_manager_v1_requests, 0, NULL, ++}; ++ ++static const struct wl_message zwp_relative_pointer_v1_requests[] = { ++ {"destroy", "", relative_pointer_unstable_v1_types + 0}, ++}; ++ ++static const struct wl_message zwp_relative_pointer_v1_events[] = { ++ {"relative_motion", "uuffff", relative_pointer_unstable_v1_types + 0}, ++}; ++ ++WL_EXPORT const struct wl_interface zwp_relative_pointer_v1_interface = { ++ "zwp_relative_pointer_v1", 1, 1, ++ zwp_relative_pointer_v1_requests, 1, zwp_relative_pointer_v1_events, ++}; +diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h +index efe3b625bd..c261e17b56 100644 +--- a/widget/nsIWidget.h ++++ b/widget/nsIWidget.h +@@ -1834,6 +1834,16 @@ class nsIWidget : public nsISupports { + + #endif + ++ /** ++ * If this widget uses native pointer lock instead of warp-to-center ++ * (currently only GTK on Wayland), these methods provide access to that ++ * functionality. ++ */ ++ virtual void SetNativePointerLockCenter( ++ const LayoutDeviceIntPoint& aLockCenter) {} ++ virtual void LockNativePointer() {} ++ virtual void UnlockNativePointer() {} ++ + /* + * Get safe area insets except to cutout. + * See https://drafts.csswg.org/css-env-1/#safe-area-insets. +-- +2.31.1 + diff --git a/http/firefox/patches/0035-bmo-1705048-Wayland-Emulate-X11-popup-parentless-win.patch b/http/firefox/patches/0035-bmo-1705048-Wayland-Emulate-X11-popup-parentless-win.patch new file mode 100644 index 0000000000..dc65d28640 --- /dev/null +++ b/http/firefox/patches/0035-bmo-1705048-Wayland-Emulate-X11-popup-parentless-win.patch @@ -0,0 +1,87 @@ +From 36211b3182555b85b147419f51b3435329f2abc5 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Wed, 5 May 2021 15:13:55 +0200 +Subject: [PATCH 35/37] bmo#1705048: Wayland: Emulate X11 popup parentless + window as a toplevel on Wayland + +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + widget/gtk/nsWindow.cpp | 18 +++++++++++++----- + widget/gtk/nsWindow.h | 4 ++++ + 2 files changed, 17 insertions(+), 5 deletions(-) + +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +index 8d06f91f89..501a2ff15a 100644 +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -553,6 +553,7 @@ nsWindow::nsWindow() { + mTitlebarBackdropState = false; + + mHasAlphaVisual = false; ++ mIsWaylandPanelWindow = false; + mIsPIPWindow = false; + mAlwaysOnTop = false; + +@@ -3713,7 +3714,7 @@ void nsWindow::OnButtonPressEvent(GdkEventButton* aEvent) { + + LayoutDeviceIntPoint refPoint = + GdkEventCoordsToDevicePixels(aEvent->x, aEvent->y); +- if (mDraggableRegion.Contains(refPoint.x, refPoint.y) && ++ if ((mIsWaylandPanelWindow || mDraggableRegion.Contains(refPoint.x, refPoint.y)) && + domButton == MouseButton::ePrimary && + eventStatus.mContentStatus != nsEventStatus_eConsumeNoDefault) { + mWindowShouldStartDragging = true; +@@ -4625,8 +4626,9 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, + // as a workaround. + mWindowType = eWindowType_toplevel; + } else if (mWindowType == eWindowType_popup && !aNativeParent && !aParent) { +- // Workaround for Wayland where the popup windows always need to have +- // parent window. For example webrtc ui is a popup window without parent. ++ // mIsWaylandPanelWindow is a special toplevel window on Wayland which ++ // emulates X11 popup window without parent. ++ mIsWaylandPanelWindow = true; + mWindowType = eWindowType_toplevel; + } + } +@@ -4653,8 +4655,10 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, + // popup window position. + GtkWindowType type = GTK_WINDOW_TOPLEVEL; + if (mWindowType == eWindowType_popup) { +- type = (mIsX11Display && aInitData->mNoAutoHide) ? GTK_WINDOW_TOPLEVEL +- : GTK_WINDOW_POPUP; ++ type = GTK_WINDOW_POPUP; ++ if (GdkIsX11Display() && aInitData->mNoAutoHide) { ++ type = GTK_WINDOW_TOPLEVEL; ++ } + } + mShell = gtk_window_new(type); + +@@ -4901,6 +4905,10 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, + } + #endif + ++ if (mIsWaylandPanelWindow) { ++ gtk_window_set_decorated(GTK_WINDOW(mShell), false); ++ } ++ + if (mWindowType == eWindowType_popup) { + // gdk does not automatically set the cursor for "temporary" + // windows, which are what gtk uses for popups. +diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h +index aa340f4ee0..79200b3ce1 100644 +--- a/widget/gtk/nsWindow.h ++++ b/widget/gtk/nsWindow.h +@@ -590,6 +590,10 @@ class nsWindow final : public nsBaseWidget { + LayoutDeviceIntRegion mDraggableRegion; + // It's PictureInPicture window. + bool mIsPIPWindow; ++ // It's undecorated popup utility window, without resizers/titlebar, ++ // movable by mouse. Used on Wayland as a workaround for popups without ++ // parent (for instance WebRTC sharing indicator). ++ bool mIsWaylandPanelWindow; + bool mAlwaysOnTop; + + #ifdef ACCESSIBILITY +-- +2.31.1 + diff --git a/http/firefox/patches/0036-bmo-1711816-Fix-stdc-compat.cpp-compilation-errors-w.patch b/http/firefox/patches/0036-bmo-1711816-Fix-stdc-compat.cpp-compilation-errors-w.patch new file mode 100644 index 0000000000..42f0217baf --- /dev/null +++ b/http/firefox/patches/0036-bmo-1711816-Fix-stdc-compat.cpp-compilation-errors-w.patch @@ -0,0 +1,41 @@ +From fef46785dd742c856c792af3b96fa07b5a21f712 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Fri, 28 May 2021 23:03:28 +0200 +Subject: [PATCH 36/37] bmo#1711816: Fix stdc++compat.cpp compilation errors + with recent GCC + +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + build/unix/stdc++compat/stdc++compat.cpp | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/build/unix/stdc++compat/stdc++compat.cpp b/build/unix/stdc++compat/stdc++compat.cpp +index dd1ebcecbf..8c4eed5997 100644 +--- a/build/unix/stdc++compat/stdc++compat.cpp ++++ b/build/unix/stdc++compat/stdc++compat.cpp +@@ -4,6 +4,7 @@ + + #include <ostream> + #include <istream> ++#include <memory> + #include <string> + #include <stdarg.h> + #include <stdio.h> +@@ -48,12 +49,14 @@ void __attribute__((weak)) __throw_out_of_range_fmt(char const* fmt, ...) { + #endif + + #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 20) ++namespace __cxxabiv1 { + /* Technically, this symbol is not in GLIBCXX_3.4.20, but in CXXABI_1.3.8, + but that's equivalent, version-wise. Those calls are added by the compiler + itself on `new Class[n]` calls. */ + extern "C" void __attribute__((weak)) __cxa_throw_bad_array_new_length() { + MOZ_CRASH(); + } ++} // namespace __cxxabiv1 + #endif + + #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 21) +-- +2.31.1 + diff --git a/http/firefox/patches/0037-bmo-1712947-Don-t-pass-neon-flags-to-rustc-when-usin.patch b/http/firefox/patches/0037-bmo-1712947-Don-t-pass-neon-flags-to-rustc-when-usin.patch new file mode 100644 index 0000000000..510d717e4a --- /dev/null +++ b/http/firefox/patches/0037-bmo-1712947-Don-t-pass-neon-flags-to-rustc-when-usin.patch @@ -0,0 +1,34 @@ +From a7629ff76a565413a22699fdbd173af803f0f5fa Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@gentoo.org> +Date: Tue, 1 Jun 2021 09:35:57 +0200 +Subject: [PATCH 37/37] bmo#1712947: Don't pass neon flags to rustc when using + thumbv7neon targets + +Bug: https://bugs.gentoo.org/792621 +Signed-off-by: Thomas Deutschmann <whissi@gentoo.org> +--- + config/makefiles/rust.mk | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk +index e683f5ec7e..838716175a 100644 +--- a/config/makefiles/rust.mk ++++ b/config/makefiles/rust.mk +@@ -86,10 +86,13 @@ endif + + rustflags_neon = + ifeq (neon,$(MOZ_FPU)) +-# Enable neon and disable restriction to 16 FPU registers ++ifneq (,$(filter thumbv7neon-,$(RUST_TARGET))) ++# Enable neon and disable restriction to 16 FPU registers when neon is enabled ++# but we're not using a thumbv7neon target, where it's already the default. + # (CPUs with neon have 32 FPU registers available) + rustflags_neon += -C target_feature=+neon,-d16 + endif ++endif + + rustflags_sancov = + ifdef LIBFUZZER +-- +2.31.1 + diff --git a/http/firefox/patches/2004_fix_sandbox_lto.patch b/http/firefox/patches/2004_fix_sandbox_lto.patch deleted file mode 100644 index ed1f8c9d92..0000000000 --- a/http/firefox/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/patches/2006_pgo_gcc_spellchecker.patch b/http/firefox/patches/2006_pgo_gcc_spellchecker.patch deleted file mode 100644 index 2ecfa46b4d..0000000000 --- a/http/firefox/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/patches/2007_arm-fp-wasm-fixes.patch b/http/firefox/patches/2007_arm-fp-wasm-fixes.patch deleted file mode 100644 index 8c66657174..0000000000 --- a/http/firefox/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/patches/2012_allow-non-ascii-chars.patch b/http/firefox/patches/2012_allow-non-ascii-chars.patch deleted file mode 100644 index 59937dd550..0000000000 --- a/http/firefox/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/patches/6004_musl_memory_report.patch b/http/firefox/patches/6004_musl_memory_report.patch deleted file mode 100644 index cebaa9990d..0000000000 --- a/http/firefox/patches/6004_musl_memory_report.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Jory A. Pratt <anarchy@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/patches/6006_musl_fix_tools.patch b/http/firefox/patches/6006_musl_fix_tools.patch deleted file mode 100644 index 26293a8a2e..0000000000 --- a/http/firefox/patches/6006_musl_fix_tools.patch +++ /dev/null @@ -1,17 +0,0 @@ -From: Jory A. Pratt <anarchy@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/patches/7000_sys_auxv_non_glibc.patch b/http/firefox/patches/7000_sys_auxv_non_glibc.patch deleted file mode 100644 index ffc6b85f4a..0000000000 --- a/http/firefox/patches/7000_sys_auxv_non_glibc.patch +++ /dev/null @@ -1,67 +0,0 @@ -From: Jory A. Pratt <anarchy@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) { |