Bug 1256728: Add environment variable to disable force present from
bug 1232042. r?benwa
MozReview-Commit-ID: 5jRr0dPMKRV
--- 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;
}
}