Browse Source

Update for Bug 1578075

Ian Neal 4 years ago
parent
commit
118bcca587

+ 0 - 1
comm-esr60/mozilla-esr60/patches/series

@@ -217,7 +217,6 @@ NOBUG-BACKOUT-1439860-60.patch
 TOP-9999999-rust133-257.patch
 TOP-9999999-fixlangpack-257.patch
 mozilla-esr60-top-nonexisting.patch
-1578075-70.patch
 1574573-70a1.patch
 1576463-71a1.patch
 1518762-66a1.patch

+ 64 - 0
rel-257/mozilla-esr60/patches/1454978-61a1.patch

@@ -0,0 +1,64 @@
+# HG changeset patch
+# User Ryan Hunt <rhunt@eqrion.net>
+# Date 1524691622 18000
+# Node ID 2ba500ed529be48c75e68b896ae1739f801fed80
+# Parent  f8d5609ca22338b752cbcbe12f8387a905024330
+Bug 1454978 - Make OMTP feature detection not depend on tiling. r=bas
+
+There's a circular dependency between `UsesTiling` and `InitOMTPConfig` because
+we try to disable OMTP if we will be using tiling and edge padding is enabled.
+Now that edge padding is disabled everywhere except android it should be safe
+to assume that if edge padding is enabled then we'll be using tiling as well
+and should disable OMTP.
+
+This commit also removes a check on `UsesTiling` from CalculateWorkerCount
+as it is redundant.
+
+MozReview-Commit-ID: 1ruWPwXfLwO
+
+diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
+--- a/gfx/layers/PaintThread.cpp
++++ b/gfx/layers/PaintThread.cpp
+@@ -96,20 +96,16 @@ PlatformThreadId PaintThread::sThreadId;
+ 
+ PaintThread::PaintThread() {}
+ 
+ void PaintThread::Release() {}
+ 
+ void PaintThread::AddRef() {}
+ 
+ /* static */ int32_t PaintThread::CalculatePaintWorkerCount() {
+-  if (!gfxPlatform::GetPlatform()->UsesTiling()) {
+-    return 0;
+-  }
+-
+   int32_t cpuCores = 1;
+   nsCOMPtr<nsIPropertyBag2> systemInfo =
+       do_GetService(NS_SYSTEMINFO_CONTRACTID);
+   if (systemInfo) {
+     nsresult rv = systemInfo->GetPropertyAsInt32(NS_LITERAL_STRING("cpucores"),
+                                                  &cpuCores);
+     if (NS_FAILED(rv)) {
+       cpuCores = 1;
+diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp
+--- a/gfx/thebes/gfxPlatform.cpp
++++ b/gfx/thebes/gfxPlatform.cpp
+@@ -2422,17 +2422,17 @@ void gfxPlatform::InitOMTPConfig() {
+     omtp.ForceDisable(FeatureStatus::Broken,
+                       "OMTP is not supported when using cairo",
+                       NS_LITERAL_CSTRING("FEATURE_FAILURE_COMP_PREF"));
+   }
+ 
+   if (InSafeMode()) {
+     omtp.ForceDisable(FeatureStatus::Blocked, "OMTP blocked by safe-mode",
+                       NS_LITERAL_CSTRING("FEATURE_FAILURE_COMP_SAFEMODE"));
+-  } else if (gfxPlatform::UsesTiling() && gfxPrefs::TileEdgePaddingEnabled()) {
++  } else if (gfxPrefs::TileEdgePaddingEnabled()) {
+     omtp.ForceDisable(FeatureStatus::Blocked,
+                       "OMTP does not yet support tiling with edge padding",
+                       NS_LITERAL_CSTRING("FEATURE_FAILURE_OMTP_TILING"));
+   }
+ 
+   if (omtp.IsEnabled()) {
+     gfxVars::SetUseOMTP(true);
+     reporter.SetSuccessful(paintWorkerCount);

+ 66 - 0
rel-257/mozilla-esr60/patches/1458462-61a1.patch

@@ -0,0 +1,66 @@
+# HG changeset patch
+# User Ryan Hunt <rhunt@eqrion.net>
+# Date 1525270873 18000
+# Node ID 895146c6b6bcb5a1fa447cdcb54f1925a5ce862a
+# Parent  7de9dceae9b748f450886d26dafd6f56d4ab5492
+Bug 1458462 - Create paint workers if it's possible we could switch to tiling in the future. r=nical
+
+On windows it's possible for us to fallback from D2D to Skia rendering at any time due to a device reset.
+If this happens with `enable-tiles-if-skia-pomtp` enabled we could begin to use tiling. This can cause a
+crash if we never created the worker threads because at initialization time we weren't using tiling.
+
+Another way to fix this would be to dynamically create the worker threads in UpdateRenderMode if we
+have switched to skia. That's a larger change and more might be required, so I'd rather just fix the
+crash for now.
+
+This commit also fixes a pref that should be `Once` instead of `Live`.
+
+MozReview-Commit-ID: JQidXPjI7ER
+
+diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
+--- a/gfx/layers/PaintThread.cpp
++++ b/gfx/layers/PaintThread.cpp
+@@ -137,17 +137,20 @@ bool PaintThread::Init() {
+ 
+   RefPtr<nsIThread> thread;
+   nsresult rv = NS_NewNamedThread("PaintThread", getter_AddRefs(thread));
+   if (NS_FAILED(rv)) {
+     return false;
+   }
+   sThread = thread;
+ 
+-  if (gfxPlatform::GetPlatform()->UsesTiling()) {
++  // Only create paint workers for tiling if we are using tiling or could
++  // expect to dynamically switch to tiling in the future
++  if (gfxPlatform::GetPlatform()->UsesTiling() ||
++      gfxPrefs::LayersTilesEnabledIfSkiaPOMTP()) {
+     int32_t paintWorkerCount = PaintThread::CalculatePaintWorkerCount();
+     mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
+                                           paintWorkerCount);
+   }
+ 
+   nsCOMPtr<nsIRunnable> paintInitTask = NewRunnableMethod(
+       "PaintThread::InitOnPaintThread", this, &PaintThread::InitOnPaintThread);
+   SyncRunnable::DispatchToThread(sThread, paintInitTask);
+diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h
+--- a/gfx/thebes/gfxPrefs.h
++++ b/gfx/thebes/gfxPrefs.h
+@@ -621,17 +621,17 @@ class gfxPrefs final {
+   DECL_GFX_PREF(Once, "layers.mlgpu.enable-cpu-occlusion",     AdvancedLayersEnableCPUOcclusion, bool, true);
+   DECL_GFX_PREF(Once, "layers.mlgpu.enable-depth-buffer",      AdvancedLayersEnableDepthBuffer, bool, false);
+   DECL_GFX_PREF(Live, "layers.mlgpu.enable-invalidation",      AdvancedLayersUseInvalidation, bool, true);
+   DECL_GFX_PREF(Once, "layers.mlgpu.enable-on-windows7",       AdvancedLayersEnableOnWindows7, bool, false);
+   DECL_GFX_PREF(Once, "layers.mlgpu.enable-container-resizing", AdvancedLayersEnableContainerResizing, bool, true);
+   DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.force-disabled", LayersOffMainThreadCompositionForceDisabled, bool, false);
+   DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1);
+   DECL_GFX_PREF(Live, "layers.omtp.dump-capture",              LayersOMTPDumpCapture, bool, false);
+-  DECL_GFX_PREF(Live, "layers.omtp.paint-workers",             LayersOMTPPaintWorkers, int32_t, 1);
++  DECL_GFX_PREF(Once, "layers.omtp.paint-workers",             LayersOMTPPaintWorkers, int32_t, 1);
+   DECL_GFX_PREF(Live, "layers.omtp.release-capture-on-main-thread", LayersOMTPReleaseCaptureOnMainThread, bool, false);
+   DECL_GFX_PREF(Live, "layers.orientation.sync.timeout",       OrientationSyncMillis, uint32_t, (uint32_t)0);
+   DECL_GFX_PREF(Once, "layers.prefer-opengl",                  LayersPreferOpenGL, bool, false);
+   DECL_GFX_PREF(Live, "layers.progressive-paint",              ProgressivePaint, bool, false);
+   DECL_GFX_PREF(Live, "layers.shared-buffer-provider.enabled", PersistentBufferProviderSharedEnabled, bool, false);
+   DECL_GFX_PREF(Live, "layers.single-tile.enabled",            LayersSingleTileEnabled, bool, true);
+   DECL_GFX_PREF(Live, "layers.force-synchronous-resize",       LayersForceSynchronousResize, bool, true);
+ 

+ 181 - 0
rel-257/mozilla-esr60/patches/1461775-62a1.patch

@@ -0,0 +1,181 @@
+# HG changeset patch
+# User Ryan Hunt <rhunt@eqrion.net>
+# Date 1526409371 18000
+# Node ID 0d06bc54d475bbe804fbb2366c46da501bba99da
+# Parent  06959a24c8d5d9ca57bc88411c29b1d2fef89659
+Bug 1461775 - Create paint worker threads in response to a device reset instead of preemptively. r=bas
+
+diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
+--- a/gfx/layers/PaintThread.cpp
++++ b/gfx/layers/PaintThread.cpp
+@@ -139,34 +139,38 @@ bool PaintThread::Init() {
+   nsresult rv = NS_NewNamedThread("PaintThread", getter_AddRefs(thread));
+   if (NS_FAILED(rv)) {
+     return false;
+   }
+   sThread = thread;
+ 
+   // Only create paint workers for tiling if we are using tiling or could
+   // expect to dynamically switch to tiling in the future
+-  if (gfxPlatform::GetPlatform()->UsesTiling() ||
+-      gfxPrefs::LayersTilesEnabledIfSkiaPOMTP()) {
+-    int32_t paintWorkerCount = PaintThread::CalculatePaintWorkerCount();
+-    mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
+-                                          paintWorkerCount);
++  if (gfxPlatform::GetPlatform()->UsesTiling()) {
++    InitPaintWorkers();
+   }
+ 
+   nsCOMPtr<nsIRunnable> paintInitTask = NewRunnableMethod(
+       "PaintThread::InitOnPaintThread", this, &PaintThread::InitOnPaintThread);
+   SyncRunnable::DispatchToThread(sThread, paintInitTask);
+   return true;
+ }
+ 
+ void PaintThread::InitOnPaintThread() {
+   MOZ_ASSERT(!NS_IsMainThread());
+   sThreadId = PlatformThread::CurrentId();
+ }
+ 
++void PaintThread::InitPaintWorkers() {
++  MOZ_ASSERT(NS_IsMainThread());
++  int32_t count = PaintThread::CalculatePaintWorkerCount();
++  mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
++                                        count);
++}
++
+ void DestroyPaintThread(UniquePtr<PaintThread>&& pt) {
+   MOZ_ASSERT(PaintThread::IsOnPaintThread());
+   pt->ShutdownOnPaintThread();
+ }
+ 
+ /* static */ void PaintThread::Shutdown() {
+   MOZ_ASSERT(NS_IsMainThread());
+ 
+@@ -191,16 +195,26 @@ void PaintThread::ShutdownOnPaintThread(
+ /* static */ bool PaintThread::IsOnPaintThread() {
+   return sThreadId == PlatformThread::CurrentId();
+ }
+ 
+ bool PaintThread::IsOnPaintWorkerThread() {
+   return mPaintWorkers && mPaintWorkers->IsOnCurrentThread();
+ }
+ 
++void PaintThread::UpdateRenderMode() {
++  if (!!mPaintWorkers != gfxPlatform::GetPlatform()->UsesTiling()) {
++    if (mPaintWorkers) {
++      mPaintWorkers = nullptr;
++    } else {
++      InitPaintWorkers();
++    }
++  }
++}
++
+ void PaintThread::PrepareBuffer(CapturedBufferState* aState) {
+   MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aState);
+ 
+   // If painting asynchronously, we need to acquire the compositor bridge which
+   // owns the underlying MessageChannel. Otherwise we leave it null and use
+   // synchronous dispatch.
+   RefPtr<CompositorBridgeChild> cbc(CompositorBridgeChild::Get());
+@@ -304,16 +318,17 @@ void PaintThread::AsyncPaintContents(
+     // AsyncEndLayer
+     DispatchEndLayerTransaction(aBridge);
+   }
+ }
+ 
+ void PaintThread::PaintTiledContents(CapturedTiledPaintState* aState) {
+   MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aState);
++  MOZ_ASSERT(mPaintWorkers);
+ 
+   if (gfxPrefs::LayersOMTPDumpCapture() && aState->mCapture) {
+     aState->mCapture->Dump();
+   }
+ 
+   RefPtr<CompositorBridgeChild> cbc(CompositorBridgeChild::Get());
+   RefPtr<CapturedTiledPaintState> state(aState);
+ 
+diff --git a/gfx/layers/PaintThread.h b/gfx/layers/PaintThread.h
+--- a/gfx/layers/PaintThread.h
++++ b/gfx/layers/PaintThread.h
+@@ -245,16 +245,18 @@ class PaintThread final {
+   static void Start();
+   static void Shutdown();
+   static PaintThread* Get();
+ 
+   // Helper for asserts.
+   static bool IsOnPaintThread();
+   bool IsOnPaintWorkerThread();
+ 
++  void UpdateRenderMode();
++
+   void PrepareBuffer(CapturedBufferState* aState);
+ 
+   void PaintContents(CapturedPaintState* aState,
+                      PrepDrawTargetForPaintingCallback aCallback);
+ 
+   void PaintTiledContents(CapturedTiledPaintState* aState);
+ 
+   // Must be called on the main thread. Signifies that the current
+@@ -283,16 +285,17 @@ class PaintThread final {
+   static int32_t CalculatePaintWorkerCount();
+ 
+  private:
+   PaintThread();
+ 
+   bool Init();
+   void ShutdownOnPaintThread();
+   void InitOnPaintThread();
++  void InitPaintWorkers();
+ 
+   void AsyncPrepareBuffer(CompositorBridgeChild* aBridge,
+                           CapturedBufferState* aState);
+   void AsyncPaintContents(CompositorBridgeChild* aBridge,
+                           CapturedPaintState* aState,
+                           PrepDrawTargetForPaintingCallback aCallback);
+   void AsyncPaintTiledContents(CompositorBridgeChild* aBridge,
+                                CapturedTiledPaintState* aState);
+diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp
+--- a/gfx/thebes/gfxWindowsPlatform.cpp
++++ b/gfx/thebes/gfxWindowsPlatform.cpp
+@@ -36,16 +36,17 @@
+ #include "nsIGfxInfo.h"
+ 
+ #include "gfxCrashReporterUtils.h"
+ 
+ #include "gfxGDIFontList.h"
+ #include "gfxGDIFont.h"
+ 
+ #include "mozilla/layers/CompositorThread.h"
++#include "mozilla/layers/PaintThread.h"
+ #include "mozilla/layers/ReadbackManagerD3D11.h"
+ 
+ #include "gfxDWriteFontList.h"
+ #include "gfxDWriteFonts.h"
+ #include "gfxDWriteCommon.h"
+ #include <dwrite.h>
+ 
+ #include "gfxTextRun.h"
+@@ -440,16 +441,20 @@ bool gfxWindowsPlatform::IsDirect2DBacke
+   return GetDefaultContentBackend() == BackendType::DIRECT2D1_1;
+ }
+ 
+ void gfxWindowsPlatform::UpdateRenderMode() {
+   bool didReset = HandleDeviceReset();
+ 
+   UpdateBackendPrefs();
+ 
++  if (PaintThread::Get()) {
++    PaintThread::Get()->UpdateRenderMode();
++  }
++
+   if (didReset) {
+     mScreenReferenceDrawTarget = CreateOffscreenContentDrawTarget(
+         IntSize(1, 1), SurfaceFormat::B8G8R8A8);
+     if (!mScreenReferenceDrawTarget) {
+       gfxCriticalNote
+           << "Failed to update reference draw target after device reset"
+           << ", D3D11 device:" << hexa(Factory::GetDirect3D11Device().get())
+           << ", D3D11 status:"

+ 67 - 0
rel-257/mozilla-esr60/patches/1473732-63a1.patch

@@ -0,0 +1,67 @@
+# HG changeset patch
+# User Jan Beich <jbeich@FreeBSD.org>
+# Date 1530398519 0
+# Node ID 393f7e716c4f7ecbb3ead2d1ccbc796a0d8726a0
+# Parent  e247721043bffbb7b6402c75ca6abf15331d361c
+Bug 1473732 - Base default number of OMTP workers on the number of logical CPU cores. r=rhunt
+
+system-info is a stub on Tier3 platforms while physical vs. logical
+difference only matters for hyper-threading. As hyper-threading
+is usually available on CPUs with more than 2 physical cores this
+change has no impact there as the default is clamped to [1, 4].
+However, on Intel i3-* CPUs with 2 physical and 4 logical cores this
+bumps the default from 1 to 3.
+
+MozReview-Commit-ID: 1Yh8rJL2JcN
+
+diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
+--- a/gfx/layers/PaintThread.cpp
++++ b/gfx/layers/PaintThread.cpp
+@@ -16,17 +16,17 @@
+ #include "mozilla/layers/ShadowLayers.h"
+ #include "mozilla/layers/SyncObject.h"
+ #include "mozilla/gfx/2D.h"
+ #include "mozilla/Preferences.h"
+ #include "mozilla/SharedThreadPool.h"
+ #include "mozilla/SyncRunnable.h"
+ #include "nsIPropertyBag2.h"
+ #include "nsServiceManagerUtils.h"
+-#include "nsSystemInfo.h"
++#include "prsystem.h"
+ 
+ // Uncomment the following line to dispatch sync runnables when
+ // painting so that rasterization happens synchronously from
+ // the perspective of the main thread
+ // #define OMTP_FORCE_SYNC
+ 
+ namespace mozilla {
+ namespace layers {
+@@ -96,27 +96,17 @@ PlatformThreadId PaintThread::sThreadId;
+ 
+ PaintThread::PaintThread() {}
+ 
+ void PaintThread::Release() {}
+ 
+ void PaintThread::AddRef() {}
+ 
+ /* static */ int32_t PaintThread::CalculatePaintWorkerCount() {
+-  int32_t cpuCores = 1;
+-  nsCOMPtr<nsIPropertyBag2> systemInfo =
+-      do_GetService(NS_SYSTEMINFO_CONTRACTID);
+-  if (systemInfo) {
+-    nsresult rv = systemInfo->GetPropertyAsInt32(NS_LITERAL_STRING("cpucores"),
+-                                                 &cpuCores);
+-    if (NS_FAILED(rv)) {
+-      cpuCores = 1;
+-    }
+-  }
+-
++  int32_t cpuCores = PR_GetNumberOfProcessors();
+   int32_t workerCount = gfxPrefs::LayersOMTPPaintWorkers();
+ 
+   // If not manually specified, default to (cpuCores * 3) / 4, and clamp
+   // between 1 and 4. If a user wants more, they can manually specify it
+   if (workerCount < 1) {
+     workerCount = std::min(std::max((cpuCores * 3) / 4, 1), 4);
+   }
+ 

+ 99 - 0
rel-257/mozilla-esr60/patches/1477799-63a1.patch

@@ -0,0 +1,99 @@
+# HG changeset patch
+# User Ryan Hunt <rhunt@eqrion.net>
+# Date 1532022094 18000
+# Node ID b9c6c62b406313bbae21a6c967e106ab58ad63a8
+# Parent  f1a4cbbd6917f9259ed61198153ff6b2cc1466f9
+Bug 1477799 - Use the paint thread instead of workers when we only have one worker. r=jrmuizel
+
+MozReview-Commit-ID: 3mR4KrS924N
+
+diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
+--- a/gfx/layers/PaintThread.cpp
++++ b/gfx/layers/PaintThread.cpp
+@@ -157,18 +157,20 @@ bool PaintThread::Init() {
+ void PaintThread::InitOnPaintThread() {
+   MOZ_ASSERT(!NS_IsMainThread());
+   sThreadId = PlatformThread::CurrentId();
+ }
+ 
+ void PaintThread::InitPaintWorkers() {
+   MOZ_ASSERT(NS_IsMainThread());
+   int32_t count = PaintThread::CalculatePaintWorkerCount();
+-  mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
+-                                        count);
++  if (count != 1) {
++    mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
++                                          count);
++  }
+ }
+ 
+ void DestroyPaintThread(UniquePtr<PaintThread>&& pt) {
+   MOZ_ASSERT(PaintThread::IsOnPaintThread());
+   pt->ShutdownOnPaintThread();
+ }
+ 
+ /* static */ void PaintThread::Shutdown() {
+@@ -192,17 +194,18 @@ void PaintThread::ShutdownOnPaintThread(
+   return PaintThread::sSingleton.get();
+ }
+ 
+ /* static */ bool PaintThread::IsOnPaintThread() {
+   return sThreadId == PlatformThread::CurrentId();
+ }
+ 
+ bool PaintThread::IsOnPaintWorkerThread() {
+-  return mPaintWorkers && mPaintWorkers->IsOnCurrentThread();
++  return (mPaintWorkers && mPaintWorkers->IsOnCurrentThread()) ||
++    (sThreadId == PlatformThread::CurrentId());
+ }
+ 
+ void PaintThread::UpdateRenderMode() {
+   if (!!mPaintWorkers != gfxPlatform::GetPlatform()->UsesTiling()) {
+     if (mPaintWorkers) {
+       mPaintWorkers = nullptr;
+     } else {
+       InitPaintWorkers();
+@@ -318,37 +321,40 @@ void PaintThread::AsyncPaintContents(
+     // AsyncEndLayer
+     DispatchEndLayerTransaction(aBridge);
+   }
+ }
+ 
+ void PaintThread::PaintTiledContents(CapturedTiledPaintState* aState) {
+   MOZ_ASSERT(NS_IsMainThread());
+   MOZ_ASSERT(aState);
+-  MOZ_ASSERT(mPaintWorkers);
+ 
+   if (gfxPrefs::LayersOMTPDumpCapture() && aState->mCapture) {
+     aState->mCapture->Dump();
+   }
+ 
+   RefPtr<CompositorBridgeChild> cbc(CompositorBridgeChild::Get());
+   RefPtr<CapturedTiledPaintState> state(aState);
+ 
+   cbc->NotifyBeginAsyncPaint(state);
+ 
+   RefPtr<PaintThread> self = this;
+   RefPtr<Runnable> task = NS_NewRunnableFunction(
+       "PaintThread::PaintTiledContents", [self, cbc, state]() -> void {
+         self->AsyncPaintTiledContents(cbc, state);
+       });
+ 
++  nsIEventTarget* paintThread = mPaintWorkers ?
++    static_cast<nsIEventTarget*>(mPaintWorkers.get()) :
++    static_cast<nsIEventTarget*>(sThread.get());
++
+ #ifndef OMTP_FORCE_SYNC
+-  mPaintWorkers->Dispatch(task.forget());
++  paintThread->Dispatch(task.forget());
+ #else
+-  SyncRunnable::DispatchToThread(mPaintWorkers, task);
++  SyncRunnable::DispatchToThread(paintThread, task);
+ #endif
+ }
+ 
+ void PaintThread::AsyncPaintTiledContents(CompositorBridgeChild* aBridge,
+                                           CapturedTiledPaintState* aState) {
+   MOZ_ASSERT(IsOnPaintWorkerThread());
+   MOZ_ASSERT(aState);
+ 

+ 48 - 57
comm-esr60/mozilla-esr60/patches/1578075-70.patch → rel-257/mozilla-esr60/patches/1578075-71a1.patch

@@ -1,43 +1,44 @@
 # HG changeset patch
 # User Ryan Hunt <rhunt@eqrion.net>
 # Date 1568128834 0
-# Node ID ffefc518e569164c2c2e62258504bdc69d111bb3
-# Parent  1cd680a6eb289d89e9b169b0cae744ab0dfc536b
-Bug 1578075 - Increase stack size of paint thread/workers on OSX Catalina or higher to workaround crash from recursion in CoreText. r=jrmuizel a=lizzard
+# Node ID cd0ea6dafa051426035949cfbbfdeb04c1c05661
+# Parent  043288bd5362454f19d0103347fc40937213b777
+Bug 1578075 - Increase stack size of paint thread/workers on OSX Catalina or higher to workaround crash from recursion in CoreText. r=jrmuizel
 
 Differential Revision: https://phabricator.services.mozilla.com/D45370
 
 diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
 --- a/gfx/layers/PaintThread.cpp
 +++ b/gfx/layers/PaintThread.cpp
-@@ -7,16 +7,20 @@
- #include "PaintThread.h"
- 
- #include "base/task.h"
- #include "gfxPrefs.h"
+@@ -14,17 +14,21 @@
+ #include "GeckoProfiler.h"
  #include "mozilla/layers/CompositorBridgeChild.h"
+ #include "mozilla/layers/ShadowLayers.h"
+ #include "mozilla/layers/SyncObject.h"
  #include "mozilla/gfx/2D.h"
  #include "mozilla/Preferences.h"
+ #include "mozilla/SharedThreadPool.h"
  #include "mozilla/SyncRunnable.h"
 +#ifdef XP_MACOSX
 +#include "nsCocoaFeatures.h"
 +#endif
+ #include "nsIPropertyBag2.h"
 +#include "nsIThreadManager.h"
+ #include "nsServiceManagerUtils.h"
+ #include "prsystem.h"
  
- namespace mozilla {
- namespace layers {
- 
- using namespace gfx;
+ // Uncomment the following line to dispatch sync runnables when
+ // painting so that rasterization happens synchronously from
+ // the perspective of the main thread
+ // #define OMTP_FORCE_SYNC
  
- StaticAutoPtr<PaintThread> PaintThread::sSingleton;
- StaticRefPtr<nsIThread> PaintThread::sThread;
-@@ -34,23 +38,40 @@ PaintThread::AddRef()
+@@ -117,21 +121,38 @@ void PaintThread::AddRef() {}
+   PaintThread::sSingleton = new PaintThread();
  
- void
- PaintThread::InitOnPaintThread()
- {
-   MOZ_ASSERT(!NS_IsMainThread());
-   sThreadId = PlatformThread::CurrentId();
+   if (!PaintThread::sSingleton->Init()) {
+     gfxCriticalNote << "Unable to start paint thread";
+     PaintThread::sSingleton = nullptr;
+   }
  }
  
 +static uint32_t GetPaintThreadStackSize() {
@@ -56,9 +57,7 @@ diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
 +#endif
 +}
 +
- bool
- PaintThread::Init()
- {
+ bool PaintThread::Init() {
    MOZ_ASSERT(NS_IsMainThread());
  
    RefPtr<nsIThread> thread;
@@ -70,40 +69,31 @@ diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp
    }
    sThread = thread;
  
-   nsCOMPtr<nsIRunnable> paintInitTask =
-     NewRunnableMethod("PaintThread::InitOnPaintThread",
-                       this, &PaintThread::InitOnPaintThread);
-@@ -71,16 +92,26 @@ PaintThread::Start()
+   // Only create paint workers for tiling if we are using tiling or could
+   // expect to dynamically switch to tiling in the future
+   if (gfxPlatform::GetPlatform()->UsesTiling()) {
+@@ -150,16 +171,17 @@ void PaintThread::InitOnPaintThread() {
+ }
  
- /* static */ PaintThread*
- PaintThread::Get()
- {
+ void PaintThread::InitPaintWorkers() {
    MOZ_ASSERT(NS_IsMainThread());
-   return PaintThread::sSingleton.get();
+   int32_t count = PaintThread::CalculatePaintWorkerCount();
+   if (count != 1) {
+     mPaintWorkers = SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"),
+                                           count);
++    mPaintWorkers->SetThreadStackSize(GetPaintThreadStackSize());
+   }
  }
  
-+// void PaintThread::InitPaintWorkers() {
-+//    MOZ_ASSERT(NS_IsMainThread());
-+//    int32_t count = PaintThread::CalculatePaintWorkerCount();
-+//    if (count != 1) {
-+//      mPaintWorkers =
-+//          SharedThreadPool::Get(NS_LITERAL_CSTRING("PaintWorker"), count);
-+// +    mPaintWorkers->SetThreadStackSize(GetPaintThreadStackSize());
-+//    }
-+// }
-+
- void
- DestroyPaintThread(UniquePtr<PaintThread>&& pt)
- {
+ void DestroyPaintThread(UniquePtr<PaintThread>&& pt) {
    MOZ_ASSERT(PaintThread::IsOnPaintThread());
    pt->ShutdownOnPaintThread();
  }
  
- /* static */ void
 diff --git a/widget/cocoa/nsCocoaFeatures.h b/widget/cocoa/nsCocoaFeatures.h
 --- a/widget/cocoa/nsCocoaFeatures.h
 +++ b/widget/cocoa/nsCocoaFeatures.h
-@@ -18,16 +18,17 @@ public:
+@@ -18,16 +18,17 @@ class nsCocoaFeatures {
    static int32_t OSXVersionMajor();
    static int32_t OSXVersionMinor();
    static int32_t OSXVersionBugFix();
@@ -114,13 +104,13 @@ diff --git a/widget/cocoa/nsCocoaFeatures.h b/widget/cocoa/nsCocoaFeatures.h
    static bool OnMojaveOrLater();
 +  static bool OnCatalinaOrLater();
  
-   static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix=0);
+   static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor,
+                                int32_t aBugFix = 0);
  
-   // These are utilities that do not change or depend on the value of mOSXVersion
-   // and instead just encapsulate the encoding algorithm.  Note that GetVersion
-   // actually adjusts to the lowest supported OS, so it will always return
-   // a "supported" version.  GetSystemVersion does not make any modifications.
-   static void GetSystemVersion(int &aMajor, int &aMinor, int &aBugFix);
+   // These are utilities that do not change or depend on the value of
+   // mOSXVersion and instead just encapsulate the encoding algorithm.  Note that
+   // GetVersion actually adjusts to the lowest supported OS, so it will always
+   // return a "supported" version.  GetSystemVersion does not make any
 diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm
 --- a/widget/cocoa/nsCocoaFeatures.mm
 +++ b/widget/cocoa/nsCocoaFeatures.mm
@@ -142,8 +132,7 @@ diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm
  
  #import <Cocoa/Cocoa.h>
  
-@@ -183,13 +184,17 @@ Gecko_OnSierraOrLater()
- }
+@@ -184,12 +185,18 @@ Gecko_OnSierraOrLater()
  
  /* static */ bool
  nsCocoaFeatures::OnMojaveOrLater()
@@ -151,11 +140,13 @@ diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm
      return (OSXVersion() >= MAC_OS_X_VERSION_10_14_HEX);
  }
  
-+/* static */ bool nsCocoaFeatures::OnCatalinaOrLater() {
-+  return (OSXVersion() >= MAC_OS_X_VERSION_10_15_HEX);
+ /* static */ bool
++nsCocoaFeatures::OnCatalinaOrLater()
++{
++    return (OSXVersion() >= MAC_OS_X_VERSION_10_15_HEX);
 +}
 +
- /* static */ bool
++/* static */ bool
  nsCocoaFeatures::IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix)
  {
      return OSXVersion() >= GetVersion(aMajor, aMinor, aBugFix);

+ 6 - 0
rel-257/mozilla-esr60/patches/series

@@ -52,3 +52,9 @@ NOBUG-0c5f5c2e2a86-64a1.patch
 1562176-70a1.patch
 1566465-70a1.patch
 1578303_enable_loginmanagercontextmenu-71a1.patch
+1454978-61a1.patch
+1458462-61a1.patch
+1461775-62a1.patch
+1477799-63a1.patch
+1473732-63a1.patch
+1578075-71a1.patch