sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
[SM-Commit] GIT changes to master grimoire by Pavel Vinogradov (4b377bb3e9a7a0c352c3c86d1ac16cad3d83166b)
- From: Pavel Vinogradov <scm AT sourcemage.org>
- To: sm-commit AT lists.ibiblio.org
- Subject: [SM-Commit] GIT changes to master grimoire by Pavel Vinogradov (4b377bb3e9a7a0c352c3c86d1ac16cad3d83166b)
- Date: Tue, 28 Jun 2022 21:00:07 +0000
GIT changes to master grimoire by Pavel Vinogradov <public AT sourcemaage.org>:
http/firefox/BUILD
| 5
http/firefox/DEPENDS
| 7
http/firefox/DETAILS
| 4
http/firefox/HISTORY
| 8
http/firefox/mozconfig
| 1
http/firefox/patches/0031-bmo-1765361-resolve_objdir_from_virtualenv_if_mozinfo_not_ancestor.patch
| 64 -
http/firefox/patches/0031-bmo-1773259-cbindgen-root_clip_chain-fix.patch
| 16
http/firefox/patches/0032-bmo-1773259-cbindgen-root_clip_chain-fix.patch
| 16
http/firefox/patches/0033-p01-bmo-1610199-vaapi-fixes-D144284.patch
| 77 --
http/firefox/patches/0033-p02-bmo-1770407-vaapi-fixes-D147420.patch
| 179 ----
http/firefox/patches/0033-p03-bmo-1752494-vaapi-fixes-D147874.patch
| 64 -
http/firefox/patches/0033-p04-bmo-1759784-vaapi-fixes-D146084.patch
| 17
http/firefox/patches/0033-p05-bmo-1759784-vaapi-fixes-D146085.patch
| 205 -----
http/firefox/patches/0033-p06-bmo-1759784-vaapi-fixes-D146086.patch
| 65 -
http/firefox/patches/0033-p07-bmo-1759784-vaapi-fixes-D146087.patch
| 19
http/firefox/patches/0033-p08-bmo-1768191-vaapi-fixes-D145725.patch
| 132 ---
http/firefox/patches/0033-p09-bmo-1768651-vaapi-fixes-D145966.patch
| 20
http/firefox/patches/0033-p10-bmo-1750388-vaapi-fixes-D145871.patch
| 140 ---
http/firefox/patches/0033-p11-bmo-1769182-vaapi-fixes-D146271.patch
| 94 --
http/firefox/patches/0033-p12-bmo-1769182-vaapi-fixes-D146271.patch
| 373 ----------
http/firefox/patches/0033-p13-bmo-1769182-vaapi-fixes-D146273.patch
| 90 --
http/firefox/patches/0033-p14-bmo-1769182-vaapi-fixes-D146274.patch
| 158 ----
http/firefox/patches/0033-p15-bmo-1769182-vaapi-fixes-D146275.patch
| 125 ---
http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p1-D147635.patch
| 125 ---
http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch
| 278 -------
http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p3-D147637.patch
| 113 ---
http/firefox/patches/0035-bmo-1765350-vaapi-fixes-p2-p1-D147720.patch
| 73 -
http/firefox/patches/0036-p01-bmo-1772719-build-wayland-only.patch
| 36
http/firefox/patches/0036-p02-bmo-1772721-build-wayland-only.patch
| 68 -
http/firefox/patches/0036-p03-bmo-1772513-build-wayland-only-D148256.patch
| 207 -----
http/firefox/patches/0036-p04-bmo-1772513-build-wayland-only-D148257.patch
| 14
http/firefox/patches/0041-p01-bmo-1772719-build-wayland-only.patch
| 36
http/firefox/patches/0042-p02-bmo-1772721-build-wayland-only-D148496fixed.patch
| 84 ++
http/firefox/patches/0043-p02-bmo-1772721-build-wayland-only.patch
| 25
http/firefox/patches/0044-p03-bmo-1772513-build-wayland-only-D148256.patch
| 207 +++++
http/firefox/patches/0045-p04-bmo-1772513-build-wayland-only-D148257.patch
| 14
http/firefox/patches/0046-bmo-1754469-memory_mozalloc_throw.patch
| 69 +
http/firefox/patches/0047-bmo-1769631-python-3.11-compatibility.patch
| 208 +++++
38 files changed, 676 insertions(+), 2760 deletions(-)
New commits:
commit 4b377bb3e9a7a0c352c3c86d1ac16cad3d83166b
Author: Pavel Vinogradov <public AT sourcemaage.org>
Commit: Pavel Vinogradov <public AT sourcemaage.org>
http/firefox: version 102.0, SECURITY_PATCH++
diff --git a/http/firefox/BUILD b/http/firefox/BUILD
index 2ab3a7a..05c38fd 100755
--- a/http/firefox/BUILD
+++ b/http/firefox/BUILD
@@ -11,6 +11,9 @@ unset DBUS_SESSION_BUS_ADDRESS \
XAUTHORITY &&
export LIBGL_ALWAYS_INDIRECT=1 &&
+# disable end of build notification
+export MOZ_NOSPAM=1 &&
+
# System rustc has no debuginfo
export RUSTFLAGS="-C debuginfo=0" &&
@@ -52,5 +55,5 @@ for option in $OPTS; do
done &&
echo "mk_add_options MOZ_MAKE_FLAGS=\"-j${MAKE_NJOBS:-1}\"" >> .mozconfig &&
-export MACH_USE_SYSTEM_PYTHON=1 &&
+export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system &&
./mach build
diff --git a/http/firefox/DEPENDS b/http/firefox/DEPENDS
index 020356a..c9cd46b 100755
--- a/http/firefox/DEPENDS
+++ b/http/firefox/DEPENDS
@@ -35,7 +35,7 @@ depends libwebp "--with-system-webp"
&&
depends nspr "--with-system-nspr" &&
-local NSS_BRANCH="3.78" &&
+local NSS_BRANCH="3.79" &&
if spell_ok nss &&
is_version_less "$(installed_version nss)" "${NSS_BRANCH}"; then
depends -sub "${NSS_BRANCH}" nss "--with-system-nss"
@@ -114,10 +114,7 @@ depends dbus-glib "--enable-dbus" &&
# 'for WebGL support' &&
depends OPENGL &&
-optional_depends LIBAVCODEC \
- "--enable-ffmpeg" \
- "--disable-ffmpeg" \
- "for fragmented H264/AAC decoding" &&
+depends LIBAVCODEC &&
suggest_depends_2 firefox-smglwiki "" "" \
"to enable searching the SMGL Wiki from the Search Bar"
diff --git a/http/firefox/DETAILS b/http/firefox/DETAILS
index 4203a61..9ea2325 100755
--- a/http/firefox/DETAILS
+++ b/http/firefox/DETAILS
@@ -1,6 +1,6 @@
SPELL=firefox
- VERSION=101.0.1
- SECURITY_PATCH=164
+ VERSION=102.0
+ SECURITY_PATCH=165
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 fa1ca38..8e0e5da 100644
--- a/http/firefox/HISTORY
+++ b/http/firefox/HISTORY
@@ -1,3 +1,11 @@
+2022-06-28 Pavel Vinogradov <public AT sourcemage.org>
+ * DETAILS: version 102.0, SECURITY_PATCH++
+ * BUILD: disabled notifications at the end of the build, updated
instruction
+ to use system python
+ * DEPENDS: nss >= 3.79, LIBAVCODEC is required now
+ * patches/*: updated
+ * mozconfig: disabled tests
+
2022-06-09 Pavel Vinogradov <public AT sourcemage.org>
* DETAILS: version 101.0.1
* patches/*: updated
diff --git a/http/firefox/mozconfig b/http/firefox/mozconfig
index 06347ff..3b429b1 100644
--- a/http/firefox/mozconfig
+++ b/http/firefox/mozconfig
@@ -23,6 +23,7 @@ ac_add_options --prefix=${INSTALL_ROOT}/usr
ac_add_options --enable-release
ac_add_options --enable-optimize="${CXXFLAGS} -fno-fast-math"
ac_add_options --enable-rust-simd
+ac_add_options --disable-tests
ac_add_options --with-distribution-id=org.sourcemage
diff --git
a/http/firefox/patches/0031-bmo-1765361-resolve_objdir_from_virtualenv_if_mozinfo_not_ancestor.patch
b/http/firefox/patches/0031-bmo-1765361-resolve_objdir_from_virtualenv_if_mozinfo_not_ancestor.patch
deleted file mode 100644
index 1b0a98a..0000000
---
a/http/firefox/patches/0031-bmo-1765361-resolve_objdir_from_virtualenv_if_mozinfo_not_ancestor.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-
-# HG changeset patch
-# User Mitchell Hentges <mhentges AT mozilla.com>
-# Date 1650979968 0
-# Node ID f05729424f4d67217eac2909844debd4b7e1dc27
-# Parent 339a9e0b4903ccc822974d2e8d04212ae1ecfe77
-Bug 1765361: Only resolve objdir from virtualenv if mozinfo not ancestor
r=glandium
-
-Virtualenv-based objdir detection doesn't work for instrumented builds,
-as instrumentation-specific objdirs aren't created.
-
-Resolve this by:
-* Removing redundant cwd-based topsrcdir resolution - the
- `__file__`-based code path below covers this case.
-* Only using virtualenv-based resolving if topsrcdir isn't resolved.
-* Documenting that virtualenv-based resolution is problematic for
- instrumented builds.
-
-Differential Revision: https://phabricator.services.mozilla.com/D144030
-
-diff --git a/python/mozbuild/mozbuild/base.py
b/python/mozbuild/mozbuild/base.py
---- a/python/mozbuild/mozbuild/base.py
-+++ b/python/mozbuild/mozbuild/base.py
-@@ -181,29 +181,26 @@ class MozbuildObject(ProcessExecutionMix
-
- for dir_path in ancestors(cwd):
- # If we find a mozinfo.json, we are in the objdir.
- mozinfo_path = os.path.join(dir_path, "mozinfo.json")
- if os.path.isfile(mozinfo_path):
- topsrcdir, topobjdir, mozconfig = load_mozinfo(mozinfo_path)
- break
-
-- # We choose an arbitrary file as an indicator that this is a
-- # srcdir. We go with ourself because why not!
-- our_path = os.path.join(
-- dir_path, "python", "mozbuild", "mozbuild", "base.py"
-- )
-- if os.path.isfile(our_path):
-- topsrcdir = dir_path
-- break
--
-- # See if we're running from a Python virtualenv that's inside an
objdir.
-- mozinfo_path = os.path.join(os.path.dirname(sys.prefix),
"../mozinfo.json")
-- if detect_virtualenv_mozinfo and os.path.isfile(mozinfo_path):
-- topsrcdir, topobjdir, mozconfig = load_mozinfo(mozinfo_path)
-+ if not topsrcdir:
-+ # See if we're running from a Python virtualenv that's inside
an objdir.
-+ # sys.prefix would look like
"$objdir/_virtualenvs/$virtualenv/".
-+ # Note that virtualenv-based objdir detection work for
instrumented builds,
-+ # because they aren't created in the scoped "instrumentated"
objdir.
-+ # However, working-directory-ancestor-based objdir resolution
should fully
-+ # cover that case.
-+ mozinfo_path = os.path.join(sys.prefix, "..", "..",
"mozinfo.json")
-+ if detect_virtualenv_mozinfo and os.path.isfile(mozinfo_path):
-+ topsrcdir, topobjdir, mozconfig = load_mozinfo(mozinfo_path)
-
- if not topsrcdir:
- topsrcdir = os.path.abspath(
- os.path.join(os.path.dirname(__file__), "..", "..", "..")
- )
-
- topsrcdir = mozpath.normsep(topsrcdir)
- if topobjdir:
-
diff --git
a/http/firefox/patches/0031-bmo-1773259-cbindgen-root_clip_chain-fix.patch
b/http/firefox/patches/0031-bmo-1773259-cbindgen-root_clip_chain-fix.patch
new file mode 100644
index 0000000..a996d35
--- /dev/null
+++ b/http/firefox/patches/0031-bmo-1773259-cbindgen-root_clip_chain-fix.patch
@@ -0,0 +1,16 @@
+Description: Remove an extra constant definition that is now being generated
by newer versions of cbindgen (0.24), and causing build failures because it
is defined in several places.
+Author: Olivier Tilloy <olivier.tilloy AT canonical.com>
+Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1773259
+Forwarded: not-needed
+
+--- a/gfx/webrender_bindings/webrender_ffi.h
++++ b/gfx/webrender_bindings/webrender_ffi.h
+@@ -73,8 +73,6 @@ struct WrPipelineInfo;
+ struct WrPipelineIdAndEpoch;
+ using WrPipelineIdEpochs = nsTArray<WrPipelineIdAndEpoch>;
+
+-const uint64_t ROOT_CLIP_CHAIN = ~0;
+-
+ } // namespace wr
+ } // namespace mozilla
+
diff --git
a/http/firefox/patches/0032-bmo-1773259-cbindgen-root_clip_chain-fix.patch
b/http/firefox/patches/0032-bmo-1773259-cbindgen-root_clip_chain-fix.patch
deleted file mode 100644
index a996d35..0000000
--- a/http/firefox/patches/0032-bmo-1773259-cbindgen-root_clip_chain-fix.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Description: Remove an extra constant definition that is now being generated
by newer versions of cbindgen (0.24), and causing build failures because it
is defined in several places.
-Author: Olivier Tilloy <olivier.tilloy AT canonical.com>
-Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1773259
-Forwarded: not-needed
-
---- a/gfx/webrender_bindings/webrender_ffi.h
-+++ b/gfx/webrender_bindings/webrender_ffi.h
-@@ -73,8 +73,6 @@ struct WrPipelineInfo;
- struct WrPipelineIdAndEpoch;
- using WrPipelineIdEpochs = nsTArray<WrPipelineIdAndEpoch>;
-
--const uint64_t ROOT_CLIP_CHAIN = ~0;
--
- } // namespace wr
- } // namespace mozilla
-
diff --git
a/http/firefox/patches/0033-p01-bmo-1610199-vaapi-fixes-D144284.patch
b/http/firefox/patches/0033-p01-bmo-1610199-vaapi-fixes-D144284.patch
deleted file mode 100644
index d838254..0000000
--- a/http/firefox/patches/0033-p01-bmo-1610199-vaapi-fixes-D144284.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-diff --git a/gfx/layers/DMABUFSurfaceImage.cpp
b/gfx/layers/DMABUFSurfaceImage.cpp
---- a/gfx/layers/DMABUFSurfaceImage.cpp
-+++ b/gfx/layers/DMABUFSurfaceImage.cpp
-@@ -39,20 +39,20 @@
-
- StaticRefPtr<GLContext> sSnapshotContext;
- static StaticMutex sSnapshotContextMutex MOZ_UNANNOTATED;
-
- already_AddRefed<gfx::SourceSurface>
DMABUFSurfaceImage::GetAsSourceSurface() {
-+ StaticMutexAutoLock lock(sSnapshotContextMutex);
- if (!sSnapshotContext) {
- nsCString discardFailureId;
- sSnapshotContext = GLContextProvider::CreateHeadless({},
&discardFailureId);
- if (!sSnapshotContext) {
- gfxCriticalError() << "Failed to create snapshot GLContext.";
- return nullptr;
- }
- }
-
-- StaticMutexAutoLock lock(sSnapshotContextMutex);
- sSnapshotContext->MakeCurrent();
-
- auto releaseTextures =
- mozilla::MakeScopeExit([&] { mSurface->ReleaseTextures(); });
-
-diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
---- a/widget/gtk/DMABufSurface.cpp
-+++ b/widget/gtk/DMABufSurface.cpp
-@@ -53,24 +53,13 @@
- using namespace mozilla::layers;
-
- #define BUFFER_FLAGS 0
-
- static RefPtr<GLContext> sSnapshotContext;
-+static StaticMutex sSnapshotContextMutex MOZ_UNANNOTATED;
- static Atomic<int> gNewSurfaceUID(1);
-
--bool EnsureSnapshotGLContext() {
-- if (!sSnapshotContext) {
-- nsCString discardFailureId;
-- sSnapshotContext = GLContextProvider::CreateHeadless({},
&discardFailureId);
-- if (!sSnapshotContext) {
-- NS_WARNING("Failed to create snapshot GLContext");
-- return false;
-- }
-- }
-- return true;
--}
--
- bool DMABufSurface::IsGlobalRefSet() const {
- if (!mGlobalRefCountFd) {
- return false;
- }
- struct pollfd pfd;
-@@ -1263,13 +1252,18 @@
- }
-
- bool DMABufSurfaceYUV::VerifyTextureCreation() {
- LOGDMABUF(("DMABufSurfaceYUV::VerifyTextureCreation() UID %d", mUID));
-
-- if (!EnsureSnapshotGLContext()) {
-- LOGDMABUF((" failed to create GL context!"));
-- return false;
-+ StaticMutexAutoLock lock(sSnapshotContextMutex);
-+ if (!sSnapshotContext) {
-+ nsCString discardFailureId;
-+ sSnapshotContext = GLContextProvider::CreateHeadless({},
&discardFailureId);
-+ if (!sSnapshotContext) {
-+ NS_WARNING("Failed to create snapshot GLContext");
-+ return false;
-+ }
- }
-
- auto release = MakeScopeExit([&] { ReleaseEGLImages(sSnapshotContext); });
-
- for (int i = 0; i < mBufferPlaneCount; i++) {
-
diff --git
a/http/firefox/patches/0033-p02-bmo-1770407-vaapi-fixes-D147420.patch
b/http/firefox/patches/0033-p02-bmo-1770407-vaapi-fixes-D147420.patch
deleted file mode 100644
index 1ee3af1..0000000
--- a/http/firefox/patches/0033-p02-bmo-1770407-vaapi-fixes-D147420.patch
+++ /dev/null
@@ -1,179 +0,0 @@
-diff -up firefox-101.0/gfx/gl/GLContextEGL.h.D147420.diff
firefox-101.0/gfx/gl/GLContextEGL.h
---- firefox-101.0/gfx/gl/GLContextEGL.h.D147420.diff 2022-05-27
01:16:54.000000000 +0200
-+++ firefox-101.0/gfx/gl/GLContextEGL.h 2022-06-07 09:01:17.487787806
+0200
-@@ -106,6 +106,9 @@ class GLContextEGL final : public GLCont
- static RefPtr<GLContextEGL> CreateEGLPBufferOffscreenContextImpl(
- std::shared_ptr<EglDisplay>, const GLContextCreateDesc&,
- const gfx::IntSize& size, bool aUseGles, nsACString* const
out_FailureId);
-+ static RefPtr<GLContextEGL> CreateEGLSurfacelessContext(
-+ const std::shared_ptr<EglDisplay> display,
-+ const GLContextCreateDesc& desc, nsACString* const out_failureId);
-
- static EGLSurface CreateEGLSurfaceForCompositorWidget(
- widget::CompositorWidget* aCompositorWidget, const EGLConfig aConfig);
-diff -up firefox-101.0/gfx/gl/GLContextProviderEGL.cpp.D147420.diff
firefox-101.0/gfx/gl/GLContextProviderEGL.cpp
---- firefox-101.0/gfx/gl/GLContextProviderEGL.cpp.D147420.diff 2022-05-27
01:16:54.000000000 +0200
-+++ firefox-101.0/gfx/gl/GLContextProviderEGL.cpp 2022-06-07
09:01:17.487787806 +0200
-@@ -1190,16 +1190,42 @@ RefPtr<GLContextEGL> GLContextEGL::Creat
- }
-
- /*static*/
-+RefPtr<GLContextEGL> GLContextEGL::CreateEGLSurfacelessContext(
-+ const std::shared_ptr<EglDisplay> display, const GLContextCreateDesc&
desc,
-+ nsACString* const out_failureId) {
-+ const EGLConfig config = {};
-+ auto fullDesc = GLContextDesc{desc};
-+ fullDesc.isOffscreen = true;
-+ RefPtr<GLContextEGL> gl = GLContextEGL::CreateGLContext(
-+ display, fullDesc, config, EGL_NO_SURFACE, false, out_failureId);
-+ if (!gl) {
-+ NS_WARNING("Failed to create surfaceless GL context");
-+ return nullptr;
-+ }
-+ return gl;
-+}
-+
-+/*static*/
- already_AddRefed<GLContext> GLContextProviderEGL::CreateHeadless(
- const GLContextCreateDesc& desc, nsACString* const out_failureId) {
- const auto display = DefaultEglDisplay(out_failureId);
- if (!display) {
- return nullptr;
- }
-- mozilla::gfx::IntSize dummySize = mozilla::gfx::IntSize(16, 16);
-- auto ret = GLContextEGL::CreateEGLPBufferOffscreenContext(
-- display, desc, dummySize, out_failureId);
-- return ret.forget();
-+ RefPtr<GLContextEGL> gl;
-+#ifdef MOZ_WAYLAND
-+ if (!gdk_display_get_default() &&
-+
display->IsExtensionSupported(EGLExtension::MESA_platform_surfaceless)) {
-+ gl =
-+ GLContextEGL::CreateEGLSurfacelessContext(display, desc,
out_failureId);
-+ } else
-+#endif
-+ {
-+ mozilla::gfx::IntSize dummySize = mozilla::gfx::IntSize(16, 16);
-+ gl = GLContextEGL::CreateEGLPBufferOffscreenContext(
-+ display, desc, dummySize, out_failureId);
-+ }
-+ return gl.forget();
- }
-
- // Don't want a global context on Android as 1) share groups across 2
threads
-diff -up firefox-101.0/gfx/gl/GLDefs.h.D147420.diff
firefox-101.0/gfx/gl/GLDefs.h
---- firefox-101.0/gfx/gl/GLDefs.h.D147420.diff 2022-05-27 01:16:54.000000000
+0200
-+++ firefox-101.0/gfx/gl/GLDefs.h 2022-06-07 09:01:17.487787806 +0200
-@@ -104,6 +104,9 @@ bool CheckContextLost(const GLContext* g
- // EGL_ANGLE_image_d3d11_texture
- #define LOCAL_EGL_D3D11_TEXTURE_ANGLE 0x3484
-
-+// EGL_MESA_platform_surfaceless
-+#define LOCAL_EGL_PLATFORM_SURFACELESS_MESA 0x31DD
-+
- // clang-format on
-
- #endif
-diff -up firefox-101.0/gfx/gl/GLLibraryEGL.cpp.D147420.diff
firefox-101.0/gfx/gl/GLLibraryEGL.cpp
---- firefox-101.0/gfx/gl/GLLibraryEGL.cpp.D147420.diff 2022-05-27
01:16:54.000000000 +0200
-+++ firefox-101.0/gfx/gl/GLLibraryEGL.cpp 2022-06-07 09:03:04.077349997
+0200
-@@ -82,7 +82,8 @@ static const char* sEGLExtensionNames[]
- "EGL_KHR_swap_buffers_with_damage",
- "EGL_EXT_buffer_age",
- "EGL_KHR_partial_update",
-- "EGL_NV_robustness_video_memory_purge"};
-+ "EGL_NV_robustness_video_memory_purge",
-+ "EGL_MESA_platform_surfaceless"};
-
- PRLibrary* LoadApitraceLibrary() {
- const char* path = nullptr;
-@@ -151,6 +152,19 @@ static std::shared_ptr<EglDisplay> GetAn
- return EglDisplay::Create(egl, display, false, aProofOfLock);
- }
-
-+#ifdef MOZ_WAYLAND
-+static std::shared_ptr<EglDisplay> GetAndInitSurfacelessDisplay(
-+ GLLibraryEGL& egl, const StaticMutexAutoLock& aProofOfLock) {
-+ const EGLAttrib attrib_list[] = {LOCAL_EGL_NONE};
-+ const EGLDisplay display = egl.fGetPlatformDisplay(
-+ LOCAL_EGL_PLATFORM_SURFACELESS_MESA, EGL_DEFAULT_DISPLAY,
attrib_list);
-+ if (display == EGL_NO_DISPLAY) {
-+ return nullptr;
-+ }
-+ return EglDisplay::Create(egl, display, true, aProofOfLock);
-+}
-+#endif
-+
- static std::shared_ptr<EglDisplay> GetAndInitWARPDisplay(
- GLLibraryEGL& egl, void* displayType,
- const StaticMutexAutoLock& aProofOfLock) {
-@@ -629,6 +643,11 @@ bool GLLibraryEGL::Init(nsACString* cons
- END_OF_SYMBOLS};
- (void)fnLoadSymbols(symbols);
- }
-+ {
-+ const SymLoadStruct symbols[] = {SYMBOL(GetPlatformDisplay),
-+ END_OF_SYMBOLS};
-+ (void)fnLoadSymbols(symbols);
-+ }
-
- return true;
- }
-@@ -806,7 +825,9 @@ std::shared_ptr<EglDisplay> GLLibraryEGL
- #ifdef MOZ_WAYLAND
- // Some drivers doesn't support EGL_DEFAULT_DISPLAY
- GdkDisplay* gdkDisplay = gdk_display_get_default();
-- if (widget::GdkIsWaylandDisplay(gdkDisplay)) {
-+ if (!gdkDisplay) {
-+ ret = GetAndInitSurfacelessDisplay(*this, aProofOfLock);
-+ } else if (widget::GdkIsWaylandDisplay(gdkDisplay)) {
- nativeDisplay = widget::WaylandDisplayGetWLDisplay(gdkDisplay);
- if (!nativeDisplay) {
- NS_WARNING("Failed to get wl_display.");
-@@ -814,7 +835,9 @@ std::shared_ptr<EglDisplay> GLLibraryEGL
- }
- }
- #endif
-- ret = GetAndInitDisplay(*this, nativeDisplay, aProofOfLock);
-+ if (!ret) {
-+ ret = GetAndInitDisplay(*this, nativeDisplay, aProofOfLock);
-+ }
- }
-
- if (!ret) {
-diff -up firefox-101.0/gfx/gl/GLLibraryEGL.h.D147420.diff
firefox-101.0/gfx/gl/GLLibraryEGL.h
---- firefox-101.0/gfx/gl/GLLibraryEGL.h.D147420.diff 2022-05-27
01:16:54.000000000 +0200
-+++ firefox-101.0/gfx/gl/GLLibraryEGL.h 2022-06-07 09:01:17.487787806
+0200
-@@ -107,6 +107,7 @@ enum class EGLExtension {
- EXT_buffer_age,
- KHR_partial_update,
- NV_robustness_video_memory_purge,
-+ MESA_platform_surfaceless,
- Max
- };
-
-diff -up firefox-101.0/widget/gtk/DMABufSurface.cpp.D147420.diff
firefox-101.0/widget/gtk/DMABufSurface.cpp
---- firefox-101.0/widget/gtk/DMABufSurface.cpp.D147420.diff 2022-06-07
09:01:17.486787773 +0200
-+++ firefox-101.0/widget/gtk/DMABufSurface.cpp 2022-06-07 09:01:17.487787806
+0200
-@@ -1259,7 +1259,7 @@ bool DMABufSurfaceYUV::VerifyTextureCrea
- nsCString discardFailureId;
- sSnapshotContext = GLContextProvider::CreateHeadless({},
&discardFailureId);
- if (!sSnapshotContext) {
-- NS_WARNING("Failed to create snapshot GLContext");
-+ LOGDMABUF((" failed to create snapshot GLContext"));
- return false;
- }
- }
-@@ -1268,10 +1268,12 @@ bool DMABufSurfaceYUV::VerifyTextureCrea
-
- for (int i = 0; i < mBufferPlaneCount; i++) {
- if (!CreateEGLImage(sSnapshotContext, i)) {
-+ LOGDMABUF((" failed to create EGL image!"));
- return false;
- }
- }
-
-+ LOGDMABUF((" success"));
- return true;
- }
-
diff --git
a/http/firefox/patches/0033-p03-bmo-1752494-vaapi-fixes-D147874.patch
b/http/firefox/patches/0033-p03-bmo-1752494-vaapi-fixes-D147874.patch
deleted file mode 100644
index f0c57dd..0000000
--- a/http/firefox/patches/0033-p03-bmo-1752494-vaapi-fixes-D147874.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-diff -up firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp.D147874.diff
firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp
---- firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp.D147874.diff 2022-05-27
01:16:54.000000000 +0200
-+++ firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp 2022-06-07
11:16:03.791419558 +0200
-@@ -233,13 +233,7 @@ void gfxPlatformGtk::InitDmabufConfig()
- void gfxPlatformGtk::InitVAAPIConfig() {
- FeatureState& feature = gfxConfig::GetFeature(Feature::VAAPI);
- #ifdef MOZ_WAYLAND
-- feature.DisableByDefault(FeatureStatus::Disabled,
-- "VAAPI is disabled by default",
-- "FEATURE_VAAPI_DISABLED"_ns);
--
-- if (StaticPrefs::media_ffmpeg_vaapi_enabled()) {
-- feature.UserForceEnable("Force enabled by pref");
-- }
-+ feature.EnableByDefault();
-
- nsCString failureId;
- int32_t status;
-@@ -253,6 +247,10 @@ void gfxPlatformGtk::InitVAAPIConfig() {
- failureId);
- }
-
-+ if (StaticPrefs::media_ffmpeg_vaapi_enabled()) {
-+ feature.UserForceEnable("Force enabled by pref");
-+ }
-+
- if (!gfxVars::UseEGL()) {
- feature.ForceDisable(FeatureStatus::Unavailable, "Requires EGL",
- "FEATURE_FAILURE_REQUIRES_EGL"_ns);
-diff -up firefox-101.0/widget/gtk/GfxInfo.cpp.D147874.diff
firefox-101.0/widget/gtk/GfxInfo.cpp
---- firefox-101.0/widget/gtk/GfxInfo.cpp.D147874.diff 2022-05-27
01:17:06.000000000 +0200
-+++ firefox-101.0/widget/gtk/GfxInfo.cpp 2022-06-07 09:52:54.416701418
+0200
-@@ -843,6 +843,31 @@ const nsTArray<GfxDriverInfo>& GfxInfo::
- V(495, 44, 0, 0), "FEATURE_FAILURE_NO_GBM", "495.44.0");
-
- ////////////////////////////////////
-+ // FEATURE_VAAPI
-+ APPEND_TO_DRIVER_BLOCKLIST_EXT(
-+ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
-+ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaAll,
-+ DeviceFamily::All, nsIGfxInfo::FEATURE_VAAPI,
-+ nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
-+ V(21, 0, 0, 0), "FEATURE_ROLLOUT_VAAPI_MESA", "Mesa 21.0.0.0");
-+
-+ // Disable on all NVIDIA hardware
-+ APPEND_TO_DRIVER_BLOCKLIST_EXT(
-+ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
-+ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::All,
-+ DeviceFamily::NvidiaAll, nsIGfxInfo::FEATURE_VAAPI,
-+ nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
-+ V(0, 0, 0, 0), "FEATURE_FAILURE_VAAPI_NO_LINUX_NVIDIA", "");
-+
-+ // Disable on all AMD devices not using Mesa.
-+ APPEND_TO_DRIVER_BLOCKLIST_EXT(
-+ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
-+ DesktopEnvironment::All, WindowProtocol::All,
DriverVendor::NonMesaAll,
-+ DeviceFamily::AtiAll, nsIGfxInfo::FEATURE_VAAPI,
-+ nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
-+ V(0, 0, 0, 0), "FEATURE_FAILURE_VAAPI_NO_LINUX_AMD", "");
-+
-+ ////////////////////////////////////
- // FEATURE_WEBRENDER_PARTIAL_PRESENT
- APPEND_TO_DRIVER_BLOCKLIST_EXT(
- OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
diff --git
a/http/firefox/patches/0033-p04-bmo-1759784-vaapi-fixes-D146084.patch
b/http/firefox/patches/0033-p04-bmo-1759784-vaapi-fixes-D146084.patch
deleted file mode 100644
index 8ed2c28..0000000
--- a/http/firefox/patches/0033-p04-bmo-1759784-vaapi-fixes-D146084.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git a/gfx/layers/ipc/LayersSurfaces.ipdlh
b/gfx/layers/ipc/LayersSurfaces.ipdlh
---- a/gfx/layers/ipc/LayersSurfaces.ipdlh
-+++ b/gfx/layers/ipc/LayersSurfaces.ipdlh
-@@ -57,10 +57,12 @@
- uint64_t[] modifier;
- uint32_t flags;
- FileDescriptor[] fds;
- uint32_t[] width;
- uint32_t[] height;
-+ uint32_t[] widthAligned;
-+ uint32_t[] heightAligned;
- uint32_t[] format;
- uint32_t[] strides;
- uint32_t[] offsets;
- YUVColorSpace yUVColorSpace;
- ColorRange colorRange;
-
diff --git
a/http/firefox/patches/0033-p05-bmo-1759784-vaapi-fixes-D146085.patch
b/http/firefox/patches/0033-p05-bmo-1759784-vaapi-fixes-D146085.patch
deleted file mode 100644
index 6b037f6..0000000
--- a/http/firefox/patches/0033-p05-bmo-1759784-vaapi-fixes-D146085.patch
+++ /dev/null
@@ -1,205 +0,0 @@
-diff --git a/widget/gtk/DMABufSurface.h b/widget/gtk/DMABufSurface.h
---- a/widget/gtk/DMABufSurface.h
-+++ b/widget/gtk/DMABufSurface.h
-@@ -275,11 +275,11 @@
- static already_AddRefed<DMABufSurfaceYUV> CreateYUVSurface(
- int aWidth, int aHeight, void** aPixelData = nullptr,
- int* aLineSizes = nullptr);
-
- static already_AddRefed<DMABufSurfaceYUV> CreateYUVSurface(
-- const VADRMPRIMESurfaceDescriptor& aDesc);
-+ const VADRMPRIMESurfaceDescriptor& aDesc, int aWidth, int aHeight);
-
- bool Serialize(mozilla::layers::SurfaceDescriptor& aOutDescriptor);
-
- DMABufSurfaceYUV* GetAsDMABufSurfaceYUV() { return this; };
-
-@@ -304,11 +304,12 @@
- mozilla::gfx::YUVColorSpace GetYUVColorSpace() { return mColorSpace; }
-
- DMABufSurfaceYUV();
-
- bool UpdateYUVData(void** aPixelData, int* aLineSizes);
-- bool UpdateYUVData(const VADRMPRIMESurfaceDescriptor& aDesc);
-+ bool UpdateYUVData(const VADRMPRIMESurfaceDescriptor& aDesc, int aWidth,
-+ int aHeight);
-
- bool VerifyTextureCreation();
-
- private:
- ~DMABufSurfaceYUV();
-@@ -329,10 +330,15 @@
- bool CreateEGLImage(mozilla::gl::GLContext* aGLContext, int aPlane);
- void ReleaseEGLImages(mozilla::gl::GLContext* aGLContext);
-
- int mWidth[DMABUF_BUFFER_PLANES];
- int mHeight[DMABUF_BUFFER_PLANES];
-+ // Aligned size of the surface imported from VADRMPRIMESurfaceDescriptor.
-+ // It's used only internally to create EGLImage as some GL drivers
-+ // needs that (Bug 1724385).
-+ int mWidthAligned[DMABUF_BUFFER_PLANES];
-+ int mHeightAligned[DMABUF_BUFFER_PLANES];
- EGLImageKHR mEGLImage[DMABUF_BUFFER_PLANES];
- GLuint mTexture[DMABUF_BUFFER_PLANES];
- mozilla::gfx::YUVColorSpace mColorSpace =
- mozilla::gfx::YUVColorSpace::Default;
- };
-diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
---- a/widget/gtk/DMABufSurface.cpp
-+++ b/widget/gtk/DMABufSurface.cpp
-@@ -479,13 +479,13 @@
- if (mGlobalRefCountFd) {
- refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCountFd));
- }
-
- aOutDescriptor = SurfaceDescriptorDMABuf(
-- mSurfaceType, modifiers, mGbmBufferFlags, fds, width, height, format,
-- strides, offsets, GetYUVColorSpace(), mColorRange, fenceFDs, mUID,
-- refCountFDs);
-+ mSurfaceType, modifiers, mGbmBufferFlags, fds, width, height, width,
-+ height, format, strides, offsets, GetYUVColorSpace(), mColorRange,
-+ fenceFDs, mUID, refCountFDs);
- return true;
- }
-
- bool DMABufSurfaceRGBA::CreateTexture(GLContext* aGLContext, int aPlane) {
- MOZ_ASSERT(!mEGLImage && !mTexture, "EGLImage is already created!");
-@@ -807,15 +807,15 @@
- }
- return surf.forget();
- }
-
- already_AddRefed<DMABufSurfaceYUV> DMABufSurfaceYUV::CreateYUVSurface(
-- const VADRMPRIMESurfaceDescriptor& aDesc) {
-+ const VADRMPRIMESurfaceDescriptor& aDesc, int aWidth, int aHeight) {
- RefPtr<DMABufSurfaceYUV> surf = new DMABufSurfaceYUV();
- LOGDMABUF(("DMABufSurfaceYUV::CreateYUVSurface() UID %d from desc\n",
- surf->GetUID()));
-- if (!surf->UpdateYUVData(aDesc)) {
-+ if (!surf->UpdateYUVData(aDesc, aWidth, aHeight)) {
- return nullptr;
- }
- return surf.forget();
- }
-
-@@ -829,11 +829,16 @@
- }
- return surf.forget();
- }
-
- DMABufSurfaceYUV::DMABufSurfaceYUV()
-- : DMABufSurface(SURFACE_NV12), mWidth(), mHeight(), mTexture() {
-+ : DMABufSurface(SURFACE_NV12),
-+ mWidth(),
-+ mHeight(),
-+ mWidthAligned(),
-+ mHeightAligned(),
-+ mTexture() {
- for (int i = 0; i < DMABUF_BUFFER_PLANES; i++) {
- mEGLImage[i] = LOCAL_EGL_NO_IMAGE;
- }
- }
-
-@@ -870,11 +875,12 @@
- close(mDmabufFds[aPlane]);
- mDmabufFds[aPlane] = -1;
- }
- }
-
--bool DMABufSurfaceYUV::UpdateYUVData(const VADRMPRIMESurfaceDescriptor&
aDesc) {
-+bool DMABufSurfaceYUV::UpdateYUVData(const VADRMPRIMESurfaceDescriptor&
aDesc,
-+ int aWidth, int aHeight) {
- if (aDesc.num_layers > DMABUF_BUFFER_PLANES ||
- aDesc.num_objects > DMABUF_BUFFER_PLANES) {
- return false;
- }
-
-@@ -907,12 +913,14 @@
-
- mBufferModifiers[i] = aDesc.objects[object].drm_format_modifier;
- mDrmFormats[i] = aDesc.layers[i].drm_format;
- mOffsets[i] = aDesc.layers[i].offset[0];
- mStrides[i] = aDesc.layers[i].pitch[0];
-- mWidth[i] = aDesc.width >> i;
-- mHeight[i] = aDesc.height >> i;
-+ mWidthAligned[i] = aDesc.width >> i;
-+ mHeightAligned[i] = aDesc.height >> i;
-+ mWidth[i] = aWidth >> i;
-+ mHeight[i] = aHeight >> i;
-
- LOGDMABUF((" plane %d size %d x %d format %x", i, mWidth[i],
mHeight[i],
- mDrmFormats[i]));
- }
-
-@@ -1044,10 +1052,12 @@
- strerror(errno)));
- return false;
- }
- mWidth[i] = aDesc.width()[i];
- mHeight[i] = aDesc.height()[i];
-+ mWidthAligned[i] = aDesc.widthAligned()[i];
-+ mHeightAligned[i] = aDesc.heightAligned()[i];
- mDrmFormats[i] = aDesc.format()[i];
- mStrides[i] = aDesc.strides()[i];
- mOffsets[i] = aDesc.offsets()[i];
- mBufferModifiers[i] = aDesc.modifier()[i];
- LOGDMABUF((" plane %d fd %d size %d x %d format %x", i,
mDmabufFds[i],
-@@ -1072,10 +1082,12 @@
-
- bool DMABufSurfaceYUV::Serialize(
- mozilla::layers::SurfaceDescriptor& aOutDescriptor) {
- AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> width;
- AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> height;
-+ AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> widthBytes;
-+ AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> heightBytes;
- AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> format;
- AutoTArray<ipc::FileDescriptor, DMABUF_BUFFER_PLANES> fds;
- AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> strides;
- AutoTArray<uint32_t, DMABUF_BUFFER_PLANES> offsets;
- AutoTArray<uint64_t, DMABUF_BUFFER_PLANES> modifiers;
-@@ -1090,10 +1102,12 @@
- }
-
- for (int i = 0; i < mBufferPlaneCount; i++) {
- width.AppendElement(mWidth[i]);
- height.AppendElement(mHeight[i]);
-+ widthBytes.AppendElement(mWidthAligned[i]);
-+ heightBytes.AppendElement(mHeightAligned[i]);
- format.AppendElement(mDrmFormats[i]);
- fds.AppendElement(ipc::FileDescriptor(mDmabufFds[i]));
- strides.AppendElement(mStrides[i]);
- offsets.AppendElement(mOffsets[i]);
- modifiers.AppendElement(mBufferModifiers[i]);
-@@ -1108,12 +1122,13 @@
- if (mGlobalRefCountFd) {
- refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCountFd));
- }
-
- aOutDescriptor = SurfaceDescriptorDMABuf(
-- mSurfaceType, modifiers, 0, fds, width, height, format, strides,
offsets,
-- GetYUVColorSpace(), mColorRange, fenceFDs, mUID, refCountFDs);
-+ mSurfaceType, modifiers, 0, fds, width, height, widthBytes,
heightBytes,
-+ format, strides, offsets, GetYUVColorSpace(), mColorRange, fenceFDs,
mUID,
-+ refCountFDs);
- return true;
- }
-
- bool DMABufSurfaceYUV::CreateEGLImage(GLContext* aGLContext, int aPlane) {
- LOGDMABUF(
-@@ -1131,13 +1146,13 @@
- return false;
- }
-
- nsTArray<EGLint> attribs;
- attribs.AppendElement(LOCAL_EGL_WIDTH);
-- attribs.AppendElement(mWidth[aPlane]);
-+ attribs.AppendElement(mWidthAligned[aPlane]);
- attribs.AppendElement(LOCAL_EGL_HEIGHT);
-- attribs.AppendElement(mHeight[aPlane]);
-+ attribs.AppendElement(mHeightAligned[aPlane]);
- attribs.AppendElement(LOCAL_EGL_LINUX_DRM_FOURCC_EXT);
- attribs.AppendElement(mDrmFormats[aPlane]);
- #define ADD_PLANE_ATTRIBS_NV12(plane_idx) \
- attribs.AppendElement(LOCAL_EGL_DMA_BUF_PLANE##plane_idx##_FD_EXT); \
- attribs.AppendElement(mDmabufFds[aPlane]); \
-
diff --git
a/http/firefox/patches/0033-p06-bmo-1759784-vaapi-fixes-D146086.patch
b/http/firefox/patches/0033-p06-bmo-1759784-vaapi-fixes-D146086.patch
deleted file mode 100644
index c6790ad..0000000
--- a/http/firefox/patches/0033-p06-bmo-1759784-vaapi-fixes-D146086.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h
b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h
---- a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h
-+++ b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h
-@@ -112,12 +112,13 @@
- public:
- VideoFramePool();
- ~VideoFramePool();
-
- RefPtr<VideoFrameSurface<LIBAV_VER>> GetVideoFrameSurface(
-- VADRMPRIMESurfaceDescriptor& aVaDesc, AVCodecContext* aAVCodecContext,
-- AVFrame* aAVFrame, FFmpegLibWrapper* aLib);
-+ VADRMPRIMESurfaceDescriptor& aVaDesc, int aWidth, int aHeight,
-+ AVCodecContext* aAVCodecContext, AVFrame* aAVFrame,
-+ FFmpegLibWrapper* aLib);
- void ReleaseUnusedVAAPIFrames();
-
- private:
- RefPtr<VideoFrameSurface<LIBAV_VER>> GetFreeVideoFrameSurface();
-
-diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp
b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp
---- a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp
-+++ b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp
-@@ -111,12 +111,13 @@
- return nullptr;
- }
-
- RefPtr<VideoFrameSurface<LIBAV_VER>>
- VideoFramePool<LIBAV_VER>::GetVideoFrameSurface(
-- VADRMPRIMESurfaceDescriptor& aVaDesc, AVCodecContext* aAVCodecContext,
-- AVFrame* aAVFrame, FFmpegLibWrapper* aLib) {
-+ VADRMPRIMESurfaceDescriptor& aVaDesc, int aWidth, int aHeight,
-+ AVCodecContext* aAVCodecContext, AVFrame* aAVFrame,
-+ FFmpegLibWrapper* aLib) {
- if (aVaDesc.fourcc != VA_FOURCC_NV12 && aVaDesc.fourcc != VA_FOURCC_YV12
&&
- aVaDesc.fourcc != VA_FOURCC_P010) {
- FFMPEG_LOG("Unsupported VA-API surface format %d", aVaDesc.fourcc);
- return nullptr;
- }
-@@ -124,11 +125,11 @@
- MutexAutoLock lock(mSurfaceLock);
- RefPtr<VideoFrameSurface<LIBAV_VER>> videoSurface =
- GetFreeVideoFrameSurface();
- if (!videoSurface) {
- RefPtr<DMABufSurfaceYUV> surface =
-- DMABufSurfaceYUV::CreateYUVSurface(aVaDesc);
-+ DMABufSurfaceYUV::CreateYUVSurface(aVaDesc, aWidth, aHeight);
- if (!surface) {
- return nullptr;
- }
- FFMPEG_LOG("Created new VA-API DMABufSurface UID = %d",
surface->GetUID());
- RefPtr<VideoFrameSurface<LIBAV_VER>> surf =
-@@ -142,11 +143,11 @@
- }
- videoSurface = surf;
- mDMABufSurfaces.AppendElement(std::move(surf));
- } else {
- RefPtr<DMABufSurfaceYUV> surface = videoSurface->GetDMABufSurface();
-- if (!surface->UpdateYUVData(aVaDesc)) {
-+ if (!surface->UpdateYUVData(aVaDesc, aWidth, aHeight)) {
- return nullptr;
- }
- FFMPEG_LOG("Reusing VA-API DMABufSurface UID = %d", surface->GetUID());
- }
- videoSurface->LockVAAPIData(aAVCodecContext, aAVFrame, aLib);
-
diff --git
a/http/firefox/patches/0033-p07-bmo-1759784-vaapi-fixes-D146087.patch
b/http/firefox/patches/0033-p07-bmo-1759784-vaapi-fixes-D146087.patch
deleted file mode 100644
index d5dcf9d..0000000
--- a/http/firefox/patches/0033-p07-bmo-1759784-vaapi-fixes-D146087.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
---- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
-+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
-@@ -1164,12 +1164,12 @@
- NS_ERROR_DOM_MEDIA_DECODE_ERR,
- RESULT_DETAIL("Unable to get frame by vaExportSurfaceHandle()"));
- }
-
- MOZ_ASSERT(mTaskQueue->IsOnCurrentThread());
-- auto surface = mVideoFramePool->GetVideoFrameSurface(vaDesc,
mCodecContext,
-- mFrame, mLib);
-+ auto surface = mVideoFramePool->GetVideoFrameSurface(
-+ vaDesc, mFrame->width, mFrame->height, mCodecContext, mFrame, mLib);
- if (!surface) {
- return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
- RESULT_DETAIL("VAAPI dmabuf allocation error"));
- }
- surface->SetYUVColorSpace(GetFrameColorSpace());
-
diff --git
a/http/firefox/patches/0033-p08-bmo-1768191-vaapi-fixes-D145725.patch
b/http/firefox/patches/0033-p08-bmo-1768191-vaapi-fixes-D145725.patch
deleted file mode 100644
index 1c28b10..0000000
--- a/http/firefox/patches/0033-p08-bmo-1768191-vaapi-fixes-D145725.patch
+++ /dev/null
@@ -1,132 +0,0 @@
-diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
---- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
-+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
-@@ -106,10 +106,11 @@
- bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
- bool IsHardwareAccelerated() const {
- nsAutoCString dummy;
- return IsHardwareAccelerated(dummy);
- }
-+ void UpdateDecodeTimes(TimeStamp aDecodeStart);
-
- #if LIBAVCODEC_VERSION_MAJOR >= 57 && LIBAVUTIL_VERSION_MAJOR >= 56
- layers::TextureClient* AllocateTextureClientForImage(
- struct AVCodecContext* aCodecContext, layers::PlanarYCbCrImage*
aImage);
-
-@@ -142,10 +143,15 @@
- static nsTArray<AVCodecID> mAcceleratedFormats;
- #endif
- RefPtr<KnowsCompositor> mImageAllocator;
- RefPtr<ImageContainer> mImageContainer;
- VideoInfo mInfo;
-+ int mDecodedFrames;
-+#if LIBAVCODEC_VERSION_MAJOR >= 58
-+ int mDecodedFramesLate;
-+#endif
-+ float mAverangeDecodeTime;
-
- class PtsCorrectionContext {
- public:
- PtsCorrectionContext();
- int64_t GuessCorrectPts(int64_t aPts, int64_t aDts);
-diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
---- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
-+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
-@@ -383,10 +383,15 @@
- mDisplay(nullptr),
- #endif
- mImageAllocator(aAllocator),
- mImageContainer(aImageContainer),
- mInfo(aConfig),
-+ mDecodedFrames(0),
-+#if LIBAVCODEC_VERSION_MAJOR >= 58
-+ mDecodedFramesLate(0),
-+#endif
-+ mAverangeDecodeTime(0),
- mLowLatency(aLowLatency) {
- FFMPEG_LOG("FFmpegVideoDecoder::FFmpegVideoDecoder MIME %s Codec ID %d",
- aConfig.mMimeType.get(), mCodecID);
- // Use a new MediaByteBuffer as the object will be modified during
- // initialization.
-@@ -769,17 +774,41 @@
- #else
- return aFrame->pkt_pts;
- #endif
- }
-
-+void FFmpegVideoDecoder<LIBAV_VER>::UpdateDecodeTimes(TimeStamp
aDecodeStart) {
-+ mDecodedFrames++;
-+ float decodeTime = (TimeStamp::Now() - aDecodeStart).ToMilliseconds();
-+ mAverangeDecodeTime =
-+ (mAverangeDecodeTime * (mDecodedFrames - 1) + decodeTime) /
-+ mDecodedFrames;
-+ FFMPEG_LOG(" averange frame decode time %.2f ms decoded frames %d\n",
-+ mAverangeDecodeTime, mDecodedFrames);
-+#if LIBAVCODEC_VERSION_MAJOR >= 58
-+ int frameDuration = mFrame->pkt_duration;
-+ if (frameDuration > 0 && frameDuration / 1000.0 < decodeTime) {
-+ mDecodedFramesLate++;
-+ FFMPEG_LOG(
-+ " slow decode: failed to decode in time, frame duration %.2f ms, "
-+ "decode time %.2f\n",
-+ frameDuration / 1000.0, decodeTime);
-+ FFMPEG_LOG(" all decoded frames / late decoded frames %d/%d\n",
-+ mDecodedFrames, mDecodedFramesLate);
-+ }
-+#endif
-+}
-+
- MediaResult FFmpegVideoDecoder<LIBAV_VER>::DoDecode(
- MediaRawData* aSample, uint8_t* aData, int aSize, bool* aGotFrame,
- MediaDataDecoder::DecodedData& aResults) {
- MOZ_ASSERT(mTaskQueue->IsOnCurrentThread());
- AVPacket packet;
- mLib->av_init_packet(&packet);
-
-+ TimeStamp decodeStart = TimeStamp::Now();
-+
- packet.data = aData;
- packet.size = aSize;
- packet.dts = aSample->mTimecode.ToMicroseconds();
- packet.pts = aSample->mTime.ToMicroseconds();
- packet.flags = aSample->mKeyframe ? AV_PKT_FLAG_KEY : 0;
-@@ -794,11 +823,10 @@
- // at a time, and we immediately call avcodec_receive_frame right after.
- FFMPEG_LOG("avcodec_send_packet error: %d", res);
- return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
- RESULT_DETAIL("avcodec_send_packet error: %d", res));
- }
--
- if (aGotFrame) {
- *aGotFrame = false;
- }
- do {
- if (!PrepareFrame()) {
-@@ -831,10 +859,13 @@
- FFMPEG_LOG(" avcodec_receive_frame error: %d", res);
- return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
- RESULT_DETAIL("avcodec_receive_frame error: %d",
res));
- }
-
-+ UpdateDecodeTimes(decodeStart);
-+ decodeStart = TimeStamp::Now();
-+
- MediaResult rv;
- # ifdef MOZ_WAYLAND_USE_VAAPI
- if (IsHardwareAccelerated()) {
- rv = CreateImageVAAPI(mFrame->pkt_pos, GetFramePts(mFrame),
- mFrame->pkt_duration, aResults);
-@@ -898,10 +929,12 @@
- *aGotFrame = false;
- }
- return NS_OK;
- }
-
-+ UpdateDecodeTimes(decodeStart);
-+
- // If we've decoded a frame then we need to output it
- int64_t pts =
- mPtsContext.GuessCorrectPts(GetFramePts(mFrame), mFrame->pkt_dts);
- // Retrieve duration from dts.
- // We use the first entry found matching this dts (this is done to
-
diff --git
a/http/firefox/patches/0033-p09-bmo-1768651-vaapi-fixes-D145966.patch
b/http/firefox/patches/0033-p09-bmo-1768651-vaapi-fixes-D145966.patch
deleted file mode 100644
index 2ecfaec..0000000
--- a/http/firefox/patches/0033-p09-bmo-1768651-vaapi-fixes-D145966.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
---- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
-+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
-@@ -780,12 +780,13 @@
- mDecodedFrames++;
- float decodeTime = (TimeStamp::Now() - aDecodeStart).ToMilliseconds();
- mAverangeDecodeTime =
- (mAverangeDecodeTime * (mDecodedFrames - 1) + decodeTime) /
- mDecodedFrames;
-- FFMPEG_LOG(" averange frame decode time %.2f ms decoded frames %d\n",
-- mAverangeDecodeTime, mDecodedFrames);
-+ FFMPEG_LOG(
-+ " decode time %.2f ms averange decode time %.2f ms decoded frames
%d\n",
-+ decodeTime, mAverangeDecodeTime, mDecodedFrames);
- #if LIBAVCODEC_VERSION_MAJOR >= 58
- int frameDuration = mFrame->pkt_duration;
- if (frameDuration > 0 && frameDuration / 1000.0 < decodeTime) {
- mDecodedFramesLate++;
- FFMPEG_LOG(
-
diff --git
a/http/firefox/patches/0033-p10-bmo-1750388-vaapi-fixes-D145871.patch
b/http/firefox/patches/0033-p10-bmo-1750388-vaapi-fixes-D145871.patch
deleted file mode 100644
index 33a2e61..0000000
--- a/http/firefox/patches/0033-p10-bmo-1750388-vaapi-fixes-D145871.patch
+++ /dev/null
@@ -1,140 +0,0 @@
-diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
---- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
-+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
-@@ -146,10 +146,15 @@
- RefPtr<ImageContainer> mImageContainer;
- VideoInfo mInfo;
- int mDecodedFrames;
- #if LIBAVCODEC_VERSION_MAJOR >= 58
- int mDecodedFramesLate;
-+ // Tracks when decode time of recent frame and averange decode time of
-+ // previous frames is bigger than frame interval,
-+ // i.e. we fail to decode in time.
-+ // We switch to SW decode when we hit HW_DECODE_LATE_FRAMES treshold.
-+ int mMissedDecodeInAverangeTime;
- #endif
- float mAverangeDecodeTime;
-
- class PtsCorrectionContext {
- public:
-diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
---- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
-+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
-@@ -14,10 +14,13 @@
- #include "VPXDecoder.h"
- #include "mozilla/layers/KnowsCompositor.h"
- #if LIBAVCODEC_VERSION_MAJOR >= 57
- # include "mozilla/layers/TextureClient.h"
- #endif
-+#if LIBAVCODEC_VERSION_MAJOR >= 58
-+# include "mozilla/ProfilerMarkers.h"
-+#endif
- #ifdef MOZ_WAYLAND_USE_VAAPI
- # include "H264.h"
- # include "mozilla/layers/DMABUFSurfaceImage.h"
- # include "mozilla/widget/DMABufLibWrapper.h"
- # include "FFmpegVideoFramePool.h"
-@@ -56,13 +59,14 @@
- typedef int VAStatus;
- # define VA_EXPORT_SURFACE_READ_ONLY 0x0001
- # define VA_EXPORT_SURFACE_SEPARATE_LAYERS 0x0004
- # define VA_STATUS_SUCCESS 0x00000000
- #endif
--
- // Use some extra HW frames for potential rendering lags.
- #define EXTRA_HW_FRAMES 6
-+// Defines number of delayed frames until we switch back to SW decode.
-+#define HW_DECODE_LATE_FRAMES 15
-
- #if LIBAVCODEC_VERSION_MAJOR >= 57 && LIBAVUTIL_VERSION_MAJOR >= 56
- # define CUSTOMIZED_BUFFER_ALLOCATION 1
- #endif
-
-@@ -386,10 +390,11 @@
- mImageContainer(aImageContainer),
- mInfo(aConfig),
- mDecodedFrames(0),
- #if LIBAVCODEC_VERSION_MAJOR >= 58
- mDecodedFramesLate(0),
-+ mMissedDecodeInAverangeTime(0),
- #endif
- mAverangeDecodeTime(0),
- mLowLatency(aLowLatency) {
- FFMPEG_LOG("FFmpegVideoDecoder::FFmpegVideoDecoder MIME %s Codec ID %d",
- aConfig.mMimeType.get(), mCodecID);
-@@ -781,22 +786,32 @@
- float decodeTime = (TimeStamp::Now() - aDecodeStart).ToMilliseconds();
- mAverangeDecodeTime =
- (mAverangeDecodeTime * (mDecodedFrames - 1) + decodeTime) /
- mDecodedFrames;
- FFMPEG_LOG(
-- " decode time %.2f ms averange decode time %.2f ms decoded frames
%d\n",
-+ "Frame decode finished, time %.2f ms averange decode time %.2f ms "
-+ "decoded %d frames\n",
- decodeTime, mAverangeDecodeTime, mDecodedFrames);
- #if LIBAVCODEC_VERSION_MAJOR >= 58
-- int frameDuration = mFrame->pkt_duration;
-- if (frameDuration > 0 && frameDuration / 1000.0 < decodeTime) {
-- mDecodedFramesLate++;
-- FFMPEG_LOG(
-- " slow decode: failed to decode in time, frame duration %.2f ms, "
-- "decode time %.2f\n",
-- frameDuration / 1000.0, decodeTime);
-- FFMPEG_LOG(" all decoded frames / late decoded frames %d/%d\n",
-- mDecodedFrames, mDecodedFramesLate);
-+ if (mFrame->pkt_duration > 0) {
-+ // Switch frame duration to ms
-+ float frameDuration = mFrame->pkt_duration / 1000.0f;
-+ if (frameDuration < decodeTime) {
-+ PROFILER_MARKER_TEXT("FFmpegVideoDecoder::DoDecode", MEDIA_PLAYBACK,
{},
-+ "frame decode takes too long");
-+ mDecodedFramesLate++;
-+ if (frameDuration < mAverangeDecodeTime) {
-+ mMissedDecodeInAverangeTime++;
-+ }
-+ FFMPEG_LOG(
-+ " slow decode: failed to decode in time, frame duration %.2f ms,
"
-+ "decode time %.2f\n",
-+ frameDuration, decodeTime);
-+ FFMPEG_LOG(" frames: all decoded %d late decoded %d over averange
%d\n",
-+ mDecodedFrames, mDecodedFramesLate,
-+ mMissedDecodeInAverangeTime);
-+ }
- }
- #endif
- }
-
- MediaResult FFmpegVideoDecoder<LIBAV_VER>::DoDecode(
-@@ -866,10 +881,18 @@
- decodeStart = TimeStamp::Now();
-
- MediaResult rv;
- # ifdef MOZ_WAYLAND_USE_VAAPI
- if (IsHardwareAccelerated()) {
-+ if (mMissedDecodeInAverangeTime > HW_DECODE_LATE_FRAMES) {
-+ PROFILER_MARKER_TEXT("FFmpegVideoDecoder::DoDecode",
MEDIA_PLAYBACK, {},
-+ "Fallback to SW decode");
-+ FFMPEG_LOG(" HW decoding is slow, switch back to SW decode");
-+ return MediaResult(
-+ NS_ERROR_DOM_MEDIA_DECODE_ERR,
-+ RESULT_DETAIL("HW decoding is slow, switch back to SW decode"));
-+ }
- rv = CreateImageVAAPI(mFrame->pkt_pos, GetFramePts(mFrame),
- mFrame->pkt_duration, aResults);
- // If VA-API playback failed, just quit. Decoder is going to be
restarted
- // without VA-API.
- if (NS_FAILED(rv)) {
-@@ -1129,11 +1152,11 @@
- }
-
- MediaResult FFmpegVideoDecoder<LIBAV_VER>::CreateImageVAAPI(
- int64_t aOffset, int64_t aPts, int64_t aDuration,
- MediaDataDecoder::DecodedData& aResults) {
-- FFMPEG_LOG("VA-API Got one frame output with pts=%" PRId64 "dts=%" PRId64
-+ FFMPEG_LOG("VA-API Got one frame output with pts=%" PRId64 " dts=%" PRId64
- " duration=%" PRId64 " opaque=%" PRId64,
- aPts, mFrame->pkt_dts, aDuration,
mCodecContext->reordered_opaque);
-
- VADRMPRIMESurfaceDescriptor vaDesc;
- if (!GetVAAPISurfaceDescriptor(&vaDesc)) {
-
diff --git
a/http/firefox/patches/0033-p11-bmo-1769182-vaapi-fixes-D146271.patch
b/http/firefox/patches/0033-p11-bmo-1769182-vaapi-fixes-D146271.patch
deleted file mode 100644
index fd2e0b0..0000000
--- a/http/firefox/patches/0033-p11-bmo-1769182-vaapi-fixes-D146271.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-diff -up firefox-101.0/security/sandbox/linux/SandboxFilter.cpp.D146271.diff
firefox-101.0/security/sandbox/linux/SandboxFilter.cpp
---- firefox-101.0/security/sandbox/linux/SandboxFilter.cpp.D146271.diff
2022-05-27 01:16:59.000000000 +0200
-+++ firefox-101.0/security/sandbox/linux/SandboxFilter.cpp 2022-06-09
09:59:35.569235176 +0200
-@@ -125,28 +125,12 @@ namespace mozilla {
- // denied if no broker client is provided by the concrete class.
- class SandboxPolicyCommon : public SandboxPolicyBase {
- protected:
-- enum class ShmemUsage : uint8_t {
-- MAY_CREATE,
-- ONLY_USE,
-- };
--
-- enum class AllowUnsafeSocketPair : uint8_t {
-- NO,
-- YES,
-- };
--
-+ // Subclasses can assign these in their constructors to loosen the
-+ // default settings.
- SandboxBrokerClient* mBroker = nullptr;
- bool mMayCreateShmem = false;
- bool mAllowUnsafeSocketPair = false;
-
-- explicit SandboxPolicyCommon(SandboxBrokerClient* aBroker,
-- ShmemUsage aShmemUsage,
-- AllowUnsafeSocketPair aAllowUnsafeSocketPair)
-- : mBroker(aBroker),
-- mMayCreateShmem(aShmemUsage == ShmemUsage::MAY_CREATE),
-- mAllowUnsafeSocketPair(aAllowUnsafeSocketPair ==
-- AllowUnsafeSocketPair::YES) {}
--
- SandboxPolicyCommon() = default;
-
- typedef const sandbox::arch_seccomp_data& ArgsRef;
-@@ -1228,11 +1212,13 @@ class ContentSandboxPolicy : public Sand
- public:
- ContentSandboxPolicy(SandboxBrokerClient* aBroker,
- ContentProcessSandboxParams&& aParams)
-- : SandboxPolicyCommon(aBroker, ShmemUsage::MAY_CREATE,
-- AllowUnsafeSocketPair::YES),
-- mParams(std::move(aParams)),
-+ : mParams(std::move(aParams)),
- mAllowSysV(PR_GetEnv("MOZ_SANDBOX_ALLOW_SYSV") != nullptr),
-- mUsingRenderDoc(PR_GetEnv("RENDERDOC_CAPTUREOPTS") != nullptr) {}
-+ mUsingRenderDoc(PR_GetEnv("RENDERDOC_CAPTUREOPTS") != nullptr) {
-+ mBroker = aBroker;
-+ mMayCreateShmem = true;
-+ mAllowUnsafeSocketPair = true;
-+ }
-
- ~ContentSandboxPolicy() override = default;
-
-@@ -1762,9 +1748,10 @@ UniquePtr<sandbox::bpf_dsl::Policy> GetM
- // segments, so it may need file brokering.
- class RDDSandboxPolicy final : public SandboxPolicyCommon {
- public:
-- explicit RDDSandboxPolicy(SandboxBrokerClient* aBroker)
-- : SandboxPolicyCommon(aBroker, ShmemUsage::MAY_CREATE,
-- AllowUnsafeSocketPair::NO) {}
-+ explicit RDDSandboxPolicy(SandboxBrokerClient* aBroker) {
-+ mBroker = aBroker;
-+ mMayCreateShmem = true;
-+ }
-
- #ifndef ANDROID
- Maybe<ResultExpr> EvaluateIpcCall(int aCall, int aArgShift) const
override {
-@@ -1875,9 +1862,10 @@ UniquePtr<sandbox::bpf_dsl::Policy> GetD
- // the SocketProcess sandbox looks like.
- class SocketProcessSandboxPolicy final : public SandboxPolicyCommon {
- public:
-- explicit SocketProcessSandboxPolicy(SandboxBrokerClient* aBroker)
-- : SandboxPolicyCommon(aBroker, ShmemUsage::MAY_CREATE,
-- AllowUnsafeSocketPair::NO) {}
-+ explicit SocketProcessSandboxPolicy(SandboxBrokerClient* aBroker) {
-+ mBroker = aBroker;
-+ mMayCreateShmem = true;
-+ }
-
- static intptr_t FcntlTrap(const sandbox::arch_seccomp_data& aArgs,
- void* aux) {
-@@ -2013,9 +2001,10 @@ UniquePtr<sandbox::bpf_dsl::Policy> GetS
-
- class UtilitySandboxPolicy : public SandboxPolicyCommon {
- public:
-- explicit UtilitySandboxPolicy(SandboxBrokerClient* aBroker)
-- : SandboxPolicyCommon(aBroker, ShmemUsage::MAY_CREATE,
-- AllowUnsafeSocketPair::NO) {}
-+ explicit UtilitySandboxPolicy(SandboxBrokerClient* aBroker) {
-+ mBroker = aBroker;
-+ mMayCreateShmem = true;
-+ }
-
- ResultExpr PrctlPolicy() const override {
- Arg<int> op(0);
diff --git
a/http/firefox/patches/0033-p12-bmo-1769182-vaapi-fixes-D146271.patch
b/http/firefox/patches/0033-p12-bmo-1769182-vaapi-fixes-D146271.patch
deleted file mode 100644
index 0a2c749..0000000
--- a/http/firefox/patches/0033-p12-bmo-1769182-vaapi-fixes-D146271.patch
+++ /dev/null
@@ -1,373 +0,0 @@
-diff --git a/security/sandbox/linux/SandboxFilter.cpp
b/security/sandbox/linux/SandboxFilter.cpp
---- a/security/sandbox/linux/SandboxFilter.cpp
-+++ b/security/sandbox/linux/SandboxFilter.cpp
-@@ -128,10 +128,11 @@
- // Subclasses can assign these in their constructors to loosen the
- // default settings.
- SandboxBrokerClient* mBroker = nullptr;
- bool mMayCreateShmem = false;
- bool mAllowUnsafeSocketPair = false;
-+ bool mBrokeredConnect = false; // Can connect() be brokered?
-
- SandboxPolicyCommon() = default;
-
- typedef const sandbox::arch_seccomp_data& ArgsRef;
-
-@@ -533,10 +534,124 @@
- MOZ_CRASH("unreachable?");
- return -ENOSYS;
- #endif
- }
-
-+ // This just needs to return something to stand in for the
-+ // unconnected socket until ConnectTrap, below, and keep track of
-+ // the socket type somehow. Half a socketpair *is* a socket, so it
-+ // should result in minimal confusion in the caller.
-+ static intptr_t FakeSocketTrapCommon(int domain, int type, int protocol) {
-+ int fds[2];
-+ // X11 client libs will still try to getaddrinfo() even for a
-+ // local connection. Also, WebRTC still has vestigial network
-+ // code trying to do things in the content process. Politely tell
-+ // them no.
-+ if (domain != AF_UNIX) {
-+ return -EAFNOSUPPORT;
-+ }
-+ if (socketpair(domain, type, protocol, fds) != 0) {
-+ return -errno;
-+ }
-+ close(fds[1]);
-+ return fds[0];
-+ }
-+
-+ static intptr_t FakeSocketTrap(ArgsRef aArgs, void* aux) {
-+ return FakeSocketTrapCommon(static_cast<int>(aArgs.args[0]),
-+ static_cast<int>(aArgs.args[1]),
-+ static_cast<int>(aArgs.args[2]));
-+ }
-+
-+ static intptr_t FakeSocketTrapLegacy(ArgsRef aArgs, void* aux) {
-+ const auto innerArgs = reinterpret_cast<unsigned long*>(aArgs.args[1]);
-+
-+ return FakeSocketTrapCommon(static_cast<int>(innerArgs[0]),
-+ static_cast<int>(innerArgs[1]),
-+ static_cast<int>(innerArgs[2]));
-+ }
-+
-+ static Maybe<int> DoGetSockOpt(int fd, int optname) {
-+ int optval;
-+ socklen_t optlen = sizeof(optval);
-+
-+ if (getsockopt(fd, SOL_SOCKET, optname, &optval, &optlen) != 0) {
-+ return Nothing();
-+ }
-+ MOZ_RELEASE_ASSERT(static_cast<size_t>(optlen) == sizeof(optval));
-+ return Some(optval);
-+ }
-+
-+ // Substitute the newly connected socket from the broker for the
-+ // original socket. This is meant to be used on a fd from
-+ // FakeSocketTrap, above, but it should also work to simulate
-+ // re-connect()ing a real connected socket.
-+ //
-+ // Warning: This isn't quite right if the socket is dup()ed, because
-+ // other duplicates will still be the original socket, but hopefully
-+ // nothing we're dealing with does that.
-+ static intptr_t ConnectTrapCommon(SandboxBrokerClient* aBroker, int aFd,
-+ const struct sockaddr_un* aAddr,
-+ socklen_t aLen) {
-+ if (aFd < 0) {
-+ return -EBADF;
-+ }
-+ const auto maybeDomain = DoGetSockOpt(aFd, SO_DOMAIN);
-+ if (!maybeDomain) {
-+ return -errno;
-+ }
-+ if (*maybeDomain != AF_UNIX) {
-+ return -EAFNOSUPPORT;
-+ }
-+ const auto maybeType = DoGetSockOpt(aFd, SO_TYPE);
-+ if (!maybeType) {
-+ return -errno;
-+ }
-+ const int oldFlags = fcntl(aFd, F_GETFL);
-+ if (oldFlags == -1) {
-+ return -errno;
-+ }
-+ const int newFd = aBroker->Connect(aAddr, aLen, *maybeType);
-+ if (newFd < 0) {
-+ return newFd;
-+ }
-+ // Copy over the nonblocking flag. The connect() won't be
-+ // nonblocking in that case, but that shouldn't matter for
-+ // AF_UNIX. The other fcntl-settable flags are either irrelevant
-+ // for sockets (e.g., O_APPEND) or would be blocked by this
-+ // seccomp-bpf policy, so they're ignored.
-+ if (fcntl(newFd, F_SETFL, oldFlags & O_NONBLOCK) != 0) {
-+ close(newFd);
-+ return -errno;
-+ }
-+ if (dup2(newFd, aFd) < 0) {
-+ close(newFd);
-+ return -errno;
-+ }
-+ close(newFd);
-+ return 0;
-+ }
-+
-+ static intptr_t ConnectTrap(ArgsRef aArgs, void* aux) {
-+ typedef const struct sockaddr_un* AddrPtr;
-+
-+ return ConnectTrapCommon(static_cast<SandboxBrokerClient*>(aux),
-+ static_cast<int>(aArgs.args[0]),
-+ reinterpret_cast<AddrPtr>(aArgs.args[1]),
-+ static_cast<socklen_t>(aArgs.args[2]));
-+ }
-+
-+ static intptr_t ConnectTrapLegacy(ArgsRef aArgs, void* aux) {
-+ const auto innerArgs = reinterpret_cast<unsigned long*>(aArgs.args[1]);
-+ typedef const struct sockaddr_un* AddrPtr;
-+
-+ return ConnectTrapCommon(static_cast<SandboxBrokerClient*>(aux),
-+ static_cast<int>(innerArgs[0]),
-+ reinterpret_cast<AddrPtr>(innerArgs[1]),
-+ static_cast<socklen_t>(innerArgs[2]));
-+ }
-+
- public:
- ResultExpr InvalidSyscall() const override {
- return Trap(BlockedSyscallTrap, nullptr);
- }
-
-@@ -630,15 +745,37 @@
- return Some(Allow());
- }
- Arg<int> level(1), optname(2);
- // SO_SNDBUF is used by IPC to avoid constructing
- // unnecessarily large gather arrays for `sendmsg`.
-- return Some(
-- If(AllOf(level == SOL_SOCKET, optname == SO_SNDBUF), Allow())
-- .Else(InvalidSyscall()));
-+ //
-+ // SO_DOMAIN and SO_TYPE are needed for connect() brokering,
-+ // but they're harmless even when it's not enabled.
-+ return Some(If(AllOf(level == SOL_SOCKET,
-+ AnyOf(optname == SO_SNDBUF, optname ==
SO_DOMAIN,
-+ optname == SO_TYPE)),
-+ Allow())
-+ .Else(InvalidSyscall()));
- }
-
-+ // These two cases are for connect() brokering, if enabled.
-+ case SYS_SOCKET:
-+ if (mBrokeredConnect) {
-+ const auto trapFn = aHasArgs ? FakeSocketTrap :
FakeSocketTrapLegacy;
-+ MOZ_ASSERT(mBroker);
-+ return Some(Trap(trapFn, mBroker));
-+ }
-+ return Nothing();
-+
-+ case SYS_CONNECT:
-+ if (mBrokeredConnect) {
-+ const auto trapFn = aHasArgs ? ConnectTrap : ConnectTrapLegacy;
-+ MOZ_ASSERT(mBroker);
-+ return Some(Trap(trapFn, mBroker));
-+ }
-+ return Nothing();
-+
- default:
- return Nothing();
- }
- }
-
-@@ -1006,10 +1143,16 @@
- return If(AnyOf(request == TCGETS, request == TIOCGWINSZ),
- Error(ENOTTY))
- .Else(SandboxPolicyBase::EvaluateSyscall(sysno));
- }
-
-+ CASES_FOR_dup2: // See ConnectTrapCommon
-+ if (mBrokeredConnect) {
-+ return Allow();
-+ }
-+ return SandboxPolicyBase::EvaluateSyscall(sysno);
-+
- #ifdef MOZ_ASAN
- // ASAN's error reporter wants to know if stderr is a tty.
- case __NR_ioctl: {
- Arg<int> fd(0);
- return If(fd == STDERR_FILENO,
Error(ENOTTY)).Else(InvalidSyscall());
-@@ -1093,133 +1236,20 @@
-
- close(fd);
- return rv;
- }
-
-- // This just needs to return something to stand in for the
-- // unconnected socket until ConnectTrap, below, and keep track of
-- // the socket type somehow. Half a socketpair *is* a socket, so it
-- // should result in minimal confusion in the caller.
-- static intptr_t FakeSocketTrapCommon(int domain, int type, int protocol) {
-- int fds[2];
-- // X11 client libs will still try to getaddrinfo() even for a
-- // local connection. Also, WebRTC still has vestigial network
-- // code trying to do things in the content process. Politely tell
-- // them no.
-- if (domain != AF_UNIX) {
-- return -EAFNOSUPPORT;
-- }
-- if (socketpair(domain, type, protocol, fds) != 0) {
-- return -errno;
-- }
-- close(fds[1]);
-- return fds[0];
-- }
--
-- static intptr_t FakeSocketTrap(ArgsRef aArgs, void* aux) {
-- return FakeSocketTrapCommon(static_cast<int>(aArgs.args[0]),
-- static_cast<int>(aArgs.args[1]),
-- static_cast<int>(aArgs.args[2]));
-- }
--
-- static intptr_t FakeSocketTrapLegacy(ArgsRef aArgs, void* aux) {
-- const auto innerArgs = reinterpret_cast<unsigned long*>(aArgs.args[1]);
--
-- return FakeSocketTrapCommon(static_cast<int>(innerArgs[0]),
-- static_cast<int>(innerArgs[1]),
-- static_cast<int>(innerArgs[2]));
-- }
--
-- static Maybe<int> DoGetSockOpt(int fd, int optname) {
-- int optval;
-- socklen_t optlen = sizeof(optval);
--
-- if (getsockopt(fd, SOL_SOCKET, optname, &optval, &optlen) != 0) {
-- return Nothing();
-- }
-- MOZ_RELEASE_ASSERT(static_cast<size_t>(optlen) == sizeof(optval));
-- return Some(optval);
-- }
--
-- // Substitute the newly connected socket from the broker for the
-- // original socket. This is meant to be used on a fd from
-- // FakeSocketTrap, above, but it should also work to simulate
-- // re-connect()ing a real connected socket.
-- //
-- // Warning: This isn't quite right if the socket is dup()ed, because
-- // other duplicates will still be the original socket, but hopefully
-- // nothing we're dealing with does that.
-- static intptr_t ConnectTrapCommon(SandboxBrokerClient* aBroker, int aFd,
-- const struct sockaddr_un* aAddr,
-- socklen_t aLen) {
-- if (aFd < 0) {
-- return -EBADF;
-- }
-- const auto maybeDomain = DoGetSockOpt(aFd, SO_DOMAIN);
-- if (!maybeDomain) {
-- return -errno;
-- }
-- if (*maybeDomain != AF_UNIX) {
-- return -EAFNOSUPPORT;
-- }
-- const auto maybeType = DoGetSockOpt(aFd, SO_TYPE);
-- if (!maybeType) {
-- return -errno;
-- }
-- const int oldFlags = fcntl(aFd, F_GETFL);
-- if (oldFlags == -1) {
-- return -errno;
-- }
-- const int newFd = aBroker->Connect(aAddr, aLen, *maybeType);
-- if (newFd < 0) {
-- return newFd;
-- }
-- // Copy over the nonblocking flag. The connect() won't be
-- // nonblocking in that case, but that shouldn't matter for
-- // AF_UNIX. The other fcntl-settable flags are either irrelevant
-- // for sockets (e.g., O_APPEND) or would be blocked by this
-- // seccomp-bpf policy, so they're ignored.
-- if (fcntl(newFd, F_SETFL, oldFlags & O_NONBLOCK) != 0) {
-- close(newFd);
-- return -errno;
-- }
-- if (dup2(newFd, aFd) < 0) {
-- close(newFd);
-- return -errno;
-- }
-- close(newFd);
-- return 0;
-- }
--
-- static intptr_t ConnectTrap(ArgsRef aArgs, void* aux) {
-- typedef const struct sockaddr_un* AddrPtr;
--
-- return ConnectTrapCommon(static_cast<SandboxBrokerClient*>(aux),
-- static_cast<int>(aArgs.args[0]),
-- reinterpret_cast<AddrPtr>(aArgs.args[1]),
-- static_cast<socklen_t>(aArgs.args[2]));
-- }
--
-- static intptr_t ConnectTrapLegacy(ArgsRef aArgs, void* aux) {
-- const auto innerArgs = reinterpret_cast<unsigned long*>(aArgs.args[1]);
-- typedef const struct sockaddr_un* AddrPtr;
--
-- return ConnectTrapCommon(static_cast<SandboxBrokerClient*>(aux),
-- static_cast<int>(innerArgs[0]),
-- reinterpret_cast<AddrPtr>(innerArgs[1]),
-- static_cast<socklen_t>(innerArgs[2]));
-- }
--
- public:
- ContentSandboxPolicy(SandboxBrokerClient* aBroker,
- ContentProcessSandboxParams&& aParams)
- : mParams(std::move(aParams)),
- mAllowSysV(PR_GetEnv("MOZ_SANDBOX_ALLOW_SYSV") != nullptr),
- mUsingRenderDoc(PR_GetEnv("RENDERDOC_CAPTUREOPTS") != nullptr) {
- mBroker = aBroker;
- mMayCreateShmem = true;
- mAllowUnsafeSocketPair = true;
-+ mBrokeredConnect = true;
- }
-
- ~ContentSandboxPolicy() override = default;
-
- Maybe<ResultExpr> EvaluateSocketCall(int aCall,
-@@ -1232,18 +1262,16 @@
-
- #ifdef ANDROID
- case SYS_SOCKET:
- return Some(Error(EACCES));
- #else // #ifdef DESKTOP
-- case SYS_SOCKET: {
-- const auto trapFn = aHasArgs ? FakeSocketTrap :
FakeSocketTrapLegacy;
-- return Some(AllowBelowLevel(4, Trap(trapFn, nullptr)));
-- }
-- case SYS_CONNECT: {
-- const auto trapFn = aHasArgs ? ConnectTrap : ConnectTrapLegacy;
-- return Some(AllowBelowLevel(4, Trap(trapFn, mBroker)));
-- }
-+ case SYS_SOCKET:
-+ case SYS_CONNECT:
-+ if (BelowLevel(4)) {
-+ return Some(Allow());
-+ }
-+ return SandboxPolicyCommon::EvaluateSocketCall(aCall, aHasArgs);
- case SYS_RECV:
- case SYS_SEND:
- case SYS_GETSOCKOPT:
- case SYS_SETSOCKOPT:
- case SYS_GETSOCKNAME:
-@@ -1458,13 +1486,10 @@
-
- case __NR_getrusage:
- case __NR_times:
- return Allow();
-
-- CASES_FOR_dup2: // See ConnectTrapCommon
-- return Allow();
--
- case __NR_fsync:
- case __NR_msync:
- return Allow();
-
- case __NR_getpriority:
-
diff --git
a/http/firefox/patches/0033-p13-bmo-1769182-vaapi-fixes-D146273.patch
b/http/firefox/patches/0033-p13-bmo-1769182-vaapi-fixes-D146273.patch
deleted file mode 100644
index 0d838e2..0000000
--- a/http/firefox/patches/0033-p13-bmo-1769182-vaapi-fixes-D146273.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-diff --git a/security/sandbox/linux/SandboxFilter.cpp
b/security/sandbox/linux/SandboxFilter.cpp
---- a/security/sandbox/linux/SandboxFilter.cpp
-+++ b/security/sandbox/linux/SandboxFilter.cpp
-@@ -699,10 +699,18 @@
- Maybe<ResultExpr> EvaluateSocketCall(int aCall,
- bool aHasArgs) const override {
- switch (aCall) {
- case SYS_RECVMSG:
- case SYS_SENDMSG:
-+ // These next four aren't needed for IPC or other core
-+ // functionality at the time of this writing, but they're
-+ // subsets of recvmsg/sendmsg so there's nothing gained by not
-+ // allowing them here (and simplifying subclasses).
-+ case SYS_RECVFROM:
-+ case SYS_SENDTO:
-+ case SYS_RECV:
-+ case SYS_SEND:
- return Some(Allow());
-
- case SYS_SOCKETPAIR: {
- // We try to allow "safe" (always connected) socketpairs when using
the
- // file broker, or for content processes, but we may need to fall
back
-@@ -1253,12 +1261,10 @@
- ~ContentSandboxPolicy() override = default;
-
- Maybe<ResultExpr> EvaluateSocketCall(int aCall,
- bool aHasArgs) const override {
- switch (aCall) {
-- case SYS_RECVFROM:
-- case SYS_SENDTO:
- case SYS_SENDMMSG: // libresolv via libasyncns; see bug 1355274
- return Some(Allow());
-
- #ifdef ANDROID
- case SYS_SOCKET:
-@@ -1268,18 +1274,21 @@
- case SYS_CONNECT:
- if (BelowLevel(4)) {
- return Some(Allow());
- }
- return SandboxPolicyCommon::EvaluateSocketCall(aCall, aHasArgs);
-- case SYS_RECV:
-- case SYS_SEND:
-+
-+ // FIXME (bug 1761134): sockopts should be filtered
- case SYS_GETSOCKOPT:
- case SYS_SETSOCKOPT:
-+ // These next 3 were needed for X11; they may not be needed
-+ // with X11 lockdown, but there's not much attack surface here.
- case SYS_GETSOCKNAME:
- case SYS_GETPEERNAME:
- case SYS_SHUTDOWN:
- return Some(Allow());
-+
- case SYS_ACCEPT:
- case SYS_ACCEPT4:
- if (mUsingRenderDoc) {
- return Some(Allow());
- }
-@@ -1908,26 +1917,19 @@
- }
-
- Maybe<ResultExpr> EvaluateSocketCall(int aCall,
- bool aHasArgs) const override {
- switch (aCall) {
-+ case SYS_SOCKET:
-+ case SYS_CONNECT:
- case SYS_BIND:
- return Some(Allow());
-
-- case SYS_SOCKET:
-- return Some(Allow());
--
-- case SYS_CONNECT:
-- return Some(Allow());
--
-- case SYS_RECVFROM:
-- case SYS_SENDTO:
-+ // FIXME(bug 1641401) do we really need this?
- case SYS_SENDMMSG:
- return Some(Allow());
-
-- case SYS_RECV:
-- case SYS_SEND:
- case SYS_GETSOCKOPT:
- case SYS_SETSOCKOPT:
- case SYS_GETSOCKNAME:
- case SYS_GETPEERNAME:
- case SYS_SHUTDOWN:
-
diff --git
a/http/firefox/patches/0033-p14-bmo-1769182-vaapi-fixes-D146274.patch
b/http/firefox/patches/0033-p14-bmo-1769182-vaapi-fixes-D146274.patch
deleted file mode 100644
index 8943ac4..0000000
--- a/http/firefox/patches/0033-p14-bmo-1769182-vaapi-fixes-D146274.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-diff --git a/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
b/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
---- a/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
-+++ b/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
-@@ -325,30 +325,84 @@
- policy->AddDynamic(perms, trimPath.get());
- }
- }
- }
-
-+static void AddX11Dependencies(SandboxBroker::Policy* policy) {
-+ // Allow Primus to contact the Bumblebee daemon to manage GPU
-+ // switching on NVIDIA Optimus systems.
-+ const char* bumblebeeSocket = PR_GetEnv("BUMBLEBEE_SOCKET");
-+ if (bumblebeeSocket == nullptr) {
-+ bumblebeeSocket = "/var/run/bumblebee.socket";
-+ }
-+ policy->AddPath(SandboxBroker::MAY_CONNECT, bumblebeeSocket);
-+
-+#if defined(MOZ_WIDGET_GTK) && defined(MOZ_X11)
-+ // Allow local X11 connections, for several purposes:
-+ //
-+ // * for content processes to use WebGL when the browser is in headless
-+ // mode, by opening the X display if/when needed
-+ //
-+ // * if Primus or VirtualGL is used, to contact the secondary X server
-+ static const bool kIsX11 =
-+ !mozilla::widget::GdkIsWaylandDisplay() && PR_GetEnv("DISPLAY");
-+ if (kIsX11) {
-+ policy->AddPrefix(SandboxBroker::MAY_CONNECT, "/tmp/.X11-unix/X");
-+ if (auto* const xauth = PR_GetEnv("XAUTHORITY")) {
-+ policy->AddPath(rdonly, xauth);
-+ } else if (auto* const home = PR_GetEnv("HOME")) {
-+ // This follows the logic in libXau: append "/.Xauthority",
-+ // even if $HOME ends in a slash, except in the special case
-+ // where HOME=/ because POSIX allows implementations to treat
-+ // an initial double slash specially.
-+ nsAutoCString xauth(home);
-+ if (xauth != "/"_ns) {
-+ xauth.Append('/');
-+ }
-+ xauth.AppendLiteral(".Xauthority");
-+ policy->AddPath(rdonly, xauth.get());
-+ }
-+ }
-+#endif
-+}
-+
-+static void AddGLDependencies(SandboxBroker::Policy* policy) {
-+ // Devices
-+ policy->AddDir(rdwr, "/dev/dri");
-+ policy->AddFilePrefix(rdwr, "/dev", "nvidia");
-+
-+ // Hardware info
-+ AddDriPaths(policy);
-+
-+ // /etc and /usr/share (glvnd, libdrm, drirc, ...?)
-+ policy->AddDir(rdonly, "/etc");
-+ policy->AddDir(rdonly, "/usr/share");
-+ policy->AddDir(rdonly, "/usr/local/share");
-+
-+ // Note: This function doesn't do anything about Mesa's shader
-+ // cache, because the details can vary by process type, including
-+ // whether caching is enabled.
-+
-+ AddX11Dependencies(policy);
-+}
-+
- void SandboxBrokerPolicyFactory::InitContentPolicy() {
- const bool headless =
- StaticPrefs::security_sandbox_content_headless_AtStartup();
-
- // Policy entries that are the same in every process go here, and
- // are cached over the lifetime of the factory.
- SandboxBroker::Policy* policy = new SandboxBroker::Policy;
- // Write permssions
-- //
-- if (!headless) {
-- // Bug 1308851: NVIDIA proprietary driver when using WebGL
-- policy->AddFilePrefix(rdwr, "/dev", "nvidia");
--
-- // Bug 1312678: Mesa with DRI when using WebGL
-- policy->AddDir(rdwr, "/dev/dri");
-- }
-
- // Bug 1575985: WASM library sandbox needs RW access to /dev/null
- policy->AddPath(rdwr, "/dev/null");
-
-+ if (!headless) {
-+ AddGLDependencies(policy);
-+ }
-+
- // Read permissions
- policy->AddPath(rdonly, "/dev/urandom");
- policy->AddPath(rdonly, "/dev/random");
- policy->AddPath(rdonly, "/proc/sys/crypto/fips_enabled");
- policy->AddPath(rdonly, "/proc/cpuinfo");
-@@ -370,13 +424,10 @@
- policy->AddDir(rdonly, "/run/host/fonts");
- policy->AddDir(rdonly, "/run/host/user-fonts");
- policy->AddDir(rdonly, "/run/host/local-fonts");
- policy->AddDir(rdonly, "/var/cache/fontconfig");
-
-- if (!headless) {
-- AddDriPaths(policy);
-- }
- AddLdconfigPaths(policy);
- AddLdLibraryEnvPaths(policy);
-
- if (!headless) {
- // Bug 1385715: NVIDIA PRIME support
-@@ -569,45 +620,11 @@
- }
- }
- #endif
-
- if (!headless) {
-- // Allow Primus to contact the Bumblebee daemon to manage GPU
-- // switching on NVIDIA Optimus systems.
-- const char* bumblebeeSocket = PR_GetEnv("BUMBLEBEE_SOCKET");
-- if (bumblebeeSocket == nullptr) {
-- bumblebeeSocket = "/var/run/bumblebee.socket";
-- }
-- policy->AddPath(SandboxBroker::MAY_CONNECT, bumblebeeSocket);
--
--#if defined(MOZ_WIDGET_GTK) && defined(MOZ_X11)
-- // Allow local X11 connections, for several purposes:
-- //
-- // * for content processes to use WebGL when the browser is in headless
-- // mode, by opening the X display if/when needed
-- //
-- // * if Primus or VirtualGL is used, to contact the secondary X server
-- static const bool kIsX11 =
-- !mozilla::widget::GdkIsWaylandDisplay() && PR_GetEnv("DISPLAY");
-- if (kIsX11) {
-- policy->AddPrefix(SandboxBroker::MAY_CONNECT, "/tmp/.X11-unix/X");
-- if (auto* const xauth = PR_GetEnv("XAUTHORITY")) {
-- policy->AddPath(rdonly, xauth);
-- } else if (auto* const home = PR_GetEnv("HOME")) {
-- // This follows the logic in libXau: append "/.Xauthority",
-- // even if $HOME ends in a slash, except in the special case
-- // where HOME=/ because POSIX allows implementations to treat
-- // an initial double slash specially.
-- nsAutoCString xauth(home);
-- if (xauth != "/"_ns) {
-- xauth.Append('/');
-- }
-- xauth.AppendLiteral(".Xauthority");
-- policy->AddPath(rdonly, xauth.get());
-- }
-- }
--#endif
-+ AddX11Dependencies(policy);
- }
-
- // Bug 1732580: when packaged as a strictly confined snap, may need
- // read-access to configuration files under $SNAP/.
- const char* snap = PR_GetEnv("SNAP");
-
diff --git
a/http/firefox/patches/0033-p15-bmo-1769182-vaapi-fixes-D146275.patch
b/http/firefox/patches/0033-p15-bmo-1769182-vaapi-fixes-D146275.patch
deleted file mode 100644
index 989b317..0000000
--- a/http/firefox/patches/0033-p15-bmo-1769182-vaapi-fixes-D146275.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-diff --git a/ipc/glue/GeckoChildProcessHost.cpp
b/ipc/glue/GeckoChildProcessHost.cpp
---- a/ipc/glue/GeckoChildProcessHost.cpp
-+++ b/ipc/glue/GeckoChildProcessHost.cpp
-@@ -418,10 +418,17 @@
- nsresult rv = NS_GetSpecialDirectory(NS_APP_CONTENT_PROCESS_TEMP_DIR,
- getter_AddRefs(contentTempDir));
- if (NS_SUCCEEDED(rv)) {
- contentTempDir->GetNativePath(mTmpDirName);
- }
-+ } else if (aProcessType == GeckoProcessType_RDD) {
-+ // The RDD process makes limited use of EGL. If Mesa's shader
-+ // cache is enabled and the directory isn't explicitly set, then
-+ // it will try to getpwuid() the user which can cause problems
-+ // with sandboxing. Because we shouldn't need shader caching in
-+ // this process, we just disable the cache to prevent that.
-+ mLaunchOptions->env_map["MESA_GLSL_CACHE_DISABLE"] = "true";
- }
- #endif
- #if defined(MOZ_ENABLE_FORKSERVER)
- if (aProcessType == GeckoProcessType_Content && ForkServiceChild::Get()) {
- mLaunchOptions->use_forkserver = true;
-diff --git a/security/sandbox/common/test/SandboxTestingChildTests.h
b/security/sandbox/common/test/SandboxTestingChildTests.h
---- a/security/sandbox/common/test/SandboxTestingChildTests.h
-+++ b/security/sandbox/common/test/SandboxTestingChildTests.h
-@@ -21,14 +21,16 @@
- # include <termios.h>
- # include <sys/resource.h>
- # include <sys/time.h>
- # include <sys/utsname.h>
- # include <sched.h>
-+# include <sys/socket.h>
- # include <sys/syscall.h>
- # include <sys/un.h>
- # include <linux/mempolicy.h>
- # include "mozilla/ProcInfo_linux.h"
-+# include "mozilla/UniquePtrExtensions.h"
- # ifdef MOZ_X11
- # include "X11/Xlib.h"
- # include "X11UndefineNone.h"
- # endif // MOZ_X11
- # endif // XP_LINUX
-@@ -595,12 +597,25 @@
- return rv;
- });
-
- RunTestsSched(child);
-
-- child->ErrnoTest("socket"_ns, false,
-- [] { return socket(AF_UNIX, SOCK_STREAM, 0); });
-+ child->ErrnoTest("socket_inet"_ns, false,
-+ [] { return socket(AF_INET, SOCK_STREAM, 0); });
-+
-+ {
-+ UniqueFileHandle fd(socket(AF_UNIX, SOCK_STREAM, 0));
-+ child->ErrnoTest("socket_unix"_ns, true, [&] { return fd.get(); });
-+
-+ struct sockaddr_un sun {};
-+ sun.sun_family = AF_UNIX;
-+ strncpy(sun.sun_path, "/tmp/forbidden-sock", sizeof(sun.sun_path));
-+
-+ child->ErrnoValueTest("socket_unix_bind"_ns, ENOSYS, [&] {
-+ return bind(fd.get(), (struct sockaddr*)&sun, sizeof(sun));
-+ });
-+ }
-
- child->ErrnoTest("uname"_ns, true, [] {
- struct utsname uts;
- return uname(&uts);
- });
-diff --git a/security/sandbox/linux/SandboxFilter.cpp
b/security/sandbox/linux/SandboxFilter.cpp
---- a/security/sandbox/linux/SandboxFilter.cpp
-+++ b/security/sandbox/linux/SandboxFilter.cpp
-@@ -1783,10 +1783,11 @@
- class RDDSandboxPolicy final : public SandboxPolicyCommon {
- public:
- explicit RDDSandboxPolicy(SandboxBrokerClient* aBroker) {
- mBroker = aBroker;
- mMayCreateShmem = true;
-+ mBrokeredConnect = true;
- }
-
- #ifndef ANDROID
- Maybe<ResultExpr> EvaluateIpcCall(int aCall, int aArgShift) const
override {
- // The Intel media driver uses SysV IPC (semaphores and shared
-@@ -1818,15 +1819,15 @@
- #endif
-
- Maybe<ResultExpr> EvaluateSocketCall(int aCall,
- bool aHasArgs) const override {
- switch (aCall) {
-- // Mesa can call getpwuid_r to get the home dir, which can try
-- // to connect to nscd (or maybe servers like NIS or LDAP); this
-- // can't be safely allowed, but we can quietly deny it.
-- case SYS_SOCKET:
-- return Some(Error(EACCES));
-+ // These are for X11.
-+ case SYS_GETSOCKNAME:
-+ case SYS_GETPEERNAME:
-+ case SYS_SHUTDOWN:
-+ return Some(Allow());
-
- default:
- return SandboxPolicyCommon::EvaluateSocketCall(aCall, aHasArgs);
- }
- }
-diff --git a/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
b/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
---- a/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
-+++ b/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
-@@ -853,13 +853,12 @@
- if (developer_repo_dir) {
- policy->AddDir(rdonly, developer_repo_dir);
- }
- }
-
-- // VA-API needs DRI and GPU detection
-- policy->AddDir(rdwr, "/dev/dri");
-- AddDriPaths(policy.get());
-+ // VA-API needs GPU access and GL context creation
-+ AddGLDependencies(policy.get());
-
- // FFmpeg and GPU drivers may need general-case library loading
- AddLdconfigPaths(policy.get());
- AddLdLibraryEnvPaths(policy.get());
-
-
diff --git
a/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p1-D147635.patch
b/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p1-D147635.patch
deleted file mode 100644
index 1d4bb58..0000000
--- a/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p1-D147635.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h
---- a/gfx/gl/GLLibraryEGL.h
-+++ b/gfx/gl/GLLibraryEGL.h
-@@ -106,10 +106,13 @@
- KHR_swap_buffers_with_damage,
- EXT_buffer_age,
- KHR_partial_update,
- NV_robustness_video_memory_purge,
- MESA_platform_surfaceless,
-+ EXT_image_dma_buf_import,
-+ EXT_image_dma_buf_import_modifiers,
-+ MESA_image_dma_buf_export,
- Max
- };
-
- // -
-
-@@ -461,10 +464,23 @@
- // EGL_KHR_partial_update
- EGLBoolean fSetDamageRegion(EGLDisplay dpy, EGLSurface surface,
- const EGLint* rects, EGLint n_rects) {
- WRAP(fSetDamageRegion(dpy, surface, rects, n_rects));
- }
-+ // EGL_MESA_image_dma_buf_export
-+ EGLBoolean fExportDMABUFImageQuery(EGLDisplay dpy, EGLImage image,
-+ int* fourcc, int* num_planes,
-+ uint64_t* modifiers) {
-+ WRAP(
-+ fExportDMABUFImageQueryMESA(dpy, image, fourcc, num_planes,
modifiers));
-+ }
-+ EGLBoolean fExportDMABUFImage(EGLDisplay dpy, EGLImage image, int* fds,
-+ EGLint* strides, EGLint* offsets) {
-+ WRAP(fExportDMABUFImageMESA(dpy, image, fds, strides, offsets));
-+ }
-+
-+#undef WRAP
-
- #undef WRAP
- #undef PROFILE_CALL
- #undef BEFORE_CALL
- #undef AFTER_CALL
-@@ -593,10 +609,22 @@
- EGLBoolean(GLAPIENTRY* fSetDamageRegion)(EGLDisplay dpy, EGLSurface
surface,
- const EGLint* rects,
- EGLint n_rects);
- EGLClientBuffer(GLAPIENTRY* fGetNativeClientBufferANDROID)(
- const struct AHardwareBuffer* buffer);
-+
-+ // EGL_MESA_image_dma_buf_export
-+ EGLBoolean(GLAPIENTRY* fExportDMABUFImageQueryMESA)(EGLDisplay dpy,
-+ EGLImage image,
-+ int* fourcc,
-+ int* num_planes,
-+ uint64_t*
modifiers);
-+ EGLBoolean(GLAPIENTRY* fExportDMABUFImageMESA)(EGLDisplay dpy,
-+ EGLImage image, int* fds,
-+ EGLint* strides,
-+ EGLint* offsets);
-+
- } mSymbols = {};
- };
-
- class EglDisplay final {
- public:
-@@ -852,10 +880,23 @@
- EGLBoolean fSetDamageRegion(EGLSurface surface, const EGLint* rects,
- EGLint n_rects) {
- MOZ_ASSERT(IsExtensionSupported(EGLExtension::KHR_partial_update));
- return mLib->fSetDamageRegion(mDisplay, surface, rects, n_rects);
- }
-+
-+ EGLBoolean fExportDMABUFImageQuery(EGLImage image, int* fourcc,
-+ int* num_planes,
-+ uint64_t* modifiers) const {
-+
MOZ_ASSERT(IsExtensionSupported(EGLExtension::MESA_image_dma_buf_export));
-+ return mLib->fExportDMABUFImageQuery(mDisplay, image, fourcc,
num_planes,
-+ modifiers);
-+ }
-+ EGLBoolean fExportDMABUFImage(EGLImage image, int* fds, EGLint* strides,
-+ EGLint* offsets) const {
-+
MOZ_ASSERT(IsExtensionSupported(EGLExtension::MESA_image_dma_buf_export));
-+ return mLib->fExportDMABUFImage(mDisplay, image, fds, strides, offsets);
-+ }
- };
-
- } /* namespace gl */
- } /* namespace mozilla */
-
-diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp
---- a/gfx/gl/GLLibraryEGL.cpp
-+++ b/gfx/gl/GLLibraryEGL.cpp
-@@ -82,11 +82,14 @@
- "EGL_EXT_swap_buffers_with_damage",
- "EGL_KHR_swap_buffers_with_damage",
- "EGL_EXT_buffer_age",
- "EGL_KHR_partial_update",
- "EGL_NV_robustness_video_memory_purge",
-- "EGL_MESA_platform_surfaceless"};
-+ "EGL_MESA_platform_surfaceless",
-+ "EGL_EXT_image_dma_buf_import",
-+ "EGL_EXT_image_dma_buf_import_modifiers",
-+ "EGL_MESA_image_dma_buf_export"};
-
- PRLibrary* LoadApitraceLibrary() {
- const char* path = nullptr;
-
- #ifdef ANDROID
-@@ -647,10 +650,16 @@
- {
- const SymLoadStruct symbols[] = {SYMBOL(GetPlatformDisplay),
- END_OF_SYMBOLS};
- (void)fnLoadSymbols(symbols);
- }
-+ {
-+ const SymLoadStruct symbols[] = {SYMBOL(ExportDMABUFImageQueryMESA),
-+ SYMBOL(ExportDMABUFImageMESA),
-+ END_OF_SYMBOLS};
-+ (void)fnLoadSymbols(symbols);
-+ }
-
- return true;
- }
-
- // -
-
diff --git
a/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch
b/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch
deleted file mode 100644
index 52462f2..0000000
--- a/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch
+++ /dev/null
@@ -1,278 +0,0 @@
-diff --git a/widget/gtk/DMABufSurface.h b/widget/gtk/DMABufSurface.h
---- a/widget/gtk/DMABufSurface.h
-+++ b/widget/gtk/DMABufSurface.h
-@@ -173,13 +173,13 @@
- SurfaceType mSurfaceType;
- uint64_t mBufferModifiers[DMABUF_BUFFER_PLANES];
-
- int mBufferPlaneCount;
- int mDmabufFds[DMABUF_BUFFER_PLANES];
-- uint32_t mDrmFormats[DMABUF_BUFFER_PLANES];
-- uint32_t mStrides[DMABUF_BUFFER_PLANES];
-- uint32_t mOffsets[DMABUF_BUFFER_PLANES];
-+ int32_t mDrmFormats[DMABUF_BUFFER_PLANES];
-+ int32_t mStrides[DMABUF_BUFFER_PLANES];
-+ int32_t mOffsets[DMABUF_BUFFER_PLANES];
-
- struct gbm_bo* mGbmBufferObject[DMABUF_BUFFER_PLANES];
- void* mMappedRegion[DMABUF_BUFFER_PLANES];
- void* mMappedRegionData[DMABUF_BUFFER_PLANES];
- uint32_t mMappedRegionStride[DMABUF_BUFFER_PLANES];
-@@ -198,10 +198,14 @@
- class DMABufSurfaceRGBA : public DMABufSurface {
- public:
- static already_AddRefed<DMABufSurfaceRGBA> CreateDMABufSurface(
- int aWidth, int aHeight, int aDMABufSurfaceFlags);
-
-+ static already_AddRefed<DMABufSurface> CreateDMABufSurface(
-+ mozilla::gl::GLContext* aGLContext, const EGLImageKHR aEGLImage,
-+ int aWidth, int aHeight);
-+
- bool Serialize(mozilla::layers::SurfaceDescriptor& aOutDescriptor);
-
- DMABufSurfaceRGBA* GetAsDMABufSurfaceRGBA() { return this; }
-
- void Clear();
-@@ -247,10 +251,12 @@
- private:
- ~DMABufSurfaceRGBA();
-
- bool Create(int aWidth, int aHeight, int aDMABufSurfaceFlags);
- bool Create(const mozilla::layers::SurfaceDescriptor& aDesc);
-+ bool Create(mozilla::gl::GLContext* aGLContext, const EGLImageKHR
aEGLImage,
-+ int aWidth, int aHeight);
-
- bool ImportSurfaceDescriptor(const mozilla::layers::SurfaceDescriptor&
aDesc);
-
- bool OpenFileDescriptorForPlane(const mozilla::MutexAutoLock&
aProofOfLock,
- int aPlane);
-diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
---- a/widget/gtk/DMABufSurface.cpp
-+++ b/widget/gtk/DMABufSurface.cpp
-@@ -204,10 +204,12 @@
- }
- }
-
- void DMABufSurface::FenceSet() {
- if (!mGL || !mGL->MakeCurrent()) {
-+ MOZ_DIAGNOSTIC_ASSERT(mGL,
-+ "DMABufSurface::FenceSet(): missing GL context!");
- return;
- }
- const auto& gle = gl::GLContextEGL::Cast(mGL);
- const auto& egl = gle->mEgl;
-
-@@ -228,21 +230,23 @@
- mGL->fFinish();
- }
-
- void DMABufSurface::FenceWait() {
- if (!mGL || mSyncFd < 0) {
-+ MOZ_DIAGNOSTIC_ASSERT(mGL,
-+ "DMABufSurface::FenceWait() missing GL context!");
- return;
- }
-
- const auto& gle = gl::GLContextEGL::Cast(mGL);
- const auto& egl = gle->mEgl;
-
- const EGLint attribs[] = {LOCAL_EGL_SYNC_NATIVE_FENCE_FD_ANDROID, mSyncFd,
- LOCAL_EGL_NONE};
- EGLSync sync = egl->fCreateSync(LOCAL_EGL_SYNC_NATIVE_FENCE_ANDROID,
attribs);
- if (!sync) {
-- MOZ_ASSERT(false, "Failed to create GLFence!");
-+ MOZ_ASSERT(false, "DMABufSurface::FenceWait(): Failed to create
GLFence!");
- // We failed to create GLFence so clear mSyncFd to avoid another try.
- close(mSyncFd);
- mSyncFd = -1;
- return;
- }
-@@ -338,17 +342,18 @@
- mGmbFormat = GetDMABufDevice()->GetGbmFormat(mSurfaceFlags &
DMABUF_ALPHA);
- if (!mGmbFormat) {
- // Requested DRM format is not supported.
- return false;
- }
-+ mDrmFormats[0] = mGmbFormat->mFormat;
-
- bool useModifiers = (aDMABufSurfaceFlags & DMABUF_USE_MODIFIERS) &&
- mGmbFormat->mModifiersCount > 0;
- if (useModifiers) {
- LOGDMABUF((" Creating with modifiers\n"));
- mGbmBufferObject[0] = nsGbmLib::CreateWithModifiers(
-- GetDMABufDevice()->GetGbmDevice(), mWidth, mHeight,
mGmbFormat->mFormat,
-+ GetDMABufDevice()->GetGbmDevice(), mWidth, mHeight, mDrmFormats[0],
- mGmbFormat->mModifiers, mGmbFormat->mModifiersCount);
- if (mGbmBufferObject[0]) {
- mBufferModifiers[0] = nsGbmLib::GetModifier(mGbmBufferObject[0]);
- }
- }
-@@ -356,11 +361,11 @@
- if (!mGbmBufferObject[0]) {
- LOGDMABUF((" Creating without modifiers\n"));
- mGbmBufferFlags = GBM_BO_USE_LINEAR;
- mGbmBufferObject[0] =
- nsGbmLib::Create(GetDMABufDevice()->GetGbmDevice(), mWidth, mHeight,
-- mGmbFormat->mFormat, mGbmBufferFlags);
-+ mDrmFormats[0], mGbmBufferFlags);
- mBufferModifiers[0] = DRM_FORMAT_MOD_INVALID;
- }
-
- if (!mGbmBufferObject[0]) {
- LOGDMABUF((" Failed to create GbmBufferObject\n"));
-@@ -386,22 +391,51 @@
-
- LOGDMABUF((" Success\n"));
- return true;
- }
-
-+bool DMABufSurfaceRGBA::Create(mozilla::gl::GLContext* aGLContext,
-+ const EGLImageKHR aEGLImage, int aWidth,
-+ int aHeight) {
-+ LOGDMABUF(("DMABufSurfaceRGBA::Create() from EGLImage UID = %d\n", mUID));
-+ if (!aGLContext) {
-+ return false;
-+ }
-+ const auto& gle = gl::GLContextEGL::Cast(aGLContext);
-+ const auto& egl = gle->mEgl;
-+
-+ mGL = aGLContext;
-+ mWidth = aWidth;
-+ mHeight = aHeight;
-+ mEGLImage = aEGLImage;
-+ if (!egl->fExportDMABUFImageQuery(mEGLImage, mDrmFormats,
&mBufferPlaneCount,
-+ mBufferModifiers)) {
-+ LOGDMABUF((" ExportDMABUFImageQueryMESA failed, quit\n"));
-+ return false;
-+ }
-+ if (mBufferPlaneCount > DMABUF_BUFFER_PLANES) {
-+ LOGDMABUF((" wrong plane count %d, quit\n", mBufferPlaneCount));
-+ return false;
-+ }
-+ if (!egl->fExportDMABUFImage(mEGLImage, mDmabufFds, mStrides, mOffsets)) {
-+ LOGDMABUF((" ExportDMABUFImageMESA failed, quit\n"));
-+ return false;
-+ }
-+
-+ LOGDMABUF((" imported size %d x %d format %x planes %d", mWidth, mHeight,
-+ mDrmFormats[0], mBufferPlaneCount));
-+ return true;
-+}
-+
- bool DMABufSurfaceRGBA::ImportSurfaceDescriptor(
- const SurfaceDescriptor& aDesc) {
- const SurfaceDescriptorDMABuf& desc = aDesc.get_SurfaceDescriptorDMABuf();
-
- mWidth = desc.width()[0];
- mHeight = desc.height()[0];
- mBufferModifiers[0] = desc.modifier()[0];
-- if (mBufferModifiers[0] != DRM_FORMAT_MOD_INVALID) {
-- mGmbFormat = GetDMABufDevice()->GetExactGbmFormat(desc.format()[0]);
-- } else {
-- mDrmFormats[0] = desc.format()[0];
-- }
-+ mDrmFormats[0] = desc.format()[0];
- mBufferPlaneCount = desc.fds().Length();
- mGbmBufferFlags = desc.flags();
- MOZ_RELEASE_ASSERT(mBufferPlaneCount <= DMABUF_BUFFER_PLANES);
- mUID = desc.uid();
-
-@@ -431,10 +465,12 @@
-
- if (desc.refCount().Length() > 0) {
-
GlobalRefCountImport(desc.refCount()[0].ClonePlatformHandle().release());
- }
-
-+ LOGDMABUF((" imported size %d x %d format %x planes %d", mWidth, mHeight,
-+ mDrmFormats[0], mBufferPlaneCount));
- return true;
- }
-
- bool DMABufSurfaceRGBA::Create(const SurfaceDescriptor& aDesc) {
- return ImportSurfaceDescriptor(aDesc);
-@@ -460,11 +496,11 @@
- return false;
- }
-
- width.AppendElement(mWidth);
- height.AppendElement(mHeight);
-- format.AppendElement(mGmbFormat->mFormat);
-+ format.AppendElement(mDrmFormats[0]);
- modifiers.AppendElement(mBufferModifiers[0]);
- for (int i = 0; i < mBufferPlaneCount; i++) {
- fds.AppendElement(ipc::FileDescriptor(mDmabufFds[i]));
- strides.AppendElement(mStrides[i]);
- offsets.AppendElement(mOffsets[i]);
-@@ -486,23 +522,20 @@
- fenceFDs, mUID, refCountFDs);
- return true;
- }
-
- bool DMABufSurfaceRGBA::CreateTexture(GLContext* aGLContext, int aPlane) {
-+ LOGDMABUF(("DMABufSurfaceRGBA::CreateTexture() UID %d\n", mUID));
- MOZ_ASSERT(!mEGLImage && !mTexture, "EGLImage is already created!");
-
- nsTArray<EGLint> attribs;
- attribs.AppendElement(LOCAL_EGL_WIDTH);
- attribs.AppendElement(mWidth);
- attribs.AppendElement(LOCAL_EGL_HEIGHT);
- attribs.AppendElement(mHeight);
- attribs.AppendElement(LOCAL_EGL_LINUX_DRM_FOURCC_EXT);
-- if (mGmbFormat) {
-- attribs.AppendElement(mGmbFormat->mFormat);
-- } else {
-- attribs.AppendElement(mDrmFormats[0]);
-- }
-+ attribs.AppendElement(mDrmFormats[0]);
- #define ADD_PLANE_ATTRIBS(plane_idx)
\
- {
\
- attribs.AppendElement(LOCAL_EGL_DMA_BUF_PLANE##plane_idx##_FD_EXT);
\
- attribs.AppendElement(mDmabufFds[plane_idx]);
\
- attribs.AppendElement(LOCAL_EGL_DMA_BUF_PLANE##plane_idx##_OFFSET_EXT);
\
-@@ -560,10 +593,11 @@
-
- return true;
- }
-
- void DMABufSurfaceRGBA::ReleaseTextures() {
-+ LOGDMABUF(("DMABufSurfaceRGBA::ReleaseTextures() UID %d\n", mUID));
- FenceDelete();
-
- if (!mTexture) {
- return;
- }
-@@ -618,11 +652,11 @@
- zwp_linux_buffer_params_v1_add(params, mDmabufFds[0], 0, mOffsets[0],
- mStrides[0], mBufferModifiers[0] >> 32,
- mBufferModifiers[0] & 0xffffffff);
-
- mWlBuffer = zwp_linux_buffer_params_v1_create_immed(
-- params, GetWidth(), GetHeight(), mGmbFormat->mFormat, 0);
-+ params, GetWidth(), GetHeight(), mDrmFormats[0], 0);
-
- CloseFileDescriptors(lockFD);
-
- return mWlBuffer != nullptr;
- }
-@@ -806,10 +840,20 @@
- return nullptr;
- }
- return surf.forget();
- }
-
-+already_AddRefed<DMABufSurface> DMABufSurfaceRGBA::CreateDMABufSurface(
-+ mozilla::gl::GLContext* aGLContext, const EGLImageKHR aEGLImage, int
aWidth,
-+ int aHeight) {
-+ RefPtr<DMABufSurfaceRGBA> surf = new DMABufSurfaceRGBA();
-+ if (!surf->Create(aGLContext, aEGLImage, aWidth, aHeight)) {
-+ return nullptr;
-+ }
-+ return surf.forget();
-+}
-+
- already_AddRefed<DMABufSurfaceYUV> DMABufSurfaceYUV::CreateYUVSurface(
- const VADRMPRIMESurfaceDescriptor& aDesc, int aWidth, int aHeight) {
- RefPtr<DMABufSurfaceYUV> surf = new DMABufSurfaceYUV();
- LOGDMABUF(("DMABufSurfaceYUV::CreateYUVSurface() UID %d from desc\n",
- surf->GetUID()));
-
diff --git
a/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p3-D147637.patch
b/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p3-D147637.patch
deleted file mode 100644
index 0a84b25..0000000
--- a/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p3-D147637.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-diff -up firefox-101.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff
firefox-101.0/gfx/gl/SharedSurfaceDMABUF.cpp
---- firefox-101.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff 2022-05-27
01:16:54.000000000 +0200
-+++ firefox-101.0/gfx/gl/SharedSurfaceDMABUF.cpp 2022-06-07
09:37:29.361992695 +0200
-@@ -12,22 +12,37 @@
-
- namespace mozilla::gl {
-
-+static bool HasDmaBufExtensions(const GLContextEGL* gl) {
-+ const auto& egl = *(gl->mEgl);
-+ return egl.IsExtensionSupported(EGLExtension::EXT_image_dma_buf_import) &&
-+ egl.IsExtensionSupported(
-+ EGLExtension::EXT_image_dma_buf_import_modifiers) &&
-+ egl.IsExtensionSupported(EGLExtension::MESA_image_dma_buf_export);
-+}
-+
- /*static*/
- UniquePtr<SharedSurface_DMABUF> SharedSurface_DMABUF::Create(
- const SharedSurfaceDesc& desc) {
-- const auto flags = static_cast<DMABufSurfaceFlags>(
-- DMABUF_TEXTURE | DMABUF_USE_MODIFIERS | DMABUF_ALPHA);
-- const RefPtr<DMABufSurface> surface =
DMABufSurfaceRGBA::CreateDMABufSurface(
-- desc.size.width, desc.size.height, flags);
-- if (!surface || !surface->CreateTexture(desc.gl)) {
-+ const auto& gle = GLContextEGL::Cast(desc.gl);
-+ const auto& context = gle->mContext;
-+ const auto& egl = *(gle->mEgl);
-+
-+ if (!HasDmaBufExtensions(gle)) {
- return nullptr;
- }
-
-- const auto tex = surface->GetTexture();
-- auto fb = MozFramebuffer::CreateForBacking(desc.gl, desc.size, 0, false,
-- LOCAL_GL_TEXTURE_2D, tex);
-+ auto fb = MozFramebuffer::Create(desc.gl, desc.size, 0, false);
- if (!fb) return nullptr;
-
-+ const auto buffer = reinterpret_cast<EGLClientBuffer>(fb->ColorTex());
-+ const auto image =
-+ egl.fCreateImage(context, LOCAL_EGL_GL_TEXTURE_2D, buffer, nullptr);
-+ if (!image) return nullptr;
-+
-+ const RefPtr<DMABufSurface> surface =
DMABufSurfaceRGBA::CreateDMABufSurface(
-+ desc.gl, image, desc.size.width, desc.size.height);
-+ if (!surface) return nullptr;
-+
- return AsUnique(new SharedSurface_DMABUF(desc, std::move(fb), surface));
- }
-
-@@ -61,7 +76,7 @@ UniquePtr<SurfaceFactory_DMABUF> Surface
- }
-
- auto dmabufFactory = MakeUnique<SurfaceFactory_DMABUF>(gl);
-- if (dmabufFactory->CanCreateSurface()) {
-+ if (dmabufFactory->CanCreateSurface(gl)) {
- return dmabufFactory;
- }
-
-@@ -71,8 +86,38 @@ UniquePtr<SurfaceFactory_DMABUF> Surface
- return nullptr;
- }
-
-+bool SurfaceFactory_DMABUF::CanCreateSurface(GLContext& gl) {
-+ UniquePtr<SharedSurface> test =
-+ CreateShared(gfx::IntSize(1, 1));
-+ if (!test) {
-+ LOGDMABUF((
-+ "SurfaceFactory_DMABUF::CanCreateSurface() failed to create
surface."));
-+ return false;
-+ }
-+ auto desc = test->ToSurfaceDescriptor();
-+ if (!desc) {
-+ LOGDMABUF(
-+ ("SurfaceFactory_DMABUF::CanCreateSurface() failed to serialize "
-+ "surface."));
-+ return false;
-+ }
-+ RefPtr<DMABufSurface> importedSurface =
-+ DMABufSurface::CreateDMABufSurface(*desc);
-+ if (!importedSurface) {
-+ LOGDMABUF((
-+ "SurfaceFactory_DMABUF::CanCreateSurface() failed to import
surface."));
-+ return false;
-+ }
-+ if (!importedSurface->CreateTexture(&gl)) {
-+ LOGDMABUF(
-+ ("SurfaceFactory_DMABUF::CanCreateSurface() failed to create
texture "
-+ "over surface."));
-+ return false;
-+ }
-+ return true;
-+}
-+
- SurfaceFactory_DMABUF::SurfaceFactory_DMABUF(GLContext& gl)
- : SurfaceFactory({&gl, SharedSurfaceType::EGLSurfaceDMABUF,
- layers::TextureType::DMABUF, true}) {}
--
- } // namespace mozilla::gl
-diff -up firefox-101.0/gfx/gl/SharedSurfaceDMABUF.h.D147637.diff
firefox-101.0/gfx/gl/SharedSurfaceDMABUF.h
---- firefox-101.0/gfx/gl/SharedSurfaceDMABUF.h.D147637.diff 2022-06-07
09:31:23.678228010 +0200
-+++ firefox-101.0/gfx/gl/SharedSurfaceDMABUF.h 2022-06-07 09:36:39.691512555
+0200
-@@ -59,10 +59,7 @@ class SurfaceFactory_DMABUF : public Sur
- return SharedSurface_DMABUF::Create(desc);
- }
-
-- bool CanCreateSurface() {
-- UniquePtr<SharedSurface> test = CreateShared(gfx::IntSize(1, 1));
-- return test != nullptr;
-- }
-+ bool CanCreateSurface(GLContext& gl);
- };
-
- } // namespace gl
diff --git
a/http/firefox/patches/0035-bmo-1765350-vaapi-fixes-p2-p1-D147720.patch
b/http/firefox/patches/0035-bmo-1765350-vaapi-fixes-p2-p1-D147720.patch
deleted file mode 100644
index 9287f44..0000000
--- a/http/firefox/patches/0035-bmo-1765350-vaapi-fixes-p2-p1-D147720.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-diff --git a/widget/gtk/DMABufSurface.h b/widget/gtk/DMABufSurface.h
---- a/widget/gtk/DMABufSurface.h
-+++ b/widget/gtk/DMABufSurface.h
-@@ -146,11 +146,16 @@
- DMABufSurface(SurfaceType aSurfaceType);
-
- protected:
- virtual bool Create(const mozilla::layers::SurfaceDescriptor& aDesc) = 0;
-
-+ // Import global ref count from IPC by file descriptor.
- void GlobalRefCountImport(int aFd);
-+ // Export global ref count by file descriptor. This adds global ref count
-+ // reference to the surface.
-+ // It's used when dmabuf surface is shared with another process via. IPC.
-+ int GlobalRefCountExport();
- void GlobalRefCountDelete();
-
- void ReleaseDMABuf();
-
- void* MapInternal(uint32_t aX, uint32_t aY, uint32_t aWidth, uint32_t
aHeight,
-diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
---- a/widget/gtk/DMABufSurface.cpp
-+++ b/widget/gtk/DMABufSurface.cpp
-@@ -105,11 +105,21 @@
- }
-
- void DMABufSurface::GlobalRefCountImport(int aFd) {
- MOZ_ASSERT(!mGlobalRefCountFd);
- mGlobalRefCountFd = aFd;
-- GlobalRefAdd();
-+ MOZ_DIAGNOSTIC_ASSERT(IsGlobalRefSet(),
-+ "We're importing unreferenced surface!");
-+}
-+
-+int DMABufSurface::GlobalRefCountExport() {
-+ if (mGlobalRefCountFd) {
-+ MOZ_DIAGNOSTIC_ASSERT(IsGlobalRefSet(),
-+ "We're exporting unreferenced surface!");
-+ GlobalRefAdd();
-+ }
-+ return mGlobalRefCountFd;
- }
-
- void DMABufSurface::GlobalRefCountDelete() {
- if (mGlobalRefCountFd) {
- GlobalRefRelease();
-@@ -475,11 +485,11 @@
- if (mSync) {
- fenceFDs.AppendElement(ipc::FileDescriptor(mSyncFd));
- }
-
- if (mGlobalRefCountFd) {
-- refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCountFd));
-+ refCountFDs.AppendElement(ipc::FileDescriptor(GlobalRefCountExport()));
- }
-
- aOutDescriptor = SurfaceDescriptorDMABuf(
- mSurfaceType, modifiers, mGbmBufferFlags, fds, width, height, width,
- height, format, strides, offsets, GetYUVColorSpace(), mColorRange,
-@@ -1118,11 +1128,11 @@
- if (mSync) {
- fenceFDs.AppendElement(ipc::FileDescriptor(mSyncFd));
- }
-
- if (mGlobalRefCountFd) {
-- refCountFDs.AppendElement(ipc::FileDescriptor(mGlobalRefCountFd));
-+ refCountFDs.AppendElement(ipc::FileDescriptor(GlobalRefCountExport()));
- }
-
- aOutDescriptor = SurfaceDescriptorDMABuf(
- mSurfaceType, modifiers, 0, fds, width, height, widthBytes,
heightBytes,
- format, strides, offsets, GetYUVColorSpace(), mColorRange, fenceFDs,
mUID,
-
diff --git
a/http/firefox/patches/0036-p01-bmo-1772719-build-wayland-only.patch
b/http/firefox/patches/0036-p01-bmo-1772719-build-wayland-only.patch
deleted file mode 100644
index 697d608..0000000
--- a/http/firefox/patches/0036-p01-bmo-1772719-build-wayland-only.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-
-# HG changeset patch
-# User ganguin <ganguin>
-# Date 1654600180 0
-# Node ID 2e739b8c44c72cfcd603a34217c7ca8d8a99c6e3
-# Parent 4d909088d95c2addd0309c2d81d89dae0c4537ea
-Bug 1772719 - fix wayland-only build with mesa X11 support r=stransky
-
-this patch fixes building firefox with
---enable-default-toolkit=cairo-gtk3-wayland-only when system mesa is build
-with X11 support.
-
-Without this patch, it only builds with mesa built without X11 support.
-
-Differential Revision: https://phabricator.services.mozilla.com/D148347
-
-diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp
---- a/widget/gtk/nsClipboard.cpp
-+++ b/widget/gtk/nsClipboard.cpp
-@@ -34,12 +34,15 @@
- #include "mozilla/SchedulerGroup.h"
- #include "mozilla/StaticPrefs_widget.h"
- #include "mozilla/TimeStamp.h"
-+#include "GRefPtr.h"
- #include "WidgetUtilsGtk.h"
-
- #include "imgIContainer.h"
-
- #include <gtk/gtk.h>
--#include <gtk/gtkx.h>
-+#if defined(MOZ_X11)
-+# include <gtk/gtkx.h>
-+#endif
-
- #include "mozilla/Encoding.h"
-
diff --git
a/http/firefox/patches/0036-p02-bmo-1772721-build-wayland-only.patch
b/http/firefox/patches/0036-p02-bmo-1772721-build-wayland-only.patch
deleted file mode 100644
index d1958cc..0000000
--- a/http/firefox/patches/0036-p02-bmo-1772721-build-wayland-only.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
---- a/widget/gtk/mozgtk/mozgtk.c
-+++ b/widget/gtk/mozgtk/mozgtk.c
-@@ -4,10 +4,16 @@
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- #include "mozilla/Types.h"
-
-+// Dummy call to gtk3 library to prevent the linker from removing
-+// the gtk3 dependency with --as-needed.
-+// see toolkit/library/moz.build for details.
-+MOZ_EXPORT void gdk_display_get_default();
-+MOZ_EXPORT void mozgtk_linker_holder(void) { gdk_display_get_default(); }
-+
- #ifdef MOZ_X11
- # include <X11/Xlib.h>
- // Bug 1271100
- // We need to trick system Cairo into not using the XShm extension due to
- // a race condition in it that results in frequent BadAccess errors. Cairo
-diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
---- a/widget/gtk/nsWindow.cpp
-+++ b/widget/gtk/nsWindow.cpp
-@@ -266,10 +266,13 @@
- return sTimeConverterSingleton;
- }
-
- bool nsWindow::sTransparentMainWindow = false;
-
-+/* forward declare from mozgtk */
-+MOZ_EXPORT extern "C" void mozgtk_linker_holder(void);
-+
- namespace mozilla {
-
- #ifdef MOZ_X11
- class CurrentX11TimeGetter {
- public:
-@@ -424,10 +427,14 @@
- do_GetService("@mozilla.org/widget/clipboard;1");
- NS_ASSERTION(clipboard, "Failed to init clipboard!");
- }
- #endif
- }
-+ // Dummy call to mozgtk to prevent the linker from removing
-+ // the dependency with --as-needed.
-+ // see toolkit/library/moz.build for details.
-+ mozgtk_linker_holder();
- }
-
- nsWindow::~nsWindow() {
- LOG("nsWindow::~nsWindow()");
-
-@@ -5342,14 +5349,10 @@
- //
- // If the window were to get unredirected, there could be visible
- // tearing because Gecko does not align its framebuffer updates with
- // vblank.
- SetCompositorHint(GTK_WIDGET_COMPOSIDED_ENABLED);
--
-- // Dummy call to a function in mozgtk to prevent the linker from
removing
-- // the dependency with --as-needed.
-- XShmQueryExtension(DefaultXDisplay());
- }
- #endif
- #ifdef MOZ_WAYLAND
- if (GdkIsWaylandDisplay()) {
- mSurfaceProvider.Initialize(this);
-
diff --git
a/http/firefox/patches/0036-p03-bmo-1772513-build-wayland-only-D148256.patch
b/http/firefox/patches/0036-p03-bmo-1772513-build-wayland-only-D148256.patch
deleted file mode 100644
index 6caf6eb..0000000
---
a/http/firefox/patches/0036-p03-bmo-1772513-build-wayland-only-D148256.patch
+++ /dev/null
@@ -1,207 +0,0 @@
-diff --git a/widget/gtk/CompositorWidgetParent.cpp
b/widget/gtk/CompositorWidgetParent.cpp
---- a/widget/gtk/CompositorWidgetParent.cpp
-+++ b/widget/gtk/CompositorWidgetParent.cpp
-@@ -4,13 +4,13 @@
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- #include "CompositorWidgetParent.h"
- #include "mozilla/Unused.h"
- #include "mozilla/widget/PlatformWidgetTypes.h"
-+#include "nsWindow.h"
-
--namespace mozilla {
--namespace widget {
-+namespace mozilla::widget {
-
- CompositorWidgetParent::CompositorWidgetParent(
- const CompositorWidgetInitData& aInitData,
- const layers::CompositorOptions& aOptions)
- : GtkCompositorWidget(aInitData.get_GtkCompositorWidgetInitData(),
aOptions,
-@@ -49,7 +49,6 @@
- const uintptr_t& aXWindow, const bool& aShaped) {
- EnableRendering(aXWindow, aShaped);
- return IPC_OK();
- }
-
--} // namespace widget
--} // namespace mozilla
-+} // namespace mozilla::widget
-diff --git a/widget/gtk/GtkCompositorWidget.cpp
b/widget/gtk/GtkCompositorWidget.cpp
---- a/widget/gtk/GtkCompositorWidget.cpp
-+++ b/widget/gtk/GtkCompositorWidget.cpp
-@@ -3,10 +3,11 @@
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- #include "GtkCompositorWidget.h"
-
-+#include "mozilla/gfx/gfxVars.h"
- #include "mozilla/layers/CompositorThread.h"
- #include "mozilla/widget/InProcessCompositorWidget.h"
- #include "mozilla/widget/PlatformWidgetTypes.h"
- #include "nsWindow.h"
-
-diff --git a/widget/gtk/IMContextWrapper.cpp
b/widget/gtk/IMContextWrapper.cpp
---- a/widget/gtk/IMContextWrapper.cpp
-+++ b/widget/gtk/IMContextWrapper.cpp
-@@ -5,10 +5,11 @@
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- #include "mozilla/Logging.h"
- #include "nsString.h"
- #include "prtime.h"
-+#include "prenv.h"
-
- #include "IMContextWrapper.h"
- #include "nsGtkKeyUtils.h"
- #include "nsWindow.h"
- #include "mozilla/AutoRestore.h"
-diff --git a/widget/gtk/InProcessGtkCompositorWidget.cpp
b/widget/gtk/InProcessGtkCompositorWidget.cpp
---- a/widget/gtk/InProcessGtkCompositorWidget.cpp
-+++ b/widget/gtk/InProcessGtkCompositorWidget.cpp
-@@ -6,14 +6,14 @@
- #include "HeadlessCompositorWidget.h"
- #include "HeadlessWidget.h"
- #include "mozilla/widget/PlatformWidgetTypes.h"
-
- #include "InProcessGtkCompositorWidget.h"
-+#include "VsyncDispatcher.h"
- #include "nsWindow.h"
-
--namespace mozilla {
--namespace widget {
-+namespace mozilla::widget {
-
- /* static */
- RefPtr<CompositorWidget> CompositorWidget::CreateLocal(
- const CompositorWidgetInitData& aInitData,
- const layers::CompositorOptions& aOptions, nsIWidget* aWidget) {
-@@ -39,7 +39,6 @@
- mWidget->GetCompositorVsyncDispatcher()) {
- cvd->SetCompositorVsyncObserver(aObserver);
- }
- }
-
--} // namespace widget
--} // namespace mozilla
-+} // namespace mozilla::widget
-diff --git a/widget/gtk/MPRISServiceHandler.cpp
b/widget/gtk/MPRISServiceHandler.cpp
---- a/widget/gtk/MPRISServiceHandler.cpp
-+++ b/widget/gtk/MPRISServiceHandler.cpp
-@@ -10,10 +10,11 @@
- #include <inttypes.h>
- #include <unordered_map>
-
- #include "MPRISInterfaceDescription.h"
- #include "mozilla/dom/MediaControlUtils.h"
-+#include "mozilla/GRefPtr.h"
- #include "mozilla/GUniquePtr.h"
- #include "mozilla/UniquePtrExtensions.h"
- #include "mozilla/Maybe.h"
- #include "mozilla/ScopeExit.h"
- #include "mozilla/Sprintf.h"
-diff --git a/widget/gtk/WindowSurfaceX11.h b/widget/gtk/WindowSurfaceX11.h
---- a/widget/gtk/WindowSurfaceX11.h
-+++ b/widget/gtk/WindowSurfaceX11.h
-@@ -11,13 +11,13 @@
-
- # include "mozilla/widget/WindowSurface.h"
- # include "mozilla/gfx/Types.h"
-
- # include <X11/Xlib.h>
-+# include "X11UndefineNone.h"
-
--namespace mozilla {
--namespace widget {
-+namespace mozilla::widget {
-
- class WindowSurfaceX11 : public WindowSurface {
- public:
- WindowSurfaceX11(Display* aDisplay, Window aWindow, Visual* aVisual,
- unsigned int aDepth);
-@@ -31,10 +31,9 @@
- Visual* const mVisual;
- const unsigned int mDepth;
- const gfx::SurfaceFormat mFormat;
- };
-
--} // namespace widget
--} // namespace mozilla
-+} // namespace mozilla::widget
-
- #endif // MOZ_X11
- #endif // _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_X11_H
-diff --git a/widget/gtk/WindowSurfaceX11.cpp
b/widget/gtk/WindowSurfaceX11.cpp
---- a/widget/gtk/WindowSurfaceX11.cpp
-+++ b/widget/gtk/WindowSurfaceX11.cpp
-@@ -4,14 +4,12 @@
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- #include "WindowSurfaceX11.h"
- #include "gfxPlatform.h"
--#include "X11UndefineNone.h"
-
--namespace mozilla {
--namespace widget {
-+namespace mozilla::widget {
-
- WindowSurfaceX11::WindowSurfaceX11(Display* aDisplay, Window aWindow,
- Visual* aVisual, unsigned int aDepth)
- : mDisplay(aDisplay),
- mWindow(aWindow),
-@@ -44,7 +42,6 @@
- }
-
- return gfx::SurfaceFormat::UNKNOWN;
- }
-
--} // namespace widget
--} // namespace mozilla
-+} // namespace mozilla::widget
-diff --git a/widget/gtk/nsApplicationChooser.cpp
b/widget/gtk/nsApplicationChooser.cpp
---- a/widget/gtk/nsApplicationChooser.cpp
-+++ b/widget/gtk/nsApplicationChooser.cpp
-@@ -9,10 +9,11 @@
-
- #include "nsApplicationChooser.h"
- #include "WidgetUtils.h"
- #include "nsIMIMEInfo.h"
- #include "nsIWidget.h"
-+#include "nsIFile.h"
- #include "nsCExternalHandlerService.h"
- #include "nsComponentManagerUtils.h"
- #include "nsGtkUtils.h"
- #include "nsPIDOMWindow.h"
-
-diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp
---- a/widget/gtk/nsClipboard.cpp
-+++ b/widget/gtk/nsClipboard.cpp
-@@ -29,10 +29,11 @@
- #include "nsStringStream.h"
- #include "nsIFileURL.h"
- #include "nsIObserverService.h"
- #include "mozilla/Services.h"
- #include "mozilla/RefPtr.h"
-+#include "mozilla/GRefPtr.h"
- #include "mozilla/SchedulerGroup.h"
- #include "mozilla/StaticPrefs_widget.h"
- #include "mozilla/TimeStamp.h"
- #include "WidgetUtilsGtk.h"
-
-diff --git a/widget/gtk/nsGtkKeyUtils.h b/widget/gtk/nsGtkKeyUtils.h
---- a/widget/gtk/nsGtkKeyUtils.h
-+++ b/widget/gtk/nsGtkKeyUtils.h
-@@ -18,10 +18,11 @@
- #endif
- #ifdef MOZ_WAYLAND
- # include <gdk/gdkwayland.h>
- # include <xkbcommon/xkbcommon.h>
- #endif
-+#include "X11UndefineNone.h"
-
- class nsWindow;
-
- namespace mozilla {
- namespace widget {
-
diff --git
a/http/firefox/patches/0036-p04-bmo-1772513-build-wayland-only-D148257.patch
b/http/firefox/patches/0036-p04-bmo-1772513-build-wayland-only-D148257.patch
deleted file mode 100644
index e6696a4..0000000
---
a/http/firefox/patches/0036-p04-bmo-1772513-build-wayland-only-D148257.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
---- a/widget/gtk/moz.build
-+++ b/widget/gtk/moz.build
-@@ -185,8 +185,7 @@
- ]
- UNIFIED_SOURCES += [
- "AsyncDBus.cpp",
- ]
- CXXFLAGS += CONFIG["MOZ_DBUS_GLIB_CFLAGS"]
-+
- CXXFLAGS += ["-Werror=switch"]
--
--REQUIRES_UNIFIED_BUILD = True
-
diff --git
a/http/firefox/patches/0041-p01-bmo-1772719-build-wayland-only.patch
b/http/firefox/patches/0041-p01-bmo-1772719-build-wayland-only.patch
new file mode 100644
index 0000000..697d608
--- /dev/null
+++ b/http/firefox/patches/0041-p01-bmo-1772719-build-wayland-only.patch
@@ -0,0 +1,36 @@
+
+# HG changeset patch
+# User ganguin <ganguin>
+# Date 1654600180 0
+# Node ID 2e739b8c44c72cfcd603a34217c7ca8d8a99c6e3
+# Parent 4d909088d95c2addd0309c2d81d89dae0c4537ea
+Bug 1772719 - fix wayland-only build with mesa X11 support r=stransky
+
+this patch fixes building firefox with
+--enable-default-toolkit=cairo-gtk3-wayland-only when system mesa is build
+with X11 support.
+
+Without this patch, it only builds with mesa built without X11 support.
+
+Differential Revision: https://phabricator.services.mozilla.com/D148347
+
+diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp
+--- a/widget/gtk/nsClipboard.cpp
++++ b/widget/gtk/nsClipboard.cpp
+@@ -34,12 +34,15 @@
+ #include "mozilla/SchedulerGroup.h"
+ #include "mozilla/StaticPrefs_widget.h"
+ #include "mozilla/TimeStamp.h"
++#include "GRefPtr.h"
+ #include "WidgetUtilsGtk.h"
+
+ #include "imgIContainer.h"
+
+ #include <gtk/gtk.h>
+-#include <gtk/gtkx.h>
++#if defined(MOZ_X11)
++# include <gtk/gtkx.h>
++#endif
+
+ #include "mozilla/Encoding.h"
+
diff --git
a/http/firefox/patches/0042-p02-bmo-1772721-build-wayland-only-D148496fixed.patch
b/http/firefox/patches/0042-p02-bmo-1772721-build-wayland-only-D148496fixed.patch
new file mode 100644
index 0000000..22a9cb0
--- /dev/null
+++
b/http/firefox/patches/0042-p02-bmo-1772721-build-wayland-only-D148496fixed.patch
@@ -0,0 +1,84 @@
+diff --git a/widget/gtk/mozgtk/moz.build b/widget/gtk/mozgtk/moz.build
+--- a/widget/gtk/mozgtk/moz.build
++++ b/widget/gtk/mozgtk/moz.build
+@@ -9,10 +9,11 @@
+ SOURCES += [
+ "mozgtk.c",
+ ]
+
+ CFLAGS += CONFIG["MOZ_X11_CFLAGS"]
++CFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
+
+ # If LDFLAGS contains -Wl,--as-needed or if it's the default for the
toolchain,
+ # we need to add -Wl,--no-as-needed before the gtk libraries, otherwise the
+ # linker will drop those dependencies because no symbols are used from them.
+ # But those dependencies need to be kept for things to work properly.
+diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
+--- a/widget/gtk/mozgtk/mozgtk.c
++++ b/widget/gtk/mozgtk/mozgtk.c
+@@ -4,10 +4,17 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ #include "mozilla/Types.h"
+
++#include <gdk/gdk.h>
++
++// Dummy call to gtk3 library to prevent the linker from removing
++// the gtk3 dependency with --as-needed.
++// see toolkit/library/moz.build for details.
++MOZ_EXPORT void mozgtk_linker_holder() { gdk_display_get_default(); }
++
+ #ifdef MOZ_X11
+ # include <X11/Xlib.h>
+ // Bug 1271100
+ // We need to trick system Cairo into not using the XShm extension due to
+ // a race condition in it that results in frequent BadAccess errors. Cairo
+diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
+--- a/widget/gtk/nsWindow.cpp
++++ b/widget/gtk/nsWindow.cpp
+@@ -266,10 +266,13 @@
+ return sTimeConverterSingleton;
+ }
+
+ bool nsWindow::sTransparentMainWindow = false;
+
++// forward declare from mozgtk
++extern "C" MOZ_EXPORT void mozgtk_linker_holder();
++
+ namespace mozilla {
+
+ #ifdef MOZ_X11
+ class CurrentX11TimeGetter {
+ public:
+@@ -426,10 +429,14 @@
+ do_GetService("@mozilla.org/widget/clipboard;1");
+ NS_ASSERTION(clipboard, "Failed to init clipboard!");
+ }
+ #endif
+ }
++ // Dummy call to mozgtk to prevent the linker from removing
++ // the dependency with --as-needed.
++ // see toolkit/library/moz.build for details.
++ mozgtk_linker_holder();
+ }
+
+ nsWindow::~nsWindow() {
+ LOG("nsWindow::~nsWindow()");
+
+@@ -5332,14 +5339,10 @@
+ //
+ // If the window were to get unredirected, there could be visible
+ // tearing because Gecko does not align its framebuffer updates with
+ // vblank.
+ SetCompositorHint(GTK_WIDGET_COMPOSIDED_ENABLED);
+-
+- // Dummy call to a function in mozgtk to prevent the linker from
removing
+- // the dependency with --as-needed.
+- XShmQueryExtension(DefaultXDisplay());
+ }
+ #endif
+ #ifdef MOZ_WAYLAND
+ if (GdkIsWaylandDisplay()) {
+ mSurfaceProvider.Initialize(this);
+
diff --git
a/http/firefox/patches/0043-p02-bmo-1772721-build-wayland-only.patch
b/http/firefox/patches/0043-p02-bmo-1772721-build-wayland-only.patch
new file mode 100644
index 0000000..63907fd
--- /dev/null
+++ b/http/firefox/patches/0043-p02-bmo-1772721-build-wayland-only.patch
@@ -0,0 +1,25 @@
+diff -Naur a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
+--- a/widget/gtk/mozgtk/mozgtk.c 2022-06-18 19:17:31.464160229 -0000
++++ b/widget/gtk/mozgtk/mozgtk.c 2022-06-18 19:24:34.966749520 -0000
+@@ -8,6 +8,8 @@
+
+ #include <gdk/gdk.h>
+
++MOZ_EXPORT unsigned int gtk_get_debug_flags(void) { return 0; }
++
+ // Dummy call to gtk3 library to prevent the linker from removing
+ // the gtk3 dependency with --as-needed.
+ // see toolkit/library/moz.build for details.
+diff -Naur a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
+--- a/widget/gtk/nsWindow.cpp 2022-06-18 19:17:31.464160229 -0000
++++ b/widget/gtk/nsWindow.cpp 2022-06-18 19:26:47.689851900 -0000
+@@ -5312,6 +5312,9 @@
+ SetCompositorHint(GTK_WIDGET_COMPOSIDED_ENABLED);
+ }
+ #endif
++// Dummy call to a function in mozgtk to prevent the linker from removing
++// the dependency with --as-needed.
++gtk_get_debug_flags();
+ #ifdef MOZ_WAYLAND
+ if (GdkIsWaylandDisplay()) {
+ mSurfaceProvider.Initialize(this);
diff --git
a/http/firefox/patches/0044-p03-bmo-1772513-build-wayland-only-D148256.patch
b/http/firefox/patches/0044-p03-bmo-1772513-build-wayland-only-D148256.patch
new file mode 100644
index 0000000..6caf6eb
--- /dev/null
+++
b/http/firefox/patches/0044-p03-bmo-1772513-build-wayland-only-D148256.patch
@@ -0,0 +1,207 @@
+diff --git a/widget/gtk/CompositorWidgetParent.cpp
b/widget/gtk/CompositorWidgetParent.cpp
+--- a/widget/gtk/CompositorWidgetParent.cpp
++++ b/widget/gtk/CompositorWidgetParent.cpp
+@@ -4,13 +4,13 @@
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ #include "CompositorWidgetParent.h"
+ #include "mozilla/Unused.h"
+ #include "mozilla/widget/PlatformWidgetTypes.h"
++#include "nsWindow.h"
+
+-namespace mozilla {
+-namespace widget {
++namespace mozilla::widget {
+
+ CompositorWidgetParent::CompositorWidgetParent(
+ const CompositorWidgetInitData& aInitData,
+ const layers::CompositorOptions& aOptions)
+ : GtkCompositorWidget(aInitData.get_GtkCompositorWidgetInitData(),
aOptions,
+@@ -49,7 +49,6 @@
+ const uintptr_t& aXWindow, const bool& aShaped) {
+ EnableRendering(aXWindow, aShaped);
+ return IPC_OK();
+ }
+
+-} // namespace widget
+-} // namespace mozilla
++} // namespace mozilla::widget
+diff --git a/widget/gtk/GtkCompositorWidget.cpp
b/widget/gtk/GtkCompositorWidget.cpp
+--- a/widget/gtk/GtkCompositorWidget.cpp
++++ b/widget/gtk/GtkCompositorWidget.cpp
+@@ -3,10 +3,11 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ #include "GtkCompositorWidget.h"
+
++#include "mozilla/gfx/gfxVars.h"
+ #include "mozilla/layers/CompositorThread.h"
+ #include "mozilla/widget/InProcessCompositorWidget.h"
+ #include "mozilla/widget/PlatformWidgetTypes.h"
+ #include "nsWindow.h"
+
+diff --git a/widget/gtk/IMContextWrapper.cpp
b/widget/gtk/IMContextWrapper.cpp
+--- a/widget/gtk/IMContextWrapper.cpp
++++ b/widget/gtk/IMContextWrapper.cpp
+@@ -5,10 +5,11 @@
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ #include "mozilla/Logging.h"
+ #include "nsString.h"
+ #include "prtime.h"
++#include "prenv.h"
+
+ #include "IMContextWrapper.h"
+ #include "nsGtkKeyUtils.h"
+ #include "nsWindow.h"
+ #include "mozilla/AutoRestore.h"
+diff --git a/widget/gtk/InProcessGtkCompositorWidget.cpp
b/widget/gtk/InProcessGtkCompositorWidget.cpp
+--- a/widget/gtk/InProcessGtkCompositorWidget.cpp
++++ b/widget/gtk/InProcessGtkCompositorWidget.cpp
+@@ -6,14 +6,14 @@
+ #include "HeadlessCompositorWidget.h"
+ #include "HeadlessWidget.h"
+ #include "mozilla/widget/PlatformWidgetTypes.h"
+
+ #include "InProcessGtkCompositorWidget.h"
++#include "VsyncDispatcher.h"
+ #include "nsWindow.h"
+
+-namespace mozilla {
+-namespace widget {
++namespace mozilla::widget {
+
+ /* static */
+ RefPtr<CompositorWidget> CompositorWidget::CreateLocal(
+ const CompositorWidgetInitData& aInitData,
+ const layers::CompositorOptions& aOptions, nsIWidget* aWidget) {
+@@ -39,7 +39,6 @@
+ mWidget->GetCompositorVsyncDispatcher()) {
+ cvd->SetCompositorVsyncObserver(aObserver);
+ }
+ }
+
+-} // namespace widget
+-} // namespace mozilla
++} // namespace mozilla::widget
+diff --git a/widget/gtk/MPRISServiceHandler.cpp
b/widget/gtk/MPRISServiceHandler.cpp
+--- a/widget/gtk/MPRISServiceHandler.cpp
++++ b/widget/gtk/MPRISServiceHandler.cpp
+@@ -10,10 +10,11 @@
+ #include <inttypes.h>
+ #include <unordered_map>
+
+ #include "MPRISInterfaceDescription.h"
+ #include "mozilla/dom/MediaControlUtils.h"
++#include "mozilla/GRefPtr.h"
+ #include "mozilla/GUniquePtr.h"
+ #include "mozilla/UniquePtrExtensions.h"
+ #include "mozilla/Maybe.h"
+ #include "mozilla/ScopeExit.h"
+ #include "mozilla/Sprintf.h"
+diff --git a/widget/gtk/WindowSurfaceX11.h b/widget/gtk/WindowSurfaceX11.h
+--- a/widget/gtk/WindowSurfaceX11.h
++++ b/widget/gtk/WindowSurfaceX11.h
+@@ -11,13 +11,13 @@
+
+ # include "mozilla/widget/WindowSurface.h"
+ # include "mozilla/gfx/Types.h"
+
+ # include <X11/Xlib.h>
++# include "X11UndefineNone.h"
+
+-namespace mozilla {
+-namespace widget {
++namespace mozilla::widget {
+
+ class WindowSurfaceX11 : public WindowSurface {
+ public:
+ WindowSurfaceX11(Display* aDisplay, Window aWindow, Visual* aVisual,
+ unsigned int aDepth);
+@@ -31,10 +31,9 @@
+ Visual* const mVisual;
+ const unsigned int mDepth;
+ const gfx::SurfaceFormat mFormat;
+ };
+
+-} // namespace widget
+-} // namespace mozilla
++} // namespace mozilla::widget
+
+ #endif // MOZ_X11
+ #endif // _MOZILLA_WIDGET_GTK_WINDOW_SURFACE_X11_H
+diff --git a/widget/gtk/WindowSurfaceX11.cpp
b/widget/gtk/WindowSurfaceX11.cpp
+--- a/widget/gtk/WindowSurfaceX11.cpp
++++ b/widget/gtk/WindowSurfaceX11.cpp
+@@ -4,14 +4,12 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ #include "WindowSurfaceX11.h"
+ #include "gfxPlatform.h"
+-#include "X11UndefineNone.h"
+
+-namespace mozilla {
+-namespace widget {
++namespace mozilla::widget {
+
+ WindowSurfaceX11::WindowSurfaceX11(Display* aDisplay, Window aWindow,
+ Visual* aVisual, unsigned int aDepth)
+ : mDisplay(aDisplay),
+ mWindow(aWindow),
+@@ -44,7 +42,6 @@
+ }
+
+ return gfx::SurfaceFormat::UNKNOWN;
+ }
+
+-} // namespace widget
+-} // namespace mozilla
++} // namespace mozilla::widget
+diff --git a/widget/gtk/nsApplicationChooser.cpp
b/widget/gtk/nsApplicationChooser.cpp
+--- a/widget/gtk/nsApplicationChooser.cpp
++++ b/widget/gtk/nsApplicationChooser.cpp
+@@ -9,10 +9,11 @@
+
+ #include "nsApplicationChooser.h"
+ #include "WidgetUtils.h"
+ #include "nsIMIMEInfo.h"
+ #include "nsIWidget.h"
++#include "nsIFile.h"
+ #include "nsCExternalHandlerService.h"
+ #include "nsComponentManagerUtils.h"
+ #include "nsGtkUtils.h"
+ #include "nsPIDOMWindow.h"
+
+diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp
+--- a/widget/gtk/nsClipboard.cpp
++++ b/widget/gtk/nsClipboard.cpp
+@@ -29,10 +29,11 @@
+ #include "nsStringStream.h"
+ #include "nsIFileURL.h"
+ #include "nsIObserverService.h"
+ #include "mozilla/Services.h"
+ #include "mozilla/RefPtr.h"
++#include "mozilla/GRefPtr.h"
+ #include "mozilla/SchedulerGroup.h"
+ #include "mozilla/StaticPrefs_widget.h"
+ #include "mozilla/TimeStamp.h"
+ #include "WidgetUtilsGtk.h"
+
+diff --git a/widget/gtk/nsGtkKeyUtils.h b/widget/gtk/nsGtkKeyUtils.h
+--- a/widget/gtk/nsGtkKeyUtils.h
++++ b/widget/gtk/nsGtkKeyUtils.h
+@@ -18,10 +18,11 @@
+ #endif
+ #ifdef MOZ_WAYLAND
+ # include <gdk/gdkwayland.h>
+ # include <xkbcommon/xkbcommon.h>
+ #endif
++#include "X11UndefineNone.h"
+
+ class nsWindow;
+
+ namespace mozilla {
+ namespace widget {
+
diff --git
a/http/firefox/patches/0045-p04-bmo-1772513-build-wayland-only-D148257.patch
b/http/firefox/patches/0045-p04-bmo-1772513-build-wayland-only-D148257.patch
new file mode 100644
index 0000000..e6696a4
--- /dev/null
+++
b/http/firefox/patches/0045-p04-bmo-1772513-build-wayland-only-D148257.patch
@@ -0,0 +1,14 @@
+diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
+--- a/widget/gtk/moz.build
++++ b/widget/gtk/moz.build
+@@ -185,8 +185,7 @@
+ ]
+ UNIFIED_SOURCES += [
+ "AsyncDBus.cpp",
+ ]
+ CXXFLAGS += CONFIG["MOZ_DBUS_GLIB_CFLAGS"]
++
+ CXXFLAGS += ["-Werror=switch"]
+-
+-REQUIRES_UNIFIED_BUILD = True
+
diff --git
a/http/firefox/patches/0046-bmo-1754469-memory_mozalloc_throw.patch
b/http/firefox/patches/0046-bmo-1754469-memory_mozalloc_throw.patch
new file mode 100644
index 0000000..634892be
--- /dev/null
+++ b/http/firefox/patches/0046-bmo-1754469-memory_mozalloc_throw.patch
@@ -0,0 +1,69 @@
+--- a/memory/mozalloc/throw_gcc.h 2022-02-02 17:33:38 UTC
++++ b/memory/mozalloc/throw_gcc.h
+@@ -74,50 +74,66 @@ __throw_bad_function_call(void) {
+ mozalloc_abort("fatal: STL threw bad_function_call");
+ }
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_logic_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_domain_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_invalid_argument(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_length_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_out_of_range(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_runtime_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_range_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_overflow_error(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_underflow_error(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_ios_failure(
+ const char* msg) {
diff --git
a/http/firefox/patches/0047-bmo-1769631-python-3.11-compatibility.patch
b/http/firefox/patches/0047-bmo-1769631-python-3.11-compatibility.patch
new file mode 100644
index 0000000..8dcd0e2
--- /dev/null
+++ b/http/firefox/patches/0047-bmo-1769631-python-3.11-compatibility.patch
@@ -0,0 +1,208 @@
+
+# HG changeset patch
+# User ahochheiden <ahochheiden AT mozilla.com>
+# Date 1654151264 0
+# Node ID f54162b2c1f2fe52c6137ab2c3469a1944f58b27
+# Parent 6e7776492240c27732840d65a33dcc440fa1aba0
+Bug 1769631 - Remove 'U' from 'mode' parameters for various 'open' calls to
ensure Python3.11 compatibility r=firefox-build-system-reviewers,glandium
+
+The 'U' flag represents "universal newline". It has been deprecated
+since Python3.3. Since then "universal newline" is the default when a
+file is opened in text mode (not bytes). In Python3.11 using the 'U'
+flag throws errors. There should be no harm in removing 'U' from 'open'
+everywhere it is used, and doing allows the use of Python3.11.
+
+For more reading see:
https://docs.python.org/3.11/whatsnew/3.11.html#changes-in-the-python-api
+
+Differential Revision: https://phabricator.services.mozilla.com/D147721
+
+diff --git a/dom/base/usecounters.py b/dom/base/usecounters.py
+--- a/dom/base/usecounters.py
++++ b/dom/base/usecounters.py
+@@ -3,17 +3,17 @@
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ import collections
+ import re
+
+
+ def read_conf(conf_filename):
+ # Can't read/write from a single StringIO, so make a new one for
reading.
+- stream = open(conf_filename, "rU")
++ stream = open(conf_filename, "r")
+
+ def parse_counters(stream):
+ for line_num, line in enumerate(stream):
+ line = line.rstrip("\n")
+ if not line or line.startswith("//"):
+ # empty line or comment
+ continue
+ m = re.match(r"method ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$", line)
+diff --git a/python/mozbuild/mozbuild/action/process_define_files.py
b/python/mozbuild/mozbuild/action/process_define_files.py
+--- a/python/mozbuild/mozbuild/action/process_define_files.py
++++ b/python/mozbuild/mozbuild/action/process_define_files.py
+@@ -31,17 +31,17 @@ def process_define_file(output, input):
+
+ config = PartialConfigEnvironment(topobjdir)
+
+ if mozpath.basedir(
+ path, [mozpath.join(topsrcdir, "js/src")]
+ ) and not config.substs.get("JS_STANDALONE"):
+ config = PartialConfigEnvironment(mozpath.join(topobjdir, "js",
"src"))
+
+- with open(path, "rU") as input:
++ with open(path, "r") as input:
+ r = re.compile(
+
"^\s*#\s*(?P<cmd>[a-z]+)(?:\s+(?P<name>\S+)(?:\s+(?P<value>\S+))?)?", re.U
+ )
+ for l in input:
+ m = r.match(l)
+ if m:
+ cmd = m.group("cmd")
+ name = m.group("name")
+diff --git a/python/mozbuild/mozbuild/backend/base.py
b/python/mozbuild/mozbuild/backend/base.py
+--- a/python/mozbuild/mozbuild/backend/base.py
++++ b/python/mozbuild/mozbuild/backend/base.py
+@@ -267,17 +267,17 @@ class BuildBackend(LoggingMixin):
+ If an exception is raised, |mach build| will fail with a
+ non-zero exit code.
+ """
+ self._write_purgecaches(config)
+
+ return status
+
+ @contextmanager
+- def _write_file(self, path=None, fh=None, readmode="rU"):
++ def _write_file(self, path=None, fh=None, readmode="r"):
+ """Context manager to write a file.
+
+ This is a glorified wrapper around FileAvoidWrite with integration
to
+ update the summary data on this instance.
+
+ Example usage:
+
+ with self._write_file('foo.txt') as fh:
+diff --git a/python/mozbuild/mozbuild/preprocessor.py
b/python/mozbuild/mozbuild/preprocessor.py
+--- a/python/mozbuild/mozbuild/preprocessor.py
++++ b/python/mozbuild/mozbuild/preprocessor.py
+@@ -526,17 +526,17 @@ class Preprocessor:
+ if not options.output:
+ raise Preprocessor.Error(
+ self, "--depend doesn't work with stdout", None
+ )
+ depfile = get_output_file(options.depend)
+
+ if args:
+ for f in args:
+- with io.open(f, "rU", encoding="utf-8") as input:
++ with io.open(f, "r", encoding="utf-8") as input:
+ self.processFile(input=input, output=out)
+ if depfile:
+ mk = Makefile()
+
mk.create_rule([six.ensure_text(options.output)]).add_dependencies(
+ self.includes
+ )
+ mk.dump(depfile)
+ depfile.close()
+@@ -855,17 +855,17 @@ class Preprocessor:
+ self.checkLineNumbers = False
+ if isName:
+ try:
+ args = _to_text(args)
+ if filters:
+ args = self.applyFilters(args)
+ if not os.path.isabs(args):
+ args = os.path.join(self.curdir, args)
+- args = io.open(args, "rU", encoding="utf-8")
++ args = io.open(args, "r", encoding="utf-8")
+ except Preprocessor.Error:
+ raise
+ except Exception:
+ raise Preprocessor.Error(self, "FILE_NOT_FOUND",
_to_text(args))
+ self.checkLineNumbers = bool(
+ re.search("\.(js|jsm|java|webidl)(?:\.in)?$", args.name)
+ )
+ oldFile = self.context["FILE"]
+@@ -909,17 +909,17 @@ class Preprocessor:
+
+ def do_error(self, args):
+ raise Preprocessor.Error(self, "Error: ", _to_text(args))
+
+
+ def preprocess(includes=[sys.stdin], defines={}, output=sys.stdout,
marker="#"):
+ pp = Preprocessor(defines=defines, marker=marker)
+ for f in includes:
+- with io.open(f, "rU", encoding="utf-8") as input:
++ with io.open(f, "r", encoding="utf-8") as input:
+ pp.processFile(input=input, output=output)
+ return pp.includes
+
+
+ # Keep this module independently executable.
+ if __name__ == "__main__":
+ pp = Preprocessor()
+ pp.handleCommandLine(None, True)
+diff --git a/python/mozbuild/mozbuild/util.py
b/python/mozbuild/mozbuild/util.py
+--- a/python/mozbuild/mozbuild/util.py
++++ b/python/mozbuild/mozbuild/util.py
+@@ -231,17 +231,17 @@ class FileAvoidWrite(BytesIO):
+ enabled by default because it a) doesn't make sense for binary files b)
+ could add unwanted overhead to calls.
+
+ Additionally, there is dry run mode where the file is not actually
written
+ out, but reports whether the file was existing and would have been
updated
+ still occur, as well as diff capture if requested.
+ """
+
+- def __init__(self, filename, capture_diff=False, dry_run=False,
readmode="rU"):
++ def __init__(self, filename, capture_diff=False, dry_run=False,
readmode="r"):
+ BytesIO.__init__(self)
+ self.name = filename
+ assert type(capture_diff) == bool
+ assert type(dry_run) == bool
+ assert "r" in readmode
+ self._capture_diff = capture_diff
+ self._write_to_file = not dry_run
+ self.diff = None
+diff --git a/python/mozbuild/mozpack/files.py
b/python/mozbuild/mozpack/files.py
+--- a/python/mozbuild/mozpack/files.py
++++ b/python/mozbuild/mozpack/files.py
+@@ -549,17 +549,17 @@ class PreprocessedFile(BaseFile):
+ self.defines = defines
+ self.extra_depends = list(extra_depends or [])
+ self.silence_missing_directive_warnings =
silence_missing_directive_warnings
+
+ def inputs(self):
+ pp = Preprocessor(defines=self.defines, marker=self.marker)
+
pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings)
+
+- with _open(self.path, "rU") as input:
++ with _open(self.path, "r") as input:
+ with _open(os.devnull, "w") as output:
+ pp.processFile(input=input, output=output)
+
+ # This always yields at least self.path.
+ return pp.includes
+
+ def copy(self, dest, skip_if_older=True):
+ """
+@@ -606,17 +606,17 @@ class PreprocessedFile(BaseFile):
+ return False
+
+ deps_out = None
+ if self.depfile:
+ deps_out = FileAvoidWrite(self.depfile)
+ pp = Preprocessor(defines=self.defines, marker=self.marker)
+
pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings)
+
+- with _open(self.path, "rU") as input:
++ with _open(self.path, "r") as input:
+ pp.processFile(input=input, output=dest, depfile=deps_out)
+
+ dest.close()
+ if self.depfile:
+ deps_out.close()
+
+ return True
+
+
- [SM-Commit] GIT changes to master grimoire by Pavel Vinogradov (4b377bb3e9a7a0c352c3c86d1ac16cad3d83166b), Pavel Vinogradov, 06/28/2022
Archive powered by MHonArc 2.6.24.