diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index de0e59696bb2..ccc8889ca05e 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -93,7 +93,6 @@ ClientLayerManager::ClientLayerManager(nsIWidget* aWidget) : mPhase(PHASE_NONE) , mWidget(aWidget) , mLatestTransactionId(0) - , mLastPaintTime(TimeDuration::Forever()) , mTargetRotation(ROTATION_0) , mRepeatTransaction(false) , mIsRepeatTransaction(false) @@ -284,24 +283,17 @@ ClientLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback, ClientLayer* root = ClientLayer::ToClientLayer(GetRoot()); mTransactionIncomplete = false; - + // Apply pending tree updates before recomputing effective // properties. GetRoot()->ApplyPendingUpdatesToSubtree(); - + mPaintedLayerCallback = aCallback; mPaintedLayerCallbackData = aCallbackData; GetRoot()->ComputeEffectiveTransforms(Matrix4x4()); - if (gfxPrefs::AlwaysPaint() && XRE_IsContentProcess()) { - TimeStamp start = TimeStamp::Now(); - root->RenderLayer(); - mLastPaintTime = TimeStamp::Now() - start; - } else { - root->RenderLayer(); - } - + root->RenderLayer(); if (!mRepeatTransaction && !GetRoot()->GetInvalidRegion().IsEmpty()) { GetRoot()->Mutated(); } @@ -631,10 +623,6 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite) transactionStart = mTransactionStart; } - if (gfxPrefs::AlwaysPaint() && XRE_IsContentProcess()) { - mForwarder->SendPaintTime(mLatestTransactionId, mLastPaintTime); - } - // forward this transaction's changeset to our LayerManagerComposite bool sent; AutoTArray replies; diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index 6fd1d8ca1304..4d0b925027cf 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -303,7 +303,7 @@ private: LayerRefArray mKeepAlive; nsIWidget* mWidget; - + /* PaintedLayer callbacks; valid at the end of a transaciton, * while rendering */ DrawPaintedLayerCallback mPaintedLayerCallback; @@ -321,7 +321,6 @@ private: RefPtr mTransactionIdAllocator; uint64_t mLatestTransactionId; - TimeDuration mLastPaintTime; // Sometimes we draw to targets that don't natively support // landscape/portrait orientation. When we need to implement that diff --git a/gfx/layers/composite/FPSCounter.cpp b/gfx/layers/composite/FPSCounter.cpp index 02ffc4b2c19c..f58692be2fa7 100644 --- a/gfx/layers/composite/FPSCounter.cpp +++ b/gfx/layers/composite/FPSCounter.cpp @@ -394,7 +394,8 @@ static void DrawDigits(unsigned int aValue, Rect drawRect = Rect(aOffsetX + n * FontWidth, aOffsetY, FontWidth, FontHeight); IntRect clipRect = IntRect(0, 0, 300, 100); - aCompositor->DrawQuad(drawRect, clipRect, aEffectChain, opacity, transform); + aCompositor->DrawQuad(drawRect, clipRect, + aEffectChain, opacity, transform); } } diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 110ae2cec627..7f620b23907e 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -12,7 +12,6 @@ #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 @@ -128,8 +127,6 @@ LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor) , mGeometryChanged(true) , mLastFrameMissedHWC(false) , mWindowOverlayChanged(false) -, mLastPaintTime(TimeDuration::Forever()) -, mRenderStartTime(TimeStamp::Now()) { mTextRenderer = new TextRenderer(aCompositor); MOZ_ASSERT(aCompositor); @@ -151,7 +148,6 @@ LayerManagerComposite::Destroy() } mRoot = nullptr; mClonedLayerTreeProperties = nullptr; - mPaintCounter = nullptr; mDestroyed = true; } } @@ -377,7 +373,6 @@ LayerManagerComposite::EndTransaction(const TimeStamp& aTimeStamp, NS_ASSERTION(!(aFlags & END_NO_COMPOSITE), "Shouldn't get END_NO_COMPOSITE here"); mInTransaction = false; - mRenderStartTime = TimeStamp::Now(); if (!mIsCompositorReady) { return; @@ -564,7 +559,6 @@ LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion, const 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)); @@ -572,20 +566,6 @@ LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion, const if (drawFrameColorBars) { aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 10, aBounds.height)); } - if (drawPaintTimes) { - aInvalidRegion.Or(aInvalidRegion, nsIntRect(PaintCounter::GetPaintRect())); - } -} - -void -LayerManagerComposite::DrawPaintTimes(Compositor* aCompositor) -{ - if (!mPaintCounter) { - mPaintCounter = new PaintCounter(); - } - - TimeDuration compositeTime = TimeStamp::Now() - mRenderStartTime; - mPaintCounter->Draw(aCompositor, mLastPaintTime, compositeTime); } static uint16_t sFrameCount = 0; @@ -595,7 +575,6 @@ 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(); @@ -735,10 +714,6 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) // We intentionally overflow at 2^16. sFrameCount++; } - - if (drawPaintTimes) { - DrawPaintTimes(mCompositor); - } } RefPtr diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index db42d2acf6f0..fbc9492246ab 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -62,7 +62,6 @@ class PaintedLayerComposite; class TextRenderer; class CompositingRenderTarget; struct FPSState; -class PaintCounter; static const int kVisualWarningDuration = 150; // ms @@ -332,8 +331,6 @@ public: void ForcePresent() { mCompositor->ForcePresent(); } - void SetPaintTime(const TimeDuration& aPaintTime) { mLastPaintTime = aPaintTime; } - private: /** Region we're clipping our current drawing to. */ nsIntRegion mClippingRegion; @@ -355,11 +352,6 @@ private: 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. */ @@ -417,9 +409,6 @@ private: bool mLastFrameMissedHWC; bool mWindowOverlayChanged; - RefPtr mPaintCounter; - TimeDuration mLastPaintTime; - TimeStamp mRenderStartTime; }; /** diff --git a/gfx/layers/composite/PaintCounter.cpp b/gfx/layers/composite/PaintCounter.cpp deleted file mode 100644 index 9b798c3c0e7d..000000000000 --- a/gfx/layers/composite/PaintCounter.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/gfx/Point.h" // for IntSize, Point -#include "mozilla/gfx/Rect.h" // for Rect -#include "mozilla/gfx/Types.h" // for Color, SurfaceFormat -#include "mozilla/layers/Compositor.h" // for Compositor -#include "mozilla/layers/CompositorTypes.h" -#include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc -#include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration -#include "mozilla/Snprintf.h" - -#include "SkColor.h" -#include "mozilla/gfx/HelpersSkia.h" -#include "skia/include/core/SkBitmapDevice.h" -#include "PaintCounter.h" - -namespace mozilla { -namespace layers { - -using namespace mozilla::gfx; - -// Positioned below the chrome UI -IntRect PaintCounter::mRect = IntRect(0, 175, 300, 60); - -PaintCounter::PaintCounter() -{ - mFormat = SurfaceFormat::B8G8R8A8; - mSurface = Factory::CreateDataSourceSurface(mRect.Size(), mFormat); - mStride = mSurface->Stride(); - - SkBitmap bitmap; - bitmap.setInfo(MakeSkiaImageInfo(mRect.Size(), mFormat), mStride); - bitmap.setPixels(mSurface->GetData()); - bitmap.eraseColor(SK_ColorWHITE); - - mCanvas.adopt(new SkCanvas(bitmap)); -} - -PaintCounter::~PaintCounter() -{ - mSurface = nullptr; - mTextureSource = nullptr; - mTexturedEffect = nullptr; -} - -void -PaintCounter::Draw(Compositor* aCompositor, TimeDuration aPaintTime, TimeDuration aCompositeTime) { - const int buffer_size = 48; - char buffer[buffer_size]; - snprintf(buffer, buffer_size, "P: %.2f C: %.2f", - aPaintTime.ToMilliseconds(), - aCompositeTime.ToMilliseconds()); - - SkPaint paint; - paint.setTextSize(32); - paint.setColor(SkColorSetRGB(0, 255, 0)); - paint.setAntiAlias(true); - - mCanvas->clear(SK_ColorTRANSPARENT); - mCanvas->drawText(buffer, strlen(buffer), 10, 30, paint); - mCanvas->flush(); - - if (!mTextureSource) { - mTextureSource = aCompositor->CreateDataTextureSource(); - mTexturedEffect = CreateTexturedEffect(mFormat, mTextureSource, - SamplingFilter::POINT, true); - mTexturedEffect->mTextureCoords = Rect(0, 0, 1.0f, 1.0f); - } - - mTextureSource->Update(mSurface); - - EffectChain effectChain; - effectChain.mPrimaryEffect = mTexturedEffect; - - gfx::Matrix4x4 identity; - Rect rect(mRect.x, mRect.y, mRect.width, mRect.height); - aCompositor->DrawQuad(rect, mRect, effectChain, 1.0, identity); -} - -} // end namespace layers -} // end namespace mozilla diff --git a/gfx/layers/composite/PaintCounter.h b/gfx/layers/composite/PaintCounter.h deleted file mode 100644 index e7571facb13e..000000000000 --- a/gfx/layers/composite/PaintCounter.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_layers_PaintCounter_h_ -#define mozilla_layers_PaintCounter_h_ - -#include // for std::map -#include "mozilla/RefPtr.h" // for already_AddRefed, RefCounted -#include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration -#include "skia/include/core/SkCanvas.h" -#include "mozilla/gfx/HelpersSkia.h" - -namespace mozilla { -namespace layers { - -class Compositor; - -using namespace mozilla::gfx; -using namespace mozilla::gl; - -// Keeps track and paints how long a full invalidation paint takes to rasterize -// and composite. -class PaintCounter { -public: - NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PaintCounter) - - PaintCounter(); - void Draw(Compositor* aCompositor, TimeDuration aPaintTime, TimeDuration aCompositeTime); - static IntRect GetPaintRect() { return PaintCounter::mRect; } - -private: - virtual ~PaintCounter(); - - SurfaceFormat mFormat; - RefPtrSkia mCanvas; - IntSize mSize; - int mStride; - - RefPtr mSurface; - RefPtr mTextureSource; - RefPtr mTexturedEffect; - static IntRect mRect; -}; - -} // namespace layers -} // namespace mozilla - -#endif // mozilla_layers_opengl_PaintCounter_h_ diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp index 09a739f488a8..4dc2af3f1721 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CompositorBridgeParent.cpp @@ -615,7 +615,6 @@ CompositorBridgeParent::CompositorBridgeParent(CSSToLayoutDeviceScale aScale, , mForceCompositionTask(nullptr) , mCompositorThreadHolder(CompositorThreadHolder::GetSingleton()) , mCompositorScheduler(nullptr) - , mPaintTime(TimeDuration::Forever()) #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) , mLastPluginUpdateLayerTreeId(0) , mDeferPluginWindows(false) @@ -1079,18 +1078,6 @@ CompositorBridgeParent::ScheduleTask(already_AddRefed task, } } -void -CompositorBridgeParent::UpdatePaintTime(LayerTransactionParent* aLayerTree, - const TimeDuration& aPaintTime) -{ - // We get a lot of paint timings for things with empty transactions. - if (!mLayerManager || aPaintTime.ToMilliseconds() < 1.0) { - return; - } - - mLayerManager->SetPaintTime(aPaintTime); -} - void CompositorBridgeParent::NotifyShadowTreeTransaction(uint64_t aId, bool aIsFirstPaint, bool aScheduleComposite, uint32_t aPaintSequenceNumber, @@ -2143,19 +2130,6 @@ public: virtual CompositorBridgeParentIPCAllocator* AsCompositorBridgeParentIPCAllocator() override { return this; } - virtual void UpdatePaintTime(LayerTransactionParent* aLayerTree, const TimeDuration& aPaintTime) override { - uint64_t id = aLayerTree->GetId(); - MOZ_ASSERT(id != 0); - - CompositorBridgeParent::LayerTreeState* state = - CompositorBridgeParent::GetIndirectShadowTree(id); - if (!state || !state->mParent) { - return; - } - - state->mParent->UpdatePaintTime(aLayerTree, aPaintTime); - } - protected: void OnChannelConnected(int32_t pid) override { mCompositorThreadHolder = CompositorThreadHolder::GetSingleton(); diff --git a/gfx/layers/ipc/CompositorBridgeParent.h b/gfx/layers/ipc/CompositorBridgeParent.h index 80d2b12c9b45..2051effd2bac 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.h +++ b/gfx/layers/ipc/CompositorBridgeParent.h @@ -372,9 +372,6 @@ public: bool aScheduleComposite, uint32_t aPaintSequenceNumber, bool aIsRepeatTransaction, bool aHitTestUpdate); - void UpdatePaintTime(LayerTransactionParent* aLayerTree, - const TimeDuration& aPaintTime) override; - /** * Check rotation info and schedule a rendering task if needed. * Only can be called from compositor thread. @@ -633,8 +630,6 @@ protected: // mSelfRef is cleared in DeferredDestroy which is scheduled by ActorDestroy. RefPtr mSelfRef; - TimeDuration mPaintTime; - #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) // cached plugin data used to reduce the number of updates we request. uint64_t mLastPluginUpdateLayerTreeId; diff --git a/gfx/layers/ipc/LayerTransactionParent.cpp b/gfx/layers/ipc/LayerTransactionParent.cpp index 9ef8d7ee91d2..a9eb1396a25c 100644 --- a/gfx/layers/ipc/LayerTransactionParent.cpp +++ b/gfx/layers/ipc/LayerTransactionParent.cpp @@ -228,14 +228,6 @@ private: InfallibleTArray* mActorsToDestroy; }; -bool -LayerTransactionParent::RecvPaintTime(const uint64_t& aTransactionId, - const TimeDuration& aPaintTime) -{ - mShadowLayersManager->UpdatePaintTime(this, aPaintTime); - return true; -} - bool LayerTransactionParent::RecvUpdate(InfallibleTArray&& cset, InfallibleTArray&& aToDestroy, diff --git a/gfx/layers/ipc/LayerTransactionParent.h b/gfx/layers/ipc/LayerTransactionParent.h index 48661284fc05..bd98897f8b47 100644 --- a/gfx/layers/ipc/LayerTransactionParent.h +++ b/gfx/layers/ipc/LayerTransactionParent.h @@ -109,9 +109,6 @@ protected: virtual bool RecvShutdown() override; - virtual bool RecvPaintTime(const uint64_t& aTransactionId, - const TimeDuration& aPaintTime) override; - virtual bool RecvUpdate(EditArray&& cset, OpDestroyArray&& aToDestroy, const uint64_t& aFwdTransactionId, diff --git a/gfx/layers/ipc/PLayerTransaction.ipdl b/gfx/layers/ipc/PLayerTransaction.ipdl index fdf63aa704ac..ad87c3f674d6 100644 --- a/gfx/layers/ipc/PLayerTransaction.ipdl +++ b/gfx/layers/ipc/PLayerTransaction.ipdl @@ -58,8 +58,6 @@ parent: int32_t paintSyncId) returns (EditReply[] reply); - async PaintTime(uint64_t id, TimeDuration paintTime); - // We don't need to send a sync transaction if // no transaction operate require a swap. async UpdateNoSwap(Edit[] cset, OpDestroy[] toDestroy, diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index 801494245e9c..ef8158a2a167 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -589,15 +589,6 @@ ShadowLayerForwarder::StorePluginWidgetConfigurations(const nsTArrayIPCOpen() || - !mShadowManager->SendPaintTime(aId, aPaintTime)) { - NS_WARNING("Could not send paint times over IPC"); - } -} - bool ShadowLayerForwarder::EndTransaction(InfallibleTArray* aReplies, const nsIntRegion& aRegionToClear, diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index ffa2ebfbf5a2..0735d8fe0e56 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -265,11 +265,6 @@ public: const nsIntRect& aPictureRect) override; #endif - /** - * Used for debugging to tell the compositor how long this frame took to paint. - */ - void SendPaintTime(uint64_t aId, TimeDuration aPaintTime); - /** * End the current transaction and forward it to LayerManagerComposite. * |aReplies| are directions from the LayerManagerComposite to the diff --git a/gfx/layers/ipc/ShadowLayersManager.h b/gfx/layers/ipc/ShadowLayersManager.h index 65be48e5a226..cab267ffc9d8 100644 --- a/gfx/layers/ipc/ShadowLayersManager.h +++ b/gfx/layers/ipc/ShadowLayersManager.h @@ -46,7 +46,6 @@ public: const uint64_t& aInputBlockId, const nsTArray& aTargets) = 0; virtual CompositorBridgeParentIPCAllocator* AsCompositorBridgeParentIPCAllocator() { return nullptr; } - virtual void UpdatePaintTime(LayerTransactionParent* aLayerTree, const TimeDuration& aPaintTime) {} }; } // namespace layers diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build index 50b6aab85712..9cddb9cd4198 100644 --- a/gfx/layers/moz.build +++ b/gfx/layers/moz.build @@ -334,7 +334,6 @@ UNIFIED_SOURCES += [ 'composite/ImageHost.cpp', 'composite/ImageLayerComposite.cpp', 'composite/LayerManagerComposite.cpp', - 'composite/PaintCounter.cpp', 'composite/PaintedLayerComposite.cpp', 'composite/TextRenderer.cpp', 'composite/TextureHost.cpp', diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index 48d6d23ce4ea..ccbb4e42a058 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -386,7 +386,6 @@ private: DECL_GFX_PREF(Live, "gfx.ycbcr.accurate-conversion", YCbCrAccurateConversion, bool, false); DECL_GFX_PREF(Live, "gfx.content.use-native-pushlayer", UseNativePushLayer, bool, false); - DECL_GFX_PREF(Live, "gfx.content.always-paint", AlwaysPaint, bool, false); // Disable surface sharing due to issues with compatible FBConfigs on // NVIDIA drivers as described in bug 1193015. diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 322d2aa87b32..5392998d19a7 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1763,11 +1763,6 @@ already_AddRefed nsDisplayList::PaintRoot(nsDisplayListBuilder* aB layerManager->BeginTransaction(); } } - - if (XRE_IsContentProcess() && gfxPrefs::AlwaysPaint()) { - FrameLayerBuilder::InvalidateAllLayers(layerManager); - } - if (widgetTransaction) { layerBuilder->DidBeginRetainedLayerTransaction(layerManager); } diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 498042b26caf..db77b8c9406f 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -1928,10 +1928,6 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime) ConfigureHighPrecision(); NS_ASSERTION(mInRefresh, "Still in refresh"); - - if (mPresContext->IsRoot() && XRE_IsContentProcess() && gfxPrefs::AlwaysPaint()) { - ScheduleViewManagerFlush(); - } } void diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index abccac65357f..191c2bc659f8 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4564,8 +4564,6 @@ pref("layers.componentalpha.enabled", true); // Use the DT-backend implemented PushLayer pref("gfx.content.use-native-pushlayer", false); -pref("gfx.content.always-paint", false); - #ifdef ANDROID pref("gfx.apitrace.enabled",false); #endif