Skip to content

Commit

Permalink
Backed out changeset 8291145f0920 (bug 1393031)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archaeopteryx committed Sep 14, 2017
1 parent 23c1c92 commit 005f4f5
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 71 deletions.
6 changes: 1 addition & 5 deletions gfx/layers/wr/WebRenderCanvasLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "mozilla/layers/StackingContextHelper.h"
#include "mozilla/layers/TextureClientSharedSurface.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
#include "mozilla/layers/IpcResourceUpdateQueue.h"
#include "PersistentBufferProvider.h"
#include "SharedSurface.h"
#include "SharedSurfaceGL.h"
Expand Down Expand Up @@ -65,11 +64,8 @@ WebRenderCanvasLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
Stringify(filter).c_str());
}

// Eww. Re-creating image keys every time is bad. Probably not worth fixing here
// since layers-full webrender is going away soon-ish. But don't reproduce what
// you see here.
wr::WrImageKey key = GenerateImageKey();
aResources.AddExternalImage(canvasRenderer->GetExternalImageId().value(), key);
WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(canvasRenderer->GetExternalImageId().value(), key));
WrManager()->AddImageKeyForDiscard(key);

wr::LayoutRect r = sc.ToRelativeLayoutRect(rect);
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/wr/WebRenderCanvasLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class WebRenderCanvasLayer : public WebRenderLayer,

protected:
virtual ~WebRenderCanvasLayer();
Maybe<wr::ImageKey> mKey;

public:
Layer* GetLayer() override { return this; }
void RenderLayer(wr::DisplayListBuilder& aBuilder,
Expand Down
3 changes: 0 additions & 3 deletions gfx/layers/wr/WebRenderLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#include "mozilla/webrender/WebRenderAPI.h"

namespace mozilla {
namespace wr {
class IpcResourceUpdateQueue;
}
namespace layers {

class ImageClientSingle;
Expand Down
13 changes: 3 additions & 10 deletions gfx/layers/wr/WebRenderLayerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ Maybe<wr::ImageKey>
WebRenderLayerManager::CreateImageKey(nsDisplayItem* aItem,
ImageContainer* aContainer,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
gfx::IntSize& aSize)
{
Expand All @@ -407,9 +406,6 @@ WebRenderLayerManager::CreateImageKey(nsDisplayItem* aItem,
if (!aContainer->GetScaleHint().IsEmpty()) {
scaleToSize = Some(aContainer->GetScaleHint());
}
// TODO!
// We appear to be using the image bridge for a lot (most/all?) of
// layers-free image handling and that breaks frame consistency.
imageData->CreateAsyncImageWebRenderCommands(aBuilder,
aContainer,
aSc,
Expand All @@ -429,21 +425,18 @@ WebRenderLayerManager::CreateImageKey(nsDisplayItem* aItem,
mozilla::layers::Image* image = autoLock.GetImage();
aSize = image->GetSize();

return imageData->UpdateImageKey(aContainer, aResources);
return imageData->UpdateImageKey(aContainer);
}

bool
WebRenderLayerManager::PushImage(nsDisplayItem* aItem,
ImageContainer* aContainer,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
const LayerRect& aRect)
{
gfx::IntSize size;
Maybe<wr::ImageKey> key = CreateImageKey(aItem, aContainer,
aBuilder, aResources,
aSc, size);
Maybe<wr::ImageKey> key = CreateImageKey(aItem, aContainer, aBuilder, aSc, size);
if (aContainer->IsAsync()) {
// Async ImageContainer does not create ImageKey, instead it uses Pipeline.
MOZ_ASSERT(key.isNothing());
Expand Down Expand Up @@ -619,7 +612,7 @@ WebRenderLayerManager::GenerateFallbackData(nsDisplayItem* aItem,
// Force update the key in fallback data since we repaint the image in this path.
// If not force update, fallbackData may reuse the original key because it
// doesn't know UpdateImageHelper already updated the image container.
if (!fallbackData->UpdateImageKey(imageContainer, aResources, true)) {
if (!fallbackData->UpdateImageKey(imageContainer, true)) {
return nullptr;
}
}
Expand Down
2 changes: 0 additions & 2 deletions gfx/layers/wr/WebRenderLayerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@ class WebRenderLayerManager final : public LayerManager
Maybe<wr::ImageKey> CreateImageKey(nsDisplayItem* aItem,
ImageContainer* aContainer,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
gfx::IntSize& aSize);
bool PushImage(nsDisplayItem* aItem,
ImageContainer* aContainer,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
const LayerRect& aRect);

Expand Down
1 change: 0 additions & 1 deletion gfx/layers/wr/WebRenderPaintedLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "LayersLogging.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/layers/ImageClient.h"
#include "mozilla/layers/IpcResourceUpdateQueue.h"
#include "mozilla/layers/ScrollingLayersHelper.h"
#include "mozilla/layers/StackingContextHelper.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
Expand Down
8 changes: 2 additions & 6 deletions gfx/layers/wr/WebRenderUserData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "mozilla/layers/WebRenderBridgeChild.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#include "mozilla/layers/WebRenderMessages.h"
#include "mozilla/layers/IpcResourceUpdateQueue.h"
#include "nsDisplayListInvalidation.h"
#include "WebRenderCanvasRenderer.h"

Expand Down Expand Up @@ -58,9 +57,7 @@ WebRenderImageData::~WebRenderImageData()
}

Maybe<wr::ImageKey>
WebRenderImageData::UpdateImageKey(ImageContainer* aContainer,
wr::IpcResourceUpdateQueue& aResources,
bool aForceUpdate)
WebRenderImageData::UpdateImageKey(ImageContainer* aContainer, bool aForceUpdate)
{
CreateImageClientIfNeeded();
CreateExternalImageIfNeeded();
Expand Down Expand Up @@ -95,13 +92,12 @@ WebRenderImageData::UpdateImageKey(ImageContainer* aContainer,
}

// Delete old key, we are generating a new key.
// TODO(nical): noooo... we need to reuse image keys.
if (mKey) {
mWRManager->AddImageKeyForDiscard(mKey.value());
}

wr::WrImageKey key = WrBridge()->GetNextImageKey();
aResources.AddExternalImage(mExternalImageId.value(), key);
mWRManager->WrBridge()->AddWebRenderParentCommand(OpAddExternalImage(mExternalImageId.value(), key));
mKey = Some(key);

return mKey;
Expand Down
8 changes: 1 addition & 7 deletions gfx/layers/wr/WebRenderUserData.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
class nsDisplayItemGeometry;

namespace mozilla {
namespace wr {
class IpcResourceUpdateQueue;
}

namespace layers {
class CanvasLayer;
class ImageClient;
Expand Down Expand Up @@ -71,9 +67,7 @@ class WebRenderImageData : public WebRenderUserData
void SetKey(const wr::ImageKey& aKey) { mKey = Some(aKey); }
already_AddRefed<ImageClient> GetImageClient();

Maybe<wr::ImageKey> UpdateImageKey(ImageContainer* aContainer,
wr::IpcResourceUpdateQueue& aResources,
bool aForceUpdate = false);
Maybe<wr::ImageKey> UpdateImageKey(ImageContainer* aContainer, bool aForceUpdate = false);

void CreateAsyncImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
ImageContainer* aContainer,
Expand Down
2 changes: 1 addition & 1 deletion layout/generic/nsBulletFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ BulletRenderer::CreateWebRenderCommandsForImage(nsDisplayItem* aItem,
}

gfx::IntSize size;
Maybe<wr::ImageKey> key = aManager->CreateImageKey(aItem, container, aBuilder, aResources, aSc, size);
Maybe<wr::ImageKey> key = aManager->CreateImageKey(aItem, container, aBuilder, aSc, size);
if (key.isNothing()) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion layout/generic/nsImageFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ nsDisplayImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilde
const LayoutDeviceRect destRect(
LayoutDeviceIntRect::FromAppUnits(GetDestRect(), factor));
const LayerRect dest = ViewAs<LayerPixel>(destRect, PixelCastJustification::WebRenderHasUnitResolution);
return aManager->PushImage(this, container, aBuilder, aResources, aSc, dest);
return aManager->PushImage(this, container, aBuilder, aSc, dest);
}

DrawResult
Expand Down
2 changes: 1 addition & 1 deletion layout/generic/nsPluginFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ nsPluginFrame::CreateWebRenderCommands(nsDisplayItem* aItem,
lm->AddDidCompositeObserver(mDidCompositeObserver.get());

LayerRect dest(r.x, r.y, size.width, size.height);
return aManager->PushImage(aItem, container, aBuilder, aResources, aSc, dest);
return aManager->PushImage(aItem, container, aBuilder, aSc, dest);
}


Expand Down
2 changes: 1 addition & 1 deletion layout/generic/nsVideoFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ class nsDisplayVideo : public nsDisplayItem {
container->SetScaleHint(scaleHint);

LayerRect rect(destGFXRect.x, destGFXRect.y, destGFXRect.width, destGFXRect.height);
return aManager->PushImage(this, container, aBuilder, aResources, aSc, rect);
return aManager->PushImage(this, container, aBuilder, aSc, rect);
}

// It would be great if we could override GetOpaqueRegion to return nonempty here,
Expand Down
6 changes: 2 additions & 4 deletions layout/painting/nsCSSRendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1994,7 +1994,6 @@ nsCSSRendering::CanBuildWebRenderDisplayItemsForStyleImageLayer(LayerManager* aM
DrawResult
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
Expand Down Expand Up @@ -2022,7 +2021,7 @@ nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams

sc = aParams.frame->StyleContext();
}
return BuildWebRenderDisplayItemsForStyleImageLayerWithSC(aParams, aBuilder, aResources, aSc, aParentCommands,
return BuildWebRenderDisplayItemsForStyleImageLayerWithSC(aParams, aBuilder, aSc, aParentCommands,
aLayer, aManager, aItem,
sc, *aParams.frame->StyleBorder());
}
Expand Down Expand Up @@ -2744,7 +2743,6 @@ nsCSSRendering::PaintStyleImageLayerWithSC(const PaintBGParams& aParams,
DrawResult
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
Expand Down Expand Up @@ -2789,7 +2787,7 @@ nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBG
result &= state.mImageRenderer.PrepareResult();
if (!state.mFillArea.IsEmpty()) {
return state.mImageRenderer.BuildWebRenderDisplayItemsForLayer(&aParams.presCtx,
aBuilder, aResources, aSc, aParentCommands,
aBuilder, aSc, aParentCommands,
aLayer, aManager, aItem,
state.mDestArea, state.mFillArea,
state.mAnchor + paintBorderArea.TopLeft(),
Expand Down
2 changes: 0 additions & 2 deletions layout/painting/nsCSSRendering.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,6 @@ struct nsCSSRendering {
int32_t aLayer);
static DrawResult BuildWebRenderDisplayItemsForStyleImageLayer(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<mozilla::layers::WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
Expand All @@ -511,7 +510,6 @@ struct nsCSSRendering {

static DrawResult BuildWebRenderDisplayItemsForStyleImageLayerWithSC(const PaintBGParams& aParams,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<mozilla::layers::WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
Expand Down
7 changes: 3 additions & 4 deletions layout/painting/nsDisplayList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3646,7 +3646,7 @@ nsDisplayBackgroundImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilde
CompositionOp::OP_OVER);
params.bgClipRect = &mBounds;
DrawResult result =
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(params, aBuilder, aResources, aSc, aParentCommands, nullptr, aManager, this);
nsCSSRendering::BuildWebRenderDisplayItemsForStyleImageLayer(params, aBuilder, aSc, aParentCommands, nullptr, aManager, this);
nsDisplayBackgroundGeometry::UpdateDrawResult(this, result);

return true;
Expand Down Expand Up @@ -5039,7 +5039,7 @@ nsDisplayBorder::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
}

if (mBorderImageRenderer) {
CreateBorderImageWebRenderCommands(aBuilder, aResources, aSc, aParentCommands,
CreateBorderImageWebRenderCommands(aBuilder, aSc, aParentCommands,
aManager, aDisplayListBuilder);
} else if (mBorderRenderer) {
mBorderRenderer->CreateWebRenderCommands(aBuilder, aResources, aSc);
Expand All @@ -5050,7 +5050,6 @@ nsDisplayBorder::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild

void
nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderLayerManager* aManager,
Expand Down Expand Up @@ -5096,7 +5095,7 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil
}

gfx::IntSize size;
Maybe<wr::ImageKey> key = aManager->CreateImageKey(this, container, aBuilder, aResources, aSc, size);
Maybe<wr::ImageKey> key = aManager->CreateImageKey(this, container, aBuilder, aSc, size);
if (key.isNothing()) {
return;
}
Expand Down
1 change: 0 additions & 1 deletion layout/painting/nsDisplayList.h
Original file line number Diff line number Diff line change
Expand Up @@ -3084,7 +3084,6 @@ class nsDisplayBorder : public nsDisplayItem {

protected:
void CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderLayerManager* aManager,
Expand Down
28 changes: 13 additions & 15 deletions layout/painting/nsImageRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,21 +585,20 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
}

DrawResult
nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
nsTArray<WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayItem* aItem,
const nsRect& aDirtyRect,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsSize& aRepeatSize,
const CSSIntRect& aSrc,
float aOpacity)
nsDisplayItem* aItem,
const nsRect& aDirtyRect,
const nsRect& aDest,
const nsRect& aFill,
const nsPoint& aAnchor,
const nsSize& aRepeatSize,
const CSSIntRect& aSrc,
float aOpacity)
{
if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
Expand Down Expand Up @@ -635,7 +634,7 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
}

gfx::IntSize size;
Maybe<wr::ImageKey> key = aManager->CreateImageKey(aItem, container, aBuilder, aResources, aSc, size);
Maybe<wr::ImageKey> key = aManager->CreateImageKey(aItem, container, aBuilder, aSc, size);

if (key.isNothing()) {
return DrawResult::BAD_IMAGE;
Expand Down Expand Up @@ -735,7 +734,6 @@ nsImageRenderer::DrawLayer(nsPresContext* aPresContext,
DrawResult
nsImageRenderer::BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
WebRenderDisplayItemLayer* aLayer,
Expand All @@ -756,7 +754,7 @@ nsImageRenderer::BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresCo
mSize.width <= 0 || mSize.height <= 0) {
return DrawResult::SUCCESS;
}
return BuildWebRenderDisplayItems(aPresContext, aBuilder, aResources, aSc, aParentCommands,
return BuildWebRenderDisplayItems(aPresContext, aBuilder, aSc, aParentCommands,
aLayer, aManager, aItem,
aDirty, aDest, aFill, aAnchor, aRepeatSize,
CSSIntRect(0, 0,
Expand Down
Loading

0 comments on commit 005f4f5

Please sign in to comment.