Bug 612123: Ensure D3D10 layer managers are not used after device changes. r=roc a=blocking-final
authorBas Schouten <bschouten@mozilla.com>
Fri, 19 Nov 2010 19:50:45 +0100
changeset 57918 3ae93548e27a134626dd619522d98a4d2d83ccbc
parent 57917 61fbdf66e57974ce792bea262728c0fdeae219fa
child 57919 8714ad3e0704fe4a0cb033984b80b4f20309d08c
push id17078
push userbschouten@mozilla.com
push dateFri, 19 Nov 2010 18:52:31 +0000
treeherdermozilla-central@8714ad3e0704 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, blocking-final
bugs612123
milestone2.0b8pre
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 612123: Ensure D3D10 layer managers are not used after device changes. r=roc a=blocking-final
widget/src/windows/nsWindow.cpp
widget/src/windows/nsWindowGfx.cpp
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -3166,16 +3166,32 @@ nsWindow::HasPendingInputEvent()
 mozilla::layers::LayerManager*
 nsWindow::GetLayerManager(bool* aAllowRetaining)
 {
   if (aAllowRetaining) {
     *aAllowRetaining = true;
   }
 
 #ifndef WINCE
+#ifdef MOZ_ENABLE_D3D10_LAYER
+  if (mLayerManager) {
+    if (mLayerManager->GetBackendType() ==
+        mozilla::layers::LayerManager::LAYERS_D3D10)
+    {
+      mozilla::layers::LayerManagerD3D10 *layerManagerD3D10 =
+        static_cast<mozilla::layers::LayerManagerD3D10*>(mLayerManager.get());
+      if (layerManagerD3D10->device() !=
+          gfxWindowsPlatform::GetPlatform()->GetD3D10Device())
+      {
+        mLayerManager = nsnull;
+      }
+    }
+  }
+#endif
+
   if (!mLayerManager) {
     nsCOMPtr<nsIPrefBranch2> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
 
     PRBool accelerateByDefault = PR_TRUE;
     PRBool disableAcceleration = PR_FALSE;
     PRBool preferOpenGL = PR_FALSE;
     PRBool preferD3D9 = PR_FALSE;
     if (prefs) {
--- a/widget/src/windows/nsWindowGfx.cpp
+++ b/widget/src/windows/nsWindowGfx.cpp
@@ -727,17 +727,16 @@ DDRAW_FAILED:
         break;
 #endif
 #ifdef MOZ_ENABLE_D3D10_LAYER
       case LayerManager::LAYERS_D3D10:
         {
           gfxWindowsPlatform::GetPlatform()->UpdateRenderMode();
           LayerManagerD3D10 *layerManagerD3D10 = static_cast<mozilla::layers::LayerManagerD3D10*>(GetLayerManager());
           if (layerManagerD3D10->device() != gfxWindowsPlatform::GetPlatform()->GetD3D10Device()) {
-            mLayerManager = nsnull;
             Invalidate(PR_FALSE);
           } else {
             result = DispatchWindowEvent(&event, eventStatus);
           }
         }
         break;
 #endif
       default: