diff --git a/gfx/config/gfxFeature.h b/gfx/config/gfxFeature.h index 90d8d9bd29bc..8167ee10a7ed 100644 --- a/gfx/config/gfxFeature.h +++ b/gfx/config/gfxFeature.h @@ -20,7 +20,7 @@ namespace gfx { _(D3D11_COMPOSITING, Feature, "Direct3D11 Compositing") \ _(D3D9_COMPOSITING, Feature, "Direct3D9 Compositing") \ _(DIRECT2D, Feature, "Direct2D") \ - _(D3D11_ANGLE, Feature, "Direct3D11 ANGLE") \ + _(D3D11_HW_ANGLE, Feature, "Direct3D11 hardware ANGLE") \ /* Add new entries above this comment */ enum class Feature : uint32_t { diff --git a/gfx/gl/GLLibraryEGL.cpp b/gfx/gl/GLLibraryEGL.cpp index e961414ccd6b..d7b7de7b7f19 100644 --- a/gfx/gl/GLLibraryEGL.cpp +++ b/gfx/gl/GLLibraryEGL.cpp @@ -170,7 +170,7 @@ GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl) { EGLDisplay ret = 0; - FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_ANGLE); + FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_HW_ANGLE); if (!gfxPrefs::WebGLANGLETryD3D11()) d3d11ANGLE.UserDisable("User disabled D3D11 ANGLE by pref"); @@ -178,7 +178,7 @@ GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl) if (gfxPrefs::WebGLANGLEForceD3D11()) d3d11ANGLE.UserForceEnable("User force-enabled D3D11 ANGLE on disabled hardware"); - if (gfxConfig::IsForcedOnByUser(Feature::D3D11_ANGLE)) + if (gfxConfig::IsForcedOnByUser(Feature::D3D11_HW_ANGLE)) return GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE); if (d3d11ANGLE.IsEnabled()) { diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index a9d543b094fc..5eb6abcc4414 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -2067,7 +2067,6 @@ gfxPlatform::OptimalFormatForContent(gfxContentType aContent) * and remember the values. Changing these preferences during the run will * not have any effect until we restart. */ -bool gANGLESupportsD3D11 = false; static mozilla::Atomic sLayersSupportsHardwareVideoDecoding(false); static bool sLayersHardwareVideoDecodingFailed = false; static bool sBufferRotationCheckPref = true; @@ -2096,15 +2095,6 @@ gfxPlatform::InitAcceleration() nsCOMPtr gfxInfo = services::GetGfxInfo(); nsCString discardFailureId; int32_t status; -#ifdef XP_WIN - if (!gfxPrefs::LayersAccelerationDisabledDoNotUseDirectly() && gfxInfo) { - if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE, discardFailureId, &status))) { - if (status == nsIGfxInfo::FEATURE_STATUS_OK) { - gANGLESupportsD3D11 = true; - } - } - } -#endif if (Preferences::GetBool("media.hardware-video-decoding.enabled", false) && #ifdef XP_WIN diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index b5867614b180..9375058b3c4a 100755 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -373,6 +373,14 @@ gfxWindowsPlatform::~gfxWindowsPlatform() CoUninitialize(); } +static void +UpdateANGLEConfig() +{ + if (!gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) { + gfxConfig::Disable(Feature::D3D11_HW_ANGLE, FeatureStatus::Disabled, "D3D11 compositing is disabled"); + } +} + void gfxWindowsPlatform::InitAcceleration() { @@ -389,6 +397,7 @@ gfxWindowsPlatform::InitAcceleration() InitializeConfig(); InitializeDevices(); + UpdateANGLEConfig(); UpdateRenderMode(); } @@ -460,6 +469,7 @@ gfxWindowsPlatform::HandleDeviceReset() gfxAlphaBoxBlur::ShutdownBlurCache(); InitializeDevices(); + UpdateANGLEConfig(); BumpDeviceCounter(); return true; } @@ -1920,6 +1930,25 @@ IsWARPStable() return true; } +static void +InitializeANGLEConfig() +{ + FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_HW_ANGLE); + + if (!gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) { + d3d11ANGLE.DisableByDefault(FeatureStatus::Unavailable, "D3D11 compositing is disabled"); + return; + } + + d3d11ANGLE.EnableByDefault(); + + nsCString message; + if (!IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE, &message)) { + d3d11ANGLE.Disable(FeatureStatus::Blacklisted, message.get()); + } + +} + void gfxWindowsPlatform::InitializeConfig() { @@ -1930,6 +1959,7 @@ gfxWindowsPlatform::InitializeConfig() InitializeD3D9Config(); InitializeD3D11Config(); + InitializeANGLEConfig(); InitializeD2DConfig(); } @@ -2033,6 +2063,9 @@ gfxWindowsPlatform::UpdateDeviceInitData() FeatureStatus::Disabled, "Disabled by parent process"); + + InitializeANGLEConfig(); + return true; } @@ -2097,13 +2130,13 @@ gfxWindowsPlatform::AttemptD3D11DeviceCreation(FeatureState& d3d11) mCompositorD3D11TextureSharingWorks = ::DoesD3D11TextureSharingWork(mD3D11Device); if (!mCompositorD3D11TextureSharingWorks) { - gfxConfig::SetFailed(Feature::D3D11_ANGLE, + gfxConfig::SetFailed(Feature::D3D11_HW_ANGLE, FeatureStatus::Broken, "Texture sharing doesn't work"); } if (DoesRenderTargetViewNeedsRecreating(mD3D11Device)) { - gfxConfig::SetFailed(Feature::D3D11_ANGLE, + gfxConfig::SetFailed(Feature::D3D11_HW_ANGLE, FeatureStatus::Broken, "RenderTargetViews need recreating"); } @@ -2352,12 +2385,6 @@ gfxWindowsPlatform::InitializeDevices() InitializeD3D11(); InitializeD2D(); - if (!gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) { - gfxConfig::DisableByDefault(Feature::D3D11_ANGLE, FeatureStatus::Disabled, "D3D11 compositing is disabled"); - } else { - gfxConfig::EnableByDefault(Feature::D3D11_ANGLE); - } - if (!gfxConfig::IsEnabled(Feature::DIRECT2D)) { if (XRE_IsContentProcess() && GetParentDevicePrefs().useD2D1()) { RecordContentDeviceFailure(TelemetryDeviceCode::D2D1);