Bug 1074382 - Add some gfxCriticalError logging in the initialization of D3D9. r=milan
authorNicolas Silva <nsilva@mozilla.com>
Thu, 30 Oct 2014 18:20:23 +0100
changeset 213404 e5970b2d633ede30781dcb00c2d42e64a8ce6059
parent 213403 3b7bdfbb0988ca84b0e92fe70b27d8481f9d0bd9
child 213405 60113dfa7cc0757201e03e40a11d6880a2ec419a
push id27748
push userryanvm@gmail.com
push dateFri, 31 Oct 2014 20:14:33 +0000
treeherdermozilla-central@12ac66e2c016 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan
bugs1074382
milestone36.0a1
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
Bug 1074382 - Add some gfxCriticalError logging in the initialization of D3D9. r=milan
gfx/layers/d3d9/DeviceManagerD3D9.cpp
--- a/gfx/layers/d3d9/DeviceManagerD3D9.cpp
+++ b/gfx/layers/d3d9/DeviceManagerD3D9.cpp
@@ -183,27 +183,27 @@ DeviceManagerD3D9::Init()
   HRESULT hr;
 
   if (!GetClassInfoW(GetModuleHandle(nullptr), kClassName, &wc)) {
       ZeroMemory(&wc, sizeof(WNDCLASSW));
       wc.hInstance = GetModuleHandle(nullptr);
       wc.lpfnWndProc = ::DefWindowProc;
       wc.lpszClassName = kClassName;
       if (!RegisterClassW(&wc)) {
-          NS_WARNING("Failed to register window class for DeviceManager.");
+          gfxCriticalError() << "[D3D9] Failed to register class for DeviceManager";
           return false;
       }
   }
 
   mFocusWnd = ::CreateWindowW(kClassName, L"D3D9Window", WS_OVERLAPPEDWINDOW,
                               CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr,
                               nullptr, GetModuleHandle(nullptr), nullptr);
 
   if (!mFocusWnd) {
-    NS_WARNING("Failed to create DeviceManagerD3D9 Window.");
+    gfxCriticalError() << "[D3D9] Failed to create a window";
     return false;
   }
 
   if (gfxPrefs::StereoVideoEnabled()) {
     /* Create an Nv3DVUtils instance */
     if (!mNv3DVUtils) {
       mNv3DVUtils = new Nv3DVUtils();
       if (!mNv3DVUtils) {
@@ -229,30 +229,33 @@ DeviceManagerD3D9::Init()
     if (SUCCEEDED(hr)) {
       mD3D9 = mD3D9Ex;
     }
   }
 #endif
 
   if (!mD3D9) {
     if (!d3d9Create) {
+      gfxCriticalError() << "[D3D9] Failed to load symbols";
       return false;
     }
 
     mD3D9 = dont_AddRef(d3d9Create(D3D_SDK_VERSION));
 
     if (!mD3D9) {
+      gfxCriticalError() << "[D3D9] Failed to create the device";
       return false;
     }
   }
 
   D3DADAPTER_IDENTIFIER9 ident;
   hr = mD3D9->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &ident);
 
   if (FAILED(hr)) {
+    gfxCriticalError() << "[D3D9] Failed to create the environment";
     return false;
   }
 
   D3DPRESENT_PARAMETERS pp;
   memset(&pp, 0, sizeof(D3DPRESENT_PARAMETERS));
 
   pp.BackBufferWidth = 1;
   pp.BackBufferHeight = 1;
@@ -295,22 +298,23 @@ DeviceManagerD3D9::Init()
                              mFocusWnd,
                              D3DCREATE_FPU_PRESERVE |
                              D3DCREATE_MULTITHREADED |
                              D3DCREATE_MIXED_VERTEXPROCESSING,
                              &pp,
                              getter_AddRefs(mDevice));
 
     if (FAILED(hr)) {
-      NS_WARNING("Failed to create Device for DeviceManagerD3D9.");
+      gfxCriticalError() << "[D3D9] Failed to create the device";
       return false;
     }
   }
 
   if (!VerifyCaps()) {
+    gfxCriticalError() << "[D3D9] insufficient capabilities";
     return false;
   }
 
   /* Grab the associated HMONITOR so that we can find out
    * if it changed later */
   D3DDEVICE_CREATION_PARAMETERS parameters;
   if (FAILED(mDevice->GetCreationParameters(&parameters)))
     return false;
@@ -323,133 +327,153 @@ DeviceManagerD3D9::Init()
   if (mNv3DVUtils) { 
     IUnknown* devUnknown = nullptr; 
     if (mDevice) { 
       mDevice->QueryInterface(IID_IUnknown, (void **)&devUnknown); 
     } 
     mNv3DVUtils->SetDeviceInfo(devUnknown); 
   } 
 
+  auto failCreateShaderMsg = "[D3D9] failed to create a critical resource (shader)";
+
   hr = mDevice->CreateVertexShader((DWORD*)LayerQuadVS,
                                    getter_AddRefs(mLayerVS));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)RGBShaderPS,
                                   getter_AddRefs(mRGBPS));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)RGBAShaderPS,
                                   getter_AddRefs(mRGBAPS));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)ComponentPass1ShaderPS,
                                   getter_AddRefs(mComponentPass1PS));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)ComponentPass2ShaderPS,
                                   getter_AddRefs(mComponentPass2PS));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)YCbCrShaderPS,
                                   getter_AddRefs(mYCbCrPS));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)SolidColorShaderPS,
                                   getter_AddRefs(mSolidColorPS));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreateVertexShader((DWORD*)LayerQuadVSMask,
                                    getter_AddRefs(mLayerVSMask));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
   hr = mDevice->CreateVertexShader((DWORD*)LayerQuadVSMask3D,
                                    getter_AddRefs(mLayerVSMask3D));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)RGBShaderPSMask,
                                   getter_AddRefs(mRGBPSMask));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)RGBAShaderPSMask,
                                   getter_AddRefs(mRGBAPSMask));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)RGBAShaderPSMask3D,
                                   getter_AddRefs(mRGBAPSMask3D));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)ComponentPass1ShaderPSMask,
                                   getter_AddRefs(mComponentPass1PSMask));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)ComponentPass2ShaderPSMask,
                                   getter_AddRefs(mComponentPass2PSMask));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)YCbCrShaderPSMask,
                                   getter_AddRefs(mYCbCrPSMask));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   hr = mDevice->CreatePixelShader((DWORD*)SolidColorShaderPSMask,
                                   getter_AddRefs(mSolidColorPSMask));
 
   if (FAILED(hr)) {
+    gfxCriticalError() << failCreateShaderMsg;
     return false;
   }
 
   if (!CreateVertexBuffer()) {
+    gfxCriticalError() << "[D3D9] Failed to create a critical resource (vbo)";
     return false;
   }
 
   hr = mDevice->SetStreamSource(0, mVB, 0, sizeof(vertex));
   if (FAILED(hr)) {
+    gfxCriticalError() << "[D3D9] Failed to set the stream source";
     return false;
   }
 
   D3DVERTEXELEMENT9 elements[] = {
     { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT,
       D3DDECLUSAGE_POSITION, 0 },
     D3DDECL_END()
   };