Bug 1256728: Add environment variable to disable force present from bug 1232042. r=BenWa
authorMilan Sreckovic <milan@mozilla.com>
Mon, 28 Mar 2016 12:59:38 -0400
changeset 290764 0e1791fce8633506e53b34c18205d6b63ae07ba7
parent 290763 926f349435b2dfe54784d18e6983dae35d68e4d9
child 290765 a5d8c5b653338303e9335f6358dbbe8c9a9dde7b
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenWa
bugs1256728, 1232042
milestone48.0a1
Bug 1256728: Add environment variable to disable force present from bug 1232042. r=BenWa MozReview-Commit-ID: 5jRr0dPMKRV
gfx/thebes/gfxEnv.h
widget/windows/nsWindowGfx.cpp
--- a/gfx/thebes/gfxEnv.h
+++ b/gfx/thebes/gfxEnv.h
@@ -43,16 +43,20 @@ public:
   DECL_GFX_ENV_LIVE("MOZ_DEBUG_SHADERS", DebugShaders);
 
   // Disabling context sharing in GLContextProviderGLX
   DECL_GFX_ENV_ONCE("MOZ_DISABLE_CONTEXT_SHARING_GLX", DisableContextSharingGlx);
 
   // Disabling the crash guard in DriverCrashGuard
   DECL_GFX_ENV_ONCE("MOZ_DISABLE_CRASH_GUARD", DisableCrashGuard);
 
+  // We force present to work around some Windows bugs - disable that if this
+  // environment variable is set.
+  DECL_GFX_ENV_ONCE("MOZ_DISABLE_FORCE_PRESENT", DisableForcePresent);
+
   // Together with paint dumping, only when MOZ_DUMP_PAINTING is defined.
   // Dumping compositor textures is broken pretty badly. For example,
   // on Linux it crashes TextureHost::GetAsSurface() returns null.
   // Expect to have to fix things like this if you turn it on.
   // Meanwhile, content-side texture dumping
   // (conditioned on DebugDumpPainting()) is a good replacement.
   DECL_GFX_ENV_ONCE("MOZ_DUMP_COMPOSITOR_TEXTURES", DumpCompositorTextures);
 
--- a/widget/windows/nsWindowGfx.cpp
+++ b/widget/windows/nsWindowGfx.cpp
@@ -19,16 +19,17 @@
 
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/plugins/PluginInstanceParent.h"
 using mozilla::plugins::PluginInstanceParent;
 
 #include "nsWindowGfx.h"
 #include "nsAppRunner.h"
 #include <windows.h>
+#include "gfxEnv.h"
 #include "gfxImageSurface.h"
 #include "gfxUtils.h"
 #include "gfxWindowsSurface.h"
 #include "gfxWindowsPlatform.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/DataSurfaceHelpers.h"
 #include "mozilla/gfx/Tools.h"
 #include "mozilla/RefPtr.h"
@@ -521,19 +522,21 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t
             }
           }
         }
         break;
       case LayersBackend::LAYERS_CLIENT:
         {
           result = listener->PaintWindow(
             this, LayoutDeviceIntRegion::FromUnknownRegion(region));
-          nsCOMPtr<nsIRunnable> event =
-            NS_NewRunnableMethod(this, &nsWindow::ForcePresent);
-          NS_DispatchToMainThread(event);
+          if (!gfxEnv::DisableForcePresent()) {
+            nsCOMPtr<nsIRunnable> event =
+              NS_NewRunnableMethod(this, &nsWindow::ForcePresent);
+            NS_DispatchToMainThread(event);
+          }
         }
         break;
       default:
         NS_ERROR("Unknown layers backend used!");
         break;
     }
   }