Bug 1337085 - Add a gfxVar to control whether or not webrender is enabled. r=sotaro

MozReview-Commit-ID: 8Ebc0DbhYbZ
This commit is contained in:
Kartikaya Gupta
2017-02-06 22:22:36 -05:00
parent 839743af59
commit 531c45795f
3 changed files with 15 additions and 5 deletions

View File

@@ -33,6 +33,7 @@ class gfxVarReceiver;
_(PDMWMFDisableD3D11Dlls, nsCString, nsCString()) \
_(PDMWMFDisableD3D9Dlls, nsCString, nsCString()) \
_(DXInterop2Blocked, bool, false) \
_(UseWebRender, bool, false) \
/* Add new entries above this line. */

View File

@@ -689,6 +689,18 @@ gfxPlatform::Init()
#endif
gPlatform->InitAcceleration();
#ifdef MOZ_ENABLE_WEBRENDER
if (XRE_IsParentProcess()) {
// XXX: right now this is just based on the pref. But we may want to
// do other runtime detection of hardware support etc.
// This pref defaults to true, so builds with --enable-webrender have it
// turned on by default, but can have it disabled via pref. The ifdef
// guards this entire block, so builds without --enable-webrender will
// always have the gfxVar default to false.
gfxVars::SetUseWebRender(Preferences::GetBool("gfx.webrender.enabled", true));
}
#endif
if (gfxConfig::IsEnabled(Feature::GPU_PROCESS)) {
GPUProcessManager* gpu = GPUProcessManager::Get();
gpu->LaunchGPUProcess();

View File

@@ -64,6 +64,7 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/gfx/GPUProcessManager.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/Move.h"
#include "mozilla/Services.h"
#include "mozilla/Sprintf.h"
@@ -1300,11 +1301,7 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
CreateCompositorVsyncDispatcher();
// 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 = Preferences::GetBool("gfx.webrender.enabled", false);
bool enableWR = gfx::gfxVars::UseWebRender();
bool enableAPZ = UseAPZ();
if (enableWR && !gfxPrefs::APZAllowWithWebRender()) {
// Disable APZ on widgets using WebRender, since it doesn't work yet. Allow