Skip to Content.
Sympa Menu

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

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Thomas Orgis <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Thomas Orgis (63cbe170054725d2a6dfa6b26331ff91ef7f1ffb)
  • Date: Thu, 30 Jun 2022 17:51:04 +0000

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

audio-drivers/pulseaudio/DEPENDS |
15
audio-drivers/pulseaudio/HISTORY |
3
http/firefox/BUILD |
6
http/firefox/CONFIGURE |
6
http/firefox/DEPENDS |
46 -
http/firefox/DETAILS |
1
http/firefox/HISTORY |
6
http/firefox/patches/0032-p03-bmo-1752494-vaapi-fixes-D147874.patch |
64 ++
http/firefox/patches/0033-bmo-1735929-webgl-nvidia-p1-D147635.patch |
125 ++++
http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch |
278 ++++++++++
http/firefox/patches/0035-bmo-1735929-webgl-nvidia-p3-D147637.patch |
139 +++++
http/firefox/patches/0036-bmo-1773968-webgl-memory-leak.patch |
80 ++
http/firefox/patches/0037-bmo-1758948-vaapi-fixes-p2-p4.patch |
28 +
http/firefox/patches/0038-bmo-1773377-vaapi-fixes-p2-p2-D148946.patch |
250 ++++++++
http/firefox/patches/0039-bmo-1774075-vaapi-fixes-p2-p3-D149238.patch |
34 +
http/firefox/patches/0040-bmo-1774271-vaapi-fixes-p2-p5.patch |
154 +++++
http/firefox/patches/0046-bmo-1754469-memory_mozalloc_throw.patch |
69 --
http/firefox/patches/0046-p05-bmo-1776724-build-wayland-only-D150485.patch |
115 ++++
http/firefox/patches/0047-bmo-1754469-memory_mozalloc_throw.patch |
69 ++
http/firefox/patches/0047-bmo-1769631-python-3.11-compatibility.patch |
208 -------
http/firefox/patches/0048-bmo-1769631-python-3.11-compatibility.patch |
208 +++++++
21 files changed, 1599 insertions(+), 305 deletions(-)

New commits:
commit 63cbe170054725d2a6dfa6b26331ff91ef7f1ffb
Author: Thomas Orgis <sobukus AT sourcemage.org>
Commit: Thomas Orgis <sobukus AT sourcemage.org>

firefox: version 102.0 refinements

We can properly select audio backends now. Alsa is a normal choice. Also
patches
are in sync with gentoo again.

commit fea699be7dde171a9a397fdf65d8d9acc0c1fadd
Author: Thomas Orgis <sobukus AT sourcemage.org>
Commit: Thomas Orgis <sobukus AT sourcemage.org>

pulseaudio: ensure some audio processor

This could be nicer. But one of the two is required.

diff --git a/audio-drivers/pulseaudio/DEPENDS
b/audio-drivers/pulseaudio/DEPENDS
index 4a11637a..3b101bd 100755
--- a/audio-drivers/pulseaudio/DEPENDS
+++ b/audio-drivers/pulseaudio/DEPENDS
@@ -132,10 +132,17 @@ optional_depends systemd \
"systemd=disabled" \
"for systemd support" &&

-optional_depends webrtc-audio-processing \
- "webrtc-aec=enabled" \
- "webrtc-aec=disabled" \
- "for WebRTC-based echo canceller" &&
+# not optional, build barks out without
+if ! list_find "$PULSEAUDIO_OPTS" adrian-aec=true; then
+ message "${MESSAGE_COLOR}Some processor is required, forcing the external
one.${DEFAULT_COLOR}" &&
+ depends webrtc-audio-processing \
+ "webrtc-aec=enabled"
+else
+ optional_depends webrtc-audio-processing \
+ "webrtc-aec=enabled" \
+ "webrtc-aec=disabled" \
+ "for WebRTC-based echo canceller"
+fi &&

if is_depends_enabled ${SPELL} webrtc-audio-processing; then
depends -sub CXX gcc
diff --git a/audio-drivers/pulseaudio/HISTORY
b/audio-drivers/pulseaudio/HISTORY
index dc84004..0e92062 100644
--- a/audio-drivers/pulseaudio/HISTORY
+++ b/audio-drivers/pulseaudio/HISTORY
@@ -1,3 +1,6 @@
+2022-06-29 Thomas Orgis <sobukus AT sourcemage.org>
+ * DEPENDS: really insists on some echo canceller
+
2022-05-28 Florian Franzmann <bwlf AT bandrate.org>
* DETAILS: version 16.0

diff --git a/http/firefox/BUILD b/http/firefox/BUILD
index 05c38fd..10d9c3b 100755
--- a/http/firefox/BUILD
+++ b/http/firefox/BUILD
@@ -50,6 +50,12 @@ if [[ $gccmajor == "4" ]] && [[ $gccminor -ge "6" ]]; then
CXXFLAGS="${CXXFLAGS//-mavx} -mno-avx"
fi

+if test -z "$FIREFOX_AUDIO"; then
+ OPTS+=" --disable-audio-backends"
+else
+ OPTS+=" --enable-audio-backends=${FIREFOX_AUDIO// /,}"
+fi &&
+
for option in $OPTS; do
echo "ac_add_options $option" >> .mozconfig
done &&
diff --git a/http/firefox/CONFIGURE b/http/firefox/CONFIGURE
index c850756..2a0ad0c 100755
--- a/http/firefox/CONFIGURE
+++ b/http/firefox/CONFIGURE
@@ -16,6 +16,8 @@ config_query FIREFOX_SDK \
n &&
config_query FIREFOX_PGO \
'Enable profile guided optimizations (takes twice as
long to build)?' \
- n
+ n &&
config_query FIREFOX_WIDEVINE \
- 'Enable Widevine DRM' n
+ 'Enable Widevine DRM' n &&
+config_query_multi FIREFOX_AUDIO "Select the audio backends:" \
+ alsa pulse jack
diff --git a/http/firefox/DEPENDS b/http/firefox/DEPENDS
index c9cd46b..76192da 100755
--- a/http/firefox/DEPENDS
+++ b/http/firefox/DEPENDS
@@ -70,24 +70,24 @@ optional_depends wireless_tools \
"--disable-necko-wifi" \
"for Necko WiFi scanning" &&

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

if is_depends_enabled $SPELL alsa-lib; then
# Firefox tries to use ogg/ogg.h even with --disable-ogg given
@@ -129,10 +129,12 @@ optional_depends harfbuzz \
"--without-system-harfbuzz" \
"for system harfbuzz" &&

-optional_depends dav1d \
- "--with-system-av1" \
- "--without-system-av1" \
- "for AV1 video support" &&
+# Seems FF wants libaom along with this. Package that, too,
+# or just roll with the vendored copy.
+#optional_depends dav1d \
+# "--with-system-av1" \
+# "--without-system-av1" \
+# "for AV1 video support" &&
if is_depends_enabled $SPELL dav1d; then
depends nasm
fi
diff --git a/http/firefox/DETAILS b/http/firefox/DETAILS
index 9ea2325..3b7b28b 100755
--- a/http/firefox/DETAILS
+++ b/http/firefox/DETAILS
@@ -1,5 +1,6 @@
SPELL=firefox
VERSION=102.0
+ PATCHLEVEL=1
SECURITY_PATCH=165
SOURCE="${SPELL}-${VERSION}.source.tar.xz"

SOURCE_URL[0]="http://releases.mozilla.org/pub/${SPELL}/releases/${VERSION}/source/${SOURCE}";
diff --git a/http/firefox/HISTORY b/http/firefox/HISTORY
index 8e0e5da..bdf7a6b 100644
--- a/http/firefox/HISTORY
+++ b/http/firefox/HISTORY
@@ -1,3 +1,9 @@
+2022-06-30 Thomas Orgis <sobukus AT sourcemage.org>
+ * DETAILS: PATCHLEVEL++
+ * patches/*: sync with gentoo firefox-102-patches-02j
+ * CONFIGURE, DEPENDS, BUILD: offer consolidated audio backend choice
+ * DEPENDS: system AV1 disabled until we got libaom packaged
+
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
diff --git
a/http/firefox/patches/0032-p03-bmo-1752494-vaapi-fixes-D147874.patch
b/http/firefox/patches/0032-p03-bmo-1752494-vaapi-fixes-D147874.patch
new file mode 100644
index 0000000..f0c57dd
--- /dev/null
+++ b/http/firefox/patches/0032-p03-bmo-1752494-vaapi-fixes-D147874.patch
@@ -0,0 +1,64 @@
+diff -up firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp.D147874.diff
firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp
+--- firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp.D147874.diff 2022-05-27
01:16:54.000000000 +0200
++++ firefox-101.0/gfx/thebes/gfxPlatformGtk.cpp 2022-06-07
11:16:03.791419558 +0200
+@@ -233,13 +233,7 @@ void gfxPlatformGtk::InitDmabufConfig()
+ void gfxPlatformGtk::InitVAAPIConfig() {
+ FeatureState& feature = gfxConfig::GetFeature(Feature::VAAPI);
+ #ifdef MOZ_WAYLAND
+- feature.DisableByDefault(FeatureStatus::Disabled,
+- "VAAPI is disabled by default",
+- "FEATURE_VAAPI_DISABLED"_ns);
+-
+- if (StaticPrefs::media_ffmpeg_vaapi_enabled()) {
+- feature.UserForceEnable("Force enabled by pref");
+- }
++ feature.EnableByDefault();
+
+ nsCString failureId;
+ int32_t status;
+@@ -253,6 +247,10 @@ void gfxPlatformGtk::InitVAAPIConfig() {
+ failureId);
+ }
+
++ if (StaticPrefs::media_ffmpeg_vaapi_enabled()) {
++ feature.UserForceEnable("Force enabled by pref");
++ }
++
+ if (!gfxVars::UseEGL()) {
+ feature.ForceDisable(FeatureStatus::Unavailable, "Requires EGL",
+ "FEATURE_FAILURE_REQUIRES_EGL"_ns);
+diff -up firefox-101.0/widget/gtk/GfxInfo.cpp.D147874.diff
firefox-101.0/widget/gtk/GfxInfo.cpp
+--- firefox-101.0/widget/gtk/GfxInfo.cpp.D147874.diff 2022-05-27
01:17:06.000000000 +0200
++++ firefox-101.0/widget/gtk/GfxInfo.cpp 2022-06-07 09:52:54.416701418
+0200
+@@ -843,6 +843,31 @@ const nsTArray<GfxDriverInfo>& GfxInfo::
+ V(495, 44, 0, 0), "FEATURE_FAILURE_NO_GBM", "495.44.0");
+
+ ////////////////////////////////////
++ // FEATURE_VAAPI
++ APPEND_TO_DRIVER_BLOCKLIST_EXT(
++ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
++ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaAll,
++ DeviceFamily::All, nsIGfxInfo::FEATURE_VAAPI,
++ nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
++ V(21, 0, 0, 0), "FEATURE_ROLLOUT_VAAPI_MESA", "Mesa 21.0.0.0");
++
++ // Disable on all NVIDIA hardware
++ APPEND_TO_DRIVER_BLOCKLIST_EXT(
++ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
++ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::All,
++ DeviceFamily::NvidiaAll, nsIGfxInfo::FEATURE_VAAPI,
++ nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
++ V(0, 0, 0, 0), "FEATURE_FAILURE_VAAPI_NO_LINUX_NVIDIA", "");
++
++ // Disable on all AMD devices not using Mesa.
++ APPEND_TO_DRIVER_BLOCKLIST_EXT(
++ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
++ DesktopEnvironment::All, WindowProtocol::All,
DriverVendor::NonMesaAll,
++ DeviceFamily::AtiAll, nsIGfxInfo::FEATURE_VAAPI,
++ nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
++ V(0, 0, 0, 0), "FEATURE_FAILURE_VAAPI_NO_LINUX_AMD", "");
++
++ ////////////////////////////////////
+ // FEATURE_WEBRENDER_PARTIAL_PRESENT
+ APPEND_TO_DRIVER_BLOCKLIST_EXT(
+ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
diff --git
a/http/firefox/patches/0033-bmo-1735929-webgl-nvidia-p1-D147635.patch
b/http/firefox/patches/0033-bmo-1735929-webgl-nvidia-p1-D147635.patch
new file mode 100644
index 0000000..1d4bb58
--- /dev/null
+++ b/http/firefox/patches/0033-bmo-1735929-webgl-nvidia-p1-D147635.patch
@@ -0,0 +1,125 @@
+diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h
+--- a/gfx/gl/GLLibraryEGL.h
++++ b/gfx/gl/GLLibraryEGL.h
+@@ -106,10 +106,13 @@
+ KHR_swap_buffers_with_damage,
+ EXT_buffer_age,
+ KHR_partial_update,
+ NV_robustness_video_memory_purge,
+ MESA_platform_surfaceless,
++ EXT_image_dma_buf_import,
++ EXT_image_dma_buf_import_modifiers,
++ MESA_image_dma_buf_export,
+ Max
+ };
+
+ // -
+
+@@ -461,10 +464,23 @@
+ // EGL_KHR_partial_update
+ EGLBoolean fSetDamageRegion(EGLDisplay dpy, EGLSurface surface,
+ const EGLint* rects, EGLint n_rects) {
+ WRAP(fSetDamageRegion(dpy, surface, rects, n_rects));
+ }
++ // EGL_MESA_image_dma_buf_export
++ EGLBoolean fExportDMABUFImageQuery(EGLDisplay dpy, EGLImage image,
++ int* fourcc, int* num_planes,
++ uint64_t* modifiers) {
++ WRAP(
++ fExportDMABUFImageQueryMESA(dpy, image, fourcc, num_planes,
modifiers));
++ }
++ EGLBoolean fExportDMABUFImage(EGLDisplay dpy, EGLImage image, int* fds,
++ EGLint* strides, EGLint* offsets) {
++ WRAP(fExportDMABUFImageMESA(dpy, image, fds, strides, offsets));
++ }
++
++#undef WRAP
+
+ #undef WRAP
+ #undef PROFILE_CALL
+ #undef BEFORE_CALL
+ #undef AFTER_CALL
+@@ -593,10 +609,22 @@
+ EGLBoolean(GLAPIENTRY* fSetDamageRegion)(EGLDisplay dpy, EGLSurface
surface,
+ const EGLint* rects,
+ EGLint n_rects);
+ EGLClientBuffer(GLAPIENTRY* fGetNativeClientBufferANDROID)(
+ const struct AHardwareBuffer* buffer);
++
++ // EGL_MESA_image_dma_buf_export
++ EGLBoolean(GLAPIENTRY* fExportDMABUFImageQueryMESA)(EGLDisplay dpy,
++ EGLImage image,
++ int* fourcc,
++ int* num_planes,
++ uint64_t*
modifiers);
++ EGLBoolean(GLAPIENTRY* fExportDMABUFImageMESA)(EGLDisplay dpy,
++ EGLImage image, int* fds,
++ EGLint* strides,
++ EGLint* offsets);
++
+ } mSymbols = {};
+ };
+
+ class EglDisplay final {
+ public:
+@@ -852,10 +880,23 @@
+ EGLBoolean fSetDamageRegion(EGLSurface surface, const EGLint* rects,
+ EGLint n_rects) {
+ MOZ_ASSERT(IsExtensionSupported(EGLExtension::KHR_partial_update));
+ return mLib->fSetDamageRegion(mDisplay, surface, rects, n_rects);
+ }
++
++ EGLBoolean fExportDMABUFImageQuery(EGLImage image, int* fourcc,
++ int* num_planes,
++ uint64_t* modifiers) const {
++
MOZ_ASSERT(IsExtensionSupported(EGLExtension::MESA_image_dma_buf_export));
++ return mLib->fExportDMABUFImageQuery(mDisplay, image, fourcc,
num_planes,
++ modifiers);
++ }
++ EGLBoolean fExportDMABUFImage(EGLImage image, int* fds, EGLint* strides,
++ EGLint* offsets) const {
++
MOZ_ASSERT(IsExtensionSupported(EGLExtension::MESA_image_dma_buf_export));
++ return mLib->fExportDMABUFImage(mDisplay, image, fds, strides, offsets);
++ }
+ };
+
+ } /* namespace gl */
+ } /* namespace mozilla */
+
+diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp
+--- a/gfx/gl/GLLibraryEGL.cpp
++++ b/gfx/gl/GLLibraryEGL.cpp
+@@ -82,11 +82,14 @@
+ "EGL_EXT_swap_buffers_with_damage",
+ "EGL_KHR_swap_buffers_with_damage",
+ "EGL_EXT_buffer_age",
+ "EGL_KHR_partial_update",
+ "EGL_NV_robustness_video_memory_purge",
+- "EGL_MESA_platform_surfaceless"};
++ "EGL_MESA_platform_surfaceless",
++ "EGL_EXT_image_dma_buf_import",
++ "EGL_EXT_image_dma_buf_import_modifiers",
++ "EGL_MESA_image_dma_buf_export"};
+
+ PRLibrary* LoadApitraceLibrary() {
+ const char* path = nullptr;
+
+ #ifdef ANDROID
+@@ -647,10 +650,16 @@
+ {
+ const SymLoadStruct symbols[] = {SYMBOL(GetPlatformDisplay),
+ END_OF_SYMBOLS};
+ (void)fnLoadSymbols(symbols);
+ }
++ {
++ const SymLoadStruct symbols[] = {SYMBOL(ExportDMABUFImageQueryMESA),
++ SYMBOL(ExportDMABUFImageMESA),
++ END_OF_SYMBOLS};
++ (void)fnLoadSymbols(symbols);
++ }
+
+ return true;
+ }
+
+ // -
+
diff --git
a/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch
b/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch
new file mode 100644
index 0000000..52462f2
--- /dev/null
+++ b/http/firefox/patches/0034-bmo-1735929-webgl-nvidia-p2-D147636.patch
@@ -0,0 +1,278 @@
+diff --git a/widget/gtk/DMABufSurface.h b/widget/gtk/DMABufSurface.h
+--- a/widget/gtk/DMABufSurface.h
++++ b/widget/gtk/DMABufSurface.h
+@@ -173,13 +173,13 @@
+ SurfaceType mSurfaceType;
+ uint64_t mBufferModifiers[DMABUF_BUFFER_PLANES];
+
+ int mBufferPlaneCount;
+ int mDmabufFds[DMABUF_BUFFER_PLANES];
+- uint32_t mDrmFormats[DMABUF_BUFFER_PLANES];
+- uint32_t mStrides[DMABUF_BUFFER_PLANES];
+- uint32_t mOffsets[DMABUF_BUFFER_PLANES];
++ int32_t mDrmFormats[DMABUF_BUFFER_PLANES];
++ int32_t mStrides[DMABUF_BUFFER_PLANES];
++ int32_t mOffsets[DMABUF_BUFFER_PLANES];
+
+ struct gbm_bo* mGbmBufferObject[DMABUF_BUFFER_PLANES];
+ void* mMappedRegion[DMABUF_BUFFER_PLANES];
+ void* mMappedRegionData[DMABUF_BUFFER_PLANES];
+ uint32_t mMappedRegionStride[DMABUF_BUFFER_PLANES];
+@@ -198,10 +198,14 @@
+ class DMABufSurfaceRGBA : public DMABufSurface {
+ public:
+ static already_AddRefed<DMABufSurfaceRGBA> CreateDMABufSurface(
+ int aWidth, int aHeight, int aDMABufSurfaceFlags);
+
++ static already_AddRefed<DMABufSurface> CreateDMABufSurface(
++ mozilla::gl::GLContext* aGLContext, const EGLImageKHR aEGLImage,
++ int aWidth, int aHeight);
++
+ bool Serialize(mozilla::layers::SurfaceDescriptor& aOutDescriptor);
+
+ DMABufSurfaceRGBA* GetAsDMABufSurfaceRGBA() { return this; }
+
+ void Clear();
+@@ -247,10 +251,12 @@
+ private:
+ ~DMABufSurfaceRGBA();
+
+ bool Create(int aWidth, int aHeight, int aDMABufSurfaceFlags);
+ bool Create(const mozilla::layers::SurfaceDescriptor& aDesc);
++ bool Create(mozilla::gl::GLContext* aGLContext, const EGLImageKHR
aEGLImage,
++ int aWidth, int aHeight);
+
+ bool ImportSurfaceDescriptor(const mozilla::layers::SurfaceDescriptor&
aDesc);
+
+ bool OpenFileDescriptorForPlane(const mozilla::MutexAutoLock&
aProofOfLock,
+ int aPlane);
+diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
+--- a/widget/gtk/DMABufSurface.cpp
++++ b/widget/gtk/DMABufSurface.cpp
+@@ -204,10 +204,12 @@
+ }
+ }
+
+ void DMABufSurface::FenceSet() {
+ if (!mGL || !mGL->MakeCurrent()) {
++ MOZ_DIAGNOSTIC_ASSERT(mGL,
++ "DMABufSurface::FenceSet(): missing GL context!");
+ return;
+ }
+ const auto& gle = gl::GLContextEGL::Cast(mGL);
+ const auto& egl = gle->mEgl;
+
+@@ -228,21 +230,23 @@
+ mGL->fFinish();
+ }
+
+ void DMABufSurface::FenceWait() {
+ if (!mGL || mSyncFd < 0) {
++ MOZ_DIAGNOSTIC_ASSERT(mGL,
++ "DMABufSurface::FenceWait() missing GL context!");
+ return;
+ }
+
+ const auto& gle = gl::GLContextEGL::Cast(mGL);
+ const auto& egl = gle->mEgl;
+
+ const EGLint attribs[] = {LOCAL_EGL_SYNC_NATIVE_FENCE_FD_ANDROID, mSyncFd,
+ LOCAL_EGL_NONE};
+ EGLSync sync = egl->fCreateSync(LOCAL_EGL_SYNC_NATIVE_FENCE_ANDROID,
attribs);
+ if (!sync) {
+- MOZ_ASSERT(false, "Failed to create GLFence!");
++ MOZ_ASSERT(false, "DMABufSurface::FenceWait(): Failed to create
GLFence!");
+ // We failed to create GLFence so clear mSyncFd to avoid another try.
+ close(mSyncFd);
+ mSyncFd = -1;
+ return;
+ }
+@@ -338,17 +342,18 @@
+ mGmbFormat = GetDMABufDevice()->GetGbmFormat(mSurfaceFlags &
DMABUF_ALPHA);
+ if (!mGmbFormat) {
+ // Requested DRM format is not supported.
+ return false;
+ }
++ mDrmFormats[0] = mGmbFormat->mFormat;
+
+ bool useModifiers = (aDMABufSurfaceFlags & DMABUF_USE_MODIFIERS) &&
+ mGmbFormat->mModifiersCount > 0;
+ if (useModifiers) {
+ LOGDMABUF((" Creating with modifiers\n"));
+ mGbmBufferObject[0] = nsGbmLib::CreateWithModifiers(
+- GetDMABufDevice()->GetGbmDevice(), mWidth, mHeight,
mGmbFormat->mFormat,
++ GetDMABufDevice()->GetGbmDevice(), mWidth, mHeight, mDrmFormats[0],
+ mGmbFormat->mModifiers, mGmbFormat->mModifiersCount);
+ if (mGbmBufferObject[0]) {
+ mBufferModifiers[0] = nsGbmLib::GetModifier(mGbmBufferObject[0]);
+ }
+ }
+@@ -356,11 +361,11 @@
+ if (!mGbmBufferObject[0]) {
+ LOGDMABUF((" Creating without modifiers\n"));
+ mGbmBufferFlags = GBM_BO_USE_LINEAR;
+ mGbmBufferObject[0] =
+ nsGbmLib::Create(GetDMABufDevice()->GetGbmDevice(), mWidth, mHeight,
+- mGmbFormat->mFormat, mGbmBufferFlags);
++ mDrmFormats[0], mGbmBufferFlags);
+ mBufferModifiers[0] = DRM_FORMAT_MOD_INVALID;
+ }
+
+ if (!mGbmBufferObject[0]) {
+ LOGDMABUF((" Failed to create GbmBufferObject\n"));
+@@ -386,22 +391,51 @@
+
+ LOGDMABUF((" Success\n"));
+ return true;
+ }
+
++bool DMABufSurfaceRGBA::Create(mozilla::gl::GLContext* aGLContext,
++ const EGLImageKHR aEGLImage, int aWidth,
++ int aHeight) {
++ LOGDMABUF(("DMABufSurfaceRGBA::Create() from EGLImage UID = %d\n", mUID));
++ if (!aGLContext) {
++ return false;
++ }
++ const auto& gle = gl::GLContextEGL::Cast(aGLContext);
++ const auto& egl = gle->mEgl;
++
++ mGL = aGLContext;
++ mWidth = aWidth;
++ mHeight = aHeight;
++ mEGLImage = aEGLImage;
++ if (!egl->fExportDMABUFImageQuery(mEGLImage, mDrmFormats,
&mBufferPlaneCount,
++ mBufferModifiers)) {
++ LOGDMABUF((" ExportDMABUFImageQueryMESA failed, quit\n"));
++ return false;
++ }
++ if (mBufferPlaneCount > DMABUF_BUFFER_PLANES) {
++ LOGDMABUF((" wrong plane count %d, quit\n", mBufferPlaneCount));
++ return false;
++ }
++ if (!egl->fExportDMABUFImage(mEGLImage, mDmabufFds, mStrides, mOffsets)) {
++ LOGDMABUF((" ExportDMABUFImageMESA failed, quit\n"));
++ return false;
++ }
++
++ LOGDMABUF((" imported size %d x %d format %x planes %d", mWidth, mHeight,
++ mDrmFormats[0], mBufferPlaneCount));
++ return true;
++}
++
+ bool DMABufSurfaceRGBA::ImportSurfaceDescriptor(
+ const SurfaceDescriptor& aDesc) {
+ const SurfaceDescriptorDMABuf& desc = aDesc.get_SurfaceDescriptorDMABuf();
+
+ mWidth = desc.width()[0];
+ mHeight = desc.height()[0];
+ mBufferModifiers[0] = desc.modifier()[0];
+- if (mBufferModifiers[0] != DRM_FORMAT_MOD_INVALID) {
+- mGmbFormat = GetDMABufDevice()->GetExactGbmFormat(desc.format()[0]);
+- } else {
+- mDrmFormats[0] = desc.format()[0];
+- }
++ mDrmFormats[0] = desc.format()[0];
+ mBufferPlaneCount = desc.fds().Length();
+ mGbmBufferFlags = desc.flags();
+ MOZ_RELEASE_ASSERT(mBufferPlaneCount <= DMABUF_BUFFER_PLANES);
+ mUID = desc.uid();
+
+@@ -431,10 +465,12 @@
+
+ if (desc.refCount().Length() > 0) {
+
GlobalRefCountImport(desc.refCount()[0].ClonePlatformHandle().release());
+ }
+
++ LOGDMABUF((" imported size %d x %d format %x planes %d", mWidth, mHeight,
++ mDrmFormats[0], mBufferPlaneCount));
+ return true;
+ }
+
+ bool DMABufSurfaceRGBA::Create(const SurfaceDescriptor& aDesc) {
+ return ImportSurfaceDescriptor(aDesc);
+@@ -460,11 +496,11 @@
+ return false;
+ }
+
+ width.AppendElement(mWidth);
+ height.AppendElement(mHeight);
+- format.AppendElement(mGmbFormat->mFormat);
++ format.AppendElement(mDrmFormats[0]);
+ modifiers.AppendElement(mBufferModifiers[0]);
+ for (int i = 0; i < mBufferPlaneCount; i++) {
+ fds.AppendElement(ipc::FileDescriptor(mDmabufFds[i]));
+ strides.AppendElement(mStrides[i]);
+ offsets.AppendElement(mOffsets[i]);
+@@ -486,23 +522,20 @@
+ fenceFDs, mUID, refCountFDs);
+ return true;
+ }
+
+ bool DMABufSurfaceRGBA::CreateTexture(GLContext* aGLContext, int aPlane) {
++ LOGDMABUF(("DMABufSurfaceRGBA::CreateTexture() UID %d\n", mUID));
+ MOZ_ASSERT(!mEGLImage && !mTexture, "EGLImage is already created!");
+
+ nsTArray<EGLint> attribs;
+ attribs.AppendElement(LOCAL_EGL_WIDTH);
+ attribs.AppendElement(mWidth);
+ attribs.AppendElement(LOCAL_EGL_HEIGHT);
+ attribs.AppendElement(mHeight);
+ attribs.AppendElement(LOCAL_EGL_LINUX_DRM_FOURCC_EXT);
+- if (mGmbFormat) {
+- attribs.AppendElement(mGmbFormat->mFormat);
+- } else {
+- attribs.AppendElement(mDrmFormats[0]);
+- }
++ attribs.AppendElement(mDrmFormats[0]);
+ #define ADD_PLANE_ATTRIBS(plane_idx)
\
+ {
\
+ attribs.AppendElement(LOCAL_EGL_DMA_BUF_PLANE##plane_idx##_FD_EXT);
\
+ attribs.AppendElement(mDmabufFds[plane_idx]);
\
+ attribs.AppendElement(LOCAL_EGL_DMA_BUF_PLANE##plane_idx##_OFFSET_EXT);
\
+@@ -560,10 +593,11 @@
+
+ return true;
+ }
+
+ void DMABufSurfaceRGBA::ReleaseTextures() {
++ LOGDMABUF(("DMABufSurfaceRGBA::ReleaseTextures() UID %d\n", mUID));
+ FenceDelete();
+
+ if (!mTexture) {
+ return;
+ }
+@@ -618,11 +652,11 @@
+ zwp_linux_buffer_params_v1_add(params, mDmabufFds[0], 0, mOffsets[0],
+ mStrides[0], mBufferModifiers[0] >> 32,
+ mBufferModifiers[0] & 0xffffffff);
+
+ mWlBuffer = zwp_linux_buffer_params_v1_create_immed(
+- params, GetWidth(), GetHeight(), mGmbFormat->mFormat, 0);
++ params, GetWidth(), GetHeight(), mDrmFormats[0], 0);
+
+ CloseFileDescriptors(lockFD);
+
+ return mWlBuffer != nullptr;
+ }
+@@ -806,10 +840,20 @@
+ return nullptr;
+ }
+ return surf.forget();
+ }
+
++already_AddRefed<DMABufSurface> DMABufSurfaceRGBA::CreateDMABufSurface(
++ mozilla::gl::GLContext* aGLContext, const EGLImageKHR aEGLImage, int
aWidth,
++ int aHeight) {
++ RefPtr<DMABufSurfaceRGBA> surf = new DMABufSurfaceRGBA();
++ if (!surf->Create(aGLContext, aEGLImage, aWidth, aHeight)) {
++ return nullptr;
++ }
++ return surf.forget();
++}
++
+ already_AddRefed<DMABufSurfaceYUV> DMABufSurfaceYUV::CreateYUVSurface(
+ const VADRMPRIMESurfaceDescriptor& aDesc, int aWidth, int aHeight) {
+ RefPtr<DMABufSurfaceYUV> surf = new DMABufSurfaceYUV();
+ LOGDMABUF(("DMABufSurfaceYUV::CreateYUVSurface() UID %d from desc\n",
+ surf->GetUID()));
+
diff --git
a/http/firefox/patches/0035-bmo-1735929-webgl-nvidia-p3-D147637.patch
b/http/firefox/patches/0035-bmo-1735929-webgl-nvidia-p3-D147637.patch
new file mode 100644
index 0000000..89bb25e
--- /dev/null
+++ b/http/firefox/patches/0035-bmo-1735929-webgl-nvidia-p3-D147637.patch
@@ -0,0 +1,139 @@
+diff -up firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff
firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp
+--- firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp.D147637.diff 2022-06-23
09:08:46.000000000 +0200
++++ firefox-102.0/gfx/gl/SharedSurfaceDMABUF.cpp 2022-06-28
16:37:52.264835137 +0200
+@@ -9,25 +9,58 @@
+ #include "GLContextEGL.h"
+ #include "MozFramebuffer.h"
+ #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
++#include "mozilla/gfx/gfxVars.h"
+
+ namespace mozilla::gl {
+
++static bool HasDmaBufExtensions(const GLContextEGL* gl) {
++ const auto& egl = *(gl->mEgl);
++ return egl.IsExtensionSupported(EGLExtension::EXT_image_dma_buf_import) &&
++ egl.IsExtensionSupported(
++ EGLExtension::EXT_image_dma_buf_import_modifiers) &&
++ egl.IsExtensionSupported(EGLExtension::MESA_image_dma_buf_export);
++}
++
+ /*static*/
+ UniquePtr<SharedSurface_DMABUF> SharedSurface_DMABUF::Create(
+ const SharedSurfaceDesc& desc) {
+- const auto flags = static_cast<DMABufSurfaceFlags>(
+- DMABUF_TEXTURE | DMABUF_USE_MODIFIERS | DMABUF_ALPHA);
+- const RefPtr<DMABufSurface> surface =
DMABufSurfaceRGBA::CreateDMABufSurface(
+- desc.size.width, desc.size.height, flags);
+- if (!surface || !surface->CreateTexture(desc.gl)) {
+- return nullptr;
++ const auto& gle = GLContextEGL::Cast(desc.gl);
++ const auto& context = gle->mContext;
++ const auto& egl = *(gle->mEgl);
++
++ RefPtr<DMABufSurface> surface;
++ UniquePtr<MozFramebuffer> fb;
++
++ if (!HasDmaBufExtensions(gle) || !gfx::gfxVars::UseDMABufSurfaceExport())
{
++ // Use MESA_image_dma_buf_export is not supported or it's broken.
++ // Create dmabuf surface directly via. GBM and create
++ // EGLImage/framebuffer over it.
++ const auto flags = static_cast<DMABufSurfaceFlags>(
++ DMABUF_TEXTURE | DMABUF_USE_MODIFIERS | DMABUF_ALPHA);
++ surface = DMABufSurfaceRGBA::CreateDMABufSurface(desc.size.width,
++ desc.size.height,
flags);
++ if (!surface || !surface->CreateTexture(desc.gl)) {
++ return nullptr;
++ }
++ const auto tex = surface->GetTexture();
++ fb = MozFramebuffer::CreateForBacking(desc.gl, desc.size, 0, false,
++ LOCAL_GL_TEXTURE_2D, tex);
++ if (!fb) return nullptr;
++ } else {
++ // Use MESA_image_dma_buf_export so create EGLImage/framebuffer directly
++ // and derive dmabuf from it.
++ fb = MozFramebuffer::Create(desc.gl, desc.size, 0, false);
++ if (!fb) return nullptr;
++
++ const auto buffer = reinterpret_cast<EGLClientBuffer>(fb->ColorTex());
++ const auto image =
++ egl.fCreateImage(context, LOCAL_EGL_GL_TEXTURE_2D, buffer, nullptr);
++ if (!image) return nullptr;
++
++ surface = DMABufSurfaceRGBA::CreateDMABufSurface(
++ desc.gl, image, desc.size.width, desc.size.height);
++ if (!surface) return nullptr;
+ }
+-
+- const auto tex = surface->GetTexture();
+- auto fb = MozFramebuffer::CreateForBacking(desc.gl, desc.size, 0, false,
+- LOCAL_GL_TEXTURE_2D, tex);
+- if (!fb) return nullptr;
+-
+ return AsUnique(new SharedSurface_DMABUF(desc, std::move(fb), surface));
+ }
+
+@@ -61,7 +94,7 @@ UniquePtr<SurfaceFactory_DMABUF> Surface
+ }
+
+ auto dmabufFactory = MakeUnique<SurfaceFactory_DMABUF>(gl);
+- if (dmabufFactory->CanCreateSurface()) {
++ if (dmabufFactory->CanCreateSurface(gl)) {
+ return dmabufFactory;
+ }
+
+@@ -71,8 +104,38 @@ UniquePtr<SurfaceFactory_DMABUF> Surface
+ return nullptr;
+ }
+
++bool SurfaceFactory_DMABUF::CanCreateSurface(GLContext& gl) {
++ UniquePtr<SharedSurface> test =
++ CreateShared(gfx::IntSize(1, 1), gfx::ColorSpace2::SRGB);
++ if (!test) {
++ LOGDMABUF((
++ "SurfaceFactory_DMABUF::CanCreateSurface() failed to create
surface."));
++ return false;
++ }
++ auto desc = test->ToSurfaceDescriptor();
++ if (!desc) {
++ LOGDMABUF(
++ ("SurfaceFactory_DMABUF::CanCreateSurface() failed to serialize "
++ "surface."));
++ return false;
++ }
++ RefPtr<DMABufSurface> importedSurface =
++ DMABufSurface::CreateDMABufSurface(*desc);
++ if (!importedSurface) {
++ LOGDMABUF((
++ "SurfaceFactory_DMABUF::CanCreateSurface() failed to import
surface."));
++ return false;
++ }
++ if (!importedSurface->CreateTexture(&gl)) {
++ LOGDMABUF(
++ ("SurfaceFactory_DMABUF::CanCreateSurface() failed to create
texture "
++ "over surface."));
++ return false;
++ }
++ return true;
++}
++
+ SurfaceFactory_DMABUF::SurfaceFactory_DMABUF(GLContext& gl)
+ : SurfaceFactory({&gl, SharedSurfaceType::EGLSurfaceDMABUF,
+ layers::TextureType::DMABUF, true}) {}
+-
+ } // namespace mozilla::gl
+diff -up firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h.D147637.diff
firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h
+--- firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h.D147637.diff 2022-06-23
09:08:47.000000000 +0200
++++ firefox-102.0/gfx/gl/SharedSurfaceDMABUF.h 2022-06-28 15:00:20.339991965
+0200
+@@ -59,11 +59,7 @@ class SurfaceFactory_DMABUF : public Sur
+ return SharedSurface_DMABUF::Create(desc);
+ }
+
+- bool CanCreateSurface() {
+- UniquePtr<SharedSurface> test =
+- CreateShared(gfx::IntSize(1, 1), gfx::ColorSpace2::SRGB);
+- return test != nullptr;
+- }
++ bool CanCreateSurface(GLContext& gl);
+ };
+
+ } // namespace gl
diff --git a/http/firefox/patches/0036-bmo-1773968-webgl-memory-leak.patch
b/http/firefox/patches/0036-bmo-1773968-webgl-memory-leak.patch
new file mode 100644
index 0000000..6e93f2b
--- /dev/null
+++ b/http/firefox/patches/0036-bmo-1773968-webgl-memory-leak.patch
@@ -0,0 +1,80 @@
+diff --git a/widget/gtk/DMABufSurface.cpp b/widget/gtk/DMABufSurface.cpp
+--- a/widget/gtk/DMABufSurface.cpp
++++ b/widget/gtk/DMABufSurface.cpp
+@@ -642,11 +642,11 @@
+
+ void DMABufSurfaceRGBA::ReleaseTextures() {
+ LOGDMABUF(("DMABufSurfaceRGBA::ReleaseTextures() UID %d\n", mUID));
+ FenceDelete();
+
+- if (!mTexture) {
++ if (!mTexture && mEGLImage == LOCAL_EGL_NO_IMAGE) {
+ return;
+ }
+
+ if (!mGL) {
+ #ifdef NIGHTLY
+@@ -663,17 +663,17 @@
+ const auto& egl = gle->mEgl;
+
+ if (mTexture && mGL->MakeCurrent()) {
+ mGL->fDeleteTextures(1, &mTexture);
+ mTexture = 0;
+- mGL = nullptr;
+ }
+
+ if (mEGLImage != LOCAL_EGL_NO_IMAGE) {
+ egl->fDestroyImage(mEGLImage);
+ mEGLImage = LOCAL_EGL_NO_IMAGE;
+ }
++ mGL = nullptr;
+ }
+
+ void DMABufSurfaceRGBA::ReleaseSurface() {
+ MOZ_ASSERT(!IsMapped(), "We can't release mapped buffer!");
+
+@@ -1325,11 +1325,11 @@
+
+ FenceDelete();
+
+ bool textureActive = false;
+ for (int i = 0; i < mBufferPlaneCount; i++) {
+- if (mTexture[i]) {
++ if (mTexture[i] || mEGLImage[i] != LOCAL_EGL_NO_IMAGE) {
+ textureActive = true;
+ break;
+ }
+ }
+
+@@ -1346,18 +1346,23 @@
+ "leaking textures!");
+ return;
+ #endif
+ }
+
+- if (textureActive && mGL->MakeCurrent()) {
+- mGL->fDeleteTextures(DMABUF_BUFFER_PLANES, mTexture);
+- for (int i = 0; i < DMABUF_BUFFER_PLANES; i++) {
+- mTexture[i] = 0;
+- }
+- ReleaseEGLImages(mGL);
+- mGL = nullptr;
++ if (!mGL->MakeCurrent()) {
++ NS_WARNING(
++ "DMABufSurfaceYUV::ReleaseTextures(): Failed to create GL context "
++ "current. We're leaking textures!");
++ return;
+ }
++
++ mGL->fDeleteTextures(DMABUF_BUFFER_PLANES, mTexture);
++ for (int i = 0; i < DMABUF_BUFFER_PLANES; i++) {
++ mTexture[i] = 0;
++ }
++ ReleaseEGLImages(mGL);
++ mGL = nullptr;
+ }
+
+ bool DMABufSurfaceYUV::VerifyTextureCreation() {
+ LOGDMABUF(("DMABufSurfaceYUV::VerifyTextureCreation() UID %d", mUID));
+
+
diff --git a/http/firefox/patches/0037-bmo-1758948-vaapi-fixes-p2-p4.patch
b/http/firefox/patches/0037-bmo-1758948-vaapi-fixes-p2-p4.patch
new file mode 100644
index 0000000..7bc99e4
--- /dev/null
+++ b/http/firefox/patches/0037-bmo-1758948-vaapi-fixes-p2-p4.patch
@@ -0,0 +1,28 @@
+changeset: 623785:a6b80ee8c35f
+tag: tip
+parent: 623782:b1ed2fa50612
+user: stransky <stransky AT redhat.com>
+date: Wed Jun 15 14:54:19 2022 +0200
+files: dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+description:
+Bug 1758948 [FFmpeg] Use AVFrame::pts instead of AVFrame::pkt_pts on ffmpeg
4.x r?alwu
+
+AVFrame::pkt_pts has been deprecated and gives us wrong values for AV1
VA-API. Let's use AVFrame::pts instead on ffmpeg 4.x
+as well as we use on ffmpeg 5.0 where AVFrame::pkt_pts is removed.
+
+Differential Revision: https://phabricator.services.mozilla.com/D149386
+
+
+diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
++++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+@@ -774,7 +774,7 @@ void FFmpegVideoDecoder<LIBAV_VER>::Init
+ #endif
+
+ static int64_t GetFramePts(AVFrame* aFrame) {
+-#if LIBAVCODEC_VERSION_MAJOR > 58
++#if LIBAVCODEC_VERSION_MAJOR > 57
+ return aFrame->pts;
+ #else
+ return aFrame->pkt_pts;
+
diff --git
a/http/firefox/patches/0038-bmo-1773377-vaapi-fixes-p2-p2-D148946.patch
b/http/firefox/patches/0038-bmo-1773377-vaapi-fixes-p2-p2-D148946.patch
new file mode 100644
index 0000000..0ab7380
--- /dev/null
+++ b/http/firefox/patches/0038-bmo-1773377-vaapi-fixes-p2-p2-D148946.patch
@@ -0,0 +1,250 @@
+diff -up firefox-102.0/gfx/gl/GLContextProviderEGL.cpp.D148946.diff
firefox-102.0/gfx/gl/GLContextProviderEGL.cpp
+--- firefox-102.0/gfx/gl/GLContextProviderEGL.cpp.D148946.diff 2022-06-23
09:08:47.000000000 +0200
++++ firefox-102.0/gfx/gl/GLContextProviderEGL.cpp 2022-06-28
14:47:40.904700050 +0200
+@@ -1182,42 +1182,16 @@ RefPtr<GLContextEGL> GLContextEGL::Creat
+ }
+
+ /*static*/
+-RefPtr<GLContextEGL> GLContextEGL::CreateEGLSurfacelessContext(
+- const std::shared_ptr<EglDisplay> display, const GLContextCreateDesc&
desc,
+- nsACString* const out_failureId) {
+- const EGLConfig config = {};
+- auto fullDesc = GLContextDesc{desc};
+- fullDesc.isOffscreen = true;
+- RefPtr<GLContextEGL> gl = GLContextEGL::CreateGLContext(
+- display, fullDesc, config, EGL_NO_SURFACE, false, out_failureId);
+- if (!gl) {
+- NS_WARNING("Failed to create surfaceless GL context");
+- return nullptr;
+- }
+- return gl;
+-}
+-
+-/*static*/
+ already_AddRefed<GLContext> GLContextProviderEGL::CreateHeadless(
+ const GLContextCreateDesc& desc, nsACString* const out_failureId) {
+ const auto display = DefaultEglDisplay(out_failureId);
+ if (!display) {
+ return nullptr;
+ }
+- RefPtr<GLContextEGL> gl;
+-#ifdef MOZ_WAYLAND
+- if (!gdk_display_get_default() &&
+-
display->IsExtensionSupported(EGLExtension::MESA_platform_surfaceless)) {
+- gl =
+- GLContextEGL::CreateEGLSurfacelessContext(display, desc,
out_failureId);
+- } else
+-#endif
+- {
+- mozilla::gfx::IntSize dummySize = mozilla::gfx::IntSize(16, 16);
+- gl = GLContextEGL::CreateEGLPBufferOffscreenContext(
+- display, desc, dummySize, out_failureId);
+- }
+- return gl.forget();
++ mozilla::gfx::IntSize dummySize = mozilla::gfx::IntSize(16, 16);
++ auto ret = GLContextEGL::CreateEGLPBufferOffscreenContext(
++ display, desc, dummySize, out_failureId);
++ return ret.forget();
+ }
+
+ // Don't want a global context on Android as 1) share groups across 2
threads
+diff -up firefox-102.0/gfx/gl/GLDefs.h.D148946.diff
firefox-102.0/gfx/gl/GLDefs.h
+--- firefox-102.0/gfx/gl/GLDefs.h.D148946.diff 2022-06-23 09:08:47.000000000
+0200
++++ firefox-102.0/gfx/gl/GLDefs.h 2022-06-28 14:47:40.904700050 +0200
+@@ -104,9 +104,6 @@ bool CheckContextLost(const GLContext* g
+ // EGL_ANGLE_image_d3d11_texture
+ #define LOCAL_EGL_D3D11_TEXTURE_ANGLE 0x3484
+
+-// EGL_MESA_platform_surfaceless
+-#define LOCAL_EGL_PLATFORM_SURFACELESS_MESA 0x31DD
+-
+ // clang-format on
+
+ #endif
+diff -up firefox-102.0/gfx/gl/GLLibraryEGL.cpp.D148946.diff
firefox-102.0/gfx/gl/GLLibraryEGL.cpp
+--- firefox-102.0/gfx/gl/GLLibraryEGL.cpp.D148946.diff 2022-06-28
14:47:40.900699918 +0200
++++ firefox-102.0/gfx/gl/GLLibraryEGL.cpp 2022-06-28 14:49:47.810911199
+0200
+@@ -54,9 +54,15 @@ StaticRefPtr<GLLibraryEGL> GLLibraryEGL:
+
+ // should match the order of EGLExtensions, and be null-terminated.
+ static const char* sEGLLibraryExtensionNames[] = {
+- "EGL_ANDROID_get_native_client_buffer", "EGL_ANGLE_device_creation",
+- "EGL_ANGLE_device_creation_d3d11", "EGL_ANGLE_platform_angle",
+- "EGL_ANGLE_platform_angle_d3d", "EGL_EXT_device_query"};
++ "EGL_ANDROID_get_native_client_buffer",
++ "EGL_ANGLE_device_creation",
++ "EGL_ANGLE_device_creation_d3d11",
++ "EGL_ANGLE_platform_angle",
++ "EGL_ANGLE_platform_angle_d3d",
++ "EGL_EXT_device_enumeration",
++ "EGL_EXT_device_query",
++ "EGL_EXT_platform_device",
++ "EGL_MESA_platform_surfaceless"};
+
+ // should match the order of EGLExtensions, and be null-terminated.
+ static const char* sEGLExtensionNames[] = {
+@@ -84,7 +90,6 @@ static const char* sEGLExtensionNames[]
+ "EGL_EXT_buffer_age",
+ "EGL_KHR_partial_update",
+ "EGL_NV_robustness_video_memory_purge",
+- "EGL_MESA_platform_surfaceless",
+ "EGL_EXT_image_dma_buf_import",
+ "EGL_EXT_image_dma_buf_import_modifiers",
+ "EGL_MESA_image_dma_buf_export"};
+@@ -157,8 +162,52 @@ static std::shared_ptr<EglDisplay> GetAn
+ }
+
+ #ifdef MOZ_WAYLAND
++static std::shared_ptr<EglDisplay> GetAndInitDeviceDisplay(
++ GLLibraryEGL& egl, const StaticMutexAutoLock& aProofOfLock) {
++ nsAutoCString drmRenderDevice(gfx::gfxVars::DrmRenderDevice());
++ if (drmRenderDevice.IsEmpty() ||
++ !egl.IsExtensionSupported(EGLLibExtension::EXT_platform_device) ||
++ !egl.IsExtensionSupported(EGLLibExtension::EXT_device_enumeration)) {
++ return nullptr;
++ }
++
++ EGLint maxDevices;
++ if (!egl.fQueryDevicesEXT(0, nullptr, &maxDevices)) {
++ return nullptr;
++ }
++
++ std::vector<EGLDeviceEXT> devices(maxDevices);
++ EGLint numDevices;
++ if (!egl.fQueryDevicesEXT(devices.size(), devices.data(), &numDevices)) {
++ return nullptr;
++ }
++ devices.resize(numDevices);
++
++ EGLDisplay display = EGL_NO_DISPLAY;
++ for (const auto& device : devices) {
++ const char* renderNodeString =
++ egl.fQueryDeviceStringEXT(device,
LOCAL_EGL_DRM_RENDER_NODE_FILE_EXT);
++ if (renderNodeString &&
++ strcmp(renderNodeString, drmRenderDevice.get()) == 0) {
++ const EGLAttrib attrib_list[] = {LOCAL_EGL_NONE};
++ display = egl.fGetPlatformDisplay(LOCAL_EGL_PLATFORM_DEVICE_EXT,
device,
++ attrib_list);
++ break;
++ }
++ }
++ if (!display) {
++ return nullptr;
++ }
++
++ return EglDisplay::Create(egl, display, true, aProofOfLock);
++}
++
+ static std::shared_ptr<EglDisplay> GetAndInitSurfacelessDisplay(
+ GLLibraryEGL& egl, const StaticMutexAutoLock& aProofOfLock) {
++ if
(!egl.IsExtensionSupported(EGLLibExtension::MESA_platform_surfaceless)) {
++ return nullptr;
++ }
++
+ const EGLAttrib attrib_list[] = {LOCAL_EGL_NONE};
+ const EGLDisplay display = egl.fGetPlatformDisplay(
+ LOCAL_EGL_PLATFORM_SURFACELESS_MESA, EGL_DEFAULT_DISPLAY,
attrib_list);
+@@ -611,9 +660,9 @@ bool GLLibraryEGL::Init(nsACString* cons
+ (void)fnLoadSymbols(symbols);
+ }
+ {
+- const SymLoadStruct symbols[] = {SYMBOL(QueryDisplayAttribEXT),
+- SYMBOL(QueryDeviceAttribEXT),
+- END_OF_SYMBOLS};
++ const SymLoadStruct symbols[] = {
++ SYMBOL(QueryDisplayAttribEXT), SYMBOL(QueryDeviceAttribEXT),
++ SYMBOL(QueryDeviceStringEXT), END_OF_SYMBOLS};
+ (void)fnLoadSymbols(symbols);
+ }
+ {
+@@ -658,6 +707,10 @@ bool GLLibraryEGL::Init(nsACString* cons
+ END_OF_SYMBOLS};
+ (void)fnLoadSymbols(symbols);
+ }
++ {
++ const SymLoadStruct symbols[] = {SYMBOL(QueryDevicesEXT),
END_OF_SYMBOLS};
++ (void)fnLoadSymbols(symbols);
++ }
+
+ return true;
+ }
+@@ -835,7 +888,10 @@ std::shared_ptr<EglDisplay> GLLibraryEGL
+ #ifdef MOZ_WAYLAND
+ GdkDisplay* gdkDisplay = gdk_display_get_default();
+ if (!gdkDisplay) {
+- ret = GetAndInitSurfacelessDisplay(*this, aProofOfLock);
++ ret = GetAndInitDeviceDisplay(*this, aProofOfLock);
++ if (!ret) {
++ ret = GetAndInitSurfacelessDisplay(*this, aProofOfLock);
++ }
+ } else if (widget::GdkIsWaylandDisplay(gdkDisplay)) {
+ // Wayland does not support EGL_DEFAULT_DISPLAY
+ nativeDisplay = widget::WaylandDisplayGetWLDisplay(gdkDisplay);
+diff -up firefox-102.0/gfx/gl/GLLibraryEGL.h.D148946.diff
firefox-102.0/gfx/gl/GLLibraryEGL.h
+--- firefox-102.0/gfx/gl/GLLibraryEGL.h.D148946.diff 2022-06-28
14:47:40.899699885 +0200
++++ firefox-102.0/gfx/gl/GLLibraryEGL.h 2022-06-28 14:47:40.904700050
+0200
+@@ -71,7 +71,10 @@ enum class EGLLibExtension {
+ ANGLE_device_creation_d3d11,
+ ANGLE_platform_angle,
+ ANGLE_platform_angle_d3d,
++ EXT_device_enumeration,
+ EXT_device_query,
++ EXT_platform_device,
++ MESA_platform_surfaceless,
+ Max
+ };
+
+@@ -107,7 +110,6 @@ enum class EGLExtension {
+ EXT_buffer_age,
+ KHR_partial_update,
+ NV_robustness_video_memory_purge,
+- MESA_platform_surfaceless,
+ EXT_image_dma_buf_import,
+ EXT_image_dma_buf_import_modifiers,
+ MESA_image_dma_buf_export,
+@@ -436,6 +438,10 @@ class GLLibraryEGL final {
+ WRAP(fQueryDeviceAttribEXT(device, attribute, value));
+ }
+
++ const char* fQueryDeviceStringEXT(EGLDeviceEXT device, EGLint name) {
++ WRAP(fQueryDeviceStringEXT(device, name));
++ }
++
+ private:
+ // NV_stream_consumer_gltexture_yuv
+ EGLBoolean fStreamConsumerGLTextureExternalAttribsNV(
+@@ -478,6 +484,13 @@ class GLLibraryEGL final {
+ WRAP(fExportDMABUFImageMESA(dpy, image, fds, strides, offsets));
+ }
+
++ public:
++ // EGL_EXT_device_enumeration
++ EGLBoolean fQueryDevicesEXT(EGLint max_devices, EGLDeviceEXT* devices,
++ EGLint* num_devices) {
++ WRAP(fQueryDevicesEXT(max_devices, devices, num_devices));
++ }
++
+ #undef WRAP
+
+ #undef WRAP
+@@ -586,6 +599,9 @@ class GLLibraryEGL final {
+ EGLBoolean(GLAPIENTRY* fQueryDeviceAttribEXT)(EGLDeviceEXT device,
+ EGLint attribute,
+ EGLAttrib* value);
++ const char*(GLAPIENTRY* fQueryDeviceStringEXT)(EGLDeviceEXT device,
++ EGLint name);
++
+ // NV_stream_consumer_gltexture_yuv
+ EGLBoolean(GLAPIENTRY* fStreamConsumerGLTextureExternalAttribsNV)(
+ EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib* attrib_list);
+@@ -623,6 +639,10 @@ class GLLibraryEGL final {
+ EGLint* strides,
+ EGLint* offsets);
+
++ EGLBoolean(GLAPIENTRY* fQueryDevicesEXT)(EGLint max_devices,
++ EGLDeviceEXT* devices,
++ EGLint* num_devices);
++
+ } mSymbols = {};
+ };
+
diff --git
a/http/firefox/patches/0039-bmo-1774075-vaapi-fixes-p2-p3-D149238.patch
b/http/firefox/patches/0039-bmo-1774075-vaapi-fixes-p2-p3-D149238.patch
new file mode 100644
index 0000000..e89c1bf
--- /dev/null
+++ b/http/firefox/patches/0039-bmo-1774075-vaapi-fixes-p2-p3-D149238.patch
@@ -0,0 +1,34 @@
+diff -up firefox-102.0/gfx/config/gfxVars.h.D149238.diff
firefox-102.0/gfx/config/gfxVars.h
+--- firefox-102.0/gfx/config/gfxVars.h.D149238.diff 2022-06-23
09:08:47.000000000 +0200
++++ firefox-102.0/gfx/config/gfxVars.h 2022-06-28 16:40:54.130895063 +0200
+@@ -91,7 +91,8 @@ class gfxVarReceiver;
+ _(AllowWebGPU, bool, false) \
+ _(UseVP8HwDecode, bool, false) \
+ _(UseVP9HwDecode, bool, false) \
+- _(HwDecodedVideoZeroCopy, bool, false)
++ _(HwDecodedVideoZeroCopy, bool, false) \
++ _(UseDMABufSurfaceExport, bool, true)
+
+ /* Add new entries above this line. */
+
+diff -up firefox-102.0/gfx/thebes/gfxPlatform.cpp.D149238.diff
firefox-102.0/gfx/thebes/gfxPlatform.cpp
+--- firefox-102.0/gfx/thebes/gfxPlatform.cpp.D149238.diff 2022-06-23
09:08:47.000000000 +0200
++++ firefox-102.0/gfx/thebes/gfxPlatform.cpp 2022-06-28 16:40:54.130895063
+0200
+@@ -2861,6 +2861,17 @@ void gfxPlatform::InitWebGLConfig() {
+ gfxVars::SetAllowEglRbab(false);
+ }
+ }
++
++ if (kIsWayland || kIsX11) {
++ // Disable EGL_MESA_image_dma_buf_export on mesa/radeonsi due to
++ // https://gitlab.freedesktop.org/mesa/mesa/-/issues/6666
++ nsString adapterDriverVendor;
++ gfxInfo->GetAdapterDriverVendor(adapterDriverVendor);
++ if (adapterDriverVendor.Find("mesa") != -1 &&
++ adapterDriverVendor.Find("radeonsi") != -1) {
++ gfxVars::SetUseDMABufSurfaceExport(false);
++ }
++ }
+ }
+
+ void gfxPlatform::InitWebGPUConfig() {
diff --git a/http/firefox/patches/0040-bmo-1774271-vaapi-fixes-p2-p5.patch
b/http/firefox/patches/0040-bmo-1774271-vaapi-fixes-p2-p5.patch
new file mode 100644
index 0000000..689e584
--- /dev/null
+++ b/http/firefox/patches/0040-bmo-1774271-vaapi-fixes-p2-p5.patch
@@ -0,0 +1,154 @@
+
+# HG changeset patch
+# User Martin Stransky <stransky AT redhat.com>
+# Date 1656309292 0
+# Node ID 6dce488087f13c4ffe6ba0c758362968a8e60704
+# Parent 00ef31a00437f25556606342668f1125e86c55b4
+Bug 1774271 [Linux] Use DMABUF_SURFACE_EXPORT feature to control dmabuf
surface export from EGLImage and disable that on Mesa/Intel and Mesa/AMD
r=jgilbert
+
+Differential Revision: https://phabricator.services.mozilla.com/D149984
+
+diff --git a/gfx/config/gfxFeature.h b/gfx/config/gfxFeature.h
+--- a/gfx/config/gfxFeature.h
++++ b/gfx/config/gfxFeature.h
+@@ -38,17 +38,18 @@ namespace gfx {
+ _(WEBGPU, Feature, "WebGPU")
\
+ _(X11_EGL, Feature, "X11 EGL")
\
+ _(DMABUF, Feature, "DMABUF")
\
+ _(WINDOW_OCCLUSION, Feature, "WINDOW_OCCLUSION")
\
+ _(VAAPI, Feature, "VA-API video decoding")
\
+ _(VIDEO_OVERLAY, Feature, "video overlay")
\
+ _(HW_DECODED_VIDEO_ZERO_COPY, Feature, "Hardware decoded video zero
copy") \
+ _(VP8_HW_DECODE, Feature, "VP8 hardware decoding")
\
+- _(VP9_HW_DECODE, Feature, "VP9 hardware decoding")
++ _(VP9_HW_DECODE, Feature, "VP9 hardware decoding")
\
++ _(DMABUF_SURFACE_EXPORT, Feature, "WebGL DMABuf surface export")
+ /* Add new entries above this comment */
+
+ enum class Feature : uint32_t {
+ #define MAKE_ENUM(name, type, desc) name,
+ GFX_FEATURE_MAP(MAKE_ENUM)
+ #undef MAKE_ENUM
+ NumValues
+ };
+diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp
+--- a/gfx/thebes/gfxPlatform.cpp
++++ b/gfx/thebes/gfxPlatform.cpp
+@@ -2806,23 +2806,29 @@ void gfxPlatform::InitWebGLConfig() {
+ nsAutoString renderer;
+ gfxInfo->GetAdapterDeviceID(renderer);
+ if (renderer.Find("Adreno (TM) 630") != -1) {
+ gfxVars::SetAllowEglRbab(false);
+ }
+ }
+
+ if (kIsWayland || kIsX11) {
+- // Disable EGL_MESA_image_dma_buf_export on mesa/radeonsi due to
+- // https://gitlab.freedesktop.org/mesa/mesa/-/issues/6666
+- nsString adapterDriverVendor;
+- gfxInfo->GetAdapterDriverVendor(adapterDriverVendor);
+- if (adapterDriverVendor.Find("mesa") != -1 &&
+- adapterDriverVendor.Find("radeonsi") != -1) {
++ nsCString discardFailureId;
++ int32_t status;
++ FeatureState& feature =
++ gfxConfig::GetFeature(Feature::DMABUF_SURFACE_EXPORT);
++ if (NS_FAILED(
++
gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DMABUF_SURFACE_EXPORT,
++ discardFailureId, &status)) ||
++ status != nsIGfxInfo::FEATURE_STATUS_OK) {
++ feature.DisableByDefault(FeatureStatus::Blocked, "Blocklisted by
gfxInfo",
++ discardFailureId);
+ gfxVars::SetUseDMABufSurfaceExport(false);
++ } else {
++ feature.EnableByDefault();
+ }
+ }
+ }
+
+ void gfxPlatform::InitWebGPUConfig() {
+ if (!XRE_IsParentProcess()) {
+ return;
+ }
+diff --git a/widget/GfxInfoBase.cpp b/widget/GfxInfoBase.cpp
+--- a/widget/GfxInfoBase.cpp
++++ b/widget/GfxInfoBase.cpp
+@@ -249,16 +249,19 @@ static const char* GetPrefNameForFeature
+ name = BLOCKLIST_PREF_BRANCH "hw-video-zero-copy";
+ break;
+ case nsIGfxInfo::FEATURE_WEBRENDER_SHADER_CACHE:
+ name = BLOCKLIST_PREF_BRANCH "webrender.program-binary-disk";
+ break;
+ case nsIGfxInfo::FEATURE_WEBRENDER_PARTIAL_PRESENT:
+ name = BLOCKLIST_PREF_BRANCH "webrender.partial-present";
+ break;
++ case nsIGfxInfo::FEATURE_DMABUF_SURFACE_EXPORT:
++ name = BLOCKLIST_PREF_BRANCH "dmabuf.surface-export";
++ break;
+ default:
+ MOZ_ASSERT_UNREACHABLE("Unexpected nsIGfxInfo feature?!");
+ break;
+ }
+
+ return name;
+ }
+
+diff --git a/widget/gtk/GfxInfo.cpp b/widget/gtk/GfxInfo.cpp
+--- a/widget/gtk/GfxInfo.cpp
++++ b/widget/gtk/GfxInfo.cpp
+@@ -822,16 +822,32 @@ const nsTArray<GfxDriverInfo>& GfxInfo::
+ APPEND_TO_DRIVER_BLOCKLIST_EXT(
+ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
+ DesktopEnvironment::All, WindowProtocol::All,
DriverVendor::NonMesaAll,
+ DeviceFamily::NvidiaAll, nsIGfxInfo::FEATURE_DMABUF,
+ nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
+ V(495, 44, 0, 0), "FEATURE_FAILURE_NO_GBM", "495.44.0");
+
+ ////////////////////////////////////
++ // FEATURE_DMABUF_SURFACE_EXPORT
++ APPEND_TO_DRIVER_BLOCKLIST_EXT(
++ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
++ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaAll,
++ DeviceFamily::AtiAll, nsIGfxInfo::FEATURE_DMABUF_SURFACE_EXPORT,
++ nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
++ V(21, 1, 2, 0), "FEATURE_FAILURE_BROKEN_MESA", "22.1.2");
++
++ APPEND_TO_DRIVER_BLOCKLIST_EXT(
++ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
++ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaAll,
++ DeviceFamily::IntelAll, nsIGfxInfo::FEATURE_DMABUF_SURFACE_EXPORT,
++ nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
++ V(0, 0, 0, 0), "FEATURE_FAILURE_BROKEN_DRIVER", "");
++
++ ////////////////////////////////////
+ // FEATURE_VAAPI
+ APPEND_TO_DRIVER_BLOCKLIST_EXT(
+ OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
+ DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaAll,
+ DeviceFamily::All, nsIGfxInfo::FEATURE_VAAPI,
+ nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
+ V(21, 0, 0, 0), "FEATURE_ROLLOUT_VAAPI_MESA", "Mesa 21.0.0.0");
+
+diff --git a/widget/nsIGfxInfo.idl b/widget/nsIGfxInfo.idl
+--- a/widget/nsIGfxInfo.idl
++++ b/widget/nsIGfxInfo.idl
+@@ -171,16 +171,18 @@ interface nsIGfxInfo : nsISupports
+ /* Whether VA-API is supported, starting in 96. */
+ const long FEATURE_VAAPI = 37;
+ /* Whether WebGPU is supported, starting in 100. */
+ const long FEATURE_WEBGPU = 38;
+ /* Whether video overlay is supported, starting in 100. */
+ const long FEATURE_VIDEO_OVERLAY = 39;
+ /* Whether hardware decoded video zero copy is supported, starting in
101. */
+ const long FEATURE_HW_DECODED_VIDEO_ZERO_COPY = 40;
++ /* Whether DMABUF export is supported, starting in 103. */
++ const long FEATURE_DMABUF_SURFACE_EXPORT = 41;
+ /* the maximum feature value. */
+ const long FEATURE_MAX_VALUE = FEATURE_HW_DECODED_VIDEO_ZERO_COPY;
+
+ /*
+ * A set of return values from GetFeatureStatus
+ */
+
+ /* The driver is safe to the best of our knowledge */
+
diff --git
a/http/firefox/patches/0046-bmo-1754469-memory_mozalloc_throw.patch
b/http/firefox/patches/0046-bmo-1754469-memory_mozalloc_throw.patch
deleted file mode 100644
index 634892be..0000000
--- a/http/firefox/patches/0046-bmo-1754469-memory_mozalloc_throw.patch
+++ /dev/null
@@ -1,69 +0,0 @@
---- 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/0046-p05-bmo-1776724-build-wayland-only-D150485.patch
b/http/firefox/patches/0046-p05-bmo-1776724-build-wayland-only-D150485.patch
new file mode 100644
index 0000000..1c27926
--- /dev/null
+++
b/http/firefox/patches/0046-p05-bmo-1776724-build-wayland-only-D150485.patch
@@ -0,0 +1,115 @@
+diff --git a/gfx/gl/GLContextProviderEGL.cpp
b/gfx/gl/GLContextProviderEGL.cpp
+--- a/gfx/gl/GLContextProviderEGL.cpp
++++ b/gfx/gl/GLContextProviderEGL.cpp
+@@ -77,10 +77,11 @@
+ #if defined(MOZ_WIDGET_GTK)
+ # include "mozilla/widget/GtkCompositorWidget.h"
+ # if defined(MOZ_WAYLAND)
+ # include <gdk/gdkwayland.h>
+ # include <wayland-egl.h>
++# include "mozilla/WidgetUtilsGtk.h"
+ # include "mozilla/widget/nsWaylandDisplay.h"
+ # endif
+ #endif
+
+ struct wl_egl_window;
+diff --git a/gfx/gl/GLContextProviderLinux.cpp
b/gfx/gl/GLContextProviderLinux.cpp
+--- a/gfx/gl/GLContextProviderLinux.cpp
++++ b/gfx/gl/GLContextProviderLinux.cpp
+@@ -11,49 +11,59 @@
+ namespace mozilla::gl {
+
+ using namespace mozilla::gfx;
+ using namespace mozilla::widget;
+
++#ifdef MOZ_X11
+ static class GLContextProviderGLX sGLContextProviderGLX;
++#endif
+ static class GLContextProviderEGL sGLContextProviderEGL;
+
+ already_AddRefed<GLContext>
GLContextProviderLinux::CreateForCompositorWidget(
+ CompositorWidget* aCompositorWidget, bool aHardwareWebRender,
+ bool aForceAccelerated) {
+ if (gfxVars::UseEGL()) {
+ return sGLContextProviderEGL.CreateForCompositorWidget(
+ aCompositorWidget, aHardwareWebRender, aForceAccelerated);
++#ifdef MOZ_X11
+ } else {
+ return sGLContextProviderGLX.CreateForCompositorWidget(
+ aCompositorWidget, aHardwareWebRender, aForceAccelerated);
++#endif
+ }
+ }
+
+ /*static*/
+ already_AddRefed<GLContext> GLContextProviderLinux::CreateHeadless(
+ const GLContextCreateDesc& desc, nsACString* const out_failureId) {
+ if (gfxVars::UseEGL()) {
+ return sGLContextProviderEGL.CreateHeadless(desc, out_failureId);
++#ifdef MOZ_X11
+ } else {
+ return sGLContextProviderGLX.CreateHeadless(desc, out_failureId);
++#endif
+ }
+ }
+
+ /*static*/
+ GLContext* GLContextProviderLinux::GetGlobalContext() {
+ if (gfxVars::UseEGL()) {
+ return sGLContextProviderEGL.GetGlobalContext();
++#ifdef MOZ_X11
+ } else {
+ return sGLContextProviderGLX.GetGlobalContext();
++#endif
+ }
+ }
+
+ /*static*/
+ void GLContextProviderLinux::Shutdown() {
+ if (gfxVars::UseEGL()) {
+ sGLContextProviderEGL.Shutdown();
++#ifdef MOZ_X11
+ } else {
+ sGLContextProviderGLX.Shutdown();
++#endif
+ }
+ }
+
+ } // namespace mozilla::gl
+diff --git a/gfx/gl/moz.build b/gfx/gl/moz.build
+--- a/gfx/gl/moz.build
++++ b/gfx/gl/moz.build
+@@ -105,14 +105,15 @@
+
+ elif gl_provider == "Linux":
+ # GLContextProviderGLX.cpp needs to be kept out of UNIFIED_SOURCES
+ # as it includes X11 headers which cause conflicts.
+ SOURCES += [
+- "GLContextProviderGLX.cpp",
+ "GLContextProviderLinux.cpp",
+ ]
+ EXPORTS += ["GLContextGLX.h", "GLXLibrary.h"]
++ if CONFIG["MOZ_X11"]:
++ SOURCES += ["GLContextProviderGLX.cpp"]
+
+ if CONFIG["MOZ_WAYLAND"]:
+ SOURCES += ["SharedSurfaceDMABUF.cpp"]
+
+ UNIFIED_SOURCES += [
+diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
+--- a/gfx/thebes/gfxPlatformGtk.cpp
++++ b/gfx/thebes/gfxPlatformGtk.cpp
+@@ -991,11 +991,11 @@
+ }
+
+ RefPtr<VsyncSource> softwareVsync = new XrandrSoftwareVsyncSource();
+ return softwareVsync.forget();
+ #else
+- return CreateSoftwareVsyncSource();
++ return GetSoftwareVsyncSource();
+ #endif
+ }
+
+ void gfxPlatformGtk::BuildContentDeviceData(ContentDeviceData* aOut) {
+ gfxPlatform::BuildContentDeviceData(aOut);
+
diff --git
a/http/firefox/patches/0047-bmo-1754469-memory_mozalloc_throw.patch
b/http/firefox/patches/0047-bmo-1754469-memory_mozalloc_throw.patch
new file mode 100644
index 0000000..634892be
--- /dev/null
+++ b/http/firefox/patches/0047-bmo-1754469-memory_mozalloc_throw.patch
@@ -0,0 +1,69 @@
+--- a/memory/mozalloc/throw_gcc.h 2022-02-02 17:33:38 UTC
++++ b/memory/mozalloc/throw_gcc.h
+@@ -74,50 +74,66 @@ __throw_bad_function_call(void) {
+ mozalloc_abort("fatal: STL threw bad_function_call");
+ }
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_logic_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_domain_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_invalid_argument(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_length_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_out_of_range(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_runtime_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_range_error(
+ const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_overflow_error(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
++#if !defined(_LIBCPP_VERSION)
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
+ __throw_underflow_error(const char* msg) {
+ mozalloc_abort(msg);
+ }
++#endif // _LIBCPP_VERSION
+
+ MOZ_THROW_NORETURN MOZ_THROW_EXPORT MOZ_THROW_INLINE void
__throw_ios_failure(
+ const char* msg) {
diff --git
a/http/firefox/patches/0047-bmo-1769631-python-3.11-compatibility.patch
b/http/firefox/patches/0047-bmo-1769631-python-3.11-compatibility.patch
deleted file mode 100644
index 8dcd0e2..0000000
--- a/http/firefox/patches/0047-bmo-1769631-python-3.11-compatibility.patch
+++ /dev/null
@@ -1,208 +0,0 @@
-
-# HG changeset patch
-# User ahochheiden <ahochheiden AT mozilla.com>
-# Date 1654151264 0
-# Node ID f54162b2c1f2fe52c6137ab2c3469a1944f58b27
-# Parent 6e7776492240c27732840d65a33dcc440fa1aba0
-Bug 1769631 - Remove 'U' from 'mode' parameters for various 'open' calls to
ensure Python3.11 compatibility r=firefox-build-system-reviewers,glandium
-
-The 'U' flag represents "universal newline". It has been deprecated
-since Python3.3. Since then "universal newline" is the default when a
-file is opened in text mode (not bytes). In Python3.11 using the 'U'
-flag throws errors. There should be no harm in removing 'U' from 'open'
-everywhere it is used, and doing allows the use of Python3.11.
-
-For more reading see:
https://docs.python.org/3.11/whatsnew/3.11.html#changes-in-the-python-api
-
-Differential Revision: https://phabricator.services.mozilla.com/D147721
-
-diff --git a/dom/base/usecounters.py b/dom/base/usecounters.py
---- a/dom/base/usecounters.py
-+++ b/dom/base/usecounters.py
-@@ -3,17 +3,17 @@
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- import collections
- import re
-
-
- def read_conf(conf_filename):
- # Can't read/write from a single StringIO, so make a new one for
reading.
-- stream = open(conf_filename, "rU")
-+ stream = open(conf_filename, "r")
-
- def parse_counters(stream):
- for line_num, line in enumerate(stream):
- line = line.rstrip("\n")
- if not line or line.startswith("//"):
- # empty line or comment
- continue
- m = re.match(r"method ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$", line)
-diff --git a/python/mozbuild/mozbuild/action/process_define_files.py
b/python/mozbuild/mozbuild/action/process_define_files.py
---- a/python/mozbuild/mozbuild/action/process_define_files.py
-+++ b/python/mozbuild/mozbuild/action/process_define_files.py
-@@ -31,17 +31,17 @@ def process_define_file(output, input):
-
- config = PartialConfigEnvironment(topobjdir)
-
- if mozpath.basedir(
- path, [mozpath.join(topsrcdir, "js/src")]
- ) and not config.substs.get("JS_STANDALONE"):
- config = PartialConfigEnvironment(mozpath.join(topobjdir, "js",
"src"))
-
-- with open(path, "rU") as input:
-+ with open(path, "r") as input:
- r = re.compile(
-
"^\s*#\s*(?P<cmd>[a-z]+)(?:\s+(?P<name>\S+)(?:\s+(?P<value>\S+))?)?", re.U
- )
- for l in input:
- m = r.match(l)
- if m:
- cmd = m.group("cmd")
- name = m.group("name")
-diff --git a/python/mozbuild/mozbuild/backend/base.py
b/python/mozbuild/mozbuild/backend/base.py
---- a/python/mozbuild/mozbuild/backend/base.py
-+++ b/python/mozbuild/mozbuild/backend/base.py
-@@ -267,17 +267,17 @@ class BuildBackend(LoggingMixin):
- If an exception is raised, |mach build| will fail with a
- non-zero exit code.
- """
- self._write_purgecaches(config)
-
- return status
-
- @contextmanager
-- def _write_file(self, path=None, fh=None, readmode="rU"):
-+ def _write_file(self, path=None, fh=None, readmode="r"):
- """Context manager to write a file.
-
- This is a glorified wrapper around FileAvoidWrite with integration
to
- update the summary data on this instance.
-
- Example usage:
-
- with self._write_file('foo.txt') as fh:
-diff --git a/python/mozbuild/mozbuild/preprocessor.py
b/python/mozbuild/mozbuild/preprocessor.py
---- a/python/mozbuild/mozbuild/preprocessor.py
-+++ b/python/mozbuild/mozbuild/preprocessor.py
-@@ -526,17 +526,17 @@ class Preprocessor:
- if not options.output:
- raise Preprocessor.Error(
- self, "--depend doesn't work with stdout", None
- )
- depfile = get_output_file(options.depend)
-
- if args:
- for f in args:
-- with io.open(f, "rU", encoding="utf-8") as input:
-+ with io.open(f, "r", encoding="utf-8") as input:
- self.processFile(input=input, output=out)
- if depfile:
- mk = Makefile()
-
mk.create_rule([six.ensure_text(options.output)]).add_dependencies(
- self.includes
- )
- mk.dump(depfile)
- depfile.close()
-@@ -855,17 +855,17 @@ class Preprocessor:
- self.checkLineNumbers = False
- if isName:
- try:
- args = _to_text(args)
- if filters:
- args = self.applyFilters(args)
- if not os.path.isabs(args):
- args = os.path.join(self.curdir, args)
-- args = io.open(args, "rU", encoding="utf-8")
-+ args = io.open(args, "r", encoding="utf-8")
- except Preprocessor.Error:
- raise
- except Exception:
- raise Preprocessor.Error(self, "FILE_NOT_FOUND",
_to_text(args))
- self.checkLineNumbers = bool(
- re.search("\.(js|jsm|java|webidl)(?:\.in)?$", args.name)
- )
- oldFile = self.context["FILE"]
-@@ -909,17 +909,17 @@ class Preprocessor:
-
- def do_error(self, args):
- raise Preprocessor.Error(self, "Error: ", _to_text(args))
-
-
- def preprocess(includes=[sys.stdin], defines={}, output=sys.stdout,
marker="#"):
- pp = Preprocessor(defines=defines, marker=marker)
- for f in includes:
-- with io.open(f, "rU", encoding="utf-8") as input:
-+ with io.open(f, "r", encoding="utf-8") as input:
- pp.processFile(input=input, output=output)
- return pp.includes
-
-
- # Keep this module independently executable.
- if __name__ == "__main__":
- pp = Preprocessor()
- pp.handleCommandLine(None, True)
-diff --git a/python/mozbuild/mozbuild/util.py
b/python/mozbuild/mozbuild/util.py
---- a/python/mozbuild/mozbuild/util.py
-+++ b/python/mozbuild/mozbuild/util.py
-@@ -231,17 +231,17 @@ class FileAvoidWrite(BytesIO):
- enabled by default because it a) doesn't make sense for binary files b)
- could add unwanted overhead to calls.
-
- Additionally, there is dry run mode where the file is not actually
written
- out, but reports whether the file was existing and would have been
updated
- still occur, as well as diff capture if requested.
- """
-
-- def __init__(self, filename, capture_diff=False, dry_run=False,
readmode="rU"):
-+ def __init__(self, filename, capture_diff=False, dry_run=False,
readmode="r"):
- BytesIO.__init__(self)
- self.name = filename
- assert type(capture_diff) == bool
- assert type(dry_run) == bool
- assert "r" in readmode
- self._capture_diff = capture_diff
- self._write_to_file = not dry_run
- self.diff = None
-diff --git a/python/mozbuild/mozpack/files.py
b/python/mozbuild/mozpack/files.py
---- a/python/mozbuild/mozpack/files.py
-+++ b/python/mozbuild/mozpack/files.py
-@@ -549,17 +549,17 @@ class PreprocessedFile(BaseFile):
- self.defines = defines
- self.extra_depends = list(extra_depends or [])
- self.silence_missing_directive_warnings =
silence_missing_directive_warnings
-
- def inputs(self):
- pp = Preprocessor(defines=self.defines, marker=self.marker)
-
pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings)
-
-- with _open(self.path, "rU") as input:
-+ with _open(self.path, "r") as input:
- with _open(os.devnull, "w") as output:
- pp.processFile(input=input, output=output)
-
- # This always yields at least self.path.
- return pp.includes
-
- def copy(self, dest, skip_if_older=True):
- """
-@@ -606,17 +606,17 @@ class PreprocessedFile(BaseFile):
- return False
-
- deps_out = None
- if self.depfile:
- deps_out = FileAvoidWrite(self.depfile)
- pp = Preprocessor(defines=self.defines, marker=self.marker)
-
pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings)
-
-- with _open(self.path, "rU") as input:
-+ with _open(self.path, "r") as input:
- pp.processFile(input=input, output=dest, depfile=deps_out)
-
- dest.close()
- if self.depfile:
- deps_out.close()
-
- return True
-
-
diff --git
a/http/firefox/patches/0048-bmo-1769631-python-3.11-compatibility.patch
b/http/firefox/patches/0048-bmo-1769631-python-3.11-compatibility.patch
new file mode 100644
index 0000000..8dcd0e2
--- /dev/null
+++ b/http/firefox/patches/0048-bmo-1769631-python-3.11-compatibility.patch
@@ -0,0 +1,208 @@
+
+# HG changeset patch
+# User ahochheiden <ahochheiden AT mozilla.com>
+# Date 1654151264 0
+# Node ID f54162b2c1f2fe52c6137ab2c3469a1944f58b27
+# Parent 6e7776492240c27732840d65a33dcc440fa1aba0
+Bug 1769631 - Remove 'U' from 'mode' parameters for various 'open' calls to
ensure Python3.11 compatibility r=firefox-build-system-reviewers,glandium
+
+The 'U' flag represents "universal newline". It has been deprecated
+since Python3.3. Since then "universal newline" is the default when a
+file is opened in text mode (not bytes). In Python3.11 using the 'U'
+flag throws errors. There should be no harm in removing 'U' from 'open'
+everywhere it is used, and doing allows the use of Python3.11.
+
+For more reading see:
https://docs.python.org/3.11/whatsnew/3.11.html#changes-in-the-python-api
+
+Differential Revision: https://phabricator.services.mozilla.com/D147721
+
+diff --git a/dom/base/usecounters.py b/dom/base/usecounters.py
+--- a/dom/base/usecounters.py
++++ b/dom/base/usecounters.py
+@@ -3,17 +3,17 @@
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ import collections
+ import re
+
+
+ def read_conf(conf_filename):
+ # Can't read/write from a single StringIO, so make a new one for
reading.
+- stream = open(conf_filename, "rU")
++ stream = open(conf_filename, "r")
+
+ def parse_counters(stream):
+ for line_num, line in enumerate(stream):
+ line = line.rstrip("\n")
+ if not line or line.startswith("//"):
+ # empty line or comment
+ continue
+ m = re.match(r"method ([A-Za-z0-9]+)\.([A-Za-z0-9]+)$", line)
+diff --git a/python/mozbuild/mozbuild/action/process_define_files.py
b/python/mozbuild/mozbuild/action/process_define_files.py
+--- a/python/mozbuild/mozbuild/action/process_define_files.py
++++ b/python/mozbuild/mozbuild/action/process_define_files.py
+@@ -31,17 +31,17 @@ def process_define_file(output, input):
+
+ config = PartialConfigEnvironment(topobjdir)
+
+ if mozpath.basedir(
+ path, [mozpath.join(topsrcdir, "js/src")]
+ ) and not config.substs.get("JS_STANDALONE"):
+ config = PartialConfigEnvironment(mozpath.join(topobjdir, "js",
"src"))
+
+- with open(path, "rU") as input:
++ with open(path, "r") as input:
+ r = re.compile(
+
"^\s*#\s*(?P<cmd>[a-z]+)(?:\s+(?P<name>\S+)(?:\s+(?P<value>\S+))?)?", re.U
+ )
+ for l in input:
+ m = r.match(l)
+ if m:
+ cmd = m.group("cmd")
+ name = m.group("name")
+diff --git a/python/mozbuild/mozbuild/backend/base.py
b/python/mozbuild/mozbuild/backend/base.py
+--- a/python/mozbuild/mozbuild/backend/base.py
++++ b/python/mozbuild/mozbuild/backend/base.py
+@@ -267,17 +267,17 @@ class BuildBackend(LoggingMixin):
+ If an exception is raised, |mach build| will fail with a
+ non-zero exit code.
+ """
+ self._write_purgecaches(config)
+
+ return status
+
+ @contextmanager
+- def _write_file(self, path=None, fh=None, readmode="rU"):
++ def _write_file(self, path=None, fh=None, readmode="r"):
+ """Context manager to write a file.
+
+ This is a glorified wrapper around FileAvoidWrite with integration
to
+ update the summary data on this instance.
+
+ Example usage:
+
+ with self._write_file('foo.txt') as fh:
+diff --git a/python/mozbuild/mozbuild/preprocessor.py
b/python/mozbuild/mozbuild/preprocessor.py
+--- a/python/mozbuild/mozbuild/preprocessor.py
++++ b/python/mozbuild/mozbuild/preprocessor.py
+@@ -526,17 +526,17 @@ class Preprocessor:
+ if not options.output:
+ raise Preprocessor.Error(
+ self, "--depend doesn't work with stdout", None
+ )
+ depfile = get_output_file(options.depend)
+
+ if args:
+ for f in args:
+- with io.open(f, "rU", encoding="utf-8") as input:
++ with io.open(f, "r", encoding="utf-8") as input:
+ self.processFile(input=input, output=out)
+ if depfile:
+ mk = Makefile()
+
mk.create_rule([six.ensure_text(options.output)]).add_dependencies(
+ self.includes
+ )
+ mk.dump(depfile)
+ depfile.close()
+@@ -855,17 +855,17 @@ class Preprocessor:
+ self.checkLineNumbers = False
+ if isName:
+ try:
+ args = _to_text(args)
+ if filters:
+ args = self.applyFilters(args)
+ if not os.path.isabs(args):
+ args = os.path.join(self.curdir, args)
+- args = io.open(args, "rU", encoding="utf-8")
++ args = io.open(args, "r", encoding="utf-8")
+ except Preprocessor.Error:
+ raise
+ except Exception:
+ raise Preprocessor.Error(self, "FILE_NOT_FOUND",
_to_text(args))
+ self.checkLineNumbers = bool(
+ re.search("\.(js|jsm|java|webidl)(?:\.in)?$", args.name)
+ )
+ oldFile = self.context["FILE"]
+@@ -909,17 +909,17 @@ class Preprocessor:
+
+ def do_error(self, args):
+ raise Preprocessor.Error(self, "Error: ", _to_text(args))
+
+
+ def preprocess(includes=[sys.stdin], defines={}, output=sys.stdout,
marker="#"):
+ pp = Preprocessor(defines=defines, marker=marker)
+ for f in includes:
+- with io.open(f, "rU", encoding="utf-8") as input:
++ with io.open(f, "r", encoding="utf-8") as input:
+ pp.processFile(input=input, output=output)
+ return pp.includes
+
+
+ # Keep this module independently executable.
+ if __name__ == "__main__":
+ pp = Preprocessor()
+ pp.handleCommandLine(None, True)
+diff --git a/python/mozbuild/mozbuild/util.py
b/python/mozbuild/mozbuild/util.py
+--- a/python/mozbuild/mozbuild/util.py
++++ b/python/mozbuild/mozbuild/util.py
+@@ -231,17 +231,17 @@ class FileAvoidWrite(BytesIO):
+ enabled by default because it a) doesn't make sense for binary files b)
+ could add unwanted overhead to calls.
+
+ Additionally, there is dry run mode where the file is not actually
written
+ out, but reports whether the file was existing and would have been
updated
+ still occur, as well as diff capture if requested.
+ """
+
+- def __init__(self, filename, capture_diff=False, dry_run=False,
readmode="rU"):
++ def __init__(self, filename, capture_diff=False, dry_run=False,
readmode="r"):
+ BytesIO.__init__(self)
+ self.name = filename
+ assert type(capture_diff) == bool
+ assert type(dry_run) == bool
+ assert "r" in readmode
+ self._capture_diff = capture_diff
+ self._write_to_file = not dry_run
+ self.diff = None
+diff --git a/python/mozbuild/mozpack/files.py
b/python/mozbuild/mozpack/files.py
+--- a/python/mozbuild/mozpack/files.py
++++ b/python/mozbuild/mozpack/files.py
+@@ -549,17 +549,17 @@ class PreprocessedFile(BaseFile):
+ self.defines = defines
+ self.extra_depends = list(extra_depends or [])
+ self.silence_missing_directive_warnings =
silence_missing_directive_warnings
+
+ def inputs(self):
+ pp = Preprocessor(defines=self.defines, marker=self.marker)
+
pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings)
+
+- with _open(self.path, "rU") as input:
++ with _open(self.path, "r") as input:
+ with _open(os.devnull, "w") as output:
+ pp.processFile(input=input, output=output)
+
+ # This always yields at least self.path.
+ return pp.includes
+
+ def copy(self, dest, skip_if_older=True):
+ """
+@@ -606,17 +606,17 @@ class PreprocessedFile(BaseFile):
+ return False
+
+ deps_out = None
+ if self.depfile:
+ deps_out = FileAvoidWrite(self.depfile)
+ pp = Preprocessor(defines=self.defines, marker=self.marker)
+
pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings)
+
+- with _open(self.path, "rU") as input:
++ with _open(self.path, "r") as input:
+ pp.processFile(input=input, output=dest, depfile=deps_out)
+
+ dest.close()
+ if self.depfile:
+ deps_out.close()
+
+ return True
+
+



  • [SM-Commit] GIT changes to master grimoire by Thomas Orgis (63cbe170054725d2a6dfa6b26331ff91ef7f1ffb), Thomas Orgis, 06/30/2022

Archive powered by MHonArc 2.6.24.

Top of Page