Bug 1194335. Disable partial present on Nvidia hardware. r=bas a=sylvestre
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Mon, 21 Sep 2015 11:52:01 -0400
changeset 289585 341d7a3d7320
parent 289584 dc552539eb77
child 289586 c5bd26c10432
push id5201
push userkwierso@gmail.com
push date2015-10-19 16:29 +0000
treeherdermozilla-beta@c5bd26c10432 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas, sylvestre
bugs1194335, 1189940
milestone42.0
Bug 1194335. Disable partial present on Nvidia hardware. r=bas a=sylvestre I have a theory that bug 1189940 is caused by partial present. This is an attempt to see if that's true.
gfx/layers/d3d11/CompositorD3D11.cpp
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -6,23 +6,25 @@
 #include "CompositorD3D11.h"
 
 #include "TextureD3D11.h"
 #include "CompositorD3D11Shaders.h"
 #include "CompositorD3D11ShadersVR.h"
 
 #include "gfxWindowsPlatform.h"
 #include "nsIWidget.h"
+#include "nsIGfxInfo.h"
 #include "mozilla/layers/ImageHost.h"
 #include "mozilla/layers/ContentHost.h"
 #include "mozilla/layers/Effects.h"
 #include "nsWindowsHelpers.h"
 #include "gfxPrefs.h"
 #include "gfxCrashReporterUtils.h"
 #include "gfxVR.h"
+#include "mozilla/Services.h"
 
 #include "mozilla/EnumeratedArray.h"
 
 #include <dxgi1_2.h>
 
 namespace mozilla {
 
 using namespace gfx;
@@ -1082,17 +1084,23 @@ CompositorD3D11::EndFrame()
     // to tear when rendering. When not using WARP it appears the DWM takes
     // care of tearing for us.
     presentInterval = 1;
   }
 
   if (oldSize == mSize) {
     RefPtr<IDXGISwapChain1> chain;
     HRESULT hr = mSwapChain->QueryInterface((IDXGISwapChain1**)byRef(chain));
-    if (SUCCEEDED(hr) && 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
       DXGI_PRESENT_PARAMETERS params;
       PodZero(&params);
       params.DirtyRectsCount = mInvalidRegion.GetNumRects();
       std::vector<RECT> rects;
       rects.reserve(params.DirtyRectsCount);
 
       nsIntRegionRectIterator iter(mInvalidRegion);
       const IntRect* r;