summaryrefslogtreecommitdiff
path: root/www/firefox
diff options
context:
space:
mode:
authormaya <maya@pkgsrc.org>2020-06-14 18:42:19 +0000
committermaya <maya@pkgsrc.org>2020-06-14 18:42:19 +0000
commit29be68788873cd50273473347e95cbea16ed2024 (patch)
treebeee1e0cffcb3c789e97c28a91948917064c8dfd /www/firefox
parent45bc1546e539175b6cc4e493f204a9cc5551e890 (diff)
downloadpkgsrc-29be68788873cd50273473347e95cbea16ed2024.tar.gz
firefox: different way of avoiding pshared semaphores for NetBSD
NetBSD has slightly (NetBSD>=9.x) or very (NetBSD<8) broken pshared semaphores. Fortunately, so does macOS, so there's an easy way to avoid reaching the code relying on it which works better. Do so for NetBSD unconditionally, and enable multiprocess unconditionally. Avoids PR kern/55386 for NetBSD>9.0 Avoids corrupt output on major websites, webGL bugs, etc. for NetBSD<=9.0
Diffstat (limited to 'www/firefox')
-rw-r--r--www/firefox/Makefile13
-rw-r--r--www/firefox/distinfo5
-rw-r--r--www/firefox/patches/patch-gfx_thebes_gfxPlatform.cpp28
-rw-r--r--www/firefox/patches/patch-ipc_glue_CrossProcessSemaphore.h29
-rw-r--r--www/firefox/patches/patch-ipc_glue_CrossProcessSemaphore__posix.cpp188
5 files changed, 32 insertions, 231 deletions
diff --git a/www/firefox/Makefile b/www/firefox/Makefile
index 2f6b4fbb538..f6d48fa2f20 100644
--- a/www/firefox/Makefile
+++ b/www/firefox/Makefile
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.430 2020/06/05 03:38:56 ryoon Exp $
+# $NetBSD: Makefile,v 1.431 2020/06/14 18:42:19 maya Exp $
FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
MOZ_BRANCH= 77.0
MOZ_BRANCH_MINOR= .1
+PKGREVISION= 1
DISTNAME= firefox-${FIREFOX_VER}.source
PKGNAME= ${DISTNAME:S/.source//:S/b/beta/:S/esr//}
@@ -99,16 +100,6 @@ pre-configure:
cd ${WRKSRC}/${OBJDIR} && touch old-configure.vars
# Do not fetch Rust Cargo file via network during build
-.if !empty(MACHINE_PLATFORM:MNetBSD-8.*-*) || !empty(MACHINE_PLATFORM:MNetBSD-9.0*)
-.PHONY: disable-multiprocess
-disable-multiprocess:
- ${STEP_MSG} "Broken process-shared mutexes, disabling multiprocess windows..."
- cd ${WRKSRC} && ${ECHO} 'pref("browser.tabs.remote.autostart", false);' >> browser/app/profile/firefox.js
- cd ${WRKSRC} && ${ECHO} 'pref("webgl.disabled", true);' >> browser/app/profile/firefox.js
-
-post-configure: disable-multiprocess
-.endif
-
post-build:
${SED} -e 's|@MOZILLA@|${MOZILLA}|g' \
-e 's|@MOZILLA_NAME@|${MOZILLA_NAME}|g' \
diff --git a/www/firefox/distinfo b/www/firefox/distinfo
index bf74d46b6d7..d838f574118 100644
--- a/www/firefox/distinfo
+++ b/www/firefox/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.397 2020/06/05 03:38:56 ryoon Exp $
+$NetBSD: distinfo,v 1.398 2020/06/14 18:42:19 maya Exp $
SHA1 (firefox-77.0.1.source.tar.xz) = 86735b221c17964f5e6a756a973b6d0696fbf1c5
RMD160 (firefox-77.0.1.source.tar.xz) = 59ef718e1bf9eef0a6b90c60ec20bbe4c7402ffe
@@ -16,11 +16,10 @@ SHA1 (patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp
SHA1 (patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h) = 2f73c76c48852613e0c55c1680fcc2a9eb3cf4ef
SHA1 (patch-gfx_cairo_cairo_src_cairo-type1-subset.c) = 89a9d934ef76706c552c0b81e6cbc0f45b1ffd2c
SHA1 (patch-gfx_skia_skia_src_core_SkCpu.cpp) = 36218819254f3681b9c717d652ea78c9f20d49ad
+SHA1 (patch-gfx_thebes_gfxPlatform.cpp) = f6f8996f0818a1b890698c7cc5054d49cb1e8924
SHA1 (patch-ipc_chromium_src_base_lock__impl__posix.cc) = d84d9b4d416e049423120dcbf9199644ce1c93ab
SHA1 (patch-ipc_chromium_src_base_message__pump__libevent.cc) = 4a6606da590cfb8d855bde58b9c6f90e98d0870c
SHA1 (patch-ipc_chromium_src_base_platform__thread__posix.cc) = 35d20981d33ccdb1d8ffb8039e48798777f11658
-SHA1 (patch-ipc_glue_CrossProcessSemaphore.h) = 102e8a164584c6d73a5ca2bd4ad1050586082410
-SHA1 (patch-ipc_glue_CrossProcessSemaphore__posix.cpp) = 9635992da0fbae262a02a0eafce7e2445c44c22b
SHA1 (patch-ipc_glue_GeckoChildProcessHost.cpp) = 260c29bacd8bf265951b7a412f850bf2b292c836
SHA1 (patch-js_src_jsfriendapi.h) = 6bbb895b882ee24929f011751c42732215e153a2
SHA1 (patch-js_src_util_NativeStack.cpp) = a0a16d8d8d78d3cc3f4d2a508586f1a7821f7dba
diff --git a/www/firefox/patches/patch-gfx_thebes_gfxPlatform.cpp b/www/firefox/patches/patch-gfx_thebes_gfxPlatform.cpp
new file mode 100644
index 00000000000..c4a4ab6b552
--- /dev/null
+++ b/www/firefox/patches/patch-gfx_thebes_gfxPlatform.cpp
@@ -0,0 +1,28 @@
+$NetBSD: patch-gfx_thebes_gfxPlatform.cpp,v 1.7 2020/06/14 18:42:19 maya Exp $
+
+Don't rely on CrossProcessSemaphore on NetBSD. It has some implementation
+issues that cause issues (kern/55386, not available on NetBSD<9)
+
+This idea is borrowed from macOS which has the same limitation.
+
+--- gfx/thebes/gfxPlatform.cpp.orig 2020-06-03 01:04:50.000000000 +0000
++++ gfx/thebes/gfxPlatform.cpp
+@@ -2922,6 +2922,10 @@ bool gfxPlatform::UsesOffMainThreadCompo
+ }
+
+ bool gfxPlatform::UsesTiling() const {
++#ifdef __NetBSD__
++ // Avoid relying on CrossProcessSemaphore
++ return true;
++#else
+ bool usesSkia = GetDefaultContentBackend() == BackendType::SKIA;
+
+ // We can't just test whether the PaintThread is initialized here because
+@@ -2934,6 +2938,7 @@ bool gfxPlatform::UsesTiling() const {
+ return StaticPrefs::layers_enable_tiles_AtStartup() ||
+ (StaticPrefs::layers_enable_tiles_if_skia_pomtp_AtStartup() &&
+ usesSkia && usesPOMTP);
++#endif
+ }
+
+ bool gfxPlatform::ContentUsesTiling() const {
diff --git a/www/firefox/patches/patch-ipc_glue_CrossProcessSemaphore.h b/www/firefox/patches/patch-ipc_glue_CrossProcessSemaphore.h
deleted file mode 100644
index 07e73175769..00000000000
--- a/www/firefox/patches/patch-ipc_glue_CrossProcessSemaphore.h
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD: patch-ipc_glue_CrossProcessSemaphore.h,v 1.4 2020/05/04 21:29:08 maya Exp $
-
---- ipc/glue/CrossProcessSemaphore.h.orig 2018-10-18 20:06:06.000000000 +0000
-+++ ipc/glue/CrossProcessSemaphore.h
-@@ -18,6 +18,10 @@
- # include "mozilla/Atomics.h"
- #endif
-
-+#ifdef __NetBSD__ // For version check only.
-+#include <sys/param.h>
-+#endif
-+
- namespace IPC {
- template <typename T>
- struct ParamTraits;
-@@ -105,7 +109,13 @@ class CrossProcessSemaphore {
- HANDLE mSemaphore;
- #elif !defined(OS_MACOSX)
- RefPtr<mozilla::ipc::SharedMemoryBasic> mSharedBuffer;
-+#if defined(__NetBSD__) && (__NetBSD_Version__ < 900000001)
-+ pthread_mutex_t* mMutex;
-+ pthread_cond_t* mNotZero;
-+ uint32_t* mValue;
-+#else
- sem_t* mSemaphore;
-+#endif
- mozilla::Atomic<int32_t>* mRefCount;
- #endif
- };
diff --git a/www/firefox/patches/patch-ipc_glue_CrossProcessSemaphore__posix.cpp b/www/firefox/patches/patch-ipc_glue_CrossProcessSemaphore__posix.cpp
deleted file mode 100644
index b73423053d6..00000000000
--- a/www/firefox/patches/patch-ipc_glue_CrossProcessSemaphore__posix.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-$NetBSD: patch-ipc_glue_CrossProcessSemaphore__posix.cpp,v 1.7 2020/05/04 21:29:08 maya Exp $
-
---- ipc/glue/CrossProcessSemaphore_posix.cpp.orig 2019-01-18 00:20:30.000000000 +0000
-+++ ipc/glue/CrossProcessSemaphore_posix.cpp
-@@ -9,6 +9,12 @@
- #include "nsDebug.h"
- #include "nsISupportsImpl.h"
- #include <errno.h>
-+#if defined(__NetBSD__)
-+#include <sys/param.h>
-+#include <iostream>
-+#include <unistd.h>
-+#include <limits>
-+#endif
-
- static const uint64_t kNsPerMs = 1000000;
- static const uint64_t kNsPerSec = 1000000000;
-@@ -16,7 +22,13 @@ static const uint64_t kNsPerSec = 100000
- namespace {
-
- struct SemaphoreData {
-+#if defined(__NetBSD__) && (__NetBSD_Version__ < 900000001)
-+ pthread_mutex_t mMutex;
-+ pthread_cond_t mNotZero;
-+ uint32_t mValue;
-+#else
- sem_t mSemaphore;
-+#endif
- mozilla::Atomic<int32_t> mRefCount;
- uint32_t mInitialValue;
- };
-@@ -43,13 +55,27 @@ CrossProcessSemaphore* CrossProcessSemap
- return nullptr;
- }
-
-+#if defined(__NetBSD__) && (__NetBSD_Version__ < 900000001)
-+ data->mValue = aInitialValue;
-+ if (pthread_mutex_init(&data->mMutex, NULL) ||
-+ pthread_cond_init(&data->mNotZero, NULL) ) {
-+ return nullptr;
-+ }
-+#else
- if (sem_init(&data->mSemaphore, 1, aInitialValue)) {
- return nullptr;
- }
-+#endif
-
- CrossProcessSemaphore* sem = new CrossProcessSemaphore;
- sem->mSharedBuffer = sharedBuffer;
-+#if defined(__NetBSD__) && (__NetBSD_Version__ < 900000001)
-+ sem->mMutex = &data->mMutex;
-+ sem->mNotZero = &data->mNotZero;
-+ sem->mValue = &data->mValue;
-+#else
- sem->mSemaphore = &data->mSemaphore;
-+#endif
- sem->mRefCount = &data->mRefCount;
- *sem->mRefCount = 1;
-
-@@ -85,23 +111,44 @@ CrossProcessSemaphore* CrossProcessSemap
-
- int32_t oldCount = data->mRefCount++;
- if (oldCount == 0) {
-+#if defined(__NetBSD__) && (__NetBSD_Version__ < 900000001)
-+ if (pthread_mutex_init(&data->mMutex, NULL) ||
-+ pthread_cond_init(&data->mNotZero, NULL) ) {
-+ data->mRefCount--;
-+ return nullptr;
-+ }
-+#else
- // The other side has already let go of their CrossProcessSemaphore, so now
- // mSemaphore is garbage. We need to re-initialize it.
- if (sem_init(&data->mSemaphore, 1, data->mInitialValue)) {
- data->mRefCount--;
- return nullptr;
- }
-+#endif
- }
-
- CrossProcessSemaphore* sem = new CrossProcessSemaphore;
- sem->mSharedBuffer = sharedBuffer;
-+#if defined(__NetBSD__) && (__NetBSD_Version__ < 900000001)
-+ sem->mMutex = &data->mMutex;
-+ sem->mNotZero = &data->mNotZero;
-+ sem->mValue = &data->mValue;
-+#else
- sem->mSemaphore = &data->mSemaphore;
-+#endif
- sem->mRefCount = &data->mRefCount;
- return sem;
- }
-
- CrossProcessSemaphore::CrossProcessSemaphore()
-- : mSemaphore(nullptr), mRefCount(nullptr) {
-+#if defined(__NetBSD__) && (__NetBSD_Version__ < 900000001)
-+ : mMutex (nullptr)
-+ , mNotZero (nullptr)
-+ , mValue (nullptr)
-+#else
-+ : mSemaphore(nullptr)
-+#endif
-+ , mRefCount(nullptr) {
- MOZ_COUNT_CTOR(CrossProcessSemaphore);
- }
-
-@@ -110,16 +157,57 @@ CrossProcessSemaphore::~CrossProcessSema
-
- if (oldCount == 0) {
- // Nothing can be done if the destroy fails so ignore return code.
-+#if defined(__NetBSD__) && (__NetBSD_Version__ < 900000001)
-+ (void)pthread_cond_destroy(mNotZero);
-+ (void)pthread_mutex_destroy(mMutex);
-+#else
- Unused << sem_destroy(mSemaphore);
-+#endif
- }
-
- MOZ_COUNT_DTOR(CrossProcessSemaphore);
- }
-
-+#if defined(__NetBSD__) && (__NetBSD_Version__ < 900000001)
-+static struct timespec
-+makeAbsTime(const Maybe<TimeDuration>& aWaitTime) {
-+ struct timespec ts;
-+ if (aWaitTime.isSome()) {
-+ clock_gettime(CLOCK_REALTIME, &ts);
-+ ts.tv_nsec += (kNsPerMs * aWaitTime->ToMilliseconds());
-+ ts.tv_sec += ts.tv_nsec / kNsPerSec;
-+ ts.tv_nsec %= kNsPerSec;
-+ }
-+ else {
-+ ts.tv_sec = std::numeric_limits<time_t>::max();
-+ ts.tv_nsec = 0;
-+ }
-+ return ts;
-+}
-+#endif
-+
- bool CrossProcessSemaphore::Wait(const Maybe<TimeDuration>& aWaitTime) {
- MOZ_ASSERT(*mRefCount > 0,
- "Attempting to wait on a semaphore with zero ref count");
- int ret;
-+#if defined(__NetBSD__) && (__NetBSD_Version__ < 900000001)
-+ struct timespec ts = makeAbsTime(aWaitTime);
-+
-+ ret = pthread_mutex_lock(mMutex);
-+
-+ if (ret == 0) {
-+ while (ret == 0 && mValue == 0) {
-+ ret = pthread_cond_timedwait(mNotZero, mMutex, &ts);
-+ while (ret == -1 && errno == EINTR) {
-+ ret = pthread_cond_timedwait(mNotZero, mMutex, &ts);
-+ }
-+ }
-+ if (ret == 0) {
-+ --(*mValue);
-+ }
-+ pthread_mutex_unlock(mMutex);
-+ }
-+#else
- if (aWaitTime.isSome()) {
- struct timespec ts;
- if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {
-@@ -136,13 +224,24 @@ bool CrossProcessSemaphore::Wait(const M
- while ((ret = sem_wait(mSemaphore)) == -1 && errno == EINTR) {
- }
- }
-+#endif
- return ret == 0;
- }
-
- void CrossProcessSemaphore::Signal() {
- MOZ_ASSERT(*mRefCount > 0,
- "Attempting to signal a semaphore with zero ref count");
-+#if defined(__NetBSD__) && (__NetBSD_Version__ < 900000001)
-+ int ret;
-+ ret = pthread_mutex_lock(mMutex);
-+ if (ret == 0) {
-+ ++(*mValue);
-+ pthread_cond_signal(mNotZero);
-+ pthread_mutex_unlock(mMutex);
-+ }
-+#else
- sem_post(mSemaphore);
-+#endif
- }
-
- CrossProcessSemaphoreHandle CrossProcessSemaphore::ShareToProcess(