Bug 1337487 - Disable WebRender on windows when the GPU process is disabled r=kats

--HG--
extra : amend_source : 0203452b319c21331f1f0ebcd74e3f843b7785e1
This commit is contained in:
Ryan Hunt 2017-02-09 00:33:54 -06:00
parent 61bc491994
commit b782e91daf
5 changed files with 60 additions and 14 deletions

View File

@ -25,6 +25,7 @@ namespace gfx {
_(D3D11_HW_ANGLE, Feature, "Direct3D11 hardware ANGLE") \
_(DIRECT_DRAW, Feature, "DirectDraw") \
_(GPU_PROCESS, Feature, "GPU Process") \
_(WEBRENDER, Feature, "WebRender") \
/* Add new entries above this comment */
enum class Feature : uint32_t {

View File

@ -154,6 +154,8 @@ GPUProcessManager::DisableGPUProcess(const char* aMessage)
gfxConfig::SetFailed(Feature::GPU_PROCESS, FeatureStatus::Failed, aMessage);
gfxCriticalNote << aMessage;
gfxPlatform::NotifyGPUProcessDisabled();
DestroyProcess();
ShutdownVsyncIOThread();
}

View File

@ -689,18 +689,6 @@ 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();
@ -2225,6 +2213,7 @@ gfxPlatform::InitAcceleration()
nullptr,
Preferences::ExactMatch);
InitGPUProcessPrefs();
InitWebRenderConfig();
}
}
@ -2311,6 +2300,47 @@ gfxPlatform::InitCompositorAccelerationPrefs()
}
}
void
gfxPlatform::InitWebRenderConfig()
{
FeatureState& featureWebRender = gfxConfig::GetFeature(Feature::WEBRENDER);
featureWebRender.EnableByDefault();
if (!Preferences::GetBool("gfx.webrender.enabled", false)) {
featureWebRender.UserDisable(
"User disabled WebRender",
NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBRENDER_DISABLED"));
}
// WebRender relies on the GPU process when on Windows
#ifdef XP_WIN
if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS)) {
featureWebRender.ForceDisable(
FeatureStatus::Unavailable,
"GPU Process is disabled",
NS_LITERAL_CSTRING("FEATURE_FAILURE_GPU_PROCESS_DISABLED"));
}
#endif
if (InSafeMode()) {
featureWebRender.ForceDisable(
FeatureStatus::Unavailable,
"Safe-mode is enabled",
NS_LITERAL_CSTRING("FEATURE_FAILURE_SAFE_MODE"));
}
#ifndef MOZ_ENABLE_WEBRENDER
featureWebRender.ForceDisable(
FeatureStatus::Unavailable,
"Build doesn't include WebRender",
NS_LITERAL_CSTRING("FEATURE_FAILURE_NO_WEBRENDER"));
#endif
// gfxFeature is not usable in the GPU process, so we use gfxVars to transmit this feature
gfxVars::SetUseWebRender(gfxConfig::IsEnabled(Feature::WEBRENDER));
}
bool
gfxPlatform::CanUseHardwareVideoDecoding()
{
@ -2561,6 +2591,18 @@ gfxPlatform::NotifyCompositorCreated(LayersBackend aBackend)
}));
}
/* static */ void
gfxPlatform::NotifyGPUProcessDisabled()
{
if (gfxConfig::IsEnabled(Feature::WEBRENDER)) {
gfxConfig::GetFeature(Feature::WEBRENDER).ForceDisable(
FeatureStatus::Unavailable,
"GPU Process is disabled",
NS_LITERAL_CSTRING("FEATURE_FAILURE_GPU_PROCESS_DISABLED"));
gfxVars::SetUseWebRender(false);
}
}
void
gfxPlatform::FetchAndImportContentDeviceData()
{

View File

@ -652,6 +652,8 @@ public:
*/
static bool PerfWarnings();
static void NotifyGPUProcessDisabled();
void NotifyCompositorCreated(mozilla::layers::LayersBackend aBackend);
mozilla::layers::LayersBackend GetCompositorBackend() const {
return mCompositorBackend;
@ -820,6 +822,7 @@ private:
void InitCompositorAccelerationPrefs();
void InitGPUProcessPrefs();
void InitWebRenderConfig();
static bool IsDXInterop2Blocked();

View File

@ -810,9 +810,7 @@ pref("gfx.logging.peak-texture-usage.enabled", false);
pref("gfx.ycbcr.accurate-conversion", false);
#ifdef MOZ_ENABLE_WEBRENDER
pref("gfx.webrender.enabled", true);
#endif
pref("accessibility.browsewithcaret", false);
pref("accessibility.warn_on_browsewithcaret", true);