зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1868737 - Allow minimal gfx features by default for uncertain configurations. r=jrmuizel
Some features such as the GPU process (except on Android), backdrop filter (because it always works with Software WebRender), ANGLE (because it is generally good) and out of process WebGL (we generally want to remote WebGL for sandboxing purposes) are special, and should not be disabled simply because we are uncertain about our configuration. In these situations, disable most features, but keep these enabled by default. Differential Revision: https://phabricator.services.mozilla.com/D197595
This commit is contained in:
Родитель
2d79e2e390
Коммит
9ad36620d3
|
@ -30,6 +30,7 @@
|
|||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPrefs_gfx.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/BuildConstants.h"
|
||||
#include "mozilla/gfx/GPUProcessManager.h"
|
||||
#include "mozilla/gfx/Logging.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
|
@ -1300,8 +1301,12 @@ nsresult GfxInfoBase::GetFeatureStatusImpl(
|
|||
if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
|
||||
NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
|
||||
NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString))) {
|
||||
aFailureId = "FEATURE_FAILURE_CANT_RESOLVE_ADAPTER";
|
||||
*aStatus = FEATURE_BLOCKED_DEVICE;
|
||||
if (OnlyAllowFeatureOnKnownConfig(aFeature)) {
|
||||
aFailureId = "FEATURE_FAILURE_CANT_RESOLVE_ADAPTER";
|
||||
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
||||
} else {
|
||||
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1515,6 +1520,26 @@ const nsCString& GfxInfoBase::GetApplicationVersion() {
|
|||
return gBaseAppVersion;
|
||||
}
|
||||
|
||||
/* static */ bool GfxInfoBase::OnlyAllowFeatureOnKnownConfig(int32_t aFeature) {
|
||||
switch (aFeature) {
|
||||
// The GPU process doesn't need hardware acceleration and can run on
|
||||
// devices that we normally block from not being on our whitelist.
|
||||
case nsIGfxInfo::FEATURE_GPU_PROCESS:
|
||||
return kIsAndroid;
|
||||
// We can mostly assume that ANGLE will work
|
||||
case nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE:
|
||||
// Remote WebGL is needed for Win32k Lockdown, so it should be enabled
|
||||
// regardless of HW support or not
|
||||
case nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS:
|
||||
// Backdrop filter should generally work, especially if we fall back to
|
||||
// Software WebRender because of an unknown vendor.
|
||||
case nsIGfxInfo::FEATURE_BACKDROP_FILTER:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void GfxInfoBase::AddCollector(GfxInfoCollectorBase* collector) {
|
||||
InitCollectors();
|
||||
sCollectors->AppendElement(collector);
|
||||
|
|
|
@ -111,6 +111,8 @@ class GfxInfoBase : public nsIGfxInfo,
|
|||
static void SetFeatureStatus(
|
||||
nsTArray<mozilla::gfx::GfxInfoFeatureStatus>&& aFS);
|
||||
|
||||
static bool OnlyAllowFeatureOnKnownConfig(int32_t aFeature);
|
||||
|
||||
protected:
|
||||
virtual ~GfxInfoBase();
|
||||
|
||||
|
|
|
@ -395,7 +395,12 @@ nsresult GfxInfo::GetFeatureStatusImpl(
|
|||
EnsureInitialized();
|
||||
|
||||
if (mGLStrings->Vendor().IsEmpty() || mGLStrings->Renderer().IsEmpty()) {
|
||||
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
||||
if (OnlyAllowFeatureOnKnownConfig(aFeature)) {
|
||||
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
||||
aFailureId = "FEATURE_FAILURE_EMPTY_VENDOR_OR_RENDERER";
|
||||
} else {
|
||||
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1252,15 +1252,14 @@ nsresult GfxInfo::GetFeatureStatusImpl(
|
|||
|
||||
GetData();
|
||||
|
||||
if (aFeature == nsIGfxInfo::FEATURE_BACKDROP_FILTER) {
|
||||
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mGlxTestError) {
|
||||
// If glxtest failed, block all features by default.
|
||||
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
||||
aFailureId = "FEATURE_FAILURE_GLXTEST_FAILED";
|
||||
// If glxtest failed, block most features by default.
|
||||
if (OnlyAllowFeatureOnKnownConfig(aFeature)) {
|
||||
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
||||
aFailureId = "FEATURE_FAILURE_GLXTEST_FAILED";
|
||||
} else {
|
||||
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1268,8 +1267,12 @@ nsresult GfxInfo::GetFeatureStatusImpl(
|
|||
// We're on OpenGL 1. In most cases that indicates really old hardware.
|
||||
// We better block them, rather than rely on them to fail gracefully,
|
||||
// because they don't! see bug 696636
|
||||
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
||||
aFailureId = "FEATURE_FAILURE_OPENGL_1";
|
||||
if (OnlyAllowFeatureOnKnownConfig(aFeature)) {
|
||||
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
|
||||
aFailureId = "FEATURE_FAILURE_OPENGL_1";
|
||||
} else {
|
||||
*aStatus = nsIGfxInfo::FEATURE_STATUS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1173,25 +1173,6 @@ static OperatingSystem WindowsVersionToOperatingSystem(
|
|||
}
|
||||
}
|
||||
|
||||
static bool OnlyAllowFeatureOnWhitelistedVendor(int32_t aFeature) {
|
||||
switch (aFeature) {
|
||||
// The GPU process doesn't need hardware acceleration and can run on
|
||||
// devices that we normally block from not being on our whitelist.
|
||||
case nsIGfxInfo::FEATURE_GPU_PROCESS:
|
||||
// We can mostly assume that ANGLE will work
|
||||
case nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE:
|
||||
// Remote WebGL is needed for Win32k Lockdown, so it should be enabled
|
||||
// regardless of HW support or not
|
||||
case nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS:
|
||||
// Backdrop filter should generally work, especially if we fall back to
|
||||
// Software WebRender because of an unknown vendor.
|
||||
case nsIGfxInfo::FEATURE_BACKDROP_FILTER:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Return true if the CPU supports AVX, but the operating system does not.
|
||||
#if defined(_M_X64)
|
||||
static inline bool DetectBrokenAVX() {
|
||||
|
@ -1930,12 +1911,16 @@ nsresult GfxInfo::GetFeatureStatusImpl(
|
|||
if (NS_FAILED(GetAdapterVendorID(adapterVendorID)) ||
|
||||
NS_FAILED(GetAdapterDeviceID(adapterDeviceID)) ||
|
||||
NS_FAILED(GetAdapterDriverVersion(adapterDriverVersionString))) {
|
||||
aFailureId = "FEATURE_FAILURE_GET_ADAPTER";
|
||||
*aStatus = FEATURE_BLOCKED_DEVICE;
|
||||
if (OnlyAllowFeatureOnKnownConfig(aFeature)) {
|
||||
aFailureId = "FEATURE_FAILURE_GET_ADAPTER";
|
||||
*aStatus = FEATURE_BLOCKED_DEVICE;
|
||||
} else {
|
||||
*aStatus = FEATURE_STATUS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (OnlyAllowFeatureOnWhitelistedVendor(aFeature) &&
|
||||
if (OnlyAllowFeatureOnKnownConfig(aFeature) &&
|
||||
!adapterVendorID.Equals(
|
||||
GfxDriverInfo::GetDeviceVendor(DeviceVendor::Intel),
|
||||
nsCaseInsensitiveStringComparator) &&
|
||||
|
@ -1985,15 +1970,23 @@ nsresult GfxInfo::GetFeatureStatusImpl(
|
|||
}
|
||||
|
||||
if (adapterDriverVersionString.Length() == 0) {
|
||||
aFailureId = "FEATURE_FAILURE_EMPTY_DRIVER_VERSION";
|
||||
*aStatus = FEATURE_BLOCKED_DRIVER_VERSION;
|
||||
if (OnlyAllowFeatureOnKnownConfig(aFeature)) {
|
||||
aFailureId = "FEATURE_FAILURE_EMPTY_DRIVER_VERSION";
|
||||
*aStatus = FEATURE_BLOCKED_DRIVER_VERSION;
|
||||
} else {
|
||||
*aStatus = FEATURE_STATUS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint64_t driverVersion;
|
||||
if (!ParseDriverVersion(adapterDriverVersionString, &driverVersion)) {
|
||||
aFailureId = "FEATURE_FAILURE_PARSE_DRIVER";
|
||||
*aStatus = FEATURE_BLOCKED_DRIVER_VERSION;
|
||||
if (OnlyAllowFeatureOnKnownConfig(aFeature)) {
|
||||
aFailureId = "FEATURE_FAILURE_PARSE_DRIVER";
|
||||
*aStatus = FEATURE_BLOCKED_DRIVER_VERSION;
|
||||
} else {
|
||||
*aStatus = FEATURE_STATUS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче