Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/firefox68 firefox68: Remove hack to disable multip...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/364e2d8b852d
branches:  trunk
changeset: 434368:364e2d8b852d
user:      nia <nia%pkgsrc.org@localhost>
date:      Mon Jun 15 10:04:03 2020 +0000

description:
firefox68: Remove hack to disable multiprocess mode

This was working around the lack of pshared semaphores on older NetBSD
releases, and restrictions on which process can destroy semaphores
on newer NetBSD releases.

However, we've switched to a new NetBSD-exclusive hack in www/firefox
where we force the use of the tiled rendering mode. This copies what
Firefox does on macOS, which has similar limitations on cross-process
semaphores. The discovery of this was a joint effort between maya
and me.

This avoids several bugs:

1) Multiprocess mode being outright broken on older NetBSD releases
2) Multiprocess mode leaking semaphores and eventually hitting open
   file limits on newer NetBSD releases

Bump PKGREVISION

diffstat:

 www/firefox68/Makefile                                                |    3 +-
 www/firefox68/distinfo                                                |    7 +-
 www/firefox68/patches/patch-browser_app_profile_firefox.js            |    9 +-
 www/firefox68/patches/patch-gfx_thebes_gfxPlatform.cpp                |   28 +
 www/firefox68/patches/patch-ipc_glue_CrossProcessSemaphore.h          |   18 -
 www/firefox68/patches/patch-ipc_glue_CrossProcessSemaphore__posix.cpp |  187 ----------
 6 files changed, 36 insertions(+), 216 deletions(-)

diffs (truncated from 318 to 300 lines):

diff -r 7f0ae2ab688e -r 364e2d8b852d www/firefox68/Makefile
--- a/www/firefox68/Makefile    Mon Jun 15 08:31:19 2020 +0000
+++ b/www/firefox68/Makefile    Mon Jun 15 10:04:03 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.24 2020/06/14 20:19:43 nia Exp $
+# $NetBSD: Makefile,v 1.25 2020/06/15 10:04:03 nia Exp $
 
 FIREFOX_VER=           ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
 MOZ_BRANCH=            68.9
@@ -6,6 +6,7 @@
 
 DISTNAME=      firefox-${FIREFOX_VER}.source
 PKGNAME=       ${DISTNAME:S/.source//:S/b/beta/:S/esr//:S/firefox-/firefox68-/}
+PKGREVISION=   1
 CATEGORIES=    www
 MASTER_SITES+= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
 EXTRACT_SUFX=  .tar.xz
diff -r 7f0ae2ab688e -r 364e2d8b852d www/firefox68/distinfo
--- a/www/firefox68/distinfo    Mon Jun 15 08:31:19 2020 +0000
+++ b/www/firefox68/distinfo    Mon Jun 15 10:04:03 2020 +0000
@@ -1,11 +1,11 @@
-$NetBSD: distinfo,v 1.16 2020/06/03 13:00:24 nia Exp $
+$NetBSD: distinfo,v 1.17 2020/06/15 10:04:03 nia Exp $
 
 SHA1 (firefox-68.9.0esr.source.tar.xz) = ee6406ec1280afc24d4a90c392ff09ff5060686e
 RMD160 (firefox-68.9.0esr.source.tar.xz) = 6bb287d394768b137d46f4abac9111ba662b9942
 SHA512 (firefox-68.9.0esr.source.tar.xz) = 98431800d80f7c680aef9eede29df8217810912a319a7f7f8c2e637c43ecd4f4e29223a417afb2a6315e825f979453ff6e6b5a575649aba5cc63ce5956375bb8
 Size (firefox-68.9.0esr.source.tar.xz) = 317469120 bytes
 SHA1 (patch-aa) = 9f7200c411cd2217a80ec10a276c8877bc6b845c
-SHA1 (patch-browser_app_profile_firefox.js) = 076cc2892547bac07fe907533f4e821f13f5738e
+SHA1 (patch-browser_app_profile_firefox.js) = cf93582b68b8d4e72c3c25682ab9138e185418c8
 SHA1 (patch-build_moz.configure_rust.configure) = b57a9b1451dc426d75774f73d7c05fc98fe6e317
 SHA1 (patch-config_gcc-stl-wrapper.template.h) = 11b45e0c7a9399c5b74b170648280a388dd67d89
 SHA1 (patch-dom_base_nsAttrName.h) = ac7ba441a3b27df2855cf2673eea36b1cb44ad49
@@ -14,12 +14,11 @@
 SHA1 (patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h) = 2f73c76c48852613e0c55c1680fcc2a9eb3cf4ef
 SHA1 (patch-gfx_gl_GLContextProviderGLX.cpp) = 2c909a10a341e600392417240ad0c556f495d6ba
 SHA1 (patch-gfx_skia_skia_src_core_SkCpu.cpp) = 36218819254f3681b9c717d652ea78c9f20d49ad
+SHA1 (patch-gfx_thebes_gfxPlatform.cpp) = e4a25e4a96055b1c42ec018b02d1828257a571de
 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_chromium_src_chrome_common_ipc__channel__posix.cc) = d634805bf3b02475081cb2f263e91e3f4c481a29
-SHA1 (patch-ipc_glue_CrossProcessSemaphore.h) = 25e24743060acf10c776c6b3b3660f52a2e9fbe8
-SHA1 (patch-ipc_glue_CrossProcessSemaphore__posix.cpp) = f8d155ee66008b7cc4052b6a889327543b89e0bb
 SHA1 (patch-ipc_glue_GeckoChildProcessHost.cpp) = 260c29bacd8bf265951b7a412f850bf2b292c836
 SHA1 (patch-js_src_threading_posix_Thread.cpp) = 47e612a676e614fd6dd43b8a3140218a3fbdc7fa
 SHA1 (patch-js_src_util_NativeStack.cpp) = 2c6f844d38343f40ebbc8fd665279256e4ae6d35
diff -r 7f0ae2ab688e -r 364e2d8b852d www/firefox68/patches/patch-browser_app_profile_firefox.js
--- a/www/firefox68/patches/patch-browser_app_profile_firefox.js        Mon Jun 15 08:31:19 2020 +0000
+++ b/www/firefox68/patches/patch-browser_app_profile_firefox.js        Mon Jun 15 10:04:03 2020 +0000
@@ -1,8 +1,8 @@
-$NetBSD: patch-browser_app_profile_firefox.js,v 1.1 2019/09/21 07:31:44 ryoon Exp $
+$NetBSD: patch-browser_app_profile_firefox.js,v 1.2 2020/06/15 10:04:04 nia Exp $
 
---- browser/app/profile/firefox.js.orig        2019-07-06 01:48:29.000000000 +0000
+--- browser/app/profile/firefox.js.orig        2020-05-28 00:01:33.000000000 +0000
 +++ browser/app/profile/firefox.js
-@@ -1865,6 +1865,15 @@ pref("prio.publicKeyB", "26E6674E65425B8
+@@ -1862,6 +1862,12 @@ pref("prio.publicKeyB", "26E6674E65425B8
  pref("toolkit.coverage.enabled", false);
  pref("toolkit.coverage.endpoint.base", "https://coverage.mozilla.org";);
  
@@ -12,9 +12,6 @@
 +// Enable system addons, for example langpacks from www/firefox-l10n
 +pref("extensions.autoDisableScopes", 11);
 +
-+// Disable multiprocess window support. Workaround for PR 53273.
-+pref("browser.tabs.remote.autostart", false);
-+
  // Discovery prefs
  pref("browser.discovery.enabled", true);
  pref("browser.discovery.containers.enabled", true);
diff -r 7f0ae2ab688e -r 364e2d8b852d www/firefox68/patches/patch-gfx_thebes_gfxPlatform.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/firefox68/patches/patch-gfx_thebes_gfxPlatform.cpp    Mon Jun 15 10:04:03 2020 +0000
@@ -0,0 +1,28 @@
+$NetBSD: patch-gfx_thebes_gfxPlatform.cpp,v 1.1 2020/06/15 10:04:04 nia 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-05-28 00:01:45.000000000 +0000
++++ gfx/thebes/gfxPlatform.cpp
+@@ -2991,6 +2991,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
+@@ -3002,6 +3006,7 @@ bool gfxPlatform::UsesTiling() const {
+ 
+   return gfxPrefs::LayersTilesEnabled() ||
+          (gfxPrefs::LayersTilesEnabledIfSkiaPOMTP() && usesSkia && usesPOMTP);
++#endif
+ }
+ 
+ bool gfxPlatform::ContentUsesTiling() const {
diff -r 7f0ae2ab688e -r 364e2d8b852d www/firefox68/patches/patch-ipc_glue_CrossProcessSemaphore.h
--- a/www/firefox68/patches/patch-ipc_glue_CrossProcessSemaphore.h      Mon Jun 15 08:31:19 2020 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-$NetBSD: patch-ipc_glue_CrossProcessSemaphore.h,v 1.1 2019/09/21 07:31:44 ryoon Exp $
-
---- ipc/glue/CrossProcessSemaphore.h.orig      2018-10-18 20:06:06.000000000 +0000
-+++ ipc/glue/CrossProcessSemaphore.h
-@@ -93,7 +93,13 @@ private:
-   HANDLE mSemaphore;
- #elif !defined(OS_MACOSX)
-   RefPtr<mozilla::ipc::SharedMemoryBasic> mSharedBuffer;
-+#if defined(__NetBSD__)
-+  pthread_mutex_t* mMutex;
-+  pthread_cond_t* mNotZero;
-+  uint32_t* mValue;
-+#else
-   sem_t* mSemaphore;
-+#endif
-   mozilla::Atomic<int32_t>* mRefCount;
- #endif
- };
diff -r 7f0ae2ab688e -r 364e2d8b852d www/firefox68/patches/patch-ipc_glue_CrossProcessSemaphore__posix.cpp
--- a/www/firefox68/patches/patch-ipc_glue_CrossProcessSemaphore__posix.cpp     Mon Jun 15 08:31:19 2020 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-$NetBSD: patch-ipc_glue_CrossProcessSemaphore__posix.cpp,v 1.1 2019/09/21 07:31:44 ryoon Exp $
-
---- ipc/glue/CrossProcessSemaphore_posix.cpp.orig      2019-01-18 00:20:30.000000000 +0000
-+++ ipc/glue/CrossProcessSemaphore_posix.cpp
-@@ -9,6 +9,11 @@
- #include "nsDebug.h"
- #include "nsISupportsImpl.h"
- #include <errno.h>
-+#if defined(__NetBSD__)
-+#include <iostream>
-+#include <unistd.h>
-+#include <limits>
-+#endif
- 
- static const uint64_t kNsPerMs = 1000000;
- static const uint64_t kNsPerSec = 1000000000;
-@@ -16,7 +21,13 @@ static const uint64_t kNsPerSec = 100000
- namespace {
- 
- struct SemaphoreData {
-+#if defined(__NetBSD__)
-+  pthread_mutex_t mMutex;
-+  pthread_cond_t mNotZero;
-+  uint32_t mValue;
-+#else
-   sem_t mSemaphore;
-+#endif
-   mozilla::Atomic<int32_t> mRefCount;
-   uint32_t mInitialValue;
- };
-@@ -42,13 +53,27 @@ namespace mozilla {
-     return nullptr;
-   }
- 
-+#if defined(__NetBSD__)
-+  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__)
-+  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;
- 
-@@ -83,23 +108,44 @@ namespace mozilla {
- 
-   int32_t oldCount = data->mRefCount++;
-   if (oldCount == 0) {
-+#if defined(__NetBSD__)
-+    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__)
-+  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__)
-+  : mMutex (nullptr)
-+  , mNotZero (nullptr)
-+  , mValue (nullptr)
-+#else
-+    : mSemaphore(nullptr)
-+#endif
-+    , mRefCount(nullptr) {
-   MOZ_COUNT_CTOR(CrossProcessSemaphore);
- }
- 
-@@ -108,16 +154,57 @@ CrossProcessSemaphore::~CrossProcessSema
- 
-   if (oldCount == 0) {
-     // Nothing can be done if the destroy fails so ignore return code.
-+#if defined(__NetBSD__)
-+    (void)pthread_cond_destroy(mNotZero);
-+    (void)pthread_mutex_destroy(mMutex);
-+#else
-     Unused << sem_destroy(mSemaphore);
-+#endif
-   }
- 
-   MOZ_COUNT_DTOR(CrossProcessSemaphore);
- }
- 
-+#if defined(__NetBSD__)
-+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__)
-+  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) {
-@@ -134,13 +221,24 @@ bool CrossProcessSemaphore::Wait(const M
-     while ((ret = sem_wait(mSemaphore)) == -1 && errno == EINTR) {
-     }
-   }
-+#endif
-   return ret == 0;
- }



Home | Main Index | Thread Index | Old Index