Bug 1677293 - Enable Software WebRender on Linux nightly for small/medium screens. r=jrmuizel

This patch enables Software WebRender for all Linux users. If their
configuration is also allowlisted for (accelerated) WebRender, then they
will default to that over Software WebRender.

Differential Revision: https://phabricator.services.mozilla.com/D97156
This commit is contained in:
Andrew Osmond 2020-11-20 17:38:53 +00:00
Родитель 9b20afabaf
Коммит d54e45522a
6 изменённых файлов: 166 добавлений и 5 удалений

Просмотреть файл

@ -30,6 +30,7 @@ void gfxConfigManager::Init() {
EmplaceUserPref("gfx.webrender.compositor", mWrCompositorEnabled);
mWrForceEnabled = gfxPlatform::WebRenderPrefEnabled();
mWrForceDisabled = StaticPrefs::gfx_webrender_force_disabled_AtStartup();
mWrSoftwareForceEnabled = StaticPrefs::gfx_webrender_software_AtStartup();
mWrCompositorForceEnabled =
StaticPrefs::gfx_webrender_compositor_force_enabled_AtStartup();
mGPUProcessAllowSoftware =
@ -113,8 +114,21 @@ void gfxConfigManager::ConfigureWebRenderSoftware() {
mFeatureWrSoftware->EnableByDefault();
if (StaticPrefs::gfx_webrender_software_AtStartup()) {
// Note that for testing in CI, software WebRender uses gfx.webrender.software
// to force enable WebRender Software. As a result, we need to prefer that
// over the MOZ_WEBRENDER envvar which is used to otherwise force on WebRender
// (hardware). See bug 1656811.
if (mWrSoftwareForceEnabled) {
mFeatureWrSoftware->UserForceEnable("Force enabled by pref");
} else if (mWrEnvForceEnabled) {
mFeatureWrSoftware->UserDisable(
"User force-enabled full WR",
"FEATURE_FAILURE_USER_FORCE_ENABLED_FULL_WR"_ns);
} else if (mWrForceDisabled || mWrEnvForceDisabled) {
// If the user set the pref to force-disable, let's do that. This
// will override all the other enabling prefs
mFeatureWrSoftware->UserDisable("User force-disabled WR",
"FEATURE_FAILURE_USER_FORCE_DISABLED"_ns);
}
nsCString failureId;

Просмотреть файл

@ -29,6 +29,7 @@ class gfxConfigManager {
mFeatureGPUProcess(nullptr),
mWrForceEnabled(false),
mWrForceDisabled(false),
mWrSoftwareForceEnabled(false),
mWrCompositorForceEnabled(false),
mWrForceAngle(false),
mWrForceAngleNoGPUProcess(false),
@ -75,6 +76,7 @@ class gfxConfigManager {
Maybe<bool> mWrCompositorEnabled;
bool mWrForceEnabled;
bool mWrForceDisabled;
bool mWrSoftwareForceEnabled;
bool mWrCompositorForceEnabled;
bool mWrForceAngle;
bool mWrForceAngleNoGPUProcess;

Просмотреть файл

@ -777,3 +777,106 @@ TEST_F(GfxConfigManager, WebRenderSofwareAndNotQualified) {
EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled());
EXPECT_TRUE(mFeatures.mWrSoftware.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderForceDisabledEnvvar) {
mWrEnvForceDisabled = 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());
EXPECT_FALSE(mFeatures.mWrSoftware.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderSoftwareAllowedForceDisabledEnvvar) {
mWrEnvForceDisabled = true;
mMockGfxInfo->mStatusWrSoftware = nsIGfxInfo::FEATURE_ALLOW_ALWAYS;
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());
EXPECT_FALSE(mFeatures.mWrSoftware.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderForceSoftwareForceDisabledEnvvar) {
mWrEnvForceDisabled = true;
mWrSoftwareForceEnabled = 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());
EXPECT_TRUE(mFeatures.mWrSoftware.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderForceEnabledEnvvar) {
mWrEnvForceEnabled = true;
mMockGfxInfo->mStatusWr = nsIGfxInfo::FEATURE_DENIED;
ConfigureWebRender();
EXPECT_FALSE(mFeatures.mWrQualified.IsEnabled());
EXPECT_TRUE(mFeatures.mWr.IsEnabled());
EXPECT_TRUE(mFeatures.mWrCompositor.IsEnabled());
EXPECT_TRUE(mFeatures.mWrAngle.IsEnabled());
EXPECT_TRUE(mFeatures.mWrDComp.IsEnabled());
EXPECT_TRUE(mFeatures.mWrPartial.IsEnabled());
EXPECT_TRUE(mFeatures.mHwCompositing.IsEnabled());
EXPECT_TRUE(mFeatures.mGPUProcess.IsEnabled());
EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled());
EXPECT_FALSE(mFeatures.mWrSoftware.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderSoftwareAllowedForceEnabledEnvvar) {
mWrEnvForceEnabled = true;
mMockGfxInfo->mStatusWr = nsIGfxInfo::FEATURE_DENIED;
mMockGfxInfo->mStatusWrSoftware = nsIGfxInfo::FEATURE_ALLOW_ALWAYS;
ConfigureWebRender();
EXPECT_FALSE(mFeatures.mWrQualified.IsEnabled());
EXPECT_TRUE(mFeatures.mWr.IsEnabled());
EXPECT_TRUE(mFeatures.mWrCompositor.IsEnabled());
EXPECT_TRUE(mFeatures.mWrAngle.IsEnabled());
EXPECT_TRUE(mFeatures.mWrDComp.IsEnabled());
EXPECT_TRUE(mFeatures.mWrPartial.IsEnabled());
EXPECT_TRUE(mFeatures.mHwCompositing.IsEnabled());
EXPECT_TRUE(mFeatures.mGPUProcess.IsEnabled());
EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled());
EXPECT_FALSE(mFeatures.mWrSoftware.IsEnabled());
}
TEST_F(GfxConfigManager, WebRenderForceSoftwareForceEnabledEnvvar) {
mWrEnvForceEnabled = true;
mWrSoftwareForceEnabled = true;
mMockGfxInfo->mStatusWr = nsIGfxInfo::FEATURE_DENIED;
ConfigureWebRender();
EXPECT_FALSE(mFeatures.mWrQualified.IsEnabled());
EXPECT_TRUE(mFeatures.mWr.IsEnabled());
EXPECT_TRUE(mFeatures.mWrCompositor.IsEnabled());
EXPECT_TRUE(mFeatures.mWrAngle.IsEnabled());
EXPECT_TRUE(mFeatures.mWrDComp.IsEnabled());
EXPECT_TRUE(mFeatures.mWrPartial.IsEnabled());
EXPECT_TRUE(mFeatures.mHwCompositing.IsEnabled());
EXPECT_TRUE(mFeatures.mGPUProcess.IsEnabled());
EXPECT_TRUE(mFeatures.mD3D11HwAngle.IsEnabled());
EXPECT_TRUE(mFeatures.mWrSoftware.IsEnabled());
}

Просмотреть файл

@ -1001,6 +1001,8 @@ const nsAString& GfxDriverInfo::GetDriverVendor(DriverVendor id) {
DECLARE_DRIVER_VENDOR_ID(MesaUnknown, "mesa/unknown");
DECLARE_DRIVER_VENDOR_ID(MesaNouveau, "mesa/nouveau");
DECLARE_DRIVER_VENDOR_ID(NonMesaAll, "non-mesa/all");
DECLARE_DRIVER_VENDOR_ID(HardwareMesaAll, "mesa/hw-all");
DECLARE_DRIVER_VENDOR_ID(SoftwareMesaAll, "mesa/sw-all");
case DriverVendor::Max: // Suppress a warning.
DECLARE_DRIVER_VENDOR_ID(All, "");
}

Просмотреть файл

@ -236,6 +236,10 @@ enum DriverVendor : uint8_t {
MesaUnknown,
// Wildcard for all non-Mesa drivers.
NonMesaAll,
// Wildcard for all hardware Mesa drivers.
HardwareMesaAll,
// Wildcard for all software Mesa drivers.
SoftwareMesaAll,
Max
};

Просмотреть файл

@ -722,6 +722,28 @@ const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() {
V(18, 0, 0, 0), "FEATURE_ROLLOUT_NIGHTLY_ATI_MESA", "Mesa 18.0.0.0");
#endif
////////////////////////////////////
// FEATURE_WEBRENDER_SOFTWARE - ALLOWLIST
#ifdef NIGHTLY_BUILD
APPEND_TO_DRIVER_BLOCKLIST_EXT(
OperatingSystem::Linux, ScreenSizeStatus::SmallAndMedium,
BatteryStatus::All, DesktopEnvironment::All, WindowProtocol::All,
DriverVendor::NonMesaAll, DeviceFamily::All,
nsIGfxInfo::FEATURE_WEBRENDER_SOFTWARE,
nsIGfxInfo::FEATURE_ALLOW_ALWAYS, DRIVER_COMPARISON_IGNORED,
V(0, 0, 0, 0), "FEATURE_ROLLOUT_NIGHTLY_SOFTWARE_WR_NON_MESA_S_M_SCRN",
"");
APPEND_TO_DRIVER_BLOCKLIST_EXT(
OperatingSystem::Linux, ScreenSizeStatus::SmallAndMedium,
BatteryStatus::All, DesktopEnvironment::All, WindowProtocol::All,
DriverVendor::HardwareMesaAll, DeviceFamily::All,
nsIGfxInfo::FEATURE_WEBRENDER_SOFTWARE,
nsIGfxInfo::FEATURE_ALLOW_ALWAYS, DRIVER_COMPARISON_IGNORED,
V(0, 0, 0, 0), "FEATURE_ROLLOUT_NIGHTLY_SOFTWARE_WR_HW_MESA_S_M_SCRN",
"");
#endif
////////////////////////////////////
APPEND_TO_DRIVER_BLOCKLIST_EXT(
@ -754,10 +776,24 @@ bool GfxInfo::DoesWindowProtocolMatch(const nsAString& aBlocklistWindowProtocol,
bool GfxInfo::DoesDriverVendorMatch(const nsAString& aBlocklistVendor,
const nsAString& aDriverVendor) {
if (mIsMesa && aBlocklistVendor.Equals(
GfxDriverInfo::GetDriverVendor(DriverVendor::MesaAll),
nsCaseInsensitiveStringComparator)) {
return true;
if (mIsMesa) {
if (aBlocklistVendor.Equals(
GfxDriverInfo::GetDriverVendor(DriverVendor::MesaAll),
nsCaseInsensitiveStringComparator)) {
return true;
}
if (mIsAccelerated &&
aBlocklistVendor.Equals(
GfxDriverInfo::GetDriverVendor(DriverVendor::HardwareMesaAll),
nsCaseInsensitiveStringComparator)) {
return true;
}
if (!mIsAccelerated &&
aBlocklistVendor.Equals(
GfxDriverInfo::GetDriverVendor(DriverVendor::SoftwareMesaAll),
nsCaseInsensitiveStringComparator)) {
return true;
}
}
if (!mIsMesa && aBlocklistVendor.Equals(
GfxDriverInfo::GetDriverVendor(DriverVendor::NonMesaAll),