diff --git a/gfx/layers/PaintThread.cpp b/gfx/layers/PaintThread.cpp index 8517a0205b81..0a72f8f3c666 100644 --- a/gfx/layers/PaintThread.cpp +++ b/gfx/layers/PaintThread.cpp @@ -122,6 +122,10 @@ PaintThread::AddRef() /* static */ int32_t PaintThread::CalculatePaintWorkerCount() { + if (!gfxPlatform::GetPlatform()->UsesTiling()) { + return 0; + } + int32_t cpuCores = 1; nsCOMPtr systemInfo = do_GetService(NS_SYSTEMINFO_CONTRACTID); if (systemInfo) { diff --git a/gfx/layers/PaintThread.h b/gfx/layers/PaintThread.h index 588caf7de0ed..917ac04f06ba 100644 --- a/gfx/layers/PaintThread.h +++ b/gfx/layers/PaintThread.h @@ -300,11 +300,11 @@ public: void Release(); void AddRef(); + static int32_t CalculatePaintWorkerCount(); + private: PaintThread(); - static int32_t CalculatePaintWorkerCount(); - bool Init(); void ShutdownOnPaintThread(); void InitOnPaintThread(); diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index 2efffed0334d..0abff0d081a9 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -469,7 +469,9 @@ var snapshotFormatters = { addRowFromKey("features", "webgl2Extensions"); addRowFromKey("features", "supportsHardwareH264", "hardwareH264"); addRowFromKey("features", "direct2DEnabled", "#Direct2D"); + addRowFromKey("features", "usesTiling"); addRowFromKey("features", "offMainThreadPaintEnabled"); + addRowFromKey("features", "offMainThreadPaintWorkerCount"); if ("directWriteEnabled" in data) { let message = data.directWriteEnabled; diff --git a/toolkit/locales/en-US/chrome/global/aboutSupport.properties b/toolkit/locales/en-US/chrome/global/aboutSupport.properties index c7baae10ff56..9584b166e6a5 100644 --- a/toolkit/locales/en-US/chrome/global/aboutSupport.properties +++ b/toolkit/locales/en-US/chrome/global/aboutSupport.properties @@ -100,7 +100,9 @@ glcontextCrashGuard = OpenGL resetOnNextRestart = Reset on Next Restart gpuProcessKillButton = Terminate GPU Process gpuDeviceResetButton = Trigger Device Reset +usesTiling = Uses Tiling offMainThreadPaintEnabled = Off Main Thread Painting Enabled +offMainThreadPaintWorkerCount = Off Main Thread Painting Worker Count audioBackend = Audio Backend maxAudioChannels = Max Channels diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm index db7181a0db6b..7ddf2a9da23c 100644 --- a/toolkit/modules/Troubleshoot.jsm +++ b/toolkit/modules/Troubleshoot.jsm @@ -472,7 +472,9 @@ var dataProviders = { DWriteEnabled: "directWriteEnabled", DWriteVersion: "directWriteVersion", cleartypeParameters: "clearTypeParameters", + UsesTiling: "usesTiling", OffMainThreadPaintEnabled: "offMainThreadPaintEnabled", + OffMainThreadPaintWorkerCount: "offMainThreadPaintWorkerCount", }; for (let prop in gfxInfoProps) { diff --git a/widget/GfxInfoBase.cpp b/widget/GfxInfoBase.cpp index 1fb7d32d18f4..20df283f1aaa 100644 --- a/widget/GfxInfoBase.cpp +++ b/widget/GfxInfoBase.cpp @@ -32,6 +32,7 @@ #include "mozilla/gfx/GPUProcessManager.h" #include "mozilla/gfx/Logging.h" #include "mozilla/gfx/gfxVars.h" +#include "mozilla/layers/PaintThread.h" #include "MediaPrefs.h" #include "gfxPrefs.h" #include "gfxPlatform.h" @@ -1488,6 +1489,13 @@ GfxInfoBase::GetWebRenderEnabled(bool* aWebRenderEnabled) return NS_OK; } +NS_IMETHODIMP +GfxInfoBase::GetUsesTiling(bool* aUsesTiling) +{ + *aUsesTiling = gfxPlatform::GetPlatform()->UsesTiling(); + return NS_OK; +} + NS_IMETHODIMP GfxInfoBase::GetOffMainThreadPaintEnabled(bool* aOffMainThreadPaintEnabled) { @@ -1495,6 +1503,17 @@ GfxInfoBase::GetOffMainThreadPaintEnabled(bool* aOffMainThreadPaintEnabled) return NS_OK; } +NS_IMETHODIMP +GfxInfoBase::GetOffMainThreadPaintWorkerCount(int32_t* aOffMainThreadPaintWorkerCount) +{ + if (gfxConfig::IsEnabled(Feature::OMTP)) { + *aOffMainThreadPaintWorkerCount = layers::PaintThread::CalculatePaintWorkerCount(); + } else { + *aOffMainThreadPaintWorkerCount = 0; + } + return NS_OK; +} + NS_IMETHODIMP GfxInfoBase::GetIsHeadless(bool* aIsHeadless) { diff --git a/widget/GfxInfoBase.h b/widget/GfxInfoBase.h index b812f2f881ed..33188c1041f5 100644 --- a/widget/GfxInfoBase.h +++ b/widget/GfxInfoBase.h @@ -63,7 +63,9 @@ public: NS_IMETHOD GetUsingGPUProcess(bool *aOutValue) override; NS_IMETHOD GetWebRenderEnabled(bool* aWebRenderEnabled) override; NS_IMETHOD GetIsHeadless(bool* aIsHeadless) override; + NS_IMETHOD GetUsesTiling(bool* aUsesTiling) override; NS_IMETHOD GetOffMainThreadPaintEnabled(bool* aOffMainThreadPaintEnabled) override; + NS_IMETHOD GetOffMainThreadPaintWorkerCount(int32_t* aOffMainThreadPaintWorkerCount) override; // Initialization function. If you override this, you must call this class's // version of Init first. diff --git a/widget/nsIGfxInfo.idl b/widget/nsIGfxInfo.idl index 9a8d013ebef0..a369b8e5db2b 100644 --- a/widget/nsIGfxInfo.idl +++ b/widget/nsIGfxInfo.idl @@ -25,7 +25,9 @@ interface nsIGfxInfo : nsISupports readonly attribute DOMString ContentBackend; readonly attribute boolean WebRenderEnabled; readonly attribute boolean isHeadless; + readonly attribute boolean UsesTiling; readonly attribute boolean OffMainThreadPaintEnabled; + readonly attribute long OffMainThreadPaintWorkerCount; // XXX: Switch to a list of devices, rather than explicitly numbering them.