From 52d5447f23b3ddaa765d42806f26cb5843cd8e8d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 22 Jun 2017 21:12:20 -0700 Subject: [PATCH] Add Advanced Layers to the compositor line in about:support. (bug 1365879 part 22, r=milan) --HG-- extra : rebase_source : 123d4190c0343b60491f34757b26532b9def5075 --- dom/base/nsDOMWindowUtils.cpp | 20 +++++++++++++++++++ dom/interfaces/base/nsIDOMWindowUtils.idl | 5 +++++ gfx/layers/CompositorTypes.h | 2 ++ gfx/layers/ipc/LayersMessageUtils.h | 2 ++ gfx/layers/mlgpu/LayerManagerMLGPU.cpp | 1 + toolkit/content/aboutSupport.js | 14 +++++++++---- toolkit/modules/Troubleshoot.jsm | 1 + .../tests/browser/browser_Troubleshoot.js | 3 +++ 8 files changed, 44 insertions(+), 4 deletions(-) diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 12cbf4139a2a..0ed772e098d9 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -2330,6 +2330,26 @@ nsDOMWindowUtils::GetLayerManagerRemote(bool* retval) return NS_OK; } +NS_IMETHODIMP +nsDOMWindowUtils::GetUsingAdvancedLayers(bool* retval) +{ + nsCOMPtr widget = GetWidget(); + if (!widget) { + return NS_ERROR_FAILURE; + } + + LayerManager *mgr = widget->GetLayerManager(); + if (!mgr) { + return NS_ERROR_FAILURE; + } + + *retval = false; + if (KnowsCompositor* fwd = mgr->AsKnowsCompositor()) { + *retval = fwd->GetTextureFactoryIdentifier().mUsingAdvancedLayers; + } + return NS_OK; +} + NS_IMETHODIMP nsDOMWindowUtils::GetSupportsHardwareH264Decoding(JS::MutableHandle aPromise) { diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index 8df27b017c87..ccc2dfa09f2a 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -1416,6 +1416,11 @@ interface nsIDOMWindowUtils : nsISupports { */ readonly attribute boolean layerManagerRemote; + /** + * True if advanced layers is enabled on this window, false otherwise. + */ + readonly attribute boolean usingAdvancedLayers; + /** * Returns a Promise that will be resolved with a string once the capabilities * of the h264 decoder have been determined. diff --git a/gfx/layers/CompositorTypes.h b/gfx/layers/CompositorTypes.h index fd67cbedf265..4b0e4c1b5102 100644 --- a/gfx/layers/CompositorTypes.h +++ b/gfx/layers/CompositorTypes.h @@ -175,6 +175,7 @@ struct TextureFactoryIdentifier bool mSupportsPartialUploads; bool mSupportsComponentAlpha; bool mSupportsBackdropCopyForComponentAlpha; + bool mUsingAdvancedLayers; SyncHandle mSyncHandle; explicit TextureFactoryIdentifier(LayersBackend aLayersBackend = LayersBackend::LAYERS_NONE, @@ -193,6 +194,7 @@ struct TextureFactoryIdentifier , mSupportsPartialUploads(aSupportsPartialUploads) , mSupportsComponentAlpha(aSupportsComponentAlpha) , mSupportsBackdropCopyForComponentAlpha(true) + , mUsingAdvancedLayers(false) , mSyncHandle(aSyncHandle) {} }; diff --git a/gfx/layers/ipc/LayersMessageUtils.h b/gfx/layers/ipc/LayersMessageUtils.h index d6869875c5fd..81bc9b9a3204 100644 --- a/gfx/layers/ipc/LayersMessageUtils.h +++ b/gfx/layers/ipc/LayersMessageUtils.h @@ -304,6 +304,7 @@ struct ParamTraits WriteParam(aMsg, aParam.mSupportsPartialUploads); WriteParam(aMsg, aParam.mSupportsComponentAlpha); WriteParam(aMsg, aParam.mSupportsBackdropCopyForComponentAlpha); + WriteParam(aMsg, aParam.mUsingAdvancedLayers); WriteParam(aMsg, aParam.mSyncHandle); } @@ -317,6 +318,7 @@ struct ParamTraits ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads) && ReadParam(aMsg, aIter, &aResult->mSupportsComponentAlpha) && ReadParam(aMsg, aIter, &aResult->mSupportsBackdropCopyForComponentAlpha) && + ReadParam(aMsg, aIter, &aResult->mUsingAdvancedLayers) && ReadParam(aMsg, aIter, &aResult->mSyncHandle); return result; } diff --git a/gfx/layers/mlgpu/LayerManagerMLGPU.cpp b/gfx/layers/mlgpu/LayerManagerMLGPU.cpp index e04c002ca4d7..34af706ba426 100644 --- a/gfx/layers/mlgpu/LayerManagerMLGPU.cpp +++ b/gfx/layers/mlgpu/LayerManagerMLGPU.cpp @@ -183,6 +183,7 @@ LayerManagerMLGPU::GetTextureFactoryIdentifier() ident = mDevice->GetTextureFactoryIdentifier(); } ident.mSupportsBackdropCopyForComponentAlpha = SupportsBackdropCopyForComponentAlpha(); + ident.mUsingAdvancedLayers = true; return ident; } diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index e3ca404f0709..dcb3a477bd78 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -393,16 +393,22 @@ var snapshotFormatters = { } // graphics-features-tbody - - let compositor = data.windowLayerManagerRemote - ? data.windowLayerManagerType - : "BasicLayers (" + strings.GetStringFromName("mainThreadNoOMTC") + ")"; + let compositor = ""; + if (data.windowLayerManagerRemote) { + compositor = data.windowLayerManagerType; + if (data.windowUsingAdvancedLayers) { + compositor += " (Advanced Layers)"; + } + } else { + compositor = "BasicLayers (" + strings.GetStringFromName("mainThreadNoOMTC") + ")"; + } addRow("features", "compositing", compositor); delete data.windowLayerManagerRemote; delete data.windowLayerManagerType; delete data.numTotalWindows; delete data.numAcceleratedWindows; delete data.numAcceleratedWindowsMessage; + delete data.windowUsingAdvancedLayers; addRow("features", "asyncPanZoom", apzInfo.length diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm index c214b9a3ede8..dc70dd12043c 100644 --- a/toolkit/modules/Troubleshoot.jsm +++ b/toolkit/modules/Troubleshoot.jsm @@ -365,6 +365,7 @@ var dataProviders = { data.numTotalWindows++; data.windowLayerManagerType = winUtils.layerManagerType; data.windowLayerManagerRemote = winUtils.layerManagerRemote; + data.windowUsingAdvancedLayers = winUtils.usingAdvancedLayers; } catch (e) { continue; } diff --git a/toolkit/modules/tests/browser/browser_Troubleshoot.js b/toolkit/modules/tests/browser/browser_Troubleshoot.js index 0d671567b37c..25fd42801c9d 100644 --- a/toolkit/modules/tests/browser/browser_Troubleshoot.js +++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js @@ -252,6 +252,9 @@ const SNAPSHOT_SCHEMA = { windowLayerManagerRemote: { type: "boolean", }, + windowUsingAdvancedLayers: { + type: "boolean", + }, currentAudioBackend: { type: "string", },