Bug 1271657. Redo gfxConfig support for HW D3D11 ANGLE. r=dvander

This commit is contained in:
Jeff Muizelaar 2016-05-24 14:24:03 -04:00
Родитель 01d029f0e7
Коммит 2418bd8394
4 изменённых файлов: 38 добавлений и 21 удалений

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

@ -20,7 +20,7 @@ namespace gfx {
_(D3D11_COMPOSITING, Feature, "Direct3D11 Compositing") \ _(D3D11_COMPOSITING, Feature, "Direct3D11 Compositing") \
_(D3D9_COMPOSITING, Feature, "Direct3D9 Compositing") \ _(D3D9_COMPOSITING, Feature, "Direct3D9 Compositing") \
_(DIRECT2D, Feature, "Direct2D") \ _(DIRECT2D, Feature, "Direct2D") \
_(D3D11_ANGLE, Feature, "Direct3D11 ANGLE") \ _(D3D11_HW_ANGLE, Feature, "Direct3D11 hardware ANGLE") \
/* Add new entries above this comment */ /* Add new entries above this comment */
enum class Feature : uint32_t { enum class Feature : uint32_t {

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

@ -170,7 +170,7 @@ GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl)
{ {
EGLDisplay ret = 0; EGLDisplay ret = 0;
FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_ANGLE); FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_HW_ANGLE);
if (!gfxPrefs::WebGLANGLETryD3D11()) if (!gfxPrefs::WebGLANGLETryD3D11())
d3d11ANGLE.UserDisable("User disabled D3D11 ANGLE by pref"); d3d11ANGLE.UserDisable("User disabled D3D11 ANGLE by pref");
@ -178,7 +178,7 @@ GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl)
if (gfxPrefs::WebGLANGLEForceD3D11()) if (gfxPrefs::WebGLANGLEForceD3D11())
d3d11ANGLE.UserForceEnable("User force-enabled D3D11 ANGLE on disabled hardware"); 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); return GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE);
if (d3d11ANGLE.IsEnabled()) { if (d3d11ANGLE.IsEnabled()) {

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

@ -2067,7 +2067,6 @@ gfxPlatform::OptimalFormatForContent(gfxContentType aContent)
* and remember the values. Changing these preferences during the run will * and remember the values. Changing these preferences during the run will
* not have any effect until we restart. * not have any effect until we restart.
*/ */
bool gANGLESupportsD3D11 = false;
static mozilla::Atomic<bool> sLayersSupportsHardwareVideoDecoding(false); static mozilla::Atomic<bool> sLayersSupportsHardwareVideoDecoding(false);
static bool sLayersHardwareVideoDecodingFailed = false; static bool sLayersHardwareVideoDecodingFailed = false;
static bool sBufferRotationCheckPref = true; static bool sBufferRotationCheckPref = true;
@ -2096,15 +2095,6 @@ gfxPlatform::InitAcceleration()
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo(); nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsCString discardFailureId; nsCString discardFailureId;
int32_t status; 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) && if (Preferences::GetBool("media.hardware-video-decoding.enabled", false) &&
#ifdef XP_WIN #ifdef XP_WIN

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

@ -373,6 +373,14 @@ gfxWindowsPlatform::~gfxWindowsPlatform()
CoUninitialize(); CoUninitialize();
} }
static void
UpdateANGLEConfig()
{
if (!gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING)) {
gfxConfig::Disable(Feature::D3D11_HW_ANGLE, FeatureStatus::Disabled, "D3D11 compositing is disabled");
}
}
void void
gfxWindowsPlatform::InitAcceleration() gfxWindowsPlatform::InitAcceleration()
{ {
@ -389,6 +397,7 @@ gfxWindowsPlatform::InitAcceleration()
InitializeConfig(); InitializeConfig();
InitializeDevices(); InitializeDevices();
UpdateANGLEConfig();
UpdateRenderMode(); UpdateRenderMode();
} }
@ -460,6 +469,7 @@ gfxWindowsPlatform::HandleDeviceReset()
gfxAlphaBoxBlur::ShutdownBlurCache(); gfxAlphaBoxBlur::ShutdownBlurCache();
InitializeDevices(); InitializeDevices();
UpdateANGLEConfig();
BumpDeviceCounter(); BumpDeviceCounter();
return true; return true;
} }
@ -1920,6 +1930,25 @@ IsWARPStable()
return true; 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 void
gfxWindowsPlatform::InitializeConfig() gfxWindowsPlatform::InitializeConfig()
{ {
@ -1930,6 +1959,7 @@ gfxWindowsPlatform::InitializeConfig()
InitializeD3D9Config(); InitializeD3D9Config();
InitializeD3D11Config(); InitializeD3D11Config();
InitializeANGLEConfig();
InitializeD2DConfig(); InitializeD2DConfig();
} }
@ -2033,6 +2063,9 @@ gfxWindowsPlatform::UpdateDeviceInitData()
FeatureStatus::Disabled, FeatureStatus::Disabled,
"Disabled by parent process"); "Disabled by parent process");
InitializeANGLEConfig();
return true; return true;
} }
@ -2097,13 +2130,13 @@ gfxWindowsPlatform::AttemptD3D11DeviceCreation(FeatureState& d3d11)
mCompositorD3D11TextureSharingWorks = ::DoesD3D11TextureSharingWork(mD3D11Device); mCompositorD3D11TextureSharingWorks = ::DoesD3D11TextureSharingWork(mD3D11Device);
if (!mCompositorD3D11TextureSharingWorks) { if (!mCompositorD3D11TextureSharingWorks) {
gfxConfig::SetFailed(Feature::D3D11_ANGLE, gfxConfig::SetFailed(Feature::D3D11_HW_ANGLE,
FeatureStatus::Broken, FeatureStatus::Broken,
"Texture sharing doesn't work"); "Texture sharing doesn't work");
} }
if (DoesRenderTargetViewNeedsRecreating(mD3D11Device)) { if (DoesRenderTargetViewNeedsRecreating(mD3D11Device)) {
gfxConfig::SetFailed(Feature::D3D11_ANGLE, gfxConfig::SetFailed(Feature::D3D11_HW_ANGLE,
FeatureStatus::Broken, FeatureStatus::Broken,
"RenderTargetViews need recreating"); "RenderTargetViews need recreating");
} }
@ -2352,12 +2385,6 @@ gfxWindowsPlatform::InitializeDevices()
InitializeD3D11(); InitializeD3D11();
InitializeD2D(); 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 (!gfxConfig::IsEnabled(Feature::DIRECT2D)) {
if (XRE_IsContentProcess() && GetParentDevicePrefs().useD2D1()) { if (XRE_IsContentProcess() && GetParentDevicePrefs().useD2D1()) {
RecordContentDeviceFailure(TelemetryDeviceCode::D2D1); RecordContentDeviceFailure(TelemetryDeviceCode::D2D1);