* update firefox to 130.0.1-1

This commit is contained in:
Alexander Baldeck 2024-09-18 10:59:02 +02:00
parent 80893aaa34
commit 76d524e280
21 changed files with 1361 additions and 0 deletions

View File

@ -0,0 +1,29 @@
From 70d47d18420fe9e3de8f896c08f97ef2596c9c84 Mon Sep 17 00:00:00 2001
From: "Jory A. Pratt" <anarchy@gentoo.org>
Date: Mon, 6 Apr 2020 20:10:03 +0200
Subject: [PATCH 13/30] musl: Set pthread name for non glibc systems
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
---
js/src/threading/posix/PosixThread.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/js/src/threading/posix/PosixThread.cpp b/js/src/threading/posix/PosixThread.cpp
index 35532e375b..983da45326 100644
--- a/js/src/threading/posix/PosixThread.cpp
+++ b/js/src/threading/posix/PosixThread.cpp
@@ -115,8 +115,10 @@ void ThisThread::SetName(const char* name) {
rv = 0;
#elif defined(__NetBSD__)
rv = pthread_setname_np(pthread_self(), "%s", (void*)name);
-#else
+#elif defined(__GLIBC__)
rv = pthread_setname_np(pthread_self(), name);
+#else
+ rv = 0;
#endif
MOZ_RELEASE_ASSERT(!rv);
}
--
2.34.1

View File

@ -0,0 +1,51 @@
From beed745f96bbc18a3c22a728095c9a2eef7435ee Mon Sep 17 00:00:00 2001
From: "Jory A. Pratt" <anarchy@gentoo.org>
Date: Mon, 6 Apr 2020 20:12:09 +0200
Subject: [PATCH 15/30] musl: sys/auvx.h avaliable on more then just glibc
systems
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
---
.../system_wrappers/source/cpu_features_linux.cc | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc b/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc
index 335bed4da3..c2c98dae8a 100644
--- a/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc
+++ b/third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc
@@ -12,13 +12,7 @@
#include <stdlib.h>
#include <string.h>
-#ifdef __GLIBC_PREREQ
-#define WEBRTC_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
-#else
-#define WEBRTC_GLIBC_PREREQ(a, b) 0
-#endif
-
-#if WEBRTC_GLIBC_PREREQ(2, 16)
+#if defined(__linux__)
#include <sys/auxv.h>
#else
#include <errno.h>
@@ -40,7 +34,7 @@ uint64_t GetCPUFeaturesARM(void) {
int architecture = 0;
uint64_t hwcap = 0;
const char* platform = NULL;
-#if WEBRTC_GLIBC_PREREQ(2, 16)
+#if defined(__linux__)
hwcap = getauxval(AT_HWCAP);
platform = (const char*)getauxval(AT_PLATFORM);
#else
@@ -64,7 +58,7 @@ uint64_t GetCPUFeaturesARM(void) {
}
close(fd);
}
-#endif // WEBRTC_GLIBC_PREREQ(2, 16)
+#endif // (__linux__)
#if defined(__aarch64__)
architecture = 8;
if ((hwcap & HWCAP_FP) != 0)
--
2.34.1

View File

@ -0,0 +1,28 @@
From 6d36ed9e971861321bb381e25516500069314eb6 Mon Sep 17 00:00:00 2001
From: Johannes <johannes.brechtmann@gmail.com>
Date: Fri, 1 May 2020 17:20:29 +0200
Subject: [PATCH 16/30] musl: make SYS_fork non-fatal, musl uses it for fork(2)
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
---
security/sandbox/linux/SandboxFilter.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp
index eb72d944c8..8ce22d6f65 100644
--- a/security/sandbox/linux/SandboxFilter.cpp
+++ b/security/sandbox/linux/SandboxFilter.cpp
@@ -1537,6 +1537,10 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
// usually do something reasonable on error.
case __NR_clone:
return ClonePolicy(Error(EPERM));
+# ifdef __NR_fork
+ case __NR_fork:
+ return Error(ENOSYS);
+# endif
case __NR_clone3:
return Error(ENOSYS);
--
2.34.1

View File

@ -0,0 +1,11 @@
diff -Naur a/config/system-headers.mozbuild b/config/system-headers.mozbuild
--- a/config/system-headers.mozbuild 2023-07-04 13:57:53.418421221 +0300
+++ b/config/system-headers.mozbuild 2023-07-04 13:58:41.177179152 +0300
@@ -227,7 +227,6 @@
"execinfo.h",
"extras.h",
"fcntl.h",
- "features.h",
"fenv.h",
"ffi.h",
"fibdef.h",

View File

@ -0,0 +1,182 @@
Allow building against system-wide harfbuzz.
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=847568
---
config/system-headers.mozbuild | 7 +++++++
dom/base/moz.build | 3 +++
gfx/moz.build | 4 +++-
gfx/skia/generate_mozbuild.py | 3 +++
gfx/skia/moz.build | 3 +++
gfx/thebes/moz.build | 3 +++
intl/unicharutil/util/moz.build | 3 +++
netwerk/dns/moz.build | 3 +++
toolkit/library/moz.build | 3 +++
toolkit/moz.configure | 9 +++++++++
10 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
index aa17660..7f416f9 100644
--- a/config/system-headers.mozbuild
+++ b/config/system-headers.mozbuild
@@ -1253,6 +1253,13 @@ if CONFIG["OS_TARGET"] == "Android":
"vr/gvr/capi/include/gvr.h",
]
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ system_headers += [
+ "harfbuzz/hb-glib.h",
+ "harfbuzz/hb-ot.h",
+ "harfbuzz/hb.h",
+ ]
+
if CONFIG["MOZ_JACK"]:
system_headers += [
"jack/jack.h",
diff --git a/dom/base/moz.build b/dom/base/moz.build
index fb7ed4b..ea65621 100644
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -616,6 +616,9 @@ FINAL_LIBRARY = "xul"
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
+
GeneratedFile(
"UseCounterList.h",
script="gen-usecounters.py",
diff --git a/gfx/moz.build b/gfx/moz.build
index 56ea317..6cc19f8 100644
--- a/gfx/moz.build
+++ b/gfx/moz.build
@@ -10,6 +10,9 @@ with Files("**"):
with Files("wr/**"):
BUG_COMPONENT = ("Core", "Graphics: WebRender")
+if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ DIRS += ["harfbuzz/src"]
+
DIRS += [
"cairo",
"2d",
@@ -20,7 +23,6 @@ DIRS += [
"gl",
"layers",
"graphite2/src",
- "harfbuzz/src",
"ots/src",
"thebes",
"ipc",
diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py
index b589efd..47f49e1 100755
--- a/gfx/skia/generate_mozbuild.py
+++ b/gfx/skia/generate_mozbuild.py
@@ -95,6 +95,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
'-Wno-unused-private-field',
]
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
LOCAL_INCLUDES += [
"/gfx/cairo/cairo/src",
diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build
index 7fee545..ba1a403 100644
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -623,6 +623,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
'-Wno-unused-private-field',
]
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
LOCAL_INCLUDES += [
"/gfx/cairo/cairo/src",
diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
index 48f2849..5e16334 100644
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -297,6 +297,9 @@ LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
DEFINES["GRAPHITE2_STATIC"] = True
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
+
CXXFLAGS += ["-Werror=switch"]
include("/tools/fuzzing/libfuzzer-config.mozbuild")
diff --git a/intl/unicharutil/util/moz.build b/intl/unicharutil/util/moz.build
index 2396210..092baac 100644
--- a/intl/unicharutil/util/moz.build
+++ b/intl/unicharutil/util/moz.build
@@ -24,6 +24,9 @@ UNIFIED_SOURCES += [
"nsUnicodeProperties.cpp",
]
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
+
include("/ipc/chromium/chromium-config.mozbuild")
GeneratedFile(
diff --git a/netwerk/dns/moz.build b/netwerk/dns/moz.build
index c926d14..5082238 100644
--- a/netwerk/dns/moz.build
+++ b/netwerk/dns/moz.build
@@ -119,4 +119,7 @@ LOCAL_INCLUDES += [
"/netwerk/protocol/http",
]
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
+
USE_LIBS += ["icu"]
diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
index a9feb0b..1d13418 100644
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -288,6 +288,9 @@ if CONFIG["MOZ_ANDROID_GOOGLE_VR"]:
"-lgvr",
]
+if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
+ OS_LIBS += CONFIG["MOZ_HARFBUZZ_LIBS"]
+
if CONFIG["MOZ_SYSTEM_JPEG"]:
OS_LIBS += CONFIG["MOZ_JPEG_LIBS"]
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index c5dcc65..0c9e5fe 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -718,6 +718,22 @@ def freetype2_combined_info(fontconfig_info, freetype2_info):
set_define("MOZ_HAVE_FREETYPE2", depends_if(freetype2_info)(lambda _: True))
+# HarfBuzz
+# ==============================================================
+option(
+ "--with-system-harfbuzz",
+ help="Use system harfbuzz (located with pkgconfig)",
+ when=use_pkg_config,
+)
+@depends("--with-system-harfbuzz", when=use_pkg_config)
+def enable_system_harfbuzz_option(enable_system_harfbuzz):
+ return enable_system_harfbuzz
+
+system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 2.7.4',
+ when='--with-system-harfbuzz')
+
+set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True))
+
# Apple platform decoder support
# ==============================================================
@depends(toolkit)
--
2.34.1

View File

@ -0,0 +1,16 @@
diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
index 51d79f9c2ec59..fafd7d6fc1e0d 100644
--- a/modules/fdlibm/src/math_private.h
+++ b/modules/fdlibm/src/math_private.h
@@ -30,7 +30,11 @@
* Adapted from https://github.com/freebsd/freebsd-src/search?q=__double_t
*/
+#if defined __FLT_EVAL_METHOD__ && (__FLT_EVAL_METHOD__ == 2)
+typedef long double __double_t;
+#else
typedef double __double_t;
+#endif
typedef __double_t double_t;
/*

View File

@ -0,0 +1,161 @@
diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
index 7f416f9..1193883 100644
--- a/config/system-headers.mozbuild
+++ b/config/system-headers.mozbuild
@@ -1260,6 +1260,12 @@ if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
"harfbuzz/hb.h",
]
+if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
+ system_headers += [
+ "graphite2/Font.h",
+ "graphite2/Segment.h",
+ ]
+
if CONFIG["MOZ_JACK"]:
system_headers += [
"jack/jack.h",
diff --git a/gfx/graphite2/geckoextra/moz.build b/gfx/graphite2/geckoextra/moz.build
new file mode 100644
index 0000000..24e8d7a
--- /dev/null
+++ b/gfx/graphite2/geckoextra/moz.build
@@ -0,0 +1,21 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+EXPORTS.graphite2 += [
+ 'include/GraphiteExtra.h',
+ 'include/GraphiteStructsForRLBox.h',
+]
+
+UNIFIED_SOURCES += [
+ '../geckoextra/src/GraphiteExtra.cpp',
+]
+
+CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
+
+# Match bundled graphite2 configuration
+AllowCompilerWarnings()
+
+FINAL_LIBRARY = 'xul'
diff --git a/gfx/moz.build b/gfx/moz.build
index 6cc19f8..14b08db 100644
--- a/gfx/moz.build
+++ b/gfx/moz.build
@@ -10,6 +10,11 @@ with Files("**"):
with Files("wr/**"):
BUG_COMPONENT = ("Core", "Graphics: WebRender")
+if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
+ DIRS += ["graphite2/geckoextra"]
+else:
+ DIRS += ["graphite2/src"]
+
if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
DIRS += ["harfbuzz/src"]
@@ -22,7 +27,6 @@ DIRS += [
"qcms",
"gl",
"layers",
- "graphite2/src",
"ots/src",
"thebes",
"ipc",
diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
index 5e16334..7d0a161 100644
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -295,7 +295,10 @@ if CONFIG["MOZ_WAYLAND"]:
LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
-DEFINES["GRAPHITE2_STATIC"] = True
+if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
+ CXXFLAGS += CONFIG["MOZ_GRAPHITE2_CFLAGS"]
+else:
+ DEFINES["GRAPHITE2_STATIC"] = True
if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
diff --git a/old-configure.in b/old-configure.in
index 2d2ad0b..f97051a 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -703,6 +703,27 @@ fi
AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
AC_SUBST(MOZ_MACBUNDLE_ID)
+dnl ========================================================
+dnl Check for graphite2
+dnl ========================================================
+if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
+ dnl graphite2.pc has bogus version, check manually
+ _SAVE_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
+ AC_TRY_COMPILE([ #include <graphite2/Font.h>
+ #define GR2_VERSION_REQUIRE(major,minor,bugfix) \
+ ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
+ * 100 + GR2_VERSION_BUGFIX >= \
+ (major) * 10000 + (minor) * 100 + (bugfix) )
+ ], [
+ #if !GR2_VERSION_REQUIRE(1,3,8)
+ #error "Insufficient graphite2 version."
+ #endif
+ ], [],
+ [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
+ CFLAGS=$_SAVE_CFLAGS
+fi
+
dnl ========================================================
dnl = Child Process Name for IPC
dnl ========================================================
diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
index 1d13418..31c8158 100644
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -288,6 +288,9 @@ if CONFIG["MOZ_ANDROID_GOOGLE_VR"]:
"-lgvr",
]
+if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
+ OS_LIBS += CONFIG["MOZ_GRAPHITE2_LIBS"]
+
if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
OS_LIBS += CONFIG["MOZ_HARFBUZZ_LIBS"]
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index 0c9e5fe..0c62ade 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -718,6 +718,23 @@ def freetype2_combined_info(fontconfig_info, freetype2_info):
set_define("MOZ_HAVE_FREETYPE2", depends_if(freetype2_info)(lambda _: True))
+# Graphite2
+# ==============================================================
+option(
+ "--with-system-graphite2",
+ help="Use system graphite2 (located with pkgconfig)",
+ when=use_pkg_config,
+)
+
+@depends("--with-system-graphite2", when=use_pkg_config)
+def check_for_graphite2(value):
+ return bool(value)
+
+system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2',
+ when=check_for_graphite2)
+
+set_config('MOZ_SYSTEM_GRAPHITE2', depends_if(system_graphite2)(lambda _: True))
+
# HarfBuzz
# ==============================================================
option(
--
2.34.1

View File

@ -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) {

View File

@ -0,0 +1,16 @@
diff -Naur a/security/sandbox/linux/moz.build b/security/sandbox/linux/moz.build
--- a/security/sandbox/linux/moz.build 2023-07-04 13:57:56.029462755 +0300
+++ b/security/sandbox/linux/moz.build 2023-07-04 14:05:08.607221195 +0300
@@ -114,9 +114,9 @@
# gcc lto likes to put the top level asm in syscall.cc in a different partition
# from the function using it which breaks the build. Work around that by
# forcing there to be only one partition.
-for f in CONFIG["OS_CXXFLAGS"]:
- if f.startswith("-flto") and CONFIG["CC_TYPE"] != "clang":
- LDFLAGS += ["--param lto-partitions=1"]
+if CONFIG['CC_TYPE'] != 'clang':
+ LDFLAGS += ['--param', 'lto-partitions=1']
+
DEFINES["NS_NO_XPCOM"] = True
DisableStlWrapping()

View File

@ -0,0 +1,35 @@
From d8ec0bd6f3b0ad2dfd8a97a864f08decaafdea69 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sun, 8 Jan 2017 19:16:38 -0600
Subject: [PATCH 10/30] musl: Add alternate name for private siginfo struct
member
musl does not provide a macro for detecting its presence. For now,
assume that it is the only non-glibc-based libc on Linux systems.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
---
security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc b/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc
index 9884be8bb2..86d8f88e30 100644
--- a/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc
+++ b/security/sandbox/chromium/sandbox/linux/seccomp-bpf/trap.cc
@@ -174,7 +174,11 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
// If the version of glibc doesn't include this information in
// siginfo_t (older than 2.17), we need to explicitly copy it
// into an arch_sigsys structure.
- memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
+#if defined(__GLIBC__)
+ memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
+#else
+ memcpy(&sigsys, &info->__si_fields, sizeof(sigsys));
+#endif
#endif
#if defined(__mips__)
--
2.34.1

View File

@ -0,0 +1,76 @@
--- firefox-111.0.1/build/moz.configure/rust.configure 2023-03-21 06:16:03.000000000 -0700
+++ firefox-111.0.1/build/moz.configure/rust.configure.new 2023-04-05 08:57:29.403219120 -0700
@@ -593,7 +593,7 @@
# ==============================================================
-option(env="RUSTFLAGS", nargs=1, help="Rust compiler flags")
+option(env="RUSTFLAGS", nargs=1, help="Rust compiler flags", comma_split=False)
set_config("RUSTFLAGS", depends("RUSTFLAGS")(lambda flags: flags))
--- firefox-111.0.1/python/mozbuild/mozbuild/configure/options.py 2023-03-21 06:16:09.000000000 -0700
+++ firefox-111.0.1/python/mozbuild/mozbuild/configure/options.py.new 2023-04-05 08:57:31.270193468 -0700
@@ -191,6 +191,10 @@
to instantiate an option indirectly. Set this to a positive integer to
force the script to look into a deeper stack frame when inferring the
`category`.
+ - `comma_split` specifies whether the value string should be split on
+ commas. The default is True. Setting it False is necessary for things
+ like compiler flags which should be a single string that may contain
+ commas.
"""
__slots__ = (
@@ -205,6 +209,7 @@
"possible_origins",
"category",
"define_depth",
+ "comma_split",
)
def __init__(
@@ -218,6 +223,7 @@
category=None,
help=None,
define_depth=0,
+ comma_split=True,
):
if not name and not env:
raise InvalidOptionError(
@@ -335,9 +341,10 @@
self.choices = choices
self.help = help
self.category = category or _infer_option_category(define_depth)
+ self.comma_split = comma_split
@staticmethod
- def split_option(option):
+ def split_option(option, comma_split=True):
"""Split a flag or variable into a prefix, a name and values
Variables come in the form NAME=values (no prefix).
@@ -350,7 +357,13 @@
elements = option.split("=", 1)
name = elements[0]
- values = tuple(elements[1].split(",")) if len(elements) == 2 else ()
+ if len(elements) == 2:
+ if comma_split:
+ values = tuple(elements[1].split(","))
+ else:
+ values = (elements[1],)
+ else:
+ values = ()
if name.startswith("--"):
name = name[2:]
if not name.islower():
@@ -426,7 +439,7 @@
% (option, origin, ", ".join(self.possible_origins))
)
- prefix, name, values = self.split_option(option)
+ prefix, name, values = self.split_option(option, self.comma_split)
option = self._join_option(prefix, name)
assert name in (self.name, self.env)

View File

@ -0,0 +1,20 @@
--- a/security/sandbox/linux/Sandbox.cpp 2023-07-10 20:29:48.000000000 +0100
+++ b/security/sandbox/linux/Sandbox.cpp 2023-07-15 09:13:43.561724668 +0100
@@ -18,6 +18,8 @@
#include <dirent.h>
#ifdef NIGHTLY_BUILD
# include "dlfcn.h"
+#else
+# include <dlfcn.h>
#endif
#include <errno.h>
#include <fcntl.h>
@@ -685,7 +687,7 @@
files->Add("/proc/stat", SandboxOpenedFile::Error{});
files->Add("/proc/net/unix", SandboxOpenedFile::Error{});
files->Add("/proc/self/maps", SandboxOpenedFile::Error{});
-
+ Unused << dlopen("libgcc_s.so.1", RTLD_GLOBAL|RTLD_LAZY);
// Finally, start the sandbox.
SetCurrentProcessSandbox(GetMediaSandboxPolicy(files));
}

View File

@ -0,0 +1,42 @@
From 1b46c0fc085fe93c36320d7ac1004c83efccdccc Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sun, 8 Jan 2017 19:19:23 -0600
Subject: [PATCH 11/30] musl: Fix syscall wrappers
musl defines p{read,write}64 to their non-suffixed equivalents to avoid
duplication in its syscall wrappers. This breaks macro expansion here,
leading to errors such as:
In function size_t sys_pread64(int, void*, size_t, off_t):
error: '__NR_pread' was not declared in this scope
The fix here is to undefine the p{read,write}64 macros, so the syscall
expands to (e.g.) __NR_pread64 instead.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
---
.../src/third_party/lss/linux_syscall_support.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
index 1abe0ba5b0..d6087a1674 100644
--- a/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h
@@ -173,6 +173,13 @@ extern "C" {
# undef __NR_waitpid
#endif
+#ifdef pread64
+#undef pread64
+#endif
+#ifdef pwrite64
+#undef pwrite64
+#endif
+
/* As glibc often provides subtly incompatible data structures (and implicit
* wrapper functions that convert them), we provide our own kernel data
* structures for use by the system calls.
--
2.34.1

View File

@ -0,0 +1,41 @@
https://bugs.gentoo.org/917599
https://bugzilla.mozilla.org/show_bug.cgi?id=1862601
https://hg.mozilla.org/try/rev/d5f3b0c4f08a426ce00a153c04e177eecb6820e2
# HG changeset patch
# User André Bargull <andre.bargull@gmail.com>
# Date 1697435923 -7200
# Node ID d5f3b0c4f08a426ce00a153c04e177eecb6820e2
# Parent c63994f8259efdf6e745c960aa9e1409d5477049
Bug xxx - Part 12: Add new line break classes. r?
diff --git a/intl/lwbrk/LineBreaker.cpp b/intl/lwbrk/LineBreaker.cpp
--- a/intl/lwbrk/LineBreaker.cpp
+++ b/intl/lwbrk/LineBreaker.cpp
@@ -443,17 +443,23 @@ static int8_t GetClass(uint32_t u, LineB
/* JT = 34, [JT] */ CLASS_CHARACTER,
/* JV = 35, [JV] */ CLASS_CHARACTER,
/* CLOSE_PARENTHESIS = 36, [CP] */ CLASS_CLOSE_LIKE_CHARACTER,
/* CONDITIONAL_JAPANESE_STARTER = 37, [CJ] */ CLASS_CLOSE,
/* HEBREW_LETTER = 38, [HL] */ CLASS_CHARACTER,
/* REGIONAL_INDICATOR = 39, [RI] */ CLASS_CHARACTER,
/* E_BASE = 40, [EB] */ CLASS_BREAKABLE,
/* E_MODIFIER = 41, [EM] */ CLASS_CHARACTER,
- /* ZWJ = 42, [ZWJ]*/ CLASS_CHARACTER};
+ /* ZWJ = 42, [ZWJ]*/ CLASS_CHARACTER,
+ /* AKSARA = 43, [AK] */ CLASS_CHARACTER,
+ /* AKSARA_PREBASE = 44, [AP] */ CLASS_CHARACTER,
+ /* AKSARA_START = 45, [AS] */ CLASS_CHARACTER,
+ /* VIRAMA_FINAL = 46, [VF] */ CLASS_CHARACTER,
+ /* VIRAMA = 47, [VI] */ CLASS_CHARACTER,
+ };
static_assert(U_LB_COUNT == mozilla::ArrayLength(sUnicodeLineBreakToClass),
"Gecko vs ICU LineBreak class mismatch");
auto cls = GetLineBreakClass(u);
MOZ_ASSERT(cls < mozilla::ArrayLength(sUnicodeLineBreakToClass));
// Overrides based on rules for the different line-break values given in

View File

@ -0,0 +1,61 @@
From: Sam James <sam@gentoo.org>
Subject: Allow RUST_TARGET override for detected Rust triplet (fixes musl build)
Respect RUST_TARGET from the environment to override Mozilla's
own triplet detection.
If the variable is unset, the old logic is used.
The issue is that Gentoo supports both, say:
- x86_64-unknown-linux-musl, and
- x86-64-gentoo-linux-musl
Our Rust is built to understand
-gentoo- as a vendor target, but
our Rust only actually includes
-unknown-.
Mozilla's configure sees -gentoo-
in CHOST and that Rust _understands_
-gentoo- and tries to use it, without
verifying that we actually have
-gentoo- installed as a Rust target.
This requires exporting RUST_TARGET
in the ebuild, possibly like:
````
inherit rust-toolchain
src_configure() {
[...]
export RUST_TARGET=$(rust_abi)
[...]
}
````
Inspired by Alpine's patch at
https://git.alpinelinux.org/aports/tree/community/firefox/fix-rust-target.patch?id=740922900cf8042be6751fcfcccdd3fc11bd77d3.
Bug: https://bugs.gentoo.org/748849
Bug: https://bugs.gentoo.org/779178
Bug: https://bugs.gentoo.org/836226
Thanks-to: Georgy Yakovlev <gyakovlev@gentoo.org>
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -275,6 +275,7 @@ def rust_supported_targets(rustc):
return data
+@imports('os')
def detect_rustc_target(
host_or_target, compiler_info, arm_target, rust_supported_targets
):
@@ -396,7 +397,7 @@ def detect_rustc_target(
return None
- rustc_target = find_candidate(candidates)
+ rustc_target = os.environ.get('RUST_TARGET', find_candidate(candidates))
if rustc_target is None:
die("Don't know how to translate {} for rustc".format(host_or_target.alias))

View File

@ -0,0 +1,96 @@
diff --git a/config/external/moz.build b/config/external/moz.build
index 2fc8df57992e..63d18e50a961 100644
--- a/config/external/moz.build
+++ b/config/external/moz.build
@@ -40,8 +40,9 @@ if not CONFIG["MOZ_SYSTEM_LIBVPX"]:
external_dirs += ["media/libvpx"]
if CONFIG["MOZ_AV1"]:
- external_dirs += ["media/libaom"]
- external_dirs += ["media/libdav1d"]
+ if not CONFIG["MOZ_SYSTEM_AV1"]:
+ external_dirs += ["media/libaom"]
+ external_dirs += ["media/libdav1d"]
if not CONFIG["MOZ_SYSTEM_PNG"]:
external_dirs += ["media/libpng"]
diff --git a/dom/media/platforms/moz.build b/dom/media/platforms/moz.build
index 5c6e25b3980b..ce99ebfb6d3f 100644
--- a/dom/media/platforms/moz.build
+++ b/dom/media/platforms/moz.build
@@ -81,6 +81,11 @@ if CONFIG["MOZ_AV1"]:
"agnostic/AOMDecoder.cpp",
"agnostic/DAV1DDecoder.cpp",
]
+ if CONFIG['MOZ_SYSTEM_AV1']:
+ CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBAOM_CFLAGS']
+ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBAOM_LIBS']
+ CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
+ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
if CONFIG["MOZ_OMX"]:
EXPORTS += [
diff --git a/media/ffvpx/libavcodec/moz.build b/media/ffvpx/libavcodec/moz.build
index 761fc8cf4cd9..793a5b8697a8 100644
--- a/media/ffvpx/libavcodec/moz.build
+++ b/media/ffvpx/libavcodec/moz.build
@@ -120,10 +120,16 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']:
'vp9recon.c',
'vpx_rac.c',
]
- USE_LIBS += [
- 'dav1d',
- 'media_libdav1d_asm',
- ]
+ if CONFIG["MOZ_SYSTEM_AV1"]:
+ CFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
+ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
+ CFLAGS += CONFIG['MOZ_SYSTEM_LIBAOM_CFLAGS']
+ OS_LIBS += CONFIG['MOZ_SYSTEM_LIBAOM_LIBS']
+ else:
+ USE_LIBS += [
+ 'dav1d',
+ 'media_libdav1d_asm',
+ ]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
LOCAL_INCLUDES += ['/media/mozva']
SOURCES += [
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index f93a5d64fec8..814357f4e979 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -744,7 +744,23 @@ def av1(value):
return True
-@depends(target, when=av1 & compile_environment)
+option("--with-system-av1",
+ help="Use system av1 (located with pkgconfig)")
+
+system_libaom_info = pkg_check_modules("MOZ_SYSTEM_LIBAOM", "aom >= 1.0.0",
+ when="--with-system-av1")
+
+system_libdav1d_info = pkg_check_modules("MOZ_SYSTEM_LIBDAV1D", "dav1d >= 0.1.1",
+ when="--with-system-av1")
+
+@depends(system_libaom_info, system_libdav1d_info)
+def system_av1(system_libaom_info, system_libdav1d_info):
+ has_av1_libs = False
+ if system_libaom_info and system_libdav1d_info:
+ has_av1_libs = True
+ return has_av1_libs
+
+@depends(target, when=av1 & depends(system_av1)(lambda v: not v) & compile_environment)
def dav1d_asm(target):
if target.cpu in ("aarch64", "x86", "x86_64"):
return True
@@ -760,6 +776,7 @@ set_config("MOZ_DAV1D_ASM", dav1d_asm)
set_define("MOZ_DAV1D_ASM", dav1d_asm)
set_config("MOZ_AV1", av1)
set_define("MOZ_AV1", av1)
+set_config("MOZ_SYSTEM_AV1", depends_if(system_av1)(lambda _: True))
# JXL Image Codec Support
# ==============================================================

View File

@ -0,0 +1,16 @@
--- a/build/moz.configure/toolchain.configure 2024-03-16 22:53:15.409390707 +0000
+++ b/build/moz.configure/toolchain.configure 2024-03-16 22:57:02.661805132 +0000
@@ -2183,10 +2183,10 @@
set_define("_LIBCPP_HIDE_FROM_ABI", libcxx_override_visibility.hide_from_abi)
-@depends(target, build_environment)
-def visibility_flags(target, env):
+@depends(target, build_environment, c_compiler)
+def visibility_flags(target, env, c_compiler):
if target.os != "WINNT":
- if target.kernel == "Darwin":
+ if target.kernel == "Darwin" or (c_compiler.type == "clang" and c_compiler.version >= "17.0.0"):
return ("-fvisibility=hidden", "-fvisibility-inlines-hidden")
return (
"-I%s/system_wrappers" % os.path.join(env.dist),

View File

@ -0,0 +1,13 @@
diff '--color=auto' -Naur a/build/moz.configure/flags.configure b/build/moz.configure/flags.configure
--- a/build/moz.configure/flags.configure 2024-07-08 20:04:44.944708403 +0300
+++ b/build/moz.configure/flags.configure 2024-07-08 20:13:30.867064722 +0300
@@ -197,9 +197,6 @@
check_and_add_flag("-pipe", when=building_with_gcc)
-check_and_add_linker_flag("-Wl,--build-id=uuid", when=check_build_id_uuid)
-check_and_add_linker_flag("-Wl,--build-id=sha1", when=check_build_id_sha1)
-
check_and_add_asm_flag("-Wa,--noexecstack", when=building_with_gnu_compatible_cc)
check_and_add_linker_flag("-Wl,-z,noexecstack", when=building_with_gnu_compatible_cc)
check_and_add_linker_flag("-Wl,-z,text", when=building_with_gnu_compatible_cc)

View File

@ -0,0 +1,14 @@
diff -Naur a/media/ffvpx/libavcodec/moz.build b/media/ffvpx/libavcodec/moz.build
--- a/media/ffvpx/libavcodec/moz.build 2024-06-07 00:33:58.000000000 +0300
+++ b/media/ffvpx/libavcodec/moz.build 2024-06-10 21:13:44.142620997 +0300
@@ -143,6 +143,10 @@
c11_flags = ["-std=gnu11"]
if CONFIG["CC_TYPE"] == "clang-cl":
c11_flags.insert(0, "-Xclang")
+
+if CONFIG["CC_TYPE"] == "gcc" and int(CONFIG["CC_VERSION"].split(".")[0]) >= 14:
+ c11_flags.insert(0, "-Wno-error=incompatible-pointer-types")
+
CFLAGS += c11_flags
if not CONFIG["MOZ_SYSTEM_LIBVPX"]:

View File

@ -0,0 +1,368 @@
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,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
--- /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
--- a/widget/gtk/MozContainerWayland.cpp
+++ b/widget/gtk/MozContainerWayland.cpp
@@ -82,33 +82,16 @@ using namespace mozilla;
using namespace mozilla::widget;
static bool moz_container_wayland_surface_create_locked(
const MutexAutoLock& aProofOfLock, MozContainer* container);
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) {
LOGWAYLAND("moz_container_wayland_invalidate [%p]\n",
(void*)moz_container_get_nsWindow(container));
GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(container));
if (!window) {
diff --git a/widget/gtk/MozContainerWayland.h b/widget/gtk/MozContainerWayland.h
--- a/widget/gtk/MozContainerWayland.h
+++ b/widget/gtk/MozContainerWayland.h
@@ -8,16 +8,17 @@
#ifndef __MOZ_CONTAINER_WAYLAND_H__
#define __MOZ_CONTAINER_WAYLAND_H__
#include <gtk/gtk.h>
#include <functional>
#include <vector>
#include "mozilla/Mutex.h"
#include "WindowSurface.h"
+#include "MozContainerSurfaceLock.h"
/*
* MozContainer
*
* This class serves three purposes in the nsIWidget implementation.
*
* - It provides objects to receive signals from GTK for events on native
* windows.
@@ -56,25 +57,22 @@ struct MozContainerWayland {
mozilla::Mutex container_lock{"MozContainerWayland::container_lock"};
};
struct _MozContainer;
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*);
void moz_container_wayland_size_allocate(GtkWidget*, GtkAllocation*);
void moz_container_wayland_unmap(GtkWidget*);
struct wl_egl_window* moz_container_wayland_get_egl_window(
MozContainer* container, double scale);
diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -28,16 +28,17 @@ if CONFIG["MOZ_WAYLAND"]:
if CONFIG["MOZ_ENABLE_VAAPI"]:
DIRS += ["vaapitest"]
if CONFIG["MOZ_ENABLE_V4L2"]:
DIRS += ["v4l2test"]
EXPORTS += [
"MozContainer.h",
+ "MozContainerSurfaceLock.h",
"nsGTKToolkit.h",
"nsGtkUtils.h",
"nsImageToPixbuf.h",
]
EXPORTS.mozilla += [
"GfxInfo.h",
"GfxInfoUtils.h",
@@ -66,16 +67,17 @@ UNIFIED_SOURCES += [
"DMABufLibWrapper.cpp",
"DMABufSurface.cpp",
"GfxInfo.cpp",
"gtk3drawing.cpp",
"GtkCompositorWidget.cpp",
"IMContextWrapper.cpp",
"InProcessGtkCompositorWidget.cpp",
"MozContainer.cpp",
+ "MozContainerSurfaceLock.cpp",
"MPRISServiceHandler.cpp",
"NativeKeyBindings.cpp",
"NativeMenuGtk.cpp",
"NativeMenuSupport.cpp",
"nsApplicationChooser.cpp",
"nsAppShell.cpp",
"nsBidiKeyboard.cpp",
"nsClipboard.cpp",
@@ -109,16 +111,17 @@ if CONFIG["MOZ_WAYLAND"]:
UNIFIED_SOURCES += [
"MozContainerWayland.cpp",
"nsClipboardWayland.cpp",
"nsWaylandDisplay.cpp",
"WaylandBuffer.cpp",
"WindowSurfaceWaylandMultiBuffer.cpp",
]
EXPORTS.mozilla.widget += [
+ "MozContainerSurfaceLock.h",
"MozContainerWayland.h",
"nsWaylandDisplay.h",
"WaylandBuffer.h",
]
if CONFIG["MOZ_X11"]:
UNIFIED_SOURCES += [
"nsClipboardX11.cpp",
diff --git a/widget/gtk/GtkCompositorWidget.cpp b/widget/gtk/GtkCompositorWidget.cpp
--- a/widget/gtk/GtkCompositorWidget.cpp
+++ b/widget/gtk/GtkCompositorWidget.cpp
@@ -206,10 +206,14 @@ void GtkCompositorWidget::SetRenderingSu
}
#ifdef MOZ_LOGGING
bool GtkCompositorWidget::IsPopup() {
return mWidget ? mWidget->IsPopup() : false;
}
#endif
+UniquePtr<MozContainerSurfaceLock> GtkCompositorWidget::LockSurface() {
+ return mWidget->LockSurface();
+}
+
} // 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
@@ -5,16 +5,18 @@
#ifndef widget_gtk_GtkCompositorWidget_h
#define widget_gtk_GtkCompositorWidget_h
#include "GLDefs.h"
#include "mozilla/DataMutex.h"
#include "mozilla/widget/CompositorWidget.h"
#include "WindowSurfaceProvider.h"
+#include "mozilla/UniquePtr.h"
+#include "MozContainerSurfaceLock.h"
class nsIWidget;
class nsWindow;
namespace mozilla {
namespace layers {
class NativeLayerRootWayland;
@@ -91,16 +93,18 @@ class GtkCompositorWidget : public Compo
RefPtr<mozilla::layers::NativeLayerRoot> GetNativeLayerRoot() override;
#endif
// PlatformCompositorWidgetDelegate Overrides
void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) override;
GtkCompositorWidget* AsGtkCompositorWidget() override { return this; }
+ UniquePtr<MozContainerSurfaceLock> LockSurface();
+
private:
#if defined(MOZ_WAYLAND)
void ConfigureWaylandBackend();
#endif
#if defined(MOZ_X11)
void ConfigureX11Backend(Window aXWindow, bool aShaped);
#endif
#ifdef MOZ_LOGGING
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -10271,8 +10271,15 @@ void nsWindow::SetDragSource(GdkDragCont
mSourceDragContext = aSourceDragContext;
if (IsPopup() &&
(widget::GdkIsWaylandDisplay() || widget::IsXWaylandProtocol())) {
if (auto* menuPopupFrame = GetMenuPopupFrame(GetFrame())) {
menuPopupFrame->SetIsDragSource(!!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
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -8,16 +8,17 @@
#ifndef __nsWindow_h__
#define __nsWindow_h__
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include "CompositorWidget.h"
#include "MozContainer.h"
+#include "MozContainerSurfaceLock.h"
#include "VsyncSource.h"
#include "mozilla/EventForwards.h"
#include "mozilla/Maybe.h"
#include "mozilla/RefPtr.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/RWLock.h"
#include "mozilla/widget/WindowSurface.h"
@@ -416,16 +417,18 @@ class nsWindow final : public nsBaseWidg
static bool TitlebarUseShapeMask();
bool IsRemoteContent() { return HasRemoteContent(); }
void NativeMoveResizeWaylandPopupCallback(const GdkRectangle* aFinalSize,
bool aFlippedX, bool aFlippedY);
static bool IsToplevelWindowTransparent();
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);
void FocusWaylandWindow(const char* aTokenID);
bool GetCSDDecorationOffset(int* aDx, int* aDy);
bool SetEGLNativeWindowSize(const LayoutDeviceIntSize& aEGLWindowSize);
void WaylandDragWorkaround(GdkEventButton* aEvent);
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
@@ -149,16 +149,26 @@ RenderedFrameId RenderCompositorEGL::End
const auto width = right - left;
const auto height = bottom - top;
bufferInvalid.OrWith(
gfx::IntRect(left, (GetBufferSize().height - bottom), width, height));
}
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;
}
void RenderCompositorEGL::Pause() { DestroyEGLSurface(); }
bool RenderCompositorEGL::Resume() {
if (kIsAndroid) {

View File

@ -0,0 +1,16 @@
bgo#925101 for some unknown reason some users are having issues with pgo crashing. Forcing software
rendering to be used while pgo'ing doesn't have an impact in performance, as hwaccel isn't used
during pgo even when it works. The issue could be caused by wrongly/automatically
configured/detected gpu access anyway. The issue seems related to mesa, but hard to pinpoint.
diff '--color=auto' -Naur a/testing/profiles/profileserver/user.js b/testing/profiles/profileserver/user.js
--- a/testing/profiles/profileserver/user.js 2024-07-11 10:37:53.889115118 +0300
+++ b/testing/profiles/profileserver/user.js 2024-07-11 10:40:23.086996283 +0300
@@ -11,3 +11,6 @@
user_pref("extensions.webextensions.warnings-as-errors", false);
// Turn off update
user_pref("app.update.disabledForTesting", true);
+// bgo#925101 mesa issues with pgo, force software rendering during pgo
+user_pref("gfx.webrender.software", true);
+