Bug 1244735 - Preference to override the default behaviour for partial present. r=jrmuizel

This commit is contained in:
Milan Sreckovic 2016-02-01 13:34:00 +01:00
Родитель f03d398a98
Коммит f20acb8ca1
2 изменённых файлов: 19 добавлений и 7 удалений

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

@ -1126,13 +1126,24 @@ CompositorD3D11::EndFrame()
if (oldSize == mSize) {
RefPtr<IDXGISwapChain1> chain;
HRESULT hr = mSwapChain->QueryInterface((IDXGISwapChain1**)getter_AddRefs(chain));
nsString vendorID;
nsCOMPtr<nsIGfxInfo> 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<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
gfxInfo->GetAdapterVendorID(vendorID);
allowPartialPresent = !vendorID.EqualsLiteral("0x10de") ||
gfxWindowsPlatform::GetPlatform()->IsWARP();
}
if (SUCCEEDED(hr) && chain && allowPartialPresent) {
DXGI_PRESENT_PARAMETERS params;
PodZero(&params);
params.DirtyRectsCount = mInvalidRegion.GetNumRects();

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

@ -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);