Remove fallback to WARP, but keep the force pref for testing. (bug 1294343, r=jrmuizel)

This commit is contained in:
David Anderson 2016-08-13 12:18:50 -07:00
Родитель e12140216e
Коммит 4257f1eff2
7 изменённых файлов: 53 добавлений и 103 удалений

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

@ -14,7 +14,7 @@ namespace gfx {
#define GFX_FALLBACK_MAP(_) \
/* Name */ \
_(USE_D3D11_WARP_COMPOSITOR) \
_(PLACEHOLDER_DO_NOT_USE) \
/* Add new entries above this comment */
enum class Fallback : uint32_t {

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

@ -1,41 +1,40 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
using struct DxgiAdapterDesc from "mozilla/D3DMessageUtils.h";
using mozilla::gfx::BackendType from "mozilla/gfx/Types.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
namespace mozilla {
namespace gfx {
struct DeviceInitData
{
bool useHwCompositing;
// Windows only.
bool useD3D11;
bool useD3D11WARP;
bool d3d11TextureSharingWorks;
bool useD2D1;
DxgiAdapterDesc adapter;
};
union GfxVarValue
{
using struct DxgiAdapterDesc from "mozilla/D3DMessageUtils.h";
using mozilla::gfx::BackendType from "mozilla/gfx/Types.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
namespace mozilla {
namespace gfx {
struct DeviceInitData
{
bool useHwCompositing;
// Windows only.
bool useD3D11;
bool d3d11TextureSharingWorks;
bool useD2D1;
DxgiAdapterDesc adapter;
};
union GfxVarValue
{
BackendType;
bool;
IntSize;
};
struct GfxVarUpdate
{
size_t index;
GfxVarValue value;
};
} // namespace gfx
} // namespace mozilla
IntSize;
};
struct GfxVarUpdate
{
size_t index;
GfxVarValue value;
};
} // namespace gfx
} // namespace mozilla

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

@ -57,16 +57,6 @@ DeviceManagerD3D11::DeviceManagerD3D11()
mFeatureLevels.AppendElement(D3D_FEATURE_LEVEL_10_0);
}
static inline bool
IsWARPStable()
{
// It seems like nvdxgiwrap makes a mess of WARP. See bug 1154703.
if (!IsWin8OrLater() || GetModuleHandleA("nvdxgiwrap.dll")) {
return false;
}
return true;
}
void
DeviceManagerD3D11::CreateDevices()
{
@ -92,29 +82,13 @@ DeviceManagerD3D11::CreateDevices()
}
if (XRE_IsParentProcess()) {
if (!gfxConfig::UseFallback(Fallback::USE_D3D11_WARP_COMPOSITOR)) {
if (!gfxPrefs::LayersD3D11ForceWARP()) {
AttemptD3D11DeviceCreation(d3d11);
if (d3d11.GetValue() == FeatureStatus::CrashedInHandler) {
return;
}
// If we failed to get a device, but WARP is allowed and might work,
// re-enable D3D11 and switch to WARP.
if (!mCompositorDevice && IsWARPStable() && !gfxPrefs::LayersD3D11DisableWARP()) {
gfxConfig::Reenable(Feature::D3D11_COMPOSITING, Fallback::USE_D3D11_WARP_COMPOSITOR);
}
}
// If that failed, see if we can use WARP.
if (gfxConfig::UseFallback(Fallback::USE_D3D11_WARP_COMPOSITOR)) {
MOZ_ASSERT(d3d11.IsEnabled());
MOZ_ASSERT(!mCompositorDevice);
MOZ_ASSERT(IsWARPStable() || gfxPrefs::LayersD3D11ForceWARP());
} else {
AttemptWARPDeviceCreation();
if (d3d11.GetValue() == FeatureStatus::CrashedInHandler) {
return;
}
}
if (d3d11.GetValue() == FeatureStatus::CrashedInHandler) {
return;
}
// If we still have no device by now, exit.
@ -129,7 +103,7 @@ DeviceManagerD3D11::CreateDevices()
// Child processes do not need a compositor, but they do need to know
// whether the parent process is using WARP and whether or not texture
// sharing works.
mIsWARP = gfxConfig::UseFallback(Fallback::USE_D3D11_WARP_COMPOSITOR);
mIsWARP = gfxPrefs::LayersD3D11ForceWARP();
mTextureSharingWorks =
gfxPlatform::GetPlatform()->GetParentDevicePrefs().d3d11TextureSharingWorks();
}

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

@ -614,11 +614,10 @@ gfxPlatform::Init()
gfxPrefs::Direct2DDisabled(),
gfxPrefs::Direct2DForceEnabled());
// Layers prefs
forcedPrefs.AppendPrintf("-L%d%d%d%d%d",
forcedPrefs.AppendPrintf("-L%d%d%d%d",
gfxPrefs::LayersAMDSwitchableGfxEnabled(),
gfxPrefs::LayersAccelerationDisabledDoNotUseDirectly(),
gfxPrefs::LayersAccelerationForceEnabledDoNotUseDirectly(),
gfxPrefs::LayersD3D11DisableWARP(),
gfxPrefs::LayersD3D11ForceWARP());
// WebGL prefs
forcedPrefs.AppendPrintf("-W%d%d%d%d%d%d%d%d",

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

@ -450,7 +450,6 @@ private:
DECL_GFX_PREF(Once, "layers.componentalpha.enabled", ComponentAlphaEnabled, bool, true);
#endif
DECL_GFX_PREF(Live, "layers.composer2d.enabled", Composer2DCompositionEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.d3d11.disable-warp", LayersD3D11DisableWARP, bool, false);
DECL_GFX_PREF(Once, "layers.d3d11.force-warp", LayersD3D11ForceWARP, bool, false);
DECL_GFX_PREF(Live, "layers.deaa.enabled", LayersDEAAEnabled, bool, false);
DECL_GFX_PREF(Live, "layers.draw-bigimage-borders", DrawBigImageBorders, bool, false);

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

@ -1512,24 +1512,13 @@ gfxWindowsPlatform::InitializeD3D11Config()
nsCString message;
nsCString failureId;
if (!gfxPlatform::IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, &message, failureId)) {
if (IsWARPStable() && !gfxPrefs::LayersD3D11DisableWARP()) {
// We do not expect hardware D3D11 to work, so we'll try WARP.
gfxConfig::EnableFallback(Fallback::USE_D3D11_WARP_COMPOSITOR, message.get());
} else {
// There is little to no chance of D3D11 working, so just disable it.
d3d11.Disable(FeatureStatus::Blacklisted, message.get(),
failureId);
}
d3d11.Disable(FeatureStatus::Blacklisted, message.get(), failureId);
}
// Check if the user really, really wants WARP.
if (gfxPrefs::LayersD3D11ForceWARP()) {
// Force D3D11 on even if we disabled it.
d3d11.UserForceEnable("User force-enabled WARP on disabled hardware");
gfxConfig::EnableFallback(
Fallback::USE_D3D11_WARP_COMPOSITOR,
"Force-enabled by user preference");
d3d11.UserForceEnable("User force-enabled WARP");
}
}
@ -1540,15 +1529,11 @@ gfxWindowsPlatform::UpdateDeviceInitData()
return false;
}
if (gfxConfig::InitOrUpdate(Feature::D3D11_COMPOSITING,
GetParentDevicePrefs().useD3D11(),
FeatureStatus::Disabled,
"Disabled by parent process"))
{
if (GetParentDevicePrefs().useD3D11WARP()) {
gfxConfig::EnableFallback(Fallback::USE_D3D11_WARP_COMPOSITOR, "Requested by parent process");
}
}
gfxConfig::InitOrUpdate(
Feature::D3D11_COMPOSITING,
GetParentDevicePrefs().useD3D11(),
FeatureStatus::Disabled,
"Disabled by parent process");
gfxConfig::InitOrUpdate(
Feature::DIRECT2D,
@ -1556,9 +1541,7 @@ gfxWindowsPlatform::UpdateDeviceInitData()
FeatureStatus::Disabled,
"Disabled by parent process");
InitializeANGLEConfig();
return true;
}
@ -2065,7 +2048,6 @@ gfxWindowsPlatform::GetDeviceInitData(DeviceInitData* aOut)
aOut->useD3D11() = true;
aOut->d3d11TextureSharingWorks() = dm->TextureSharingWorks();
aOut->useD3D11WARP() = dm->IsWARP();
aOut->useD2D1() = gfxConfig::IsEnabled(Feature::DIRECT2D);
if (RefPtr<ID3D11Device> device = dm->GetCompositorDevice()) {

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

@ -4588,9 +4588,6 @@ pref("gfx.direct2d.force-enabled", false);
pref("layers.prefer-opengl", false);
pref("layers.prefer-d3d9", false);
pref("layers.allow-d3d9-fallback", true);
pref("layers.d3d11.force-warp", false);
pref("layers.d3d11.disable-warp", true);
#endif
// Copy-on-write canvas
@ -5515,4 +5512,4 @@ pref("layout.css.servo.enabled", true);
pref("dom.html_fragment_serialisation.appendLF", true);
#else
pref("dom.html_fragment_serialisation.appendLF", false);
#endif
#endif