4a4070a0e9
(mozilla-disable-skia-be.patch) OBS-URL: https://build.opensuse.org/package/show/mozilla:Factory/MozillaFirefox?expand=0&rev=569
293 lines
8.8 KiB
Diff
293 lines
8.8 KiB
Diff
|
|
# HG changeset patch
|
|
# User Lee Salzman <lsalzman@mozilla.com>
|
|
# Date 1484854371 18000
|
|
# Node ID 42afdb8f7e6b3e8a465042f64c6c49782f231af4
|
|
# Parent dfadd79c97458f898d542461033a61dd34d3a5f0
|
|
Bug 1319374 - Wrap PaintCounter with ifdef USE_SKIA. r=mchang, a=jcristau
|
|
|
|
diff --git a/gfx/2d/BorrowedContext.h b/gfx/2d/BorrowedContext.h
|
|
--- a/gfx/2d/BorrowedContext.h
|
|
+++ b/gfx/2d/BorrowedContext.h
|
|
@@ -190,18 +190,28 @@ public:
|
|
}
|
|
|
|
~BorrowedCGContext() {
|
|
MOZ_ASSERT(!cg);
|
|
}
|
|
|
|
CGContextRef cg;
|
|
private:
|
|
+#ifdef USE_SKIA
|
|
static CGContextRef BorrowCGContextFromDrawTarget(DrawTarget *aDT);
|
|
static void ReturnCGContextToDrawTarget(DrawTarget *aDT, CGContextRef cg);
|
|
+#else
|
|
+ static CGContextRef BorrowCGContextFromDrawTarget(DrawTarget *aDT) {
|
|
+ MOZ_CRASH("Not supported without Skia");
|
|
+ }
|
|
+
|
|
+ static void ReturnCGContextToDrawTarget(DrawTarget *aDT, CGContextRef cg) {
|
|
+ MOZ_CRASH("not supported without Skia");
|
|
+ }
|
|
+#endif
|
|
DrawTarget *mDT;
|
|
};
|
|
#endif
|
|
|
|
} // namespace gfx
|
|
} // namespace mozilla
|
|
|
|
#endif // _MOZILLA_GFX_BORROWED_CONTEXT_H
|
|
diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp
|
|
--- a/gfx/layers/composite/LayerManagerComposite.cpp
|
|
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
|
|
@@ -7,17 +7,16 @@
|
|
#include <stddef.h> // for size_t
|
|
#include <stdint.h> // for uint16_t, uint32_t
|
|
#include "CanvasLayerComposite.h" // for CanvasLayerComposite
|
|
#include "ColorLayerComposite.h" // for ColorLayerComposite
|
|
#include "Composer2D.h" // for Composer2D
|
|
#include "CompositableHost.h" // for CompositableHost
|
|
#include "ContainerLayerComposite.h" // for ContainerLayerComposite, etc
|
|
#include "FPSCounter.h" // for FPSState, FPSCounter
|
|
-#include "PaintCounter.h" // For PaintCounter
|
|
#include "FrameMetrics.h" // for FrameMetrics
|
|
#include "GeckoProfiler.h" // for profiler_set_frame_number, etc
|
|
#include "ImageLayerComposite.h" // for ImageLayerComposite
|
|
#include "Layers.h" // for Layer, ContainerLayer, etc
|
|
#include "LayerScope.h" // for LayerScope Tool
|
|
#include "protobuf/LayerScopePacket.pb.h" // for protobuf (LayerScope)
|
|
#include "PaintedLayerComposite.h" // for PaintedLayerComposite
|
|
#include "TiledContentHost.h"
|
|
@@ -68,16 +67,20 @@
|
|
#include "nsScreenManagerGonk.h"
|
|
#include "nsWindow.h"
|
|
#endif
|
|
#include "GeckoProfiler.h"
|
|
#include "TextRenderer.h" // for TextRenderer
|
|
#include "mozilla/layers/CompositorBridgeParent.h"
|
|
#include "TreeTraversal.h" // for ForEachNode
|
|
|
|
+#ifdef USE_SKIA
|
|
+#include "PaintCounter.h" // For PaintCounter
|
|
+#endif
|
|
+
|
|
class gfxContext;
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
class ImageLayer;
|
|
|
|
using namespace mozilla::gfx;
|
|
@@ -128,16 +131,20 @@ LayerManagerComposite::LayerManagerCompo
|
|
, mGeometryChanged(true)
|
|
, mLastFrameMissedHWC(false)
|
|
, mWindowOverlayChanged(false)
|
|
, mLastPaintTime(TimeDuration::Forever())
|
|
, mRenderStartTime(TimeStamp::Now())
|
|
{
|
|
mTextRenderer = new TextRenderer(aCompositor);
|
|
MOZ_ASSERT(aCompositor);
|
|
+
|
|
+#ifdef USE_SKIA
|
|
+ mPaintCounter = nullptr;
|
|
+#endif
|
|
}
|
|
|
|
LayerManagerComposite::~LayerManagerComposite()
|
|
{
|
|
Destroy();
|
|
}
|
|
|
|
|
|
@@ -146,18 +153,21 @@ LayerManagerComposite::Destroy()
|
|
{
|
|
if (!mDestroyed) {
|
|
mCompositor->GetWidget()->CleanupWindowEffects();
|
|
if (mRoot) {
|
|
RootLayer()->Destroy();
|
|
}
|
|
mRoot = nullptr;
|
|
mClonedLayerTreeProperties = nullptr;
|
|
+ mDestroyed = true;
|
|
+
|
|
+#ifdef USE_SKIA
|
|
mPaintCounter = nullptr;
|
|
- mDestroyed = true;
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
void
|
|
LayerManagerComposite::UpdateRenderBounds(const IntRect& aRect)
|
|
{
|
|
mRenderBounds = aRect;
|
|
}
|
|
@@ -559,48 +569,52 @@ LayerManagerComposite::RootLayer() const
|
|
#endif
|
|
|
|
void
|
|
LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion, const IntRect& aBounds)
|
|
{
|
|
bool drawFps = gfxPrefs::LayersDrawFPS();
|
|
bool drawFrameCounter = gfxPrefs::DrawFrameCounter();
|
|
bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
|
|
- bool drawPaintTimes = gfxPrefs::AlwaysPaint();
|
|
|
|
if (drawFps || drawFrameCounter) {
|
|
aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 256, 256));
|
|
}
|
|
if (drawFrameColorBars) {
|
|
aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 10, aBounds.height));
|
|
}
|
|
+
|
|
+#ifdef USE_SKIA
|
|
+ bool drawPaintTimes = gfxPrefs::AlwaysPaint();
|
|
if (drawPaintTimes) {
|
|
aInvalidRegion.Or(aInvalidRegion, nsIntRect(PaintCounter::GetPaintRect()));
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
+#ifdef USE_SKIA
|
|
void
|
|
LayerManagerComposite::DrawPaintTimes(Compositor* aCompositor)
|
|
{
|
|
if (!mPaintCounter) {
|
|
mPaintCounter = new PaintCounter();
|
|
}
|
|
|
|
TimeDuration compositeTime = TimeStamp::Now() - mRenderStartTime;
|
|
mPaintCounter->Draw(aCompositor, mLastPaintTime, compositeTime);
|
|
}
|
|
+#endif
|
|
|
|
static uint16_t sFrameCount = 0;
|
|
void
|
|
LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds)
|
|
{
|
|
bool drawFps = gfxPrefs::LayersDrawFPS();
|
|
bool drawFrameCounter = gfxPrefs::DrawFrameCounter();
|
|
bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
|
|
- bool drawPaintTimes = gfxPrefs::AlwaysPaint();
|
|
|
|
TimeStamp now = TimeStamp::Now();
|
|
|
|
if (drawFps) {
|
|
if (!mFPS) {
|
|
mFPS = MakeUnique<FPSState>();
|
|
}
|
|
|
|
@@ -731,19 +745,22 @@ LayerManagerComposite::RenderDebugOverla
|
|
}
|
|
#endif
|
|
|
|
if (drawFrameColorBars || drawFrameCounter) {
|
|
// We intentionally overflow at 2^16.
|
|
sFrameCount++;
|
|
}
|
|
|
|
+#ifdef USE_SKIA
|
|
+ bool drawPaintTimes = gfxPrefs::AlwaysPaint();
|
|
if (drawPaintTimes) {
|
|
DrawPaintTimes(mCompositor);
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
RefPtr<CompositingRenderTarget>
|
|
LayerManagerComposite::PushGroupForLayerEffects()
|
|
{
|
|
// This is currently true, so just making sure that any new use of this
|
|
// method is flagged for investigation
|
|
MOZ_ASSERT(gfxPrefs::LayersEffectInvert() ||
|
|
diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h
|
|
--- a/gfx/layers/composite/LayerManagerComposite.h
|
|
+++ b/gfx/layers/composite/LayerManagerComposite.h
|
|
@@ -326,21 +326,16 @@ private:
|
|
* Render the current layer tree to the active target.
|
|
*/
|
|
void Render(const nsIntRegion& aInvalidRegion, const nsIntRegion& aOpaqueRegion);
|
|
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
|
|
void RenderToPresentationSurface();
|
|
#endif
|
|
|
|
/**
|
|
- * Render paint and composite times above the frame.
|
|
- */
|
|
- void DrawPaintTimes(Compositor* aCompositor);
|
|
-
|
|
- /**
|
|
* We need to know our invalid region before we're ready to render.
|
|
*/
|
|
void InvalidateDebugOverlay(nsIntRegion& aInvalidRegion, const gfx::IntRect& aBounds);
|
|
|
|
/**
|
|
* Render debug overlays such as the FPS/FrameCounter above the frame.
|
|
*/
|
|
void RenderDebugOverlay(const gfx::IntRect& aBounds);
|
|
@@ -386,19 +381,26 @@ private:
|
|
RefPtr<TextRenderer> mTextRenderer;
|
|
bool mGeometryChanged;
|
|
|
|
// Testing property. If hardware composer is supported, this will return
|
|
// true if the last frame was deemed 'too complicated' to be rendered.
|
|
bool mLastFrameMissedHWC;
|
|
|
|
bool mWindowOverlayChanged;
|
|
- RefPtr<PaintCounter> mPaintCounter;
|
|
TimeDuration mLastPaintTime;
|
|
TimeStamp mRenderStartTime;
|
|
+
|
|
+#ifdef USE_SKIA
|
|
+ /**
|
|
+ * Render paint and composite times above the frame.
|
|
+ */
|
|
+ void DrawPaintTimes(Compositor* aCompositor);
|
|
+ RefPtr<PaintCounter> mPaintCounter;
|
|
+#endif
|
|
};
|
|
|
|
/**
|
|
* Composite layers are for use with OMTC on the compositor thread only. There
|
|
* must be corresponding Basic layers on the content thread. For composite
|
|
* layers, the layer manager only maintains the layer tree, all rendering is
|
|
* done by a Compositor (see Compositor.h). As such, composite layers are
|
|
* platform-independent and can be used on any platform for which there is a
|
|
diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build
|
|
--- a/gfx/layers/moz.build
|
|
+++ b/gfx/layers/moz.build
|
|
@@ -335,17 +335,16 @@ UNIFIED_SOURCES += [
|
|
'composite/CompositableHost.cpp',
|
|
'composite/ContainerLayerComposite.cpp',
|
|
'composite/ContentHost.cpp',
|
|
'composite/FPSCounter.cpp',
|
|
'composite/FrameUniformityData.cpp',
|
|
'composite/ImageHost.cpp',
|
|
'composite/ImageLayerComposite.cpp',
|
|
'composite/LayerManagerComposite.cpp',
|
|
- 'composite/PaintCounter.cpp',
|
|
'composite/PaintedLayerComposite.cpp',
|
|
'composite/TextRenderer.cpp',
|
|
'composite/TextureHost.cpp',
|
|
'composite/TiledContentHost.cpp',
|
|
'Compositor.cpp',
|
|
'CopyableCanvasLayer.cpp',
|
|
'Effects.cpp',
|
|
'FrameMetrics.cpp',
|
|
@@ -480,8 +479,13 @@ MOCHITEST_CHROME_MANIFESTS += ['apz/test
|
|
|
|
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
|
|
CXXFLAGS += CONFIG['TK_CFLAGS']
|
|
|
|
LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
|
|
|
|
if CONFIG['GNU_CXX']:
|
|
CXXFLAGS += ['-Wno-error=shadow']
|
|
+
|
|
+if CONFIG['MOZ_ENABLE_SKIA']:
|
|
+ UNIFIED_SOURCES += [
|
|
+ 'composite/PaintCounter.cpp',
|
|
+ ]
|