Bug 1269387. Port D3D11 ANGLE configuration to gfxConfig. r=dvander

This commit is contained in:
Jeff Muizelaar 2016-05-02 11:56:31 -04:00
parent 4098575167
commit e1beb97b75
5 changed files with 30 additions and 30 deletions

View File

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

View File

@ -4,6 +4,7 @@
#include "GLLibraryEGL.h"
#include "gfxConfig.h"
#include "gfxCrashReporterUtils.h"
#include "gfxUtils.h"
#include "mozilla/Preferences.h"
@ -169,20 +170,19 @@ GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl)
{
EGLDisplay ret = 0;
// D3D11 ANGLE only works with OMTC; there's a bug in the non-OMTC layer
// manager, and it's pointless to try to fix it. We also don't try
// D3D11 ANGLE if the layer manager is prefering D3D9 (hrm, do we care?)
if (!gfxPrefs::LayersOffMainThreadCompositionForceDisabled() &&
!gfxPrefs::LayersPreferD3D9())
{
if (gfxPrefs::WebGLANGLEForceD3D11())
return GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE);
FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_ANGLE);
if (gfxPrefs::WebGLANGLETryD3D11() &&
gfxPlatform::GetPlatform()->CanUseDirect3D11ANGLE())
{
ret = GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE);
}
if (!gfxPrefs::WebGLANGLETryD3D11())
d3d11ANGLE.UserDisable("User disabled D3D11 ANGLE by pref");
if (gfxPrefs::WebGLANGLEForceD3D11())
d3d11ANGLE.UserForceEnable("User force-enabled D3D11 ANGLE on disabled hardware");
if (gfxConfig::IsForcedOnByUser(Feature::D3D11_ANGLE))
return GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE);
if (d3d11ANGLE.IsEnabled()) {
ret = GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE);
}
if (!ret) {

View File

@ -95,8 +95,6 @@ enum eGfxLog {
// when searching through pref langs, max number of pref langs
const uint32_t kMaxLenPrefLangList = 32;
extern bool gANGLESupportsD3D11;
#define UNINITIALIZED_VALUE (-1)
inline const char*
@ -450,7 +448,6 @@ public:
static bool OffMainThreadCompositingEnabled();
virtual bool CanUseHardwareVideoDecoding();
virtual bool CanUseDirect3D11ANGLE() { return false; }
// Returns a prioritized list of all available compositor backends.
void GetCompositorBackends(bool useAcceleration, nsTArray<mozilla::layers::LayersBackend>& aBackends);

View File

@ -428,12 +428,6 @@ gfxWindowsPlatform::CanUseHardwareVideoDecoding()
return !IsWARP() && gfxPlatform::CanUseHardwareVideoDecoding();
}
bool
gfxWindowsPlatform::CanUseDirect3D11ANGLE()
{
return gANGLESupportsD3D11 && gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING);
}
bool
gfxWindowsPlatform::InitDWriteSupport()
{
@ -1578,12 +1572,10 @@ bool DoesD3D11DeviceWork()
&displayLinkModuleVersion)) {
gfxCriticalError() << "DisplayLink: could not parse version "
<< checkModules[i];
gANGLESupportsD3D11 = false;
return false;
}
if (displayLinkModuleVersion <= V(8,6,1,36484)) {
gfxCriticalError(CriticalLog::DefaultOptions(false)) << "DisplayLink: too old version " << displayLinkModuleVersionString.get();
gANGLESupportsD3D11 = false;
return false;
}
}
@ -2119,8 +2111,16 @@ gfxWindowsPlatform::AttemptD3D11DeviceCreation(FeatureState& d3d11)
// GetDeviceRemovedReason to return weird values.
mCompositorD3D11TextureSharingWorks = ::DoesD3D11TextureSharingWork(mD3D11Device);
if (!mCompositorD3D11TextureSharingWorks || DoesRenderTargetViewNeedsRecreating(mD3D11Device)) {
gANGLESupportsD3D11 = false;
if (!mCompositorD3D11TextureSharingWorks) {
gfxConfig::SetFailed(Feature::D3D11_ANGLE,
FeatureStatus::Broken,
"Texture sharing doesn't work");
}
if (DoesRenderTargetViewNeedsRecreating(mD3D11Device)) {
gfxConfig::SetFailed(Feature::D3D11_ANGLE,
FeatureStatus::Broken,
"RenderTargetViews need recreating");
}
mD3D11Device->SetExceptionMode(0);
@ -2367,6 +2367,12 @@ 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);

View File

@ -97,8 +97,6 @@ struct ClearTypeParameterInfo {
int32_t enhancedContrast;
};
extern bool gANGLESupportsD3D11;
class gfxWindowsPlatform : public gfxPlatform {
public:
enum TextRenderingMode {
@ -262,8 +260,6 @@ public:
}
bool SupportsPluginDirectDXGIDrawing();
virtual bool CanUseDirect3D11ANGLE();
protected:
bool AccelerateLayersByDefault() override {
return true;