extra/firefox to 128.0-2

This commit is contained in:
Kevin Mihelich 2024-07-19 12:47:46 +00:00
parent 300dd982bf
commit ebd5e4115e
5 changed files with 329 additions and 4 deletions

View file

@ -1,7 +1,7 @@
pkgbase = firefox
pkgdesc = Fast, Private & Safe Web Browser
pkgver = 128.0
pkgrel = 1
pkgrel = 2
url = https://www.mozilla.org/firefox/
arch = x86_64
license = MPL-2.0
@ -68,16 +68,25 @@ pkgbase = firefox
source = firefox-symbolic.svg
source = firefox.desktop
source = org.mozilla.firefox.metainfo.xml
source = 0001-Bug-1898476-Wayland-Move-MozContainerSurfaceLock-fro.patch
source = 0002-Bug-1898476-Wayland-Provide-surface-lock-by-GtkCompo.patch
source = 0003-Bug-1898476-Wayland-Lock-Wayland-surface-before-Swap.patch
validpgpkeys = 14F26682D0916CDD81E37B6D61B7B526D98F0353
sha256sums = 65271ffefb235ea1e162a081f2074a0f06fce27b2f613f573c126ba8eef95172
sha256sums = SKIP
sha256sums = a9b8b4a0a1f4a7b4af77d5fc70c2686d624038909263c795ecc81e0aec7711e9
sha256sums = 1f241fdc619f92a914c75aece7c7c717401d7467c9a306458e106b05f34e5044
sha256sums = 58d78ce57b3ee936bc966458d6b20ab142d02a897bbe924b3f26717af0c5bee1
sha256sums = f4e1db05768325bce5f38b67263c47b3aa4038cfadbdbf8a9e0cbec061a58c57
sha256sums = 37d70141e9bb9f118cfc74d4f50e7d7f5be4eee6273818a491892da926941519
sha256sums = cbe19f6c95d27d50e3b6664907f8d084784162ea35d5d98fadbb91dbb77ef700
b2sums = a50c7ded69d86c9d45475e701f83295ab6ccfc4eb59d9c91379504bc35dd0e7e1fb59e8c7737684709fe62969b9762e2960fa90607c83f9e8d637b78e60f56b3
b2sums = SKIP
b2sums = 63a8dd9d8910f9efb353bed452d8b4b2a2da435857ccee083fc0c557f8c4c1339ca593b463db320f70387a1b63f1a79e709e9d12c69520993e26d85a3d742e34
b2sums = d07557840097dd48a60c51cc5111950781e1c6ce255557693bd11306c7a9258b2a82548329762148f117b2295145f9e66e0483a18e2fe09c5afcffed2e4b8628
b2sums = 2ce33432f8a73a4f1a412b7a065d3c124e1ca9f6bdf3fad0407e897efc0840f8ef43eeeb1b9bef4a102d9fac0b2c4a2ef205726b817f83fe9c3742d076778b14
b2sums = 2d4c421aec450c85c25554a8f312df8b74bb184e13fdd631ec7b34abbc3e5b1015fdef8d7ee637638c916f8bdd9cecfcb9c2713055471feb863888fd238e288e
b2sums = 15eba129138c13241556522c79e6fd68bb01ff465d45fbf8a13626b827906e5e59df7fd787c6f799ffee098da1cef01302f27d8eaf4550e30f85ca7147e2fb3d
b2sums = b649c5c3edc4a0319d012ff0c12dbc97f3bb244220c9db5334a921864f57e05506943f50ccd7ee832b881ace642ce294892e25eaa555716d2dcc726f4790c605
pkgname = firefox

View file

@ -0,0 +1,178 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: stransky <stransky@redhat.com>
Date: Wed, 10 Jul 2024 10:59:52 +0000
Subject: [PATCH] Bug 1898476 [Wayland] Move MozContainerSurfaceLock from
MozContainerWayland to MozContainerSurfaceLock module r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D214883
---
widget/gtk/MozContainerSurfaceLock.cpp | 31 ++++++++++++++++++++++++++
widget/gtk/MozContainerSurfaceLock.h | 28 +++++++++++++++++++++++
widget/gtk/MozContainerWayland.cpp | 17 --------------
widget/gtk/MozContainerWayland.h | 16 ++++++-------
widget/gtk/moz.build | 3 +++
5 files changed, 69 insertions(+), 26 deletions(-)
create mode 100644 widget/gtk/MozContainerSurfaceLock.cpp
create mode 100644 widget/gtk/MozContainerSurfaceLock.h
diff --git a/widget/gtk/MozContainerSurfaceLock.cpp b/widget/gtk/MozContainerSurfaceLock.cpp
new file mode 100644
index 000000000000..22e6baf0bd82
--- /dev/null
+++ b/widget/gtk/MozContainerSurfaceLock.cpp
@@ -0,0 +1,31 @@
+/* -*- 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"
+
+using namespace mozilla::widget;
+
+MozContainerSurfaceLock::MozContainerSurfaceLock(MozContainer* aContainer) {
+#ifdef MOZ_WAYLAND
+ mContainer = aContainer;
+ if (GdkIsWaylandDisplay()) {
+ // mSurface can be nullptr if we lock hidden MozContainer and
+ // that's correct, MozContainer is still locked.
+ 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
index 000000000000..f96893b3f5b9
--- /dev/null
+++ b/widget/gtk/MozContainerSurfaceLock.h
@@ -0,0 +1,28 @@
+/* -*- 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();
+
+ // wl_surface can be nullptr if we lock hidden MozContainer.
+ struct wl_surface* GetSurface();
+
+ private:
+#ifdef MOZ_WAYLAND
+ MozContainer* mContainer = nullptr;
+#endif
+ struct wl_surface* mSurface = nullptr;
+};
+
+#endif // widget_gtk_MozContainerSurfaceLock_h
diff --git a/widget/gtk/MozContainerWayland.cpp b/widget/gtk/MozContainerWayland.cpp
index 84c5e0a6642d..47e7cce6927b 100644
--- a/widget/gtk/MozContainerWayland.cpp
+++ b/widget/gtk/MozContainerWayland.cpp
@@ -87,23 +87,6 @@ static void moz_container_wayland_set_opaque_region_locked(
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
index 6a33df264279..6b1b07316955 100644
--- a/widget/gtk/MozContainerWayland.h
+++ b/widget/gtk/MozContainerWayland.h
@@ -13,6 +13,7 @@
#include <vector>
#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
index 1567c006a457..6ced9be06e8f 100644
--- 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",

View file

@ -0,0 +1,88 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: stransky <stransky@redhat.com>
Date: Wed, 10 Jul 2024 10:59:53 +0000
Subject: [PATCH] Bug 1898476 [Wayland] Provide surface lock by
GtkCompositorWidget r=emilio
Depends on D214883
Differential Revision: https://phabricator.services.mozilla.com/D214884
---
widget/gtk/GtkCompositorWidget.cpp | 4 ++++
widget/gtk/GtkCompositorWidget.h | 4 ++++
widget/gtk/nsWindow.cpp | 7 +++++++
widget/gtk/nsWindow.h | 3 +++
4 files changed, 18 insertions(+)
diff --git a/widget/gtk/GtkCompositorWidget.cpp b/widget/gtk/GtkCompositorWidget.cpp
index 50eb90a0c860..65b9dd3f49e0 100644
--- a/widget/gtk/GtkCompositorWidget.cpp
+++ b/widget/gtk/GtkCompositorWidget.cpp
@@ -211,5 +211,9 @@ bool GtkCompositorWidget::IsPopup() {
}
#endif
+UniquePtr<MozContainerSurfaceLock> GtkCompositorWidget::LockSurface() {
+ return mWidget->LockSurface();
+}
+
} // namespace widget
} // namespace mozilla
diff --git a/widget/gtk/GtkCompositorWidget.h b/widget/gtk/GtkCompositorWidget.h
index d4834247f16d..8d56f35a561c 100644
--- a/widget/gtk/GtkCompositorWidget.h
+++ b/widget/gtk/GtkCompositorWidget.h
@@ -10,6 +10,8 @@
#include "mozilla/DataMutex.h"
#include "mozilla/widget/CompositorWidget.h"
#include "WindowSurfaceProvider.h"
+#include "mozilla/UniquePtr.h"
+#include "MozContainerSurfaceLock.h"
class nsIWidget;
class nsWindow;
@@ -96,6 +98,8 @@ class GtkCompositorWidget : public CompositorWidget,
void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) override;
GtkCompositorWidget* AsGtkCompositorWidget() override { return this; }
+ UniquePtr<MozContainerSurfaceLock> LockSurface();
+
private:
#if defined(MOZ_WAYLAND)
void ConfigureWaylandBackend();
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
index 297149796986..28c0cb2641e2 100644
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -10218,3 +10218,10 @@ void nsWindow::SetDragSource(GdkDragContext* aSourceDragContext) {
}
}
}
+
+UniquePtr<MozContainerSurfaceLock> nsWindow::LockSurface() {
+ if (mIsDestroyed) {
+ return nullptr;
+ }
+ return MakeUnique<MozContainerSurfaceLock>(mContainer);
+}
diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
index 1dd1f1dce8f4..98cec928817f 100644
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -13,6 +13,7 @@
#include "CompositorWidget.h"
#include "MozContainer.h"
+#include "MozContainerSurfaceLock.h"
#include "VsyncSource.h"
#include "mozilla/EventForwards.h"
#include "mozilla/Maybe.h"
@@ -422,6 +423,8 @@ class nsWindow final : public nsBaseWidget {
static nsWindow* GetFocusedWindow();
+ mozilla::UniquePtr<MozContainerSurfaceLock> LockSurface();
+
#ifdef MOZ_WAYLAND
// Use xdg-activation protocol to transfer focus from gFocusWindow to aWindow.
static void TransferFocusToWaylandWindow(nsWindow* aWindow);

View file

@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: stransky <stransky@redhat.com>
Date: Wed, 10 Jul 2024 10:59:53 +0000
Subject: [PATCH] Bug 1898476 [Wayland] Lock Wayland surface before Swap
buffers in RenderCompositorEGL r=emilio
Depends on D214884
Differential Revision: https://phabricator.services.mozilla.com/D214885
---
gfx/webrender_bindings/RenderCompositorEGL.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gfx/webrender_bindings/RenderCompositorEGL.cpp b/gfx/webrender_bindings/RenderCompositorEGL.cpp
index ccabfd375f37..ba10c40657d9 100644
--- a/gfx/webrender_bindings/RenderCompositorEGL.cpp
+++ b/gfx/webrender_bindings/RenderCompositorEGL.cpp
@@ -154,6 +154,16 @@ RenderedFrameId RenderCompositorEGL::EndFrame(
}
gl()->SetDamage(bufferInvalid);
}
+
+#ifdef MOZ_WIDGET_GTK
+ // Rendering on Wayland has to be atomic (buffer attach + commit) and
+ // wayland surface is also used by main thread so lock it before
+ // we paint at SwapBuffers().
+ UniquePtr<MozContainerSurfaceLock> lock;
+ if (auto* gtkWidget = mWidget->AsGTK()) {
+ lock = gtkWidget->LockSurface();
+ }
+#endif
gl()->SwapBuffers();
return frameId;
}

View file

@ -11,7 +11,7 @@ highmem=1
pkgname=firefox
pkgver=128.0
pkgrel=1
pkgrel=2
pkgdesc="Fast, Private & Safe Web Browser"
url="https://www.mozilla.org/firefox/"
arch=(x86_64)
@ -83,6 +83,9 @@ source=(
$pkgname-symbolic.svg
$pkgname.desktop
org.mozilla.$pkgname.metainfo.xml
0001-Bug-1898476-Wayland-Move-MozContainerSurfaceLock-fro.patch
0002-Bug-1898476-Wayland-Provide-surface-lock-by-GtkCompo.patch
0003-Bug-1898476-Wayland-Lock-Wayland-surface-before-Swap.patch
)
validpgpkeys=(
# Mozilla Software Releases <release@mozilla.com>
@ -93,12 +96,18 @@ sha256sums=('65271ffefb235ea1e162a081f2074a0f06fce27b2f613f573c126ba8eef95172'
'SKIP'
'a9b8b4a0a1f4a7b4af77d5fc70c2686d624038909263c795ecc81e0aec7711e9'
'1f241fdc619f92a914c75aece7c7c717401d7467c9a306458e106b05f34e5044'
'58d78ce57b3ee936bc966458d6b20ab142d02a897bbe924b3f26717af0c5bee1')
'58d78ce57b3ee936bc966458d6b20ab142d02a897bbe924b3f26717af0c5bee1'
'f4e1db05768325bce5f38b67263c47b3aa4038cfadbdbf8a9e0cbec061a58c57'
'37d70141e9bb9f118cfc74d4f50e7d7f5be4eee6273818a491892da926941519'
'cbe19f6c95d27d50e3b6664907f8d084784162ea35d5d98fadbb91dbb77ef700')
b2sums=('a50c7ded69d86c9d45475e701f83295ab6ccfc4eb59d9c91379504bc35dd0e7e1fb59e8c7737684709fe62969b9762e2960fa90607c83f9e8d637b78e60f56b3'
'SKIP'
'63a8dd9d8910f9efb353bed452d8b4b2a2da435857ccee083fc0c557f8c4c1339ca593b463db320f70387a1b63f1a79e709e9d12c69520993e26d85a3d742e34'
'd07557840097dd48a60c51cc5111950781e1c6ce255557693bd11306c7a9258b2a82548329762148f117b2295145f9e66e0483a18e2fe09c5afcffed2e4b8628'
'2ce33432f8a73a4f1a412b7a065d3c124e1ca9f6bdf3fad0407e897efc0840f8ef43eeeb1b9bef4a102d9fac0b2c4a2ef205726b817f83fe9c3742d076778b14')
'2ce33432f8a73a4f1a412b7a065d3c124e1ca9f6bdf3fad0407e897efc0840f8ef43eeeb1b9bef4a102d9fac0b2c4a2ef205726b817f83fe9c3742d076778b14'
'2d4c421aec450c85c25554a8f312df8b74bb184e13fdd631ec7b34abbc3e5b1015fdef8d7ee637638c916f8bdd9cecfcb9c2713055471feb863888fd238e288e'
'15eba129138c13241556522c79e6fd68bb01ff465d45fbf8a13626b827906e5e59df7fd787c6f799ffee098da1cef01302f27d8eaf4550e30f85ca7147e2fb3d'
'b649c5c3edc4a0319d012ff0c12dbc97f3bb244220c9db5334a921864f57e05506943f50ccd7ee832b881ace642ce294892e25eaa555716d2dcc726f4790c605')
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
# Note: These are for Arch Linux use ONLY. For your own distribution, please
@ -117,6 +126,13 @@ prepare() {
mkdir mozbuild
cd firefox-$pkgver
# Backport fixes for NVIDIA crashes
# https://gitlab.archlinux.org/archlinux/packaging/packages/firefox/-/issues/7
# https://bugzilla.mozilla.org/show_bug.cgi?id=1898476
patch -Np1 -i ../0001-Bug-1898476-Wayland-Move-MozContainerSurfaceLock-fro.patch
patch -Np1 -i ../0002-Bug-1898476-Wayland-Provide-surface-lock-by-GtkCompo.patch
patch -Np1 -i ../0003-Bug-1898476-Wayland-Lock-Wayland-surface-before-Swap.patch
echo -n "$_google_api_key" >google-api-key
echo -n "$_mozilla_api_key" >mozilla-api-key