Bug 1543217 - Allow qualified Linux machines to get WebRender. r=jrmuizel

Linux machines using Intel graphics with Mesa drivers being at least
18.2.8.0 and not 4k displays should be able to run WebRender well, given
this is a common configuration used for testing already by Mozilla. This
patch allows users meeting said requirements to join the WebRender
experiments on nightly. WebRender will remain disabled by default for
other configurations/devices.

Differential Revision: https://phabricator.services.mozilla.com/D26796
This commit is contained in:
Andrew Osmond 2019-04-09 15:27:16 -04:00
Родитель 02079beb91
Коммит dc64e9d9b7
5 изменённых файлов: 61 добавлений и 9 удалений

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

@ -923,6 +923,7 @@ void gfxPlatform::Init() {
#else
# error "No gfxPlatform implementation available"
#endif
gPlatform->PopulateScreenInfo();
gPlatform->InitAcceleration();
gPlatform->InitWebRenderConfig();
// When using WebRender, we defer initialization of the D3D11 devices until
@ -960,7 +961,6 @@ void gfxPlatform::Init() {
InitLayersIPC();
gPlatform->PopulateScreenInfo();
gPlatform->ComputeTileSize();
#ifdef MOZ_ENABLE_FREETYPE
@ -2511,7 +2511,7 @@ static bool CalculateWrQualifiedPrefValue() {
}
static FeatureState& WebRenderHardwareQualificationStatus(
bool aHasBattery, nsCString& aOutFailureId) {
const IntSize& aScreenSize, bool aHasBattery, nsCString& aOutFailureId) {
FeatureState& featureWebRenderQualified =
gfxConfig::GetFeature(Feature::WEBRENDER_QUALIFIED);
featureWebRenderQualified.EnableByDefault();
@ -2576,7 +2576,8 @@ static FeatureState& WebRenderHardwareQualificationStatus(
FeatureStatus::Blocked, "Device too old",
NS_LITERAL_CSTRING("FEATURE_FAILURE_DEVICE_TOO_OLD"));
}
} else if (adapterVendorID == u"0x8086") { // Intel
} else if (adapterVendorID == u"0x8086" ||
adapterVendorID == u"mesa/i965") { // Intel
const uint16_t supportedDevices[] = {
0x191d, // HD Graphics P530
0x192d, // Iris Pro Graphics P555
@ -2605,6 +2606,18 @@ static FeatureState& WebRenderHardwareQualificationStatus(
featureWebRenderQualified.Disable(
FeatureStatus::Blocked, "Device too old",
NS_LITERAL_CSTRING("FEATURE_FAILURE_DEVICE_TOO_OLD"));
} else if (adapterVendorID == u"mesa/i965") {
const int32_t maxPixels = 3440 * 1440; // UWQHD
int32_t pixels = aScreenSize.width * aScreenSize.height;
if (pixels > maxPixels) {
featureWebRenderQualified.Disable(
FeatureStatus::Blocked, "Screen size too large",
NS_LITERAL_CSTRING("FEATURE_FAILURE_SCREEN_SIZE_TOO_LARGE"));
} else if (pixels <= 0) {
featureWebRenderQualified.Disable(
FeatureStatus::Blocked, "Screen size unknown",
NS_LITERAL_CSTRING("FEATURE_FAILURE_SCREEN_SIZE_UNKNOWN"));
}
}
#endif
} else {
@ -2653,7 +2666,8 @@ void gfxPlatform::InitWebRenderConfig() {
nsCString failureId;
FeatureState& featureWebRenderQualified =
WebRenderHardwareQualificationStatus(HasBattery(), failureId);
WebRenderHardwareQualificationStatus(GetScreenSize(), HasBattery(),
failureId);
FeatureState& featureWebRender = gfxConfig::GetFeature(Feature::WEBRENDER);
featureWebRender.DisableByDefault(
@ -2748,6 +2762,16 @@ void gfxPlatform::InitWebRenderConfig() {
WebRenderDebugPrefChangeCallback, WR_DEBUG_PREF);
}
}
#if defined(XP_LINUX) && !defined(MOZ_WIDGET_ANDROID)
else if (gfxConfig::IsEnabled(Feature::HW_COMPOSITING)) {
// Hardware compositing should be disabled by default if we aren't using
// WebRender. We had to check if it is enabled at all, because it may
// already have been forced disabled (e.g. safe mode, headless). It may
// still be forced on by the user, and if so, this should have no effect.
gfxConfig::Disable(Feature::HW_COMPOSITING, FeatureStatus::Blocked,
"Acceleration blocked by platform");
}
#endif
#ifdef XP_WIN
if (Preferences::GetBool("gfx.webrender.dcomp-win.enabled", false)) {

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

@ -736,7 +736,7 @@ class gfxPlatform : public mozilla::layers::MemoryPressureListener {
gfxPlatform();
virtual ~gfxPlatform();
virtual bool HasBattery() { return true; }
virtual bool HasBattery() { return false; }
virtual void InitAcceleration();
virtual void InitWebRenderConfig();

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

@ -330,7 +330,7 @@ uint32_t gfxPlatformGtk::MaxGenericSubstitions() {
}
bool gfxPlatformGtk::AccelerateLayersByDefault() {
return gfxPrefs::WebRenderAll();
return true;
}
void gfxPlatformGtk::GetPlatformCMSOutputProfile(void*& mem, size_t& size) {

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

@ -307,6 +307,34 @@ const nsTArray<GfxDriverInfo> &GfxInfo::GetGfxDriverInfo() {
GfxDriverInfo::allDevices, GfxDriverInfo::allFeatures,
nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
V(13, 15, 100, 1), "FEATURE_FAILURE_OLD_FGLRX", "fglrx 13.15.100.1");
////////////////////////////////////
// FEATURE_WEBRENDER
// Mesa baseline (chosen arbitrarily as that which ships with
// Ubuntu 18.04 LTS).
APPEND_TO_DRIVER_BLOCKLIST(
OperatingSystem::Linux,
(nsAString &)GfxDriverInfo::GetDeviceVendor(VendorMesaAll),
GfxDriverInfo::allDevices, nsIGfxInfo::FEATURE_WEBRENDER,
nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN,
V(18, 2, 8, 0), "FEATURE_FAILURE_WEBRENDER_OLD_MESA", "Mesa 18.2.8.0");
// Disable on all NVIDIA devices for now.
APPEND_TO_DRIVER_BLOCKLIST(
OperatingSystem::Linux,
(nsAString &)GfxDriverInfo::GetDeviceVendor(VendorNVIDIA),
GfxDriverInfo::allDevices, nsIGfxInfo::FEATURE_WEBRENDER,
nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
V(0, 0, 0, 0), "FEATURE_FAILURE_WEBRENDER_NO_LINUX_NVIDIA", "");
// Disable on all ATI devices for now.
APPEND_TO_DRIVER_BLOCKLIST(
OperatingSystem::Linux,
(nsAString &)GfxDriverInfo::GetDeviceVendor(VendorATI),
GfxDriverInfo::allDevices, nsIGfxInfo::FEATURE_WEBRENDER,
nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
V(0, 0, 0, 0), "FEATURE_FAILURE_WEBRENDER_NO_LINUX_ATI", "");
}
return *sDriverInfo;
}

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

@ -1602,9 +1602,9 @@ const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() {
////////////////////////////////////
// FEATURE_WEBRENDER
// We are blocking all non-Nvidia cards in gfxPlatform.cpp where we check
// for the WEBRENDER_QUALIFIED feature. However we also want to block some
// specific Nvidia cards for being too low-powered, so we do that here.
// We are blocking most hardware explicitly in gfxPlatform.cpp where we
// check for the WEBRENDER_QUALIFIED feature. However we also want to block
// some specific Nvidia cards for being too low-powered, so we do that here.
APPEND_TO_DRIVER_BLOCKLIST2(
OperatingSystem::Windows10,
(nsAString&)GfxDriverInfo::GetDeviceVendor(VendorNVIDIA),