From f3d2d75a879167060b4b3cace4f876f4b2c15c7b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 3 Feb 2015 14:18:44 -0800 Subject: [PATCH] Make debugging whole-layer invalidation slightly easier. (bug 1128752, r=mattwoodrow) --- gfx/layers/client/ContentClient.cpp | 2 +- gfx/layers/ipc/CompositorParent.cpp | 3 +-- gfx/thebes/gfxPrefs.h | 2 ++ layout/base/FrameLayerBuilder.cpp | 9 +++++---- layout/base/nsLayoutUtils.cpp | 8 ++++++++ modules/libpref/init/all.js | 2 ++ 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index c81b8dcdcdb..8beacc458d5 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -786,7 +786,7 @@ ContentClientIncremental::BeginPaintBuffer(PaintedLayer* aLayer, if ((mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) != mHasBufferOnWhite) { printf_stderr("Layer's component alpha status has changed\n"); } - printf_stderr("Invalidating entire layer %p\n", aLayer); + printf_stderr("Invalidating entire layer %p: no buffer, or content type or component alpha changed\n", aLayer); } #endif // We're effectively clearing the valid region, so we need to draw diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index edc05af1bb4..5e9897ab725 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -972,8 +972,7 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect) RenderTraceLayers(mLayerManager->GetRoot(), "0000"); #ifdef MOZ_DUMP_PAINTING - static bool gDumpCompositorTree = false; - if (gDumpCompositorTree) { + if (gfxPrefs::DumpHostLayers()) { printf_stderr("Painting --- compositing layer tree:\n"); mLayerManager->Dump(); } diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index f14b4db5ec3..dc4e07d5d6a 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -276,6 +276,8 @@ private: DECL_GFX_PREF(Live, "layers.dump-texture", LayersDumpTexture, bool, false); #ifdef MOZ_DUMP_PAINTING DECL_GFX_PREF(Live, "layers.dump-decision", LayersDumpDecision, bool, false); + DECL_GFX_PREF(Live, "layers.dump-client-layers", DumpClientLayers, bool, false); + DECL_GFX_PREF(Live, "layers.dump-host-layers", DumpHostLayers, bool, false); #endif // 0 is "no change" for contrast, positive values increase it, negative values diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 1be0ef3135f..323b934b4f2 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -32,6 +32,7 @@ #include "mozilla/gfx/Tools.h" #include "mozilla/gfx/2D.h" #include "gfxPrefs.h" +#include "LayersLogging.h" #include @@ -1649,11 +1650,11 @@ ResetScrollPositionForLayerPixelAlignment(const nsIFrame* aAnimatedGeometryRoot) } static void -InvalidateEntirePaintedLayer(PaintedLayer* aLayer, const nsIFrame* aAnimatedGeometryRoot) +InvalidateEntirePaintedLayer(PaintedLayer* aLayer, const nsIFrame* aAnimatedGeometryRoot, const char *aReason) { #ifdef MOZ_DUMP_PAINTING if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) { - printf_stderr("Invalidating entire layer %p\n", aLayer); + printf_stderr("Invalidating entire layer %p: %s\n", aLayer, aReason); } #endif nsIntRect invalidate = aLayer->GetValidRegion().GetBounds(); @@ -1722,7 +1723,7 @@ ContainerState::CreateOrRecyclePaintedLayer(const nsIFrame* aAnimatedGeometryRoo printf_stderr("Recycled layer %p changed scale\n", layer.get()); } #endif - InvalidateEntirePaintedLayer(layer, aAnimatedGeometryRoot); + InvalidateEntirePaintedLayer(layer, aAnimatedGeometryRoot, "recycled layer changed state"); #ifndef MOZ_WIDGET_ANDROID didResetScrollPositionForLayerPixelAlignment = true; #endif @@ -1798,7 +1799,7 @@ ContainerState::CreateOrRecyclePaintedLayer(const nsIFrame* aAnimatedGeometryRoo // from what we need. if (!animatedGeometryRootTopLeft.WithinEpsilonOf(data->mAnimatedGeometryRootPosition, SUBPIXEL_OFFSET_EPSILON)) { data->mAnimatedGeometryRootPosition = animatedGeometryRootTopLeft; - InvalidateEntirePaintedLayer(layer, aAnimatedGeometryRoot); + InvalidateEntirePaintedLayer(layer, aAnimatedGeometryRoot, "subpixel offset"); } else if (didResetScrollPositionForLayerPixelAlignment) { data->mAnimatedGeometryRootPosition = animatedGeometryRootTopLeft; } diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 225383be141..41a1e5b10b9 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -3227,6 +3227,14 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram #endif } +#ifdef MOZ_DUMP_PAINTING + if (gfxPrefs::DumpClientLayers()) { + std::stringstream ss; + FrameLayerBuilder::DumpRetainedLayerTree(layerManager, ss, false); + printf_stderr("%s", ss.str().c_str()); + } +#endif + // Update the widget's opaque region information. This sets // glass boundaries on Windows. Also set up the window dragging region // and plugin clip regions and bounds. diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 55baab3487f..3b4b773c4b8 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -3923,6 +3923,8 @@ pref("layers.dump", false); // If we're dumping layers, also dump the texture data pref("layers.dump-texture", false); pref("layers.dump-decision", false); +pref("layers.dump-client-layers", false); +pref("layers.dump-host-layers", false); #endif pref("layers.draw-borders", false); pref("layers.draw-tile-borders", false);