diff --git a/gfx/config/gfxConfigManager.cpp b/gfx/config/gfxConfigManager.cpp index 56294f11a739..d8c087b365e1 100644 --- a/gfx/config/gfxConfigManager.cpp +++ b/gfx/config/gfxConfigManager.cpp @@ -66,6 +66,7 @@ void gfxConfigManager::Init() { #ifdef MOZ_WIDGET_GTK mDisableHwCompositingNoWr = true; + mXRenderEnabled = mozilla::Preferences::GetBool("gfx.xrender.enabled"); #endif #ifdef NIGHTLY_BUILD @@ -267,6 +268,13 @@ void gfxConfigManager::ConfigureWebRender() { "FEATURE_FAILURE_SAFE_MODE"_ns); } + if (mXRenderEnabled) { + // XRender and WebRender don't play well together. XRender is disabled by + // default. If the user opts into it don't enable webrender. + mFeatureWr->ForceDisable(FeatureStatus::Blocked,"XRender is enabled", + "FEATURE_FAILURE_XRENDER"_ns); + } + mFeatureWrAngle->DisableByDefault(FeatureStatus::OptIn, "WebRender ANGLE is an opt-in feature", "FEATURE_FAILURE_DEFAULT_OFF"_ns); diff --git a/gfx/config/gfxConfigManager.h b/gfx/config/gfxConfigManager.h index 45a8f1993f99..0f7c196b55c4 100644 --- a/gfx/config/gfxConfigManager.h +++ b/gfx/config/gfxConfigManager.h @@ -34,6 +34,7 @@ class gfxConfigManager { mWrPictureCaching(false), mWrPartialPresent(false), mGPUProcessAllowSoftware(false), + mXRenderEnabled(false), mWrEnvForceEnabled(false), mWrEnvForceDisabled(false), mHwStretchingSupport(false), @@ -81,6 +82,7 @@ class gfxConfigManager { bool mWrPictureCaching; bool mWrPartialPresent; bool mGPUProcessAllowSoftware; + bool mXRenderEnabled; /** * Environment variables diff --git a/gfx/tests/gtest/TestConfigManager.cpp b/gfx/tests/gtest/TestConfigManager.cpp index 65782c1ccb2a..cce30899e2e9 100644 --- a/gfx/tests/gtest/TestConfigManager.cpp +++ b/gfx/tests/gtest/TestConfigManager.cpp @@ -696,3 +696,19 @@ TEST_F(GfxConfigManager, WebRenderAtRefreshRateThreshold) { EXPECT_TRUE(mFeatures.mGPUProcess.IsEnabled()); EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled()); } + +TEST_F(GfxConfigManager, WebRenderWhenXRenderEnabled) { + mXRenderEnabled = true; + ConfigureWebRender(); + + EXPECT_TRUE(mFeatures.mWrQualified.IsEnabled()); + EXPECT_FALSE(mFeatures.mWr.IsEnabled()); + EXPECT_FALSE(mFeatures.mWrCompositor.IsEnabled()); + EXPECT_FALSE(mFeatures.mWrAngle.IsEnabled()); + EXPECT_FALSE(mFeatures.mWrDComp.IsEnabled()); + EXPECT_FALSE(mFeatures.mWrPartial.IsEnabled()); + EXPECT_TRUE(mFeatures.mHwCompositing.IsEnabled()); + EXPECT_TRUE(mFeatures.mGPUProcess.IsEnabled()); + EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled()); +} +