Bug 1326421 - Add a compositor option for WebRender being enabled or not. r?dvander
MozReview-Commit-ID: Cu7xm9NxHxR
--- a/gfx/ipc/CompositorOptions.h
+++ b/gfx/ipc/CompositorOptions.h
@@ -26,30 +26,35 @@ namespace layers {
* and are accessible to content processes over PCompositorBridge as well.
*/
class CompositorOptions
{
public:
// This constructor needed for IPDL purposes, don't use it anywhere else.
CompositorOptions()
: mUseAPZ(false)
+ , mUseWebRender(false)
{
}
- explicit CompositorOptions(bool aUseAPZ)
+ explicit CompositorOptions(bool aUseAPZ,
+ bool aUseWebRender)
: mUseAPZ(aUseAPZ)
+ , mUseWebRender(aUseWebRender)
{
}
bool UseAPZ() const { return mUseAPZ; }
+ bool UseWebRender() const { return mUseWebRender; }
friend struct IPC::ParamTraits<CompositorOptions>;
private:
bool mUseAPZ;
+ bool mUseWebRender;
// Make sure to add new fields to the ParamTraits implementation
};
} // namespace layers
} // namespace mozilla
#endif // _include_mozilla_gfx_ipc_CompositorOptions_h_
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -1321,18 +1321,20 @@ struct ParamTraits<mozilla::Array<T, Len
template <>
struct ParamTraits<mozilla::layers::CompositorOptions>
{
typedef mozilla::layers::CompositorOptions paramType;
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, aParam.mUseAPZ);
+ WriteParam(aMsg, aParam.mUseWebRender);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
- return ReadParam(aMsg, aIter, &aResult->mUseAPZ);
+ return ReadParam(aMsg, aIter, &aResult->mUseAPZ)
+ && ReadParam(aMsg, aIter, &aResult->mUseWebRender);
}
};
} /* namespace IPC */
#endif /* __GFXMESSAGEUTILS_H__ */
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -1293,25 +1293,25 @@ void nsBaseWidget::CreateCompositor(int
// If we've already received a shutdown notification, don't try
// create a new compositor.
if (!mShutdownObserver) {
return;
}
CreateCompositorVsyncDispatcher();
+ CompositorOptions options(UseAPZ(), gfxPrefs::WebRenderEnabled());
+
RefPtr<LayerManager> lm;
- if (gfxPrefs::WebRenderEnabled()) {
+ if (options.UseWebRender()) {
lm = new WebRenderLayerManager(this);
} else {
lm = new ClientLayerManager(this);
}
- CompositorOptions options(UseAPZ());
-
gfx::GPUProcessManager* gpu = gfx::GPUProcessManager::Get();
mCompositorSession = gpu->CreateTopLevelCompositor(
this,
lm,
GetDefaultScale(),
options,
UseExternalCompositingSurface(),
gfx::IntSize(aWidth, aHeight));
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -3902,17 +3902,17 @@ nsWindow::GetLayerManager(PLayerTransact
// Ensure we have a widget proxy even if we're not using the compositor,
// since all our transparent window handling lives there.
CompositorWidgetInitData initData(
reinterpret_cast<uintptr_t>(mWnd),
reinterpret_cast<uintptr_t>(static_cast<nsIWidget*>(this)),
mTransparencyMode);
// If we're not using the compositor, the options don't actually matter.
- CompositorOptions options(false);
+ CompositorOptions options(false, false);
mBasicLayersSurface = new InProcessWinCompositorWidget(initData, options, this);
mCompositorWidgetDelegate = mBasicLayersSurface;
mLayerManager = CreateBasicLayerManager();
}
NS_ASSERTION(mLayerManager, "Couldn't provide a valid layer manager.");
return mLayerManager;