diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 991aa1a5f466..46815a59d26e 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -1126,13 +1126,24 @@ CompositorD3D11::EndFrame() if (oldSize == mSize) { RefPtr chain; HRESULT hr = mSwapChain->QueryInterface((IDXGISwapChain1**)getter_AddRefs(chain)); - nsString vendorID; - nsCOMPtr gfxInfo = services::GetGfxInfo(); - gfxInfo->GetAdapterVendorID(vendorID); - bool isNvidia = vendorID.EqualsLiteral("0x10de") && !gfxWindowsPlatform::GetPlatform()->IsWARP(); - if (SUCCEEDED(hr) && chain && !isNvidia) { - // Avoid partial present on Nvidia hardware to try to work around - // bug 1189940 + // We can force partial present or block partial present, based on the value of + // this preference; the default is to disable it on Nvidia (bug 1189940) + bool allowPartialPresent = false; + + int32_t partialPresentPref = gfxPrefs::PartialPresent(); + if (partialPresentPref > 0) { + allowPartialPresent = true; + } else if (partialPresentPref < 0) { + allowPartialPresent = false; + } else if (partialPresentPref == 0) { + nsString vendorID; + nsCOMPtr gfxInfo = services::GetGfxInfo(); + gfxInfo->GetAdapterVendorID(vendorID); + allowPartialPresent = !vendorID.EqualsLiteral("0x10de") || + gfxWindowsPlatform::GetPlatform()->IsWARP(); + } + + if (SUCCEEDED(hr) && chain && allowPartialPresent) { DXGI_PRESENT_PARAMETERS params; PodZero(¶ms); params.DirtyRectsCount = mInvalidRegion.GetNumRects(); diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index 17c3a74ed5f2..ad2f85f8fa80 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -257,6 +257,7 @@ private: // The maximums here are quite conservative, we can tighten them if problems show up. DECL_GFX_PREF(Once, "gfx.max-alloc-size", MaxAllocSize, int32_t, (int32_t)500000000); DECL_GFX_PREF(Once, "gfx.max-texture-size", MaxTextureSize, int32_t, (int32_t)32767); + DECL_GFX_PREF(Live, "gfx.partialpresent.force", PartialPresent, int32_t, 0); DECL_GFX_PREF(Live, "gfx.perf-warnings.enabled", PerfWarnings, bool, false); DECL_GFX_PREF(Live, "gfx.SurfaceTexture.detach.enabled", SurfaceTextureDetachEnabled, bool, true); DECL_GFX_PREF(Live, "gfx.testing.device-reset", DeviceResetForTesting, int32_t, 0);