From b9fbf3dea9b6f3b0299e87e1ebe1b399a7cce8a7 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Mon, 6 Aug 2012 21:59:01 -0700 Subject: [PATCH] Back out 9fb78d71f361, 28f8ce199bed, 78ffaa79a3de, 9f6f9b74d685 (bug 779940 and bug 778036) because of Android failures --- dom/ipc/TabChild.cpp | 13 +++-- dom/ipc/TabChild.h | 1 - gfx/layers/Layers.h | 60 ++++++---------------- gfx/layers/ipc/CompositorParent.cpp | 16 +----- gfx/layers/ipc/CompositorParent.h | 1 - gfx/layers/ipc/ShadowLayers.h | 2 - gfx/layers/opengl/LayerManagerOGL.cpp | 71 +-------------------------- gfx/layers/opengl/LayerManagerOGL.h | 10 +--- layout/ipc/RenderFrameParent.cpp | 13 ++--- layout/ipc/RenderFrameParent.h | 3 +- 10 files changed, 33 insertions(+), 157 deletions(-) diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index d8687f568335..8aee4abbf25e 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -102,7 +102,6 @@ TabChild::TabChild(PRUint32 aChromeFlags, bool aIsBrowserElement, , mDidFakeShow(false) , mIsBrowserElement(aIsBrowserElement) , mAppId(aAppId) - , mNotified(false) { printf("creating %d!\n", NS_IsMainThread()); } @@ -1184,9 +1183,17 @@ TabChild::SetBackgroundColor(const nscolor& aColor) void TabChild::NotifyPainted() { - if (UseDirectCompositor() && !mNotified) { + if (UseDirectCompositor()) { + // FIXME/bug XXXXXX: in theory, we should only have to push a + // txn to our remote frame once, and the + // display-list/FrameLayerBuilder code there will manage the + // tree from there on. But in practice, that doesn't work for + // some unknown reason. So for now, always notify the content + // thread in the parent process. It's wasteful but won't + // result in unnecessary repainting or even composites + // (usually, unless timing is unlucky), since they're + // throttled. mRemoteFrame->SendNotifyCompositorTransaction(); - mNotified = true; } } diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 9692fa8945ee..67b6c2ade8aa 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -305,7 +305,6 @@ private: ScrollingBehavior mScrolling; bool mDidFakeShow; bool mIsBrowserElement; - bool mNotified; PRUint32 mAppId; DISALLOW_EVIL_CONSTRUCTORS(TabChild); diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index a0b1ffe394b6..73f517b05ee0 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -539,10 +539,8 @@ public: NS_ASSERTION((aFlags & (CONTENT_OPAQUE | CONTENT_COMPONENT_ALPHA)) != (CONTENT_OPAQUE | CONTENT_COMPONENT_ALPHA), "Can't be opaque and require component alpha"); - if (mContentFlags != aFlags) { - mContentFlags = aFlags; - Mutated(); - } + mContentFlags = aFlags; + Mutated(); } /** * CONSTRUCTION PHASE ONLY @@ -559,10 +557,8 @@ public: */ virtual void SetVisibleRegion(const nsIntRegion& aRegion) { - if (!mVisibleRegion.IsEqual(aRegion)) { - mVisibleRegion = aRegion; - Mutated(); - } + mVisibleRegion = aRegion; + Mutated(); } /** @@ -572,10 +568,8 @@ public: */ void SetOpacity(float aOpacity) { - if (mOpacity != aOpacity) { - mOpacity = aOpacity; - Mutated(); - } + mOpacity = aOpacity; + Mutated(); } /** @@ -590,25 +584,11 @@ public: */ void SetClipRect(const nsIntRect* aRect) { - if (mUseClipRect) { - if (!aRect) { - mUseClipRect = false; - Mutated(); - } else { - if (!aRect->IsEqualEdges(mClipRect)) { - mClipRect = *aRect; - Mutated(); - } - } - } else { - if (aRect) { - Mutated(); - mUseClipRect = true; - if (!aRect->IsEqualEdges(mClipRect)) { - mClipRect = *aRect; - } - } + mUseClipRect = aRect != nullptr; + if (aRect) { + mClipRect = *aRect; } + Mutated(); } /** @@ -657,10 +637,8 @@ public: } #endif - if (mMaskLayer != aMaskLayer) { - mMaskLayer = aMaskLayer; - Mutated(); - } + mMaskLayer = aMaskLayer; + Mutated(); } /** @@ -672,9 +650,6 @@ public: */ void SetBaseTransform(const gfx3DMatrix& aMatrix) { - if (mTransform == aMatrix) { - return; - } mTransform = aMatrix; Mutated(); } @@ -1129,10 +1104,8 @@ public: */ void SetFrameMetrics(const FrameMetrics& aFrameMetrics) { - if (mFrameMetrics != aFrameMetrics) { - mFrameMetrics = aFrameMetrics; - Mutated(); - } + mFrameMetrics = aFrameMetrics; + Mutated(); } void SetPreScale(float aXScale, float aYScale) @@ -1422,10 +1395,7 @@ public: void SetReferentId(uint64_t aId) { MOZ_ASSERT(aId != 0); - if (mId != aId) { - mId = aId; - Mutated(); - } + mId = aId; } /** * CONSTRUCTION PHASE ONLY diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index e44f9e968d5f..ed50e97fc5e0 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -320,16 +320,6 @@ CompositorParent::ScheduleTask(CancelableTask* task, int time) } } -void -CompositorParent::NotifyShadowTreeTransaction() -{ - ShadowLayerManager *shadow = mLayerManager->AsShadowManager(); - if (shadow) { - shadow->NotifyShadowTreeTransaction(); - } - ScheduleComposition(); -} - void CompositorParent::ScheduleComposition() { @@ -896,10 +886,6 @@ CompositorParent::ShadowLayersUpdated(ShadowLayersParent* aLayerTree, SetShadowProperties(root); } ScheduleComposition(); - ShadowLayerManager *shadow = mLayerManager->AsShadowManager(); - if (shadow) { - shadow->NotifyShadowTreeTransaction(); - } } PLayersParent* @@ -1207,7 +1193,7 @@ CrossProcessCompositorParent::ShadowLayersUpdated( } UpdateIndirectTree(id, shadowRoot, isFirstPaint); - sCurrentCompositor->NotifyShadowTreeTransaction(); + sCurrentCompositor->ScheduleComposition(); } void diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index c11474c82950..364eb80abf7c 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -86,7 +86,6 @@ public: void ScheduleResumeOnCompositorThread(int width, int height); virtual void ScheduleComposition(); - void NotifyShadowTreeTransaction(); /** * Returns a pointer to the compositor corresponding to the given ID. diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index a4442aba8a26..1897f90566f7 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -411,8 +411,6 @@ public: /** CONSTRUCTION PHASE ONLY */ virtual already_AddRefed CreateShadowRefLayer() { return nullptr; } - virtual void NotifyShadowTreeTransaction() {} - /** * Try to open |aDescriptor| for direct texturing. If the * underlying surface supports direct texturing, a non-null diff --git a/gfx/layers/opengl/LayerManagerOGL.cpp b/gfx/layers/opengl/LayerManagerOGL.cpp index 1ac92f5362a5..8631600da77f 100644 --- a/gfx/layers/opengl/LayerManagerOGL.cpp +++ b/gfx/layers/opengl/LayerManagerOGL.cpp @@ -506,12 +506,6 @@ LayerManagerOGL::RootLayer() const bool LayerManagerOGL::sDrawFPS = false; -void -LayerManagerOGL::FPSState::NotifyShadowTreeTransaction() -{ - contentFCount++; -} - /* This function tries to stick to portable C89 as much as possible * so that it can be easily copied into other applications */ void @@ -527,13 +521,6 @@ LayerManagerOGL::FPSState::DrawFPS(GLContext* context, ShaderProgramOGL* copypro fps = rate / duration.ToSeconds() + .5; fcount = 0; } - if (contentFCount >= rate) { - TimeStamp now = TimeStamp::Now(); - TimeDuration duration = now - contentLast; - contentLast = now; - contentFps = contentFCount / duration.ToSeconds() + .5; - contentFCount = 0; - } GLint viewport[4]; context->fGetIntegerv(LOCAL_GL_VIEWPORT, viewport); @@ -588,34 +575,13 @@ LayerManagerOGL::FPSState::DrawFPS(GLContext* context, ShaderProgramOGL* copypro { -1.0f + 44.f / viewport[2], 1.0f - 42.f / viewport[3] }, { -1.0f + 44.f / viewport[2], 1.0f }, { -1.0f + 66.f / viewport[2], 1.0f - 42.f / viewport[3] }, - { -1.0f + 66.f / viewport[2], 1.0f }, - }; - - const Vertex2D vertices2[] = { - { -1.0f + 80.f / viewport[2], 1.0f - 42.f / viewport[3] }, - { -1.0f + 80.f / viewport[2], 1.0f }, - { -1.0f + 102.f / viewport[2], 1.0f - 42.f / viewport[3] }, - { -1.0f + 102.f / viewport[2], 1.0f }, - - { -1.0f + 102.f / viewport[2], 1.0f - 42.f / viewport[3] }, - { -1.0f + 102.f / viewport[2], 1.0f }, - { -1.0f + 124.f / viewport[2], 1.0f - 42.f / viewport[3] }, - { -1.0f + 124.f / viewport[2], 1.0f }, - - { -1.0f + 124.f / viewport[2], 1.0f - 42.f / viewport[3] }, - { -1.0f + 124.f / viewport[2], 1.0f }, - { -1.0f + 146.f / viewport[2], 1.0f - 42.f / viewport[3] }, - { -1.0f + 146.f / viewport[2], 1.0f }, + { -1.0f + 66.f / viewport[2], 1.0f } }; int v1 = fps % 10; int v10 = (fps % 100) / 10; int v100 = (fps % 1000) / 100; - int content1 = contentFps % 10; - int content10 = (contentFps % 100) / 10; - int content100 = (contentFps % 1000) / 100; - // Feel free to comment these texture coordinates out and use one // of the ones below instead, or play around with your own values. const GLfloat texCoords[] = { @@ -634,23 +600,6 @@ LayerManagerOGL::FPSState::DrawFPS(GLContext* context, ShaderProgramOGL* copypro (v1 * 4.f + 4) / 64, 7.f / 8, (v1 * 4.f + 4) / 64, 0.0f, }; - - const GLfloat texCoords2[] = { - (content100 * 4.f) / 64, 7.f / 8, - (content100 * 4.f) / 64, 0.0f, - (content100 * 4.f + 4) / 64, 7.f / 8, - (content100 * 4.f + 4) / 64, 0.0f, - - (content10 * 4.f) / 64, 7.f / 8, - (content10 * 4.f) / 64, 0.0f, - (content10 * 4.f + 4) / 64, 7.f / 8, - (content10 * 4.f + 4) / 64, 0.0f, - - (content1 * 4.f) / 64, 7.f / 8, - (content1 * 4.f) / 64, 0.0f, - (content1 * 4.f + 4) / 64, 7.f / 8, - (content1 * 4.f + 4) / 64, 0.0f, - }; // Turn necessary features on context->fEnable(LOCAL_GL_BLEND); @@ -688,18 +637,6 @@ LayerManagerOGL::FPSState::DrawFPS(GLContext* context, ShaderProgramOGL* copypro 0, texCoords); context->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 12); - - context->fVertexAttribPointer(vcattr, - 2, LOCAL_GL_FLOAT, - LOCAL_GL_FALSE, - 0, vertices2); - - context->fVertexAttribPointer(tcattr, - 2, LOCAL_GL_FLOAT, - LOCAL_GL_FALSE, - 0, texCoords2); - - context->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 12); } // |aTexCoordRect| is the rectangle from the texture that we want to @@ -777,12 +714,6 @@ LayerManagerOGL::BindAndDrawQuadWithTextureRect(ShaderProgramOGL *aProg, } } -void -LayerManagerOGL::NotifyShadowTreeTransaction() -{ - mFPS.NotifyShadowTreeTransaction(); -} - void LayerManagerOGL::Render() { diff --git a/gfx/layers/opengl/LayerManagerOGL.h b/gfx/layers/opengl/LayerManagerOGL.h index d2d78d71bacf..d86409561600 100644 --- a/gfx/layers/opengl/LayerManagerOGL.h +++ b/gfx/layers/opengl/LayerManagerOGL.h @@ -103,7 +103,6 @@ public: void EndConstruction(); virtual bool EndEmptyTransaction(); - virtual void NotifyShadowTreeTransaction(); virtual void EndTransaction(DrawThebesLayerCallback aCallback, void* aCallbackData, EndTransactionFlags aFlags = END_DEFAULT); @@ -443,22 +442,15 @@ private: int fcount; TimeStamp last; - int contentFps; - int contentFCount; - TimeStamp contentLast; - FPSState() : texture(0) , fps(0) , initialized(false) , fcount(0) - , contentFps(0) - , contentFCount(0) { - contentLast = last = TimeStamp::Now(); + last = TimeStamp::Now(); } void DrawFPS(GLContext*, ShaderProgramOGL*); - void NotifyShadowTreeTransaction(); } mFPS; static bool sDrawFPS; diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index 8db7f7ea7e74..896b11d9aac3 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -584,8 +584,7 @@ already_AddRefed RenderFrameParent::BuildLayer(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, LayerManager* aManager, - const nsIntRect& aVisibleRect, - nsDisplayItem* aItem) + const nsIntRect& aVisibleRect) { NS_ABORT_IF_FALSE(aFrame, "makes no sense to have a shadow tree without a frame"); @@ -608,17 +607,13 @@ RenderFrameParent::BuildLayer(nsDisplayListBuilder* aBuilder, if (0 != id) { MOZ_ASSERT(!GetRootLayer()); - nsRefPtr layer = - (GetLayerBuilderForManager(aManager)->GetLeafLayerFor(aBuilder, aManager, aItem)); - if (!layer) { - layer = aManager->CreateRefLayer(); - } + nsRefPtr layer = aManager->CreateRefLayer(); if (!layer) { // Probably a temporary layer manager that doesn't know how to // use ref layers. return nullptr; } - static_cast(layer.get())->SetReferentId(id); + layer->SetReferentId(id); layer->SetVisibleRegion(aVisibleRect); nsIntPoint rootFrameOffset = GetRootFrameOffset(aFrame, aBuilder); layer->SetBaseTransform( @@ -867,7 +862,7 @@ nsDisplayRemote::BuildLayer(nsDisplayListBuilder* aBuilder, { PRInt32 appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); nsIntRect visibleRect = GetVisibleRect().ToNearestPixels(appUnitsPerDevPixel); - nsRefPtr layer = mRemoteFrame->BuildLayer(aBuilder, mFrame, aManager, visibleRect, this); + nsRefPtr layer = mRemoteFrame->BuildLayer(aBuilder, mFrame, aManager, visibleRect); return layer.forget(); } diff --git a/layout/ipc/RenderFrameParent.h b/layout/ipc/RenderFrameParent.h index b0093a5b7126..a7ea91feb97a 100644 --- a/layout/ipc/RenderFrameParent.h +++ b/layout/ipc/RenderFrameParent.h @@ -82,8 +82,7 @@ public: already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, LayerManager* aManager, - const nsIntRect& aVisibleRect, - nsDisplayItem* aItem); + const nsIntRect& aVisibleRect); void OwnerContentChanged(nsIContent* aContent);