Bug 1326421 - Clean up remaining uses of gfxPrefs::WebRenderEnabled. r?dvander
MozReview-Commit-ID: 5PqILhx9Abx
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -385,17 +385,17 @@ CompositorBridgeParent::Initialize()
{ // scope lock
MonitorAutoLock lock(*sIndirectLayerTreesLock);
sIndirectLayerTrees[mRootLayerTreeID].mParent = this;
}
LayerScope::SetPixelScale(mScale.scale);
- if (!gfxPrefs::WebRenderEnabled()) {
+ if (!mOptions.UseWebRender()) {
mCompositorScheduler = new CompositorVsyncScheduler(this, mWidget);
}
}
mozilla::ipc::IPCResult
CompositorBridgeParent::RecvReset(nsTArray<LayersBackend>&& aBackendHints,
const uint64_t& aSeqNo,
bool* aResult,
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -935,19 +935,19 @@ gfxPlatform::InitLayersIPC()
{
if (sLayersIPCIsUp) {
return;
}
sLayersIPCIsUp = true;
if (XRE_IsParentProcess())
{
- if (gfxPrefs::WebRenderEnabled()) {
- RenderThread::Start();
- }
+#ifdef MOZ_ENABLE_WEBRENDER
+ RenderThread::Start();
+#endif
layers::CompositorThreadHolder::Start();
}
}
/* static */ void
gfxPlatform::ShutdownLayersIPC()
{
if (!sLayersIPCIsUp) {
@@ -964,19 +964,19 @@ gfxPlatform::ShutdownLayersIPC()
}
} else if (XRE_IsParentProcess()) {
gfx::VRManagerChild::ShutDown();
layers::CompositorBridgeChild::ShutDown();
layers::ImageBridgeChild::ShutDown();
// This has to happen after shutting down the child protocols.
layers::CompositorThreadHolder::Shutdown();
- if (gfxPrefs::WebRenderEnabled()) {
- RenderThread::ShutDown();
- }
+#ifdef MOZ_ENABLE_WEBRENDER
+ RenderThread::ShutDown();
+#endif
} else {
// TODO: There are other kind of processes and we should make sure gfx
// stuff is either not created there or shut down properly.
}
}
void
gfxPlatform::WillShutdown()
@@ -2461,22 +2461,16 @@ gfxPlatform::AsyncPanZoomEnabled()
#if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_UIKIT)
// For XUL applications (everything but Firefox on Android)
// we only want to use APZ when E10S is enabled. If
// we ever get input events off the main thread we can consider relaxing
// this requirement.
if (!BrowserTabsRemoteAutostart()) {
return false;
}
-#ifdef MOZ_ENABLE_WEBRENDER
- // For webrender hacking we have a special pref to disable APZ even with e10s
- if (gfxPrefs::WebRenderEnabled() && !gfxPrefs::APZAllowWithWebRender()) {
- return false;
- }
-#endif // MOZ_ENABLE_WEBRENDER
#endif
#ifdef MOZ_WIDGET_ANDROID
return true;
#else
return gfxPrefs::AsyncPanZoomEnabledDoNotUseDirectly();
#endif
}
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -421,20 +421,20 @@ private:
DECL_GFX_PREF(Once, "gfx.vr.openvr-runtime", VROpenVRRuntime, std::string, "");
DECL_GFX_PREF(Live, "gfx.vsync.collect-scroll-transforms", CollectScrollTransforms, bool, false);
DECL_GFX_PREF(Once, "gfx.vsync.compositor.unobserve-count", CompositorUnobserveCount, int32_t, 10);
DECL_GFX_PREF(Live, "gfx.webrender.profiler.enable", WebRenderProfilerEnabled, bool, false);
// Use vsync events generated by hardware
DECL_GFX_PREF(Once, "gfx.work-around-driver-bugs", WorkAroundDriverBugs, bool, true);
DECL_GFX_PREF(Once, "gfx.screen-mirroring.enabled", ScreenMirroringEnabled, bool, false);
#ifdef MOZ_ENABLE_WEBRENDER
- DECL_GFX_PREF(Once, "gfx.webrender.enabled", WebRenderEnabled, bool, false);
+ DECL_GFX_PREF(Live, "gfx.webrender.enabled", WebRenderEnabledDoNotUseDirectly, bool, false);
#else
public:
- static bool WebRenderEnabled() { return false; }
+ static bool WebRenderEnabledDoNotUseDirectly() { return false; }
private:
#endif
DECL_GFX_PREF(Live, "gl.ignore-dx-interop2-blacklist", IgnoreDXInterop2Blacklist, bool, false);
DECL_GFX_PREF(Live, "gl.msaa-level", MSAALevel, uint32_t, 2);
#if defined(XP_MACOSX)
DECL_GFX_PREF(Live, "gl.multithreaded", GLMultithreaded, bool, false);
#endif
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -1293,17 +1293,28 @@ 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());
+ // For now we decide whether or not to enable WR on this widget by the current
+ // value of the pref (this is the only place in the code allowed to check the
+ // value of the pref). We might want to change this eventually and drop the
+ // pref entirely.
+ bool enableWR = gfxPrefs::WebRenderEnabledDoNotUseDirectly();
+ bool enableAPZ = UseAPZ();
+ if (enableWR && !gfxPrefs::APZAllowWithWebRender()) {
+ // Disable APZ on widgets using WebRender, since it doesn't work yet. Allow
+ // it on non-WR widgets or if the pref forces it on.
+ enableAPZ = false;
+ }
+ CompositorOptions options(enableAPZ, enableWR);
RefPtr<LayerManager> lm;
if (options.UseWebRender()) {
lm = new WebRenderLayerManager(this);
} else {
lm = new ClientLayerManager(this);
}