mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Bug 1668144 - Add blocklisting for OOP WebGL. r=mattwoodrow
* Add FEATURE_THREADSAFE_GL and FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS * Add gfxVars::AllowWebglOop() * Blocklist THREADSAFE_GL on mesa/nouveau Differential Revision: https://phabricator.services.mozilla.com/D91879
This commit is contained in:
parent
cbaaa09c79
commit
449098b7b4
@ -565,7 +565,15 @@ ClientWebGLContext::SetDimensions(const int32_t signedWidth,
|
||||
}
|
||||
|
||||
static bool IsWebglOutOfProcessEnabled() {
|
||||
return StaticPrefs::webgl_out_of_process();
|
||||
bool useOop = StaticPrefs::webgl_out_of_process();
|
||||
|
||||
if (!gfxVars::AllowWebglOop()) {
|
||||
useOop = false;
|
||||
}
|
||||
if (StaticPrefs::webgl_out_of_process_force()) {
|
||||
useOop = true;
|
||||
}
|
||||
return useOop;
|
||||
}
|
||||
|
||||
bool ClientWebGLContext::CreateHostContext(const uvec2& requestedSize) {
|
||||
|
@ -261,7 +261,8 @@ bool WebGLContext::CreateAndInitGL(
|
||||
if (IsWebGL2() && !forceEnabled) {
|
||||
FailureReason reason;
|
||||
if (!gfx::gfxVars::AllowWebgl2()) {
|
||||
reason.info = "AllowWebgl2:false restricts context creation on this system.";
|
||||
reason.info =
|
||||
"AllowWebgl2:false restricts context creation on this system.";
|
||||
out_failReasons->push_back(reason);
|
||||
GenerateWarning("%s", reason.info.BeginReading());
|
||||
return false;
|
||||
@ -338,7 +339,9 @@ bool WebGLContext::CreateAndInitGL(
|
||||
if (tryNativeGL && !forceEnabled) {
|
||||
FailureReason reason;
|
||||
if (!gfx::gfxVars::WebglAllowWindowsNativeGl()) {
|
||||
reason.info = "WebglAllowWindowsNativeGl:false restricts context creation on this system.";
|
||||
reason.info =
|
||||
"WebglAllowWindowsNativeGl:false restricts context creation on this "
|
||||
"system.";
|
||||
|
||||
out_failReasons->push_back(reason);
|
||||
|
||||
|
@ -24,6 +24,7 @@ class gfxVarReceiver;
|
||||
#define GFX_VARS_LIST(_) \
|
||||
/* C++ Name, Data Type, Default Value */ \
|
||||
_(AllowWebgl2, bool, true) \
|
||||
_(AllowWebglOop, bool, true) \
|
||||
_(BrowserTabsRemoteAutostart, bool, false) \
|
||||
_(ContentBackend, BackendType, BackendType::NONE) \
|
||||
_(SoftwareBackend, BackendType, BackendType::NONE) \
|
||||
|
@ -2551,15 +2551,14 @@ void gfxPlatform::InitAcceleration() {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (NS_SUCCEEDED(
|
||||
gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBGL2,
|
||||
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBGL2,
|
||||
discardFailureId, &status))) {
|
||||
gfxVars::SetAllowWebgl2(status == nsIGfxInfo::FEATURE_STATUS_OK);
|
||||
}
|
||||
if (NS_SUCCEEDED(
|
||||
gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBGL_OPENGL,
|
||||
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_WEBGL_OPENGL,
|
||||
discardFailureId, &status))) {
|
||||
gfxVars::SetWebglAllowWindowsNativeGl(status == nsIGfxInfo::FEATURE_STATUS_OK);
|
||||
gfxVars::SetWebglAllowWindowsNativeGl(status ==
|
||||
nsIGfxInfo::FEATURE_STATUS_OK);
|
||||
}
|
||||
|
||||
if (kIsMacOS) {
|
||||
@ -2568,10 +2567,31 @@ void gfxPlatform::InitAcceleration() {
|
||||
gfxInfo->GetAdapterVendorID(vendorID);
|
||||
gfxInfo->GetAdapterDeviceID(deviceID);
|
||||
if (vendorID.EqualsLiteral("0x8086") &&
|
||||
(deviceID.EqualsLiteral("0x0116") || deviceID.EqualsLiteral("0x0126"))) {
|
||||
(deviceID.EqualsLiteral("0x0116") ||
|
||||
deviceID.EqualsLiteral("0x0126"))) {
|
||||
gfxVars::SetWebglAllowCoreProfile(false);
|
||||
}
|
||||
}
|
||||
|
||||
const auto IsFeatureOk = [&](const int32_t feature) {
|
||||
nsCString discardFailureId;
|
||||
int32_t status;
|
||||
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(
|
||||
gfxInfo->GetFeatureStatus(feature, discardFailureId, &status)));
|
||||
return (status == nsIGfxInfo::FEATURE_STATUS_OK);
|
||||
};
|
||||
|
||||
{
|
||||
bool allowWebGLOop =
|
||||
IsFeatureOk(nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS);
|
||||
|
||||
const bool threadsafeGl = IsFeatureOk(nsIGfxInfo::FEATURE_THREADSAFE_GL);
|
||||
if (gfxVars::UseWebRender() && !threadsafeGl) {
|
||||
allowWebGLOop = false;
|
||||
}
|
||||
|
||||
gfxVars::SetAllowWebglOop(allowWebGLOop);
|
||||
}
|
||||
}
|
||||
|
||||
if (Preferences::GetBool("media.hardware-video-decoding.enabled", false) &&
|
||||
|
@ -9961,6 +9961,11 @@
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
- name: webgl.out-of-process.force
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
- name: webgl.out-of-process.shmem-size
|
||||
type: RelaxedAtomicUint32
|
||||
value: 100000 # 100KB
|
||||
|
@ -925,6 +925,7 @@ const nsAString& GfxDriverInfo::GetDriverVendor(DriverVendor id) {
|
||||
DECLARE_DRIVER_VENDOR_ID(MesaSoftPipe, "mesa/softpipe");
|
||||
DECLARE_DRIVER_VENDOR_ID(MesaSWRast, "mesa/swrast");
|
||||
DECLARE_DRIVER_VENDOR_ID(MesaUnknown, "mesa/unknown");
|
||||
DECLARE_DRIVER_VENDOR_ID(MesaNouveau, "mesa/nouveau");
|
||||
DECLARE_DRIVER_VENDOR_ID(NonMesaAll, "non-mesa/all");
|
||||
case DriverVendor::Max: // Suppress a warning.
|
||||
DECLARE_DRIVER_VENDOR_ID(All, "");
|
||||
|
@ -229,6 +229,8 @@ enum DriverVendor : uint8_t {
|
||||
MesaLLVMPipe,
|
||||
MesaSoftPipe,
|
||||
MesaSWRast,
|
||||
// Nouveau: Open-source nvidia
|
||||
MesaNouveau,
|
||||
// A generic ID to be provided when we can't determine the DRI driver on Mesa.
|
||||
MesaUnknown,
|
||||
// Wildcard for all non-Mesa drivers.
|
||||
|
@ -222,6 +222,12 @@ static const char* GetPrefNameForFeature(int32_t aFeature) {
|
||||
case nsIGfxInfo::FEATURE_WEBRENDER_SCISSORED_CACHE_CLEARS:
|
||||
name = BLOCKLIST_PREF_BRANCH "webrender.scissored_cache_clears";
|
||||
break;
|
||||
case nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS:
|
||||
name = BLOCKLIST_PREF_BRANCH "webgl.allow-oop";
|
||||
break;
|
||||
case nsIGfxInfo::FEATURE_THREADSAFE_GL:
|
||||
name = BLOCKLIST_PREF_BRANCH "gl.threadsafe";
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected nsIGfxInfo feature?!");
|
||||
break;
|
||||
@ -411,6 +417,10 @@ static int32_t BlocklistFeatureToGfxFeature(const nsAString& aFeature) {
|
||||
return nsIGfxInfo::FEATURE_GL_SWIZZLE;
|
||||
else if (aFeature.EqualsLiteral("WEBRENDER_SCISSORED_CACHE_CLEARS"))
|
||||
return nsIGfxInfo::FEATURE_WEBRENDER_SCISSORED_CACHE_CLEARS;
|
||||
else if (aFeature.EqualsLiteral("ALLOW_WEBGL_OUT_OF_PROCESS"))
|
||||
return nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS;
|
||||
else if (aFeature.EqualsLiteral("THREADSAFE_GL"))
|
||||
return nsIGfxInfo::FEATURE_THREADSAFE_GL;
|
||||
|
||||
// If we don't recognize the feature, it may be new, and something
|
||||
// this version doesn't understand. So, nothing to do. This is
|
||||
@ -1275,6 +1285,7 @@ void GfxInfoBase::EvaluateDownloadedBlocklist(
|
||||
nsIGfxInfo::FEATURE_DX_P010,
|
||||
nsIGfxInfo::FEATURE_DX_P016,
|
||||
nsIGfxInfo::FEATURE_GL_SWIZZLE,
|
||||
nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS,
|
||||
0};
|
||||
|
||||
// For every feature we know about, we evaluate whether this blocklist has a
|
||||
|
@ -581,6 +581,15 @@ const nsTArray<GfxDriverInfo>& GfxInfo::GetGfxDriverInfo() {
|
||||
nsIGfxInfo::FEATURE_ALLOW_QUALIFIED, DRIVER_GREATER_THAN_OR_EQUAL,
|
||||
V(18, 0, 0, 0), "FEATURE_ROLLOUT_NIGHTLY_ATI_MESA", "Mesa 18.0.0.0");
|
||||
#endif
|
||||
|
||||
////////////////////////////////////
|
||||
|
||||
APPEND_TO_DRIVER_BLOCKLIST_EXT(
|
||||
OperatingSystem::Linux, ScreenSizeStatus::All, BatteryStatus::All,
|
||||
DesktopEnvironment::All, WindowProtocol::All, DriverVendor::MesaNouveau,
|
||||
DeviceFamily::All, nsIGfxInfo::FEATURE_THREADSAFE_GL,
|
||||
nsIGfxInfo::FEATURE_BLOCKED_DEVICE, DRIVER_COMPARISON_IGNORED,
|
||||
V(0, 0, 0, 0), "FEATURE_FAILURE_THREADSAFE_GL", "");
|
||||
}
|
||||
return *sDriverInfo;
|
||||
}
|
||||
|
@ -162,8 +162,12 @@ interface nsIGfxInfo : nsISupports
|
||||
const long FEATURE_WEBRENDER_COMPOSITOR = 29;
|
||||
/* Whether WebRender can use scissored clears for cached surfaces, staring in 79 */
|
||||
const long FEATURE_WEBRENDER_SCISSORED_CACHE_CLEARS = 30;
|
||||
/* Support webgl.out-of-process: true (starting in 83) */
|
||||
const long FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS = 31;
|
||||
/* Is OpenGL threadsafe (starting in 83) */
|
||||
const long FEATURE_THREADSAFE_GL = 32;
|
||||
/* the maximum feature value. */
|
||||
const long FEATURE_MAX_VALUE = FEATURE_WEBRENDER_SCISSORED_CACHE_CLEARS;
|
||||
const long FEATURE_MAX_VALUE = FEATURE_THREADSAFE_GL;
|
||||
|
||||
/*
|
||||
* A set of return values from GetFeatureStatus
|
||||
|
Loading…
Reference in New Issue
Block a user