From cd5314efb389f4847072afa23518b451987c8082 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Tue, 9 Jul 2024 13:56:03 +0200 Subject: [PATCH] Updated to 128.0 --- .gitignore | 3 + build-aarch64-skia.patch | 46 ++-- firefox.sh.in | 34 +-- firefox.spec | 31 +-- ...ebrtc-fix-pipewire-camera-duplicates.patch | 41 --- ...ture-pipewire-drop-corrupted-buffers.patch | 51 ---- mozilla-1898476-sync.patch | 238 ++++++++++++++++++ pgo.patch | 90 ++++--- sources | 5 +- wasi.patch | 2 +- 10 files changed, 327 insertions(+), 214 deletions(-) delete mode 100644 libwebrtc-fix-pipewire-camera-duplicates.patch delete mode 100644 libwebrtc-video-capture-pipewire-drop-corrupted-buffers.patch create mode 100644 mozilla-1898476-sync.patch diff --git a/.gitignore b/.gitignore index f1a94d5..1031950 100644 --- a/.gitignore +++ b/.gitignore @@ -643,3 +643,6 @@ firefox-3.6.4.source.tar.bz2 /firefox-langpacks-127.0-20240610.tar.xz /firefox-langpacks-127.0.2-20240625.tar.xz /firefox-127.0.2.source.tar.xz +/firefox-128.0.source.tar.xz +/firefox-langpacks-128.0-20240702.tar.xz +/firefox-langpacks-128.0-20240708.tar.xz diff --git a/build-aarch64-skia.patch b/build-aarch64-skia.patch index 342836f..b3abe7a 100644 --- a/build-aarch64-skia.patch +++ b/build-aarch64-skia.patch @@ -1,25 +1,35 @@ -diff -up firefox-114.0/gfx/skia/skia/modules/skcms/src/Transform_inl.h.aarch64-skia firefox-114.0/gfx/skia/skia/modules/skcms/src/Transform_inl.h ---- firefox-114.0/gfx/skia/skia/modules/skcms/src/Transform_inl.h.aarch64-skia 2023-06-02 03:15:22.000000000 +0200 -+++ firefox-114.0/gfx/skia/skia/modules/skcms/src/Transform_inl.h 2023-06-05 10:18:46.942777997 +0200 -@@ -189,8 +189,6 @@ SI F F_from_Half(U16 half) { +diff -up firefox-128.0/gfx/skia/skia/modules/skcms/src/Transform_inl.h.aarch64-skia firefox-128.0/gfx/skia/skia/modules/skcms/src/Transform_inl.h +--- firefox-128.0/gfx/skia/skia/modules/skcms/src/Transform_inl.h.aarch64-skia 2024-07-02 11:10:25.047099913 +0200 ++++ firefox-128.0/gfx/skia/skia/modules/skcms/src/Transform_inl.h 2024-07-02 11:15:43.855410571 +0200 +@@ -151,7 +151,7 @@ SI U32 to_fixed(F f) { return (U32)cast + + + SI F F_from_Half(U16 half) { +-#if defined(USING_NEON_F16C) ++#if 0 // defined(USING_NEON_F16C) + return vcvt_f32_f16((float16x4_t)half); + #elif defined(USING_AVX512F) + return (F)_mm512_cvtph_ps((__m256i)half); +@@ -178,7 +178,7 @@ SI F F_from_Half(U16 half) { + __attribute__((no_sanitize("unsigned-integer-overflow"))) + #endif SI U16 Half_from_F(F f) { - #if defined(USING_NEON_FP16) - return bit_pun(f); --#elif defined(USING_NEON_F16C) -- return (U16)vcvt_f16_f32(f); +-#if defined(USING_NEON_F16C) ++#if 0 //defined(USING_NEON_F16C) + return (U16)vcvt_f16_f32(f); #elif defined(USING_AVX512F) return (U16)_mm512_cvtps_ph((__m512 )f, _MM_FROUND_CUR_DIRECTION ); - #elif defined(USING_AVX_F16C) -diff -up firefox-114.0/gfx/skia/skia/src/base/SkHalf.h.aarch64-skia firefox-114.0/gfx/skia/skia/src/base/SkHalf.h -diff -up firefox-114.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h.aarch64-skia firefox-114.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h ---- firefox-114.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h.aarch64-skia 2023-06-05 10:18:46.941777963 +0200 -+++ firefox-114.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h 2023-06-05 10:20:44.924843847 +0200 -@@ -1128,7 +1128,7 @@ SI F from_half(U16 h) { +diff -up firefox-128.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h.aarch64-skia firefox-128.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h +--- firefox-128.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h.aarch64-skia 2024-07-02 11:10:25.048099949 +0200 ++++ firefox-128.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h 2024-07-02 11:13:33.384783413 +0200 +@@ -1425,8 +1425,8 @@ SI F from_half(U16 h) { } SI U16 to_half(F f) { --#if defined(JUMPER_IS_NEON) && defined(SK_CPU_ARM64) \ -+#if 0 //defined(JUMPER_IS_NEON) && defined(SK_CPU_ARM64) \ - && !defined(SK_BUILD_FOR_GOOGLE3) // Temporary workaround for some Google3 builds. - return sk_bit_cast(vcvt_f16_f32(f)); +-#if defined(JUMPER_IS_NEON) && defined(SK_CPU_ARM64) +- return (U16)vcvt_f16_f32(f); ++#if 0 //defined(JUMPER_IS_NEON) && defined(SK_CPU_ARM64) ++ return (U16)vcvt_f16_f32(f); + #elif defined(JUMPER_IS_SKX) + return (U16)_mm512_cvtps_ph(f, _MM_FROUND_CUR_DIRECTION); diff --git a/firefox.sh.in b/firefox.sh.in index c5a85fa..a6b92c0 100644 --- a/firefox.sh.in +++ b/firefox.sh.in @@ -64,7 +64,6 @@ MOZ_DIST_BIN="$MOZ_LIB_DIR/firefox" MOZ_LANGPACKS_DIR="$MOZ_DIST_BIN/langpacks" MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" MOZ_PROGRAM="$MOZ_DIST_BIN/$MOZ_FIREFOX_FILE" -MOZ_LAUNCHER="$MOZ_DIST_BIN/run-mozilla.sh" GETENFORCE_FILE="/usr/sbin/getenforce" ## @@ -245,35 +244,6 @@ fi NSS_SSL_CBC_RANDOM_IV=${NSS_SSL_CBC_RANDOM_IV-1} export NSS_SSL_CBC_RANDOM_IV -# Prepare command line arguments -script_args="" -pass_arg_count=0 -while [ $# -gt $pass_arg_count ] -do - case "$1" in - -g | --debug) - script_args="$script_args -g" - debugging=1 - shift - ;; - -d | --debugger) - if [ $# -gt 1 ]; then - script_args="$script_args -d $2" - shift 2 - else - shift - fi - ;; - *) - # Move the unrecognized argument to the end of the list. - arg="$1" - shift - set -- "$@" "$arg" - pass_arg_count=`expr $pass_arg_count + 1` - ;; - esac -done - # MOZ_APP_REMOTINGNAME links Firefox with desktop file name if [ -z "$MOZ_APP_REMOTINGNAME" ] then @@ -298,7 +268,7 @@ export MOZ_ALLOW_DOWNGRADE=1 debugging=0 if [ $debugging = 1 ] then - echo $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@" + echo $MOZ_PROGRAM "$@" fi -exec $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@" +exec $MOZ_PROGRAM "$@" diff --git a/firefox.spec b/firefox.spec index 65a1672..12b6970 100644 --- a/firefox.spec +++ b/firefox.spec @@ -188,13 +188,13 @@ ExcludeArch: i686 Summary: Mozilla Firefox Web browser Name: firefox -Version: 127.0.2 -Release: 2%{?pre_tag}%{?dist} +Version: 128.0 +Release: 1%{?pre_tag}%{?dist} URL: https://www.mozilla.org/firefox/ License: MPLv1.1 or GPLv2+ or LGPLv2+ Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz %if %{with langpacks} -Source1: firefox-langpacks-%{version}%{?pre_version}-20240625.tar.xz +Source1: firefox-langpacks-%{version}%{?pre_version}-20240708.tar.xz %endif Source2: cbindgen-vendor.tar.xz Source3: dump_syms-vendor.tar.xz @@ -242,7 +242,6 @@ Patch38: build-cacheFlush-missing.patch Patch40: build-aarch64-skia.patch Patch44: build-arm-libopus.patch Patch46: firefox-nss-version.patch -Patch47: fedora-shebang-build.patch Patch53: firefox-gcc-build.patch Patch55: firefox-testing.patch Patch61: firefox-glibc-dynstack.patch @@ -274,16 +273,12 @@ Patch242: 0026-Add-KDE-integration-to-Firefox.patch # Upstream patches Patch402: mozilla-1196777.patch Patch407: mozilla-1667096.patch -# https://webrtc-review.googlesource.com/c/src/+/349881 -Patch410: libwebrtc-video-capture-pipewire-drop-corrupted-buffers.patch -# https://phabricator.services.mozilla.com/D213749 -Patch411: libwebrtc-fix-pipewire-camera-duplicates.patch - Patch420: D209910.1715685533.diff Patch421: D209911.1715685535.diff Patch422: D210158.1715685536.diff Patch423: D210159.1715685538.diff Patch424: D210430.1715848796.diff +Patch450: mozilla-1898476-sync.patch # PGO/LTO patches Patch600: pgo.patch @@ -565,7 +560,6 @@ This package contains results of tests executed during build. %patch -P40 -p1 -b .aarch64-skia %patch -P44 -p1 -b .build-arm-libopus -%patch -P47 -p1 -b .fedora-shebang %patch -P53 -p1 -b .firefox-gcc-build %patch -P71 -p1 -b .0001-GLIBCXX-fix-for-GCC-12 %patch -P78 -p1 -b .firefox-i686 @@ -598,14 +592,8 @@ export LIBCLANG_RT=`pwd`/wasi-sdk-20/build/compiler-rt/lib/wasi/libclang_rt.buil %patch -P402 -p1 -b .1196777 %patch -P407 -p1 -b .1667096 -%patch -P410 -p1 -b .libwebrtc-video-capture-pipewire-drop-corrupted-buffers -%patch -P411 -p1 -b .libwebrtc-fix-pipewire-camera-duplicates -%patch -P420 -p1 -b .D209910.1715685533 -%patch -P421 -p1 -b .D209911.1715685535 -%patch -P422 -p1 -b .D210158.1715685536 -%patch -P423 -p1 -b .D210159.1715685538 -%patch -P424 -p1 -b .D210430.1715848796 +%patch -P450 -p1 -b mozilla-1898476-sync # PGO patches %if %{build_with_pgo} @@ -809,6 +797,8 @@ cp %{SOURCE32} %{_buildrootdir}/bin || : find ./ -path ./third_party/rust -prune -o -name config.guess -exec cp /usr/lib/rpm/config.guess {} ';' MOZ_OPT_FLAGS=$(echo "%{optflags}" | sed -e 's/-Wall//') +# Firefox is not supposed to build with exceptions globally enabled +MOZ_OPT_FLAGS=$(echo "$MOZ_OPT_FLAGS" | sed -e 's/-fexceptions//') #rhbz#1037063 # -Werror=format-security causes build failures when -Wno-format is explicitly given # for some sources @@ -1094,9 +1084,6 @@ cp %{SOURCE12} %{buildroot}%{mozappdir}/browser/defaults/preferences echo 'pref("widget.use-xdg-desktop-portal.file-picker", 1);' >> %{buildroot}%{mozappdir}/browser/defaults/preferences/firefox-redhat-default-prefs.js %endif -# Copy over run-mozilla.sh -cp build/unix/run-mozilla.sh %{buildroot}%{mozappdir} - # Add distribution.ini mkdir -p %{buildroot}%{mozappdir}/distribution cp %{SOURCE26} %{buildroot}%{mozappdir}/distribution @@ -1199,7 +1186,6 @@ fi %endif %endif %{mozappdir}/browser/omni.ja -%{mozappdir}/run-mozilla.sh %{mozappdir}/application.ini %{mozappdir}/pingsender %exclude %{mozappdir}/removed-files @@ -1240,6 +1226,9 @@ fi #--------------------------------------------------------------------- %changelog +* Tue Jul 2 2024 Martin Stransky - 128.0-1 +- Update to 128.0 + * Tue Jul 2 2024 Martin Stransky - 127.0.2-2 - Allow to override MOZ_DBUS_APP_NAME diff --git a/libwebrtc-fix-pipewire-camera-duplicates.patch b/libwebrtc-fix-pipewire-camera-duplicates.patch deleted file mode 100644 index 867ea92..0000000 --- a/libwebrtc-fix-pipewire-camera-duplicates.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff --git a/third_party/libwebrtc/modules/video_capture/linux/pipewire_session.cc b/third_party/libwebrtc/modules/video_capture/linux/pipewire_session.cc ---- a/third_party/libwebrtc/modules/video_capture/linux/pipewire_session.cc -+++ b/third_party/libwebrtc/modules/video_capture/linux/pipewire_session.cc -@@ -352,10 +352,17 @@ - const char* type, - uint32_t version, - const spa_dict* props) { - PipeWireSession* that = static_cast(data); - -+ // Skip already added nodes to avoid duplicate camera entries -+ if (std::find_if(that->nodes_.begin(), that->nodes_.end(), -+ [id](const PipeWireNode& node) { -+ return node.id() == id; -+ }) != that->nodes_.end()) -+ return; -+ - if (type != absl::string_view(PW_TYPE_INTERFACE_Node)) - return; - - if (!spa_dict_lookup(props, PW_KEY_NODE_DESCRIPTION)) - return; -@@ -370,16 +377,14 @@ - - // static - void PipeWireSession::OnRegistryGlobalRemove(void* data, uint32_t id) { - PipeWireSession* that = static_cast(data); - -- for (auto it = that->nodes_.begin(); it != that->nodes().end(); ++it) { -- if ((*it).id() == id) { -- that->nodes_.erase(it); -- break; -- } -- } -+ auto it = std::remove_if( -+ that->nodes_.begin(), that->nodes_.end(), -+ [id](const PipeWireNode& node) { return node.id() == id; }); -+ that->nodes_.erase(it, that->nodes_.end()); - } - - void PipeWireSession::Finish(VideoCaptureOptions::Status status) { - webrtc::MutexLock lock(&callback_lock_); diff --git a/libwebrtc-video-capture-pipewire-drop-corrupted-buffers.patch b/libwebrtc-video-capture-pipewire-drop-corrupted-buffers.patch deleted file mode 100644 index 2e91759..0000000 --- a/libwebrtc-video-capture-pipewire-drop-corrupted-buffers.patch +++ /dev/null @@ -1,51 +0,0 @@ -From b7653310766909158a4781fe9def5fb8e9414d1a Mon Sep 17 00:00:00 2001 -From: Jan Grulich -Date: Mon, 06 May 2024 11:20:27 +0200 -Subject: [PATCH] Video capture PipeWire: drop corrupted PipeWire buffers - -Use SPA_CHUNK_FLAG_CORRUPTED and SPA_META_HEADER_FLAG_CORRUPTED flags to -determine corrupted buffers or corrupted buffer data. We used to only -rely on compositors setting chunk->size, but this doesn't make sense for -dmabufs where they have to make up arbitrary values. It also looks this -is not reliable and can cause glitches as we end up processing corrupted buffers. - -Bug: webrtc:338232699 -Change-Id: Ida0c6a5e7a37e19598c6d5884726200f81b94962 ---- - -diff --git a/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc b/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc -index 6998d65..f7feddd 100644 ---- a/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc -+++ b/third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc -@@ -323,6 +323,15 @@ - return; - } - -+ struct spa_meta_header* header = -+ static_cast(spa_buffer_find_meta_data( -+ buffer->buffer, SPA_META_Header, sizeof(*header))); -+ if (header && (header->flags & SPA_META_HEADER_FLAG_CORRUPTED)) { -+ RTC_LOG(LS_WARNING) << "Dropping corrupted buffer"; -+ pw_stream_queue_buffer(that->pw_stream_, buffer); -+ return; -+ } -+ - that->ProcessBuffer(buffer); - - pw_stream_queue_buffer(that->pw_stream_, buffer); -@@ -709,7 +718,14 @@ - } - } - -- if (spa_buffer->datas[0].chunk->size == 0) { -+ if (spa_buffer->datas[0].chunk->flags & SPA_CHUNK_FLAG_CORRUPTED) { -+ RTC_LOG(LS_WARNING) << "Dropping buffer with corrupted data"; -+ return; -+ } -+ -+ if (spa_buffer->datas[0].type == SPA_DATA_MemFd && -+ spa_buffer->datas[0].chunk->size == 0) { -+ RTC_LOG(LS_WARNING) << "Dropping buffer with empty data"; - return; - } - diff --git a/mozilla-1898476-sync.patch b/mozilla-1898476-sync.patch new file mode 100644 index 0000000..cc937ec --- /dev/null +++ b/mozilla-1898476-sync.patch @@ -0,0 +1,238 @@ +diff --git a/gfx/webrender_bindings/RenderCompositorEGL.cpp b/gfx/webrender_bindings/RenderCompositorEGL.cpp +--- a/gfx/webrender_bindings/RenderCompositorEGL.cpp ++++ b/gfx/webrender_bindings/RenderCompositorEGL.cpp +@@ -154,6 +154,13 @@ RenderedFrameId RenderCompositorEGL::End + } + gl()->SetDamage(bufferInvalid); + } ++ ++#ifdef MOZ_WIDGET_GTK ++ UniquePtr lock; ++ if (mWidget->AsGTK()) { ++ lock = mWidget->AsGTK()->LockSurface(); ++ } ++#endif + gl()->SwapBuffers(); + return frameId; + } +diff --git a/widget/gtk/GtkCompositorWidget.cpp b/widget/gtk/GtkCompositorWidget.cpp +--- a/widget/gtk/GtkCompositorWidget.cpp ++++ b/widget/gtk/GtkCompositorWidget.cpp +@@ -211,5 +211,11 @@ bool GtkCompositorWidget::IsPopup() { + } + #endif + ++#if defined(MOZ_WAYLAND) ++UniquePtr GtkCompositorWidget::LockSurface() { ++ return mWidget->LockSurface(); ++} ++#endif ++ + } // namespace widget + } // namespace mozilla +diff --git a/widget/gtk/GtkCompositorWidget.h b/widget/gtk/GtkCompositorWidget.h +--- a/widget/gtk/GtkCompositorWidget.h ++++ b/widget/gtk/GtkCompositorWidget.h +@@ -10,6 +10,10 @@ + #include "mozilla/DataMutex.h" + #include "mozilla/widget/CompositorWidget.h" + #include "WindowSurfaceProvider.h" ++#if defined(MOZ_WAYLAND) ++# include "mozilla/UniquePtr.h" ++# include "MozContainerSurfaceLock.h" ++#endif + + class nsIWidget; + class nsWindow; +@@ -96,6 +100,8 @@ class GtkCompositorWidget : public Compo + void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) override; + GtkCompositorWidget* AsGtkCompositorWidget() override { return this; } + ++ UniquePtr LockSurface(); ++ + private: + #if defined(MOZ_WAYLAND) + void ConfigureWaylandBackend(); +diff --git a/widget/gtk/MozContainerSurfaceLock.cpp b/widget/gtk/MozContainerSurfaceLock.cpp +new file mode 100644 +--- /dev/null ++++ b/widget/gtk/MozContainerSurfaceLock.cpp +@@ -0,0 +1,27 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* This Source Code Form is subject to the terms of the Mozilla Public ++ * License, v. 2.0. If a copy of the MPL was not distributed with this ++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ ++ ++#include "MozContainerSurfaceLock.h" ++#include "MozContainer.h" ++#include "WidgetUtilsGtk.h" ++ ++MozContainerSurfaceLock::MozContainerSurfaceLock(MozContainer* aContainer) { ++ mContainer = aContainer; ++#ifdef MOZ_WAYLAND ++ if (GdkIsWaylandDisplay()) { ++ mSurface = moz_container_wayland_surface_lock(aContainer); ++ } ++#endif ++} ++ ++MozContainerSurfaceLock::~MozContainerSurfaceLock() { ++#ifdef MOZ_WAYLAND ++ if (GdkIsWaylandDisplay()) { ++ moz_container_wayland_surface_unlock(mContainer, &mSurface); ++ } ++#endif ++} ++ ++struct wl_surface* MozContainerSurfaceLock::GetSurface() { return mSurface; } +diff --git a/widget/gtk/MozContainerSurfaceLock.h b/widget/gtk/MozContainerSurfaceLock.h +new file mode 100644 +--- /dev/null ++++ b/widget/gtk/MozContainerSurfaceLock.h +@@ -0,0 +1,25 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* This Source Code Form is subject to the terms of the Mozilla Public ++ * License, v. 2.0. If a copy of the MPL was not distributed with this ++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ ++ ++#ifndef widget_gtk_MozContainerSurfaceLock_h ++#define widget_gtk_MozContainerSurfaceLock_h ++ ++struct wl_surface; ++struct _MozContainer; ++typedef struct _MozContainer MozContainer; ++ ++class MozContainerSurfaceLock { ++ public: ++ explicit MozContainerSurfaceLock(MozContainer* aContainer); ++ ~MozContainerSurfaceLock(); ++ ++ struct wl_surface* GetSurface(); ++ ++ private: ++ MozContainer* mContainer = nullptr; ++ struct wl_surface* mSurface = nullptr; ++}; ++ ++#endif // widget_gtk_MozContainerSurfaceLock_h +diff --git a/widget/gtk/MozContainerWayland.cpp b/widget/gtk/MozContainerWayland.cpp +--- a/widget/gtk/MozContainerWayland.cpp ++++ b/widget/gtk/MozContainerWayland.cpp +@@ -87,23 +87,6 @@ static void moz_container_wayland_set_op + const MutexAutoLock& aProofOfLock, MozContainer* container, + const LayoutDeviceIntRegion&); + +-// Lock mozcontainer and get wayland surface of it. You need to pair with +-// moz_container_wayland_surface_unlock() even +-// if moz_container_wayland_surface_lock() fails and returns nullptr. +-static struct wl_surface* moz_container_wayland_surface_lock( +- MozContainer* container); +-static void moz_container_wayland_surface_unlock(MozContainer* container, +- struct wl_surface** surface); +- +-MozContainerSurfaceLock::MozContainerSurfaceLock(MozContainer* aContainer) { +- mContainer = aContainer; +- mSurface = moz_container_wayland_surface_lock(aContainer); +-} +-MozContainerSurfaceLock::~MozContainerSurfaceLock() { +- moz_container_wayland_surface_unlock(mContainer, &mSurface); +-} +-struct wl_surface* MozContainerSurfaceLock::GetSurface() { return mSurface; } +- + // Invalidate gtk wl_surface to commit changes to wl_subsurface. + // wl_subsurface changes are effective when parent surface is commited. + static void moz_container_wayland_invalidate(MozContainer* container) { +diff --git a/widget/gtk/MozContainerWayland.h b/widget/gtk/MozContainerWayland.h +--- a/widget/gtk/MozContainerWayland.h ++++ b/widget/gtk/MozContainerWayland.h +@@ -13,6 +13,7 @@ + #include + #include "mozilla/Mutex.h" + #include "WindowSurface.h" ++#include "MozContainerSurfaceLock.h" + + /* + * MozContainer +@@ -61,15 +62,12 @@ struct _MozContainerClass; + typedef struct _MozContainer MozContainer; + typedef struct _MozContainerClass MozContainerClass; + +-class MozContainerSurfaceLock { +- MozContainer* mContainer; +- struct wl_surface* mSurface; +- +- public: +- explicit MozContainerSurfaceLock(MozContainer* aContainer); +- ~MozContainerSurfaceLock(); +- struct wl_surface* GetSurface(); +-}; ++// Lock mozcontainer and get wayland surface of it. You need to pair with ++// moz_container_wayland_surface_unlock() even ++// if moz_container_wayland_surface_lock() fails and returns nullptr. ++struct wl_surface* moz_container_wayland_surface_lock(MozContainer* container); ++void moz_container_wayland_surface_unlock(MozContainer* container, ++ struct wl_surface** surface); + + void moz_container_wayland_map(GtkWidget*); + gboolean moz_container_wayland_map_event(GtkWidget*, GdkEventAny*); +diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build +--- a/widget/gtk/moz.build ++++ b/widget/gtk/moz.build +@@ -33,6 +33,7 @@ if CONFIG["MOZ_ENABLE_V4L2"]: + + EXPORTS += [ + "MozContainer.h", ++ "MozContainerSurfaceLock.h", + "nsGTKToolkit.h", + "nsGtkUtils.h", + "nsImageToPixbuf.h", +@@ -71,6 +72,7 @@ UNIFIED_SOURCES += [ + "IMContextWrapper.cpp", + "InProcessGtkCompositorWidget.cpp", + "MozContainer.cpp", ++ "MozContainerSurfaceLock.cpp", + "MPRISServiceHandler.cpp", + "NativeKeyBindings.cpp", + "NativeMenuGtk.cpp", +@@ -114,6 +116,7 @@ if CONFIG["MOZ_WAYLAND"]: + "WindowSurfaceWaylandMultiBuffer.cpp", + ] + EXPORTS.mozilla.widget += [ ++ "MozContainerSurfaceLock.h", + "MozContainerWayland.h", + "nsWaylandDisplay.h", + "WaylandBuffer.h", +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -10196,3 +10196,10 @@ void nsWindow::SetDragSource(GdkDragCont + } + } + } ++ ++UniquePtr nsWindow::LockSurface() { ++ if (mIsDestroyed) { ++ return nullptr; ++ } ++ return MakeUnique(mContainer); ++} +diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h +--- a/widget/gtk/nsWindow.h ++++ b/widget/gtk/nsWindow.h +@@ -42,6 +42,7 @@ + # include "base/thread.h" + # include "WaylandVsyncSource.h" + # include "nsClipboardWayland.h" ++# include "MozContainerSurfaceLock.h" + #endif + + #ifdef MOZ_LOGGING +@@ -421,6 +422,8 @@ class nsWindow final : public nsBaseWidg + + static nsWindow* GetFocusedWindow(); + ++ mozilla::UniquePtr LockSurface(); ++ + #ifdef MOZ_WAYLAND + // Use xdg-activation protocol to transfer focus from gFocusWindow to aWindow. + static void TransferFocusToWaylandWindow(nsWindow* aWindow); diff --git a/pgo.patch b/pgo.patch index 6499434..3d8a0b1 100644 --- a/pgo.patch +++ b/pgo.patch @@ -1,6 +1,6 @@ -diff -up firefox-123.0/build/moz.configure/lto-pgo.configure.pgo firefox-123.0/build/moz.configure/lto-pgo.configure ---- firefox-123.0/build/moz.configure/lto-pgo.configure.pgo 2024-02-22 10:53:12.608509264 +0100 -+++ firefox-123.0/build/moz.configure/lto-pgo.configure 2024-02-22 10:56:14.911881765 +0100 +diff -up firefox-128.0/build/moz.configure/lto-pgo.configure.pgo firefox-128.0/build/moz.configure/lto-pgo.configure +--- firefox-128.0/build/moz.configure/lto-pgo.configure.pgo 2024-07-02 00:34:14.000000000 +0200 ++++ firefox-128.0/build/moz.configure/lto-pgo.configure 2024-07-02 17:59:44.425650444 +0200 @@ -90,12 +90,16 @@ set_config("PGO_PROFILE_PATH", pgo_profi @depends( @@ -19,7 +19,7 @@ diff -up firefox-123.0/build/moz.configure/lto-pgo.configure.pgo firefox-123.0/b if not profile_use: return None -@@ -130,7 +134,7 @@ def pgo_flags(compiler, linker, profdata +@@ -133,7 +137,7 @@ def pgo_flags( return namespace( gen_cflags=["-fprofile-generate"], gen_ldflags=["-fprofile-generate"], @@ -28,9 +28,9 @@ diff -up firefox-123.0/build/moz.configure/lto-pgo.configure.pgo firefox-123.0/b use_ldflags=["-fprofile-use"], ) -diff -up firefox-123.0/build/pgo/profileserver.py.pgo firefox-123.0/build/pgo/profileserver.py ---- firefox-123.0/build/pgo/profileserver.py.pgo 2024-02-14 08:18:40.000000000 +0100 -+++ firefox-123.0/build/pgo/profileserver.py 2024-02-22 10:06:42.665963053 +0100 +diff -up firefox-128.0/build/pgo/profileserver.py.pgo firefox-128.0/build/pgo/profileserver.py +--- firefox-128.0/build/pgo/profileserver.py.pgo 2024-07-02 00:34:15.000000000 +0200 ++++ firefox-128.0/build/pgo/profileserver.py 2024-07-02 17:59:44.425650444 +0200 @@ -11,7 +11,7 @@ import subprocess import sys @@ -40,7 +40,7 @@ diff -up firefox-123.0/build/pgo/profileserver.py.pgo firefox-123.0/build/pgo/pr from mozfile import TemporaryDirectory from mozhttpd import MozHttpd from mozprofile import FirefoxProfile, Preferences -@@ -98,9 +98,22 @@ if __name__ == "__main__": +@@ -97,9 +97,22 @@ if __name__ == "__main__": locations = ServerLocations() locations.add_host(host="127.0.0.1", port=PORT, options="primary,privileged") @@ -66,10 +66,10 @@ diff -up firefox-123.0/build/pgo/profileserver.py.pgo firefox-123.0/build/pgo/pr with TemporaryDirectory() as profilePath: # TODO: refactor this into mozprofile -diff -up firefox-123.0/gfx/2d/moz.build.pgo firefox-123.0/gfx/2d/moz.build ---- firefox-123.0/gfx/2d/moz.build.pgo 2024-02-14 08:18:41.000000000 +0100 -+++ firefox-123.0/gfx/2d/moz.build 2024-02-22 10:06:42.665963053 +0100 -@@ -134,11 +134,11 @@ if CONFIG["INTEL_ARCHITECTURE"]: +diff -up firefox-128.0/gfx/2d/moz.build.pgo firefox-128.0/gfx/2d/moz.build +--- firefox-128.0/gfx/2d/moz.build.pgo 2024-07-02 00:34:17.000000000 +0200 ++++ firefox-128.0/gfx/2d/moz.build 2024-07-02 17:59:44.425650444 +0200 +@@ -135,11 +135,11 @@ if CONFIG["INTEL_ARCHITECTURE"]: # The file uses SSE2 intrinsics, so it needs special compile flags on some # compilers. SOURCES["BlurSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"] @@ -83,44 +83,38 @@ diff -up firefox-123.0/gfx/2d/moz.build.pgo firefox-123.0/gfx/2d/moz.build SOURCES["SwizzleSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"] SOURCES["SwizzleSSSE3.cpp"].flags += CONFIG["SSSE3_FLAGS"] elif CONFIG["TARGET_CPU"].startswith("mips"): -diff -up firefox-123.0/gfx/skia/generate_mozbuild.py.pgo firefox-123.0/gfx/skia/generate_mozbuild.py ---- firefox-123.0/gfx/skia/generate_mozbuild.py.pgo 2024-02-14 08:18:42.000000000 +0100 -+++ firefox-123.0/gfx/skia/generate_mozbuild.py 2024-02-22 10:06:42.665963053 +0100 -@@ -54,10 +54,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind +diff -up firefox-128.0/gfx/skia/generate_mozbuild.py.pgo firefox-128.0/gfx/skia/generate_mozbuild.py +--- firefox-128.0/gfx/skia/generate_mozbuild.py.pgo 2024-07-02 17:59:44.425650444 +0200 ++++ firefox-128.0/gfx/skia/generate_mozbuild.py 2024-07-02 18:17:40.973081400 +0200 +@@ -54,8 +54,8 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind if CONFIG['INTEL_ARCHITECTURE']: - SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-Dskvx=skvx_ssse3', '-mssse3'] - SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags += ['-Dskvx=skvx_sse42', '-msse4.2'] -- SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx', '-mavx'] -- SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma'] -+ SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx', '-mavx', '-fno-lto'] -+ SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma', '-fno-lto'] - if not CONFIG["MOZ_CODE_COVERAGE"]: -- SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags += ['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw', '-mavx512vl'] -+ SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags += ['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw', '-mavx512vl', '-fno-lto'] - elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['CC_TYPE'] in ('clang', 'gcc'): - SOURCES['skia/src/opts/SkOpts_crc32.cpp'].flags += ['-Dskvx=skvx_crc32', '-march=armv8-a+crc'] - -diff -up firefox-123.0/gfx/skia/moz.build.pgo firefox-123.0/gfx/skia/moz.build ---- firefox-123.0/gfx/skia/moz.build.pgo 2024-02-14 08:18:42.000000000 +0100 -+++ firefox-123.0/gfx/skia/moz.build 2024-02-22 10:06:42.666963088 +0100 -@@ -564,10 +564,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind + SOURCES['skia/modules/skcms/skcms.cc'].flags += ['-DSKCMS_DISABLE_SKX'] + skia_ssse3_flags = ['-Dskvx=skvx_ssse3', '-mssse3'] +- skia_avx_flags = ['-Dskvx=skvx_avx', '-mavx'] +- skia_hsw_flags = ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma'] ++ skia_avx_flags = ['-Dskvx=skvx_avx', '-mavx', '-fno-lto'] ++ skia_hsw_flags = ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma', '-fno-lto'] + SOURCES['skia/src/core/SkBitmapProcState_opts_ssse3.cpp'].flags += skia_ssse3_flags + SOURCES['skia/src/core/SkBlitMask_opts_ssse3.cpp'].flags += skia_ssse3_flags + SOURCES['skia/src/core/SkSwizzler_opts_ssse3.cpp'].flags += ['-Dskvx=skvx_ssse3'] +diff -up firefox-128.0/gfx/skia/moz.build.pgo firefox-128.0/gfx/skia/moz.build +--- firefox-128.0/gfx/skia/moz.build.pgo 2024-07-02 17:59:44.425650444 +0200 ++++ firefox-128.0/gfx/skia/moz.build 2024-07-02 18:19:21.092831537 +0200 +@@ -582,8 +582,8 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind if CONFIG['INTEL_ARCHITECTURE']: - SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-Dskvx=skvx_ssse3', '-mssse3'] - SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags += ['-Dskvx=skvx_sse42', '-msse4.2'] -- SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx', '-mavx'] -- SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma'] -+ SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx', '-mavx', '-fno-lto'] -+ SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma', '-fno-lto'] - if not CONFIG["MOZ_CODE_COVERAGE"]: -- SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags += ['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw', '-mavx512vl'] -+ SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags += ['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw', '-mavx512vl', '-fno-lto'] - elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['CC_TYPE'] in ('clang', 'gcc'): - SOURCES['skia/src/opts/SkOpts_crc32.cpp'].flags += ['-Dskvx=skvx_crc32', '-march=armv8-a+crc'] - -diff -up firefox-123.0/toolkit/components/terminator/nsTerminator.cpp.pgo firefox-123.0/toolkit/components/terminator/nsTerminator.cpp ---- firefox-123.0/toolkit/components/terminator/nsTerminator.cpp.pgo 2024-02-14 08:18:56.000000000 +0100 -+++ firefox-123.0/toolkit/components/terminator/nsTerminator.cpp 2024-02-22 10:06:42.666963088 +0100 -@@ -460,6 +460,11 @@ void nsTerminator::StartWatchdog() { + SOURCES['skia/modules/skcms/skcms.cc'].flags += ['-DSKCMS_DISABLE_SKX'] + skia_ssse3_flags = ['-Dskvx=skvx_ssse3', '-mssse3'] +- skia_avx_flags = ['-Dskvx=skvx_avx', '-mavx'] +- skia_hsw_flags = ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma'] ++ skia_avx_flags = ['-Dskvx=skvx_avx', '-mavx', '-fno-lto'] ++ skia_hsw_flags = ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma', '-fno-lto'] + SOURCES['skia/src/core/SkBitmapProcState_opts_ssse3.cpp'].flags += skia_ssse3_flags + SOURCES['skia/src/core/SkBlitMask_opts_ssse3.cpp'].flags += skia_ssse3_flags + SOURCES['skia/src/core/SkSwizzler_opts_ssse3.cpp'].flags += ['-Dskvx=skvx_ssse3'] +diff -up firefox-128.0/toolkit/components/terminator/nsTerminator.cpp.pgo firefox-128.0/toolkit/components/terminator/nsTerminator.cpp +--- firefox-128.0/toolkit/components/terminator/nsTerminator.cpp.pgo 2024-07-02 00:34:32.000000000 +0200 ++++ firefox-128.0/toolkit/components/terminator/nsTerminator.cpp 2024-07-02 17:59:44.425650444 +0200 +@@ -332,6 +332,11 @@ void nsTerminator::StartWatchdog() { } #endif diff --git a/sources b/sources index ae1f065..e6c078c 100644 --- a/sources +++ b/sources @@ -2,5 +2,6 @@ SHA512 (mochitest-python.tar.gz) = 089b1593068b76f4572af0086eaccf52a6a1299bfffb5 SHA512 (cbindgen-vendor.tar.xz) = 3e7eaff088db918e95f5505e5feeb06e8b7b95cc62042a6d163a708fc76baea43d21bf49cf7e02bc64fdfc61e8d7704057dbb225098de56e110783104d166c54 SHA512 (wasi-sdk-20.tar.gz) = 95be9d9b41ed1f7884e9cd68bad22abbb355b049fd09731c89b9e36666d0205b1a16ec9c21820adf0c5a34e2048015cbfbef0542170d466fa3336c636873c405 SHA512 (dump_syms-vendor.tar.xz) = 58d4ac9556dcf408f04429bf6300e0eef8b554763d5dc45e0dc150465f714fb43b8a44fa20c7e92ad462d4af9b26cb63ec584b34551f536fc61b6340ad55bb8d -SHA512 (firefox-langpacks-127.0.2-20240625.tar.xz) = 16f38bfe8a831a57a199a3c8f997bba699e716896cc45645e9c5d17cb5defd6957f8c746a6ff812db9055daf138cfc1d8f8d1972b9e663992e327626b23e7b63 -SHA512 (firefox-127.0.2.source.tar.xz) = d5a959a032309b8a42690b7f5afd5110c2e6ca7de426e1529d50f59cf065e67623ed98bf3aab39ce4d345ccfad2a273b24ce4f87c7ba7e6eccf2e9dfe3008d8b +SHA512 (firefox-langpacks-128.0-20240702.tar.xz) = 9c30d7cbd665baa9221d22a63aa21f8198c402989e82724009b10e4c456543b87fce1d9d4d0a2f311c0ddf549060d582d437f25fb40eac7aa070217d63783c33 +SHA512 (firefox-128.0.source.tar.xz) = 309c0e2a0bea5699e6daf4fa02300ad7fd118d2c02c35cb5fa97a5fcc6e250cc7aec34e50fe872b8fd516436bfcfe37ddf33c9d0f9291860388cd6f3f08ea9f1 +SHA512 (firefox-langpacks-128.0-20240708.tar.xz) = 1502d8a3c5a7dc79adbc4236685fac9d298ef98b50decc38a35c4ab7a74798642f102e5fa7315f2314af808374781dd155835d485f2224f81526d61dbcc012d6 diff --git a/wasi.patch b/wasi.patch index d2c9c32..6783282 100644 --- a/wasi.patch +++ b/wasi.patch @@ -6,7 +6,7 @@ diff -up firefox-121.0.1/toolkit/moz.configure.wasi firefox-121.0.1/toolkit/moz. if wasi_sysroot: log.info("Using wasi sysroot in %s", wasi_sysroot) - return ["--sysroot=%s" % wasi_sysroot] -+ return ["--sysroot=%s" % wasi_sysroot, "-nodefaultlibs", "-lc", "-lwasi-emulated-process-clocks", "-lc++", "-lc++abi", "/raid/CVS/firefox/firefox-127.0.2/wasi-sdk-20/build/compiler-rt/lib/wasi/libclang_rt.builtins-wasm32.a"] ++ return ["--sysroot=%s" % wasi_sysroot, "-nodefaultlibs", "-lc", "-lwasi-emulated-process-clocks", "-lc++", "-lc++abi", "/raid/CVS/firefox/firefox-128.0/wasi-sdk-20/build/compiler-rt/lib/wasi/libclang_rt.builtins-wasm32.a"] return [] set_config("WASI_SYSROOT", wasi_sysroot)