Backed out changeset 4c22e58f4398 (bug 1097321) for causing the Windows crash rate to spike.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 13 Jan 2015 15:41:18 -0500
changeset 223628 9862bab2c3010c2065f9f7fc40c221176d9ec7b3
parent 223627 e7da7bc52c940a7f6e07efd3103926dc18087be1
child 223629 6749eed3e68c03ad8c1b9945bc78297201121c95
push id28098
push userkwierso@gmail.com
push dateWed, 14 Jan 2015 00:52:19 +0000
treeherdermozilla-central@e978b8bc5c45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1097321
milestone38.0a1
backs out4c22e58f439822660830751836931b4fee5f45ab
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 4c22e58f4398 (bug 1097321) for causing the Windows crash rate to spike.
gfx/thebes/gfxWindowsPlatform.cpp
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1593,18 +1593,16 @@ bool DoesD3D11DeviceWork(ID3D11Device *d
 #endif
       return false;
     }
   }
   result = true;
   return true;
 }
 
-#define TEXTURE_SIZE 32
-
 // See bug 1083071. On some drivers, Direct3D 11 CreateShaderResourceView fails
 // with E_OUTOFMEMORY.
 bool DoesD3D11TextureSharingWork(ID3D11Device *device)
 {
   static bool checked;
   static bool result;
 
   if (checked)
@@ -1613,39 +1611,45 @@ bool DoesD3D11TextureSharingWork(ID3D11D
 
   if (gfxPrefs::Direct2DForceEnabled() ||
       gfxPrefs::LayersAccelerationForceEnabled())
   {
     result = true;
     return true;
   }
 
+  if (GetModuleHandleW(L"atidxx32.dll")) {
+    nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
+    if (gfxInfo) {
+      nsString vendorID, vendorID2;
+      gfxInfo->GetAdapterVendorID(vendorID);
+      gfxInfo->GetAdapterVendorID2(vendorID2);
+      if (vendorID.EqualsLiteral("0x8086") && vendorID2.IsEmpty()) {
+#if defined(MOZ_CRASHREPORTER)
+        CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Unexpected Intel/AMD dual-GPU setup\n"));
+#endif
+        return false;
+      }
+    }
+  }
+
   RefPtr<ID3D11Texture2D> texture;
   D3D11_TEXTURE2D_DESC desc;
-  desc.Width = TEXTURE_SIZE;
-  desc.Height = TEXTURE_SIZE;
+  desc.Width = 32;
+  desc.Height = 32;
   desc.MipLevels = 1;
   desc.ArraySize = 1;
   desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
   desc.SampleDesc.Count = 1;
   desc.SampleDesc.Quality = 0;
   desc.Usage = D3D11_USAGE_DEFAULT;
   desc.CPUAccessFlags = 0;
   desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
   desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
-
-  int color[TEXTURE_SIZE * TEXTURE_SIZE];
-  D3D11_SUBRESOURCE_DATA data;
-  data.pSysMem = color;
-  data.SysMemPitch = TEXTURE_SIZE * 4;
-  data.SysMemSlicePitch = 0;
-  for (int i = 0; i < sizeof(color)/sizeof(color[0]); i++) {
-      color[i] = 0xff00ffff;
-  }
-  if (FAILED(device->CreateTexture2D(&desc, &data, byRef(texture)))) {
+  if (FAILED(device->CreateTexture2D(&desc, NULL, byRef(texture)))) {
     return false;
   }
 
   HANDLE shareHandle;
   nsRefPtr<IDXGIResource> otherResource;
   if (FAILED(texture->QueryInterface(__uuidof(IDXGIResource),
                                      getter_AddRefs(otherResource))))
   {
@@ -1665,57 +1669,16 @@ bool DoesD3D11TextureSharingWork(ID3D11D
   }
 
   if (FAILED(sharedResource->QueryInterface(__uuidof(ID3D11Texture2D),
                                             getter_AddRefs(sharedTexture))))
   {
     return false;
   }
 
-  desc.Usage = D3D11_USAGE_STAGING;
-  desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
-  desc.MiscFlags = 0;
-  desc.BindFlags = 0;
-
-  RefPtr<ID3D11Texture2D> cpuTexture;
-  if (FAILED(device->CreateTexture2D(&desc, &data, byRef(cpuTexture)))) {
-    return false;
-  }
-
-  nsRefPtr<IDXGIKeyedMutex> sharedMutex;
-  nsRefPtr<ID3D11DeviceContext> deviceContext;
-  sharedResource->QueryInterface(__uuidof(IDXGIKeyedMutex), getter_AddRefs(sharedMutex));
-  device->GetImmediateContext(getter_AddRefs(deviceContext));
-  if (FAILED(sharedMutex->AcquireSync(0, 30*1000))) {
-#if defined(MOZ_CRASHREPORTER)
-    CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Keyed Mutex timeout\n"));
-#endif
-    // only wait for 30 seconds
-    return false;
-  }
-
-  int resultColor;
-  deviceContext->CopyResource(cpuTexture, sharedTexture);
-
-  D3D11_MAPPED_SUBRESOURCE mapped;
-  deviceContext->Map(cpuTexture, 0, D3D11_MAP_READ, 0, &mapped);
-  resultColor = *(int*)mapped.pData;
-  deviceContext->Unmap(cpuTexture, 0);
-
-  sharedMutex->ReleaseSync(0);
-
-  if (resultColor != color[0]) {
-    // Shared surfaces seem to be broken on dual AMD & Intel HW when using the
-    // AMD GPU
-#if defined(MOZ_CRASHREPORTER)
-    CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Shared Surfaces don't work\n"));
-#endif
-    return false;
-  }
-
   RefPtr<ID3D11ShaderResourceView> sharedView;
 
   // This if(FAILED()) is the one that actually fails on systems affected by bug 1083071.
   if (FAILED(device->CreateShaderResourceView(sharedTexture, NULL, byRef(sharedView)))) {
 #if defined(MOZ_CRASHREPORTER)
     CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("CreateShaderResourceView failed\n"));
 #endif
     return false;