Bug 1262187: Allow D3D9 if D3D11 failed, behind the pref, but on by default. r=bas
MozReview-Commit-ID: JnO4nIN4gXv
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -325,16 +325,17 @@ private:
DECL_GFX_PREF(Live, "image.single-color-optimization.enabled", ImageSingleColorOptimizationEnabled, bool, true);
DECL_GFX_PREF(Live, "layers.child-process-shutdown", ChildProcessShutdown, bool, true);
DECL_GFX_PREF(Once, "layers.acceleration.disabled", LayersAccelerationDisabled, bool, false);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps", LayersDrawFPS, bool, false);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram", FPSPrintHistogram, bool, false);
DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false);
DECL_GFX_PREF(Once, "layers.acceleration.force-enabled", LayersAccelerationForceEnabled, bool, false);
+ DECL_GFX_PREF(Once, "layers.allow-d3d9-fallback", LayersAllowD3D9Fallback, bool, false);
DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled", LayersAMDSwitchableGfxEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled", AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
DECL_GFX_PREF(Once, "layers.async-pan-zoom.separate-event-thread", AsyncPanZoomSeparateEventThread, bool, false);
DECL_GFX_PREF(Live, "layers.bench.enabled", LayersBenchEnabled, bool, false);
DECL_GFX_PREF(Once, "layers.bufferrotation.enabled", BufferRotationEnabled, bool, true);
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
// If MOZ_GFX_OPTIMIZE_MOBILE is defined, we force component alpha off
// and ignore the preference.
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -2881,26 +2881,28 @@ gfxWindowsPlatform::SupportsApzTouchInpu
void
gfxWindowsPlatform::GetAcceleratedCompositorBackends(nsTArray<LayersBackend>& aBackends)
{
if (gfxPrefs::LayersPreferOpenGL()) {
aBackends.AppendElement(LayersBackend::LAYERS_OPENGL);
}
+ bool allowTryingD3D9 = false;
if (!gfxPrefs::LayersPreferD3D9()) {
if (gfxPlatform::CanUseDirect3D11() && mD3D11Device) {
aBackends.AppendElement(LayersBackend::LAYERS_D3D11);
} else {
+ allowTryingD3D9 = gfxPrefs::LayersAllowD3D9Fallback();
NS_WARNING("Direct3D 11-accelerated layers are not supported on this system.");
}
}
- if (gfxPrefs::LayersPreferD3D9() || !IsVistaOrLater()) {
- // We don't want D3D9 except on Windows XP
+ if (gfxPrefs::LayersPreferD3D9() || !IsVistaOrLater() || allowTryingD3D9) {
+ // We don't want D3D9 except on Windows XP, unless we failed to get D3D11
if (gfxPlatform::CanUseDirect3D9()) {
aBackends.AppendElement(LayersBackend::LAYERS_D3D9);
} else {
NS_WARNING("Direct3D 9-accelerated layers are not supported on this system.");
}
}
}
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4497,16 +4497,17 @@ pref("gfx.content.use-native-pushlayer",
pref("gfx.direct2d.disabled", false);
// Whether to attempt to enable Direct2D regardless of automatic detection or
// blacklisting
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
// Force all possible layers to be always active layers
pref("layers.force-active", false);