Backed out changeset 8291145f0920 (bug 1393031)

This commit is contained in:
Sebastian Hengst 2017-09-14 23:18:05 +02:00
Родитель 23c1c9203d
Коммит 005f4f5fc0
19 изменённых файлов: 31 добавлений и 71 удалений

Просмотреть файл

@ -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"
@ -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);

Просмотреть файл

@ -33,7 +33,7 @@ public:
protected:
virtual ~WebRenderCanvasLayer();
Maybe<wr::ImageKey> mKey;
public:
Layer* GetLayer() override { return this; }
void RenderLayer(wr::DisplayListBuilder& aBuilder,

Просмотреть файл

@ -11,9 +11,6 @@
#include "mozilla/webrender/WebRenderAPI.h"
namespace mozilla {
namespace wr {
class IpcResourceUpdateQueue;
}
namespace layers {
class ImageClientSingle;

Просмотреть файл

@ -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)
{
@ -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,
@ -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());
@ -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;
}
}

Просмотреть файл

@ -64,13 +64,11 @@ public:
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);

Просмотреть файл

@ -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"

Просмотреть файл

@ -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"
@ -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();
@ -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;

Просмотреть файл

@ -13,10 +13,6 @@
class nsDisplayItemGeometry;
namespace mozilla {
namespace wr {
class IpcResourceUpdateQueue;
}
namespace layers {
class CanvasLayer;
class ImageClient;
@ -71,9 +67,7 @@ public:
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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -488,7 +488,7 @@ public:
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,

Просмотреть файл

@ -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,
@ -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());
}
@ -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,
@ -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(),

Просмотреть файл

@ -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,
@ -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,

Просмотреть файл

@ -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;
@ -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);
@ -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,
@ -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;
}

Просмотреть файл

@ -3084,7 +3084,6 @@ public:
protected:
void CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderLayerManager* aManager,

Просмотреть файл

@ -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");
@ -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;
@ -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,
@ -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,

Просмотреть файл

@ -22,7 +22,6 @@ class WebRenderLayerManager;
namespace wr {
class DisplayListBuilder;
class IpcResourceUpdateQueue;
} // namespace wr
// A CSSSizeOrRatio represents a (possibly partially specified) size for use
@ -211,7 +210,6 @@ public:
*/
DrawResult BuildWebRenderDisplayItemsForLayer(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResource,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<layers::WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,
@ -299,7 +297,6 @@ private:
*/
DrawResult BuildWebRenderDisplayItems(nsPresContext* aPresContext,
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
nsTArray<layers::WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderDisplayItemLayer* aLayer,

Просмотреть файл

@ -447,9 +447,7 @@ nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
}
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;
}