From 43118373ed5f299ef1595c8bf4b0540f4e89f2e6 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Thu, 25 Jan 2018 14:12:39 -0600 Subject: [PATCH] Enable parallel painting on OSX and cap the amount of paint workers to 4. (bug 1430793, r=milan) --HG-- extra : rebase_source : 9d5c853f84b160819540cc062fb84f4bea8fcb02 --- gfx/layers/PaintThread.cpp | 9 +++------ modules/libpref/init/all.js | 6 +++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp index 0a72f8f3c666..a92441cd3409 100644 --- a/gfx/layers/PaintThread.cpp +++ b/gfx/layers/PaintThread.cpp @@ -137,13 +137,10 @@ PaintThread::CalculatePaintWorkerCount() int32_t workerCount = gfxPrefs::LayersOMTPPaintWorkers(); - // If not manually specified, default to (cpuCores * 3) / 4 + // 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::max((cpuCores * 3) / 4, 1); - - if (workerCount > 32) { - workerCount = 32; - } + workerCount = std::min(std::max((cpuCores * 3) / 4, 1), 4); } return workerCount; diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index a988a29397c9..386ce7070073 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -5935,5 +5935,9 @@ pref("layers.omtp.enabled", true); #else pref("layers.omtp.enabled", false); #endif -pref("layers.omtp.release-capture-on-main-thread", false); +#if defined(XP_MACOSX) +pref("layers.omtp.paint-workers", -1); +#else pref("layers.omtp.paint-workers", 1); +#endif +pref("layers.omtp.release-capture-on-main-thread", false);