Back out 4 csets from bug 1322504 for introducing or exposing an intermittent debug reftest-e10s-4 failure. r=backout

This commit is contained in:
Kartikaya Gupta 2017-01-12 12:33:49 -05:00
Родитель e2d1fd765a
Коммит 5068b330bb
10 изменённых файлов: 44 добавлений и 185 удалений

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

@ -19,7 +19,6 @@ using WRGlyphArray from "mozilla/gfx/webrender.h";
using MaybeImageMask from "mozilla/layers/WebRenderTypes.h";
using mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
using mozilla::gfx::ByteBuffer from "mozilla/layers/WebRenderTypes.h";
using mozilla::LayerIntRegion from "Units.h";
namespace mozilla {
namespace layers {
@ -64,7 +63,6 @@ struct OpDPPushImage {
};
struct OpDPPushExternalImageId {
LayerIntRegion validBufferRegion;
WRRect bounds;
WRRect clip;
MaybeImageMask mask;

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

@ -329,36 +329,12 @@ WebRenderBridgeParent::ProcessWebrenderCommands(InfallibleTArray<WebRenderComman
if (!dSurf) {
break;
}
nsIntRegion validBufferRegion = op.validBufferRegion().ToUnknownRegion();
IntRect visibleRect = IntRect(IntPoint(0,0), dSurf->GetSize());
if (!validBufferRegion.IsEmpty()) {
IntPoint offset = validBufferRegion.GetBounds().TopLeft();
validBufferRegion.MoveBy(-offset);
validBufferRegion.AndWith(IntRect(IntPoint(0,0), dSurf->GetSize()));
visibleRect = validBufferRegion.GetBounds().ToUnknownRect();
// XXX Remove it when we can put subimage in WebRender.
RefPtr<DrawTarget> target =
gfx::Factory::CreateDrawTarget(gfx::BackendType::SKIA, visibleRect.Size(), SurfaceFormat::B8G8R8A8);
for (auto iter = validBufferRegion.RectIter(); !iter.Done(); iter.Next()) {
IntRect regionRect = iter.Get();
Rect srcRect(regionRect.x + offset.x, regionRect.y + offset.y, regionRect.width, regionRect.height);
Rect dstRect(regionRect.x, regionRect.y, regionRect.width, regionRect.height);
target->DrawSurface(dSurf, dstRect, srcRect);
}
RefPtr<SourceSurface> surf = target->Snapshot();
dSurf = surf->GetDataSurface();
}
DataSourceSurface::MappedSurface map;
if (!dSurf->Map(DataSourceSurface::MapType::READ, &map)) {
if (!dSurf->Map(gfx::DataSourceSurface::MapType::READ, &map)) {
break;
}
WRImageKey key = wr_add_image(mWRWindowState, visibleRect.width, visibleRect.height, map.mStride,
RGBA8, map.mData, visibleRect.height * map.mStride);
gfx::IntSize size = dSurf->GetSize();
WRImageKey key = wr_add_image(mWRWindowState, size.width, size.height, map.mStride, RGBA8, map.mData, size.height * map.mStride);
wr_dp_push_image(mWRState, op.bounds(), op.clip(), op.mask().ptrOr(nullptr), key);
keysToDelete.push_back(key);
dSurf->Unmap();
@ -479,9 +455,7 @@ WebRenderBridgeParent::RecvAddExternalImageId(const uint64_t& aImageId,
NS_ERROR("CompositableHost not found in the map!");
return IPC_FAIL_NO_REASON(this);
}
if (host->GetType() != CompositableType::IMAGE &&
host->GetType() != CompositableType::CONTENT_SINGLE &&
host->GetType() != CompositableType::CONTENT_DOUBLE) {
if (host->GetType() != CompositableType::IMAGE) {
NS_ERROR("Incompatible CompositableHost");
return IPC_OK();
}
@ -502,9 +476,7 @@ WebRenderBridgeParent::RecvAddExternalImageIdForCompositable(const uint64_t& aIm
MOZ_ASSERT(!mExternalImageIds.Get(aImageId).get());
CompositableHost* host = CompositableHost::FromIPDLActor(aCompositable);
if (host->GetType() != CompositableType::IMAGE &&
host->GetType() != CompositableType::CONTENT_SINGLE &&
host->GetType() != CompositableType::CONTENT_DOUBLE) {
if (host->GetType() != CompositableType::IMAGE) {
NS_ERROR("Incompatible CompositableHost");
return IPC_OK();
}

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

@ -70,12 +70,11 @@ WebRenderCanvasLayer::RenderLayer()
clip = rect;
}
if (gfxPrefs::LayersDump()) printf_stderr("CanvasLayer %p using rect:%s clip:%s\n", this, Stringify(rect).c_str(), Stringify(clip).c_str());
gfx::Rect relBounds = TransformedVisibleBoundsRelativeToParent();
gfx::Rect overflow(0, 0, relBounds.width, relBounds.height);
WRBridge()->AddWebRenderCommand(
OpDPPushStackingContext(ToWRRect(relBounds), ToWRRect(overflow), Nothing(), transform, FrameMetrics::NULL_SCROLL_ID));
WRBridge()->AddWebRenderCommand(OpDPPushExternalImageId(LayerIntRegion(), ToWRRect(rect), ToWRRect(clip), Nothing(), mExternalImageId));
WRBridge()->AddWebRenderCommand(OpDPPushExternalImageId(ToWRRect(rect), ToWRRect(clip), Nothing(), mExternalImageId));
if (gfxPrefs::LayersDump()) printf_stderr("CanvasLayer %p using %s as bounds/overflow, %s for transform\n", this, Stringify(relBounds).c_str(), Stringify(transform).c_str());
WRBridge()->AddWebRenderCommand(OpDPPopStackingContext());

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

@ -126,6 +126,10 @@ WebRenderImageLayer::RenderLayer()
WRScrollFrameStackingContextGenerator scrollFrames(this);
//XXX
MOZ_RELEASE_ASSERT(surface->GetFormat() == SurfaceFormat::B8G8R8X8 ||
surface->GetFormat() == SurfaceFormat::B8G8R8A8, "bad format");
Rect rect(0, 0, size.width, size.height);
Rect clip;
@ -135,14 +139,14 @@ WebRenderImageLayer::RenderLayer()
clip = rect;
}
if (gfxPrefs::LayersDump()) printf_stderr("ImageLayer %p using rect:%s clip:%s\n", this, Stringify(rect).c_str(), Stringify(clip).c_str());
Rect relBounds = TransformedVisibleBoundsRelativeToParent();
Rect overflow(0, 0, relBounds.width, relBounds.height);
Matrix4x4 transform;// = GetTransform();
WRBridge()->AddWebRenderCommand(
OpDPPushStackingContext(ToWRRect(relBounds), ToWRRect(overflow), Nothing(), transform, FrameMetrics::NULL_SCROLL_ID));
WRBridge()->AddWebRenderCommand(OpDPPushExternalImageId(LayerIntRegion(), ToWRRect(rect), ToWRRect(clip), Nothing(), mExternalImageId));
WRBridge()->AddWebRenderCommand(OpDPPushExternalImageId(ToWRRect(rect), ToWRRect(clip), Nothing(), mExternalImageId));
if (gfxPrefs::LayersDump()) printf_stderr("ImageLayer %p using %s as bounds/overflow, %s for transform\n", this, Stringify(relBounds).c_str(), Stringify(transform).c_str());
WRBridge()->AddWebRenderCommand(OpDPPopStackingContext());

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

@ -263,10 +263,6 @@ WebRenderLayerManager::EndTransaction(DrawPaintedLayerCallback aCallback,
WRBridge()->DPEnd(sync, mLatestTransactionId);
MakeSnapshotIfRequired(size);
// this may result in Layers being deleted, which results in
// PLayer::Send__delete__() and DeallocShmem()
mKeepAlive.Clear();
}
void
@ -346,12 +342,6 @@ WebRenderLayerManager::DiscardImages()
mImageKeys.clear();
}
void
WebRenderLayerManager::Hold(Layer* aLayer)
{
mKeepAlive.AppendElement(aLayer);
}
void
WebRenderLayerManager::SetLayerObserverEpoch(uint64_t aLayerObserverEpoch)
{

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

@ -10,7 +10,6 @@
#include "mozilla/gfx/webrender.h"
#include "mozilla/layers/CompositorController.h"
#include "mozilla/layers/TransactionIdAllocator.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
class nsIWidget;
@ -37,16 +36,6 @@ public:
return static_cast<WebRenderLayer*>(aLayer->ImplData());
}
template <typename LayerType>
static inline void RenderMaskLayers(LayerType* aLayer) {
if (aLayer->GetMaskLayer()) {
ToWebRenderLayer(aLayer->GetMaskLayer())->RenderLayer();
}
for (size_t i = 0; i < aLayer->GetAncestorMaskLayerCount(); i++) {
ToWebRenderLayer(aLayer->GetAncestorMaskLayerAt(i))->RenderLayer();
}
}
WebRenderLayerManager* WRManager();
WebRenderBridgeChild* WRBridge();
@ -68,8 +57,6 @@ private:
class WebRenderLayerManager final : public LayerManager
{
typedef nsTArray<RefPtr<Layer> > LayerRefArray;
public:
explicit WebRenderLayerManager(nsIWidget* aWidget);
void Initialize(PCompositorBridgeChild* aCBChild, uint64_t aLayersId, TextureFactoryIdentifier* aTextureFactoryIdentifier);
@ -140,8 +127,6 @@ public:
WebRenderBridgeChild* WRBridge() const { return mWRChild; }
void Hold(Layer* aLayer);
private:
/**
* Take a snapshot of the parent context, and copy
@ -167,8 +152,6 @@ private:
nsTArray<DidCompositeObserver*> mDidCompositeObservers;
LayerRefArray mKeepAlive;
// When we're doing a transaction in order to draw to a non-default
// target, the layers transaction is only performed in order to send
// a PLayers:Update. We save the original non-default target to

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

@ -16,106 +16,9 @@ namespace layers {
using namespace mozilla::gfx;
void
WebRenderPaintedLayer::PaintThebes()
{
PROFILER_LABEL("WebRenderPaintedLayer", "PaintThebes",
js::ProfileEntry::Category::GRAPHICS);
uint32_t flags = RotatedContentBuffer::PAINT_CAN_DRAW_ROTATED;
PaintState state =
mContentClient->BeginPaintBuffer(this, flags);
mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate);
if (!state.mRegionToDraw.IsEmpty() && !Manager()->GetPaintedLayerCallback()) {
return;
}
// The area that became invalid and is visible needs to be repainted
// (this could be the whole visible area if our buffer switched
// from RGB to RGBA, because we might need to repaint with
// subpixel AA)
state.mRegionToInvalidate.And(state.mRegionToInvalidate,
GetLocalVisibleRegion().ToUnknownRegion());
bool didUpdate = false;
RotatedContentBuffer::DrawIterator iter;
while (DrawTarget* target = mContentClient->BorrowDrawTargetForPainting(state, &iter)) {
if (!target || !target->IsValid()) {
if (target) {
mContentClient->ReturnDrawTargetToBuffer(target);
}
continue;
}
SetAntialiasingFlags(this, target);
RefPtr<gfxContext> ctx = gfxContext::CreatePreservingTransformOrNull(target);
MOZ_ASSERT(ctx); // already checked the target above
Manager()->GetPaintedLayerCallback()(this,
ctx,
iter.mDrawRegion,
iter.mDrawRegion,
state.mClip,
state.mRegionToInvalidate,
Manager()->GetPaintedLayerCallbackData());
ctx = nullptr;
mContentClient->ReturnDrawTargetToBuffer(target);
didUpdate = true;
}
if (didUpdate) {
Mutated();
ContentClientRemote* contentClientRemote = static_cast<ContentClientRemote*>(mContentClient.get());
MOZ_ASSERT(contentClientRemote->GetIPDLActor());
// Hold(this) ensures this layer is kept alive through the current transaction
// The ContentClient assumes this layer is kept alive (e.g., in CreateBuffer),
// so deleting this Hold for whatever reason will break things.
Manager()->Hold(this);
contentClientRemote->Updated(state.mRegionToDraw,
mVisibleRegion.ToUnknownRegion(),
state.mDidSelfCopy);
}
}
void
WebRenderPaintedLayer::RenderLayerWithReadback(ReadbackProcessor *aReadback)
{
if (!mContentClient) {
mContentClient = ContentClient::CreateContentClient(Manager()->WRBridge());
if (!mContentClient) {
return;
}
mContentClient->Connect();
MOZ_ASSERT(mContentClient->GetForwarder());
}
nsTArray<ReadbackProcessor::Update> readbackUpdates;
nsIntRegion readbackRegion;
if (aReadback && UsedForReadback()) {
aReadback->GetPaintedLayerUpdates(this, &readbackUpdates);
}
IntPoint origin(mVisibleRegion.GetBounds().x, mVisibleRegion.GetBounds().y);
mContentClient->BeginPaint();
PaintThebes();
mContentClient->EndPaint(&readbackUpdates);
}
void
WebRenderPaintedLayer::RenderLayer()
{
RenderLayerWithReadback(nullptr);
if (!mExternalImageId) {
mExternalImageId = WRBridge()->AllocExternalImageIdForCompositable(mContentClient);
MOZ_ASSERT(mExternalImageId);
}
LayerIntRegion visibleRegion = GetVisibleRegion();
LayerIntRect bounds = visibleRegion.GetBounds();
LayerIntSize size = bounds.Size();
@ -125,6 +28,34 @@ WebRenderPaintedLayer::RenderLayer()
WRScrollFrameStackingContextGenerator scrollFrames(this);
RefPtr<DrawTarget> target = gfx::Factory::CreateDrawTarget(gfx::BackendType::SKIA, size.ToUnknownSize(), SurfaceFormat::B8G8R8A8);
target->SetTransform(Matrix().PreTranslate(-bounds.x, -bounds.y));
RefPtr<gfxContext> ctx = gfxContext::CreatePreservingTransformOrNull(target);
MOZ_ASSERT(ctx); // already checked the target above
Manager()->GetPaintedLayerCallback()(this,
ctx,
visibleRegion.ToUnknownRegion(), visibleRegion.ToUnknownRegion(),
DrawRegionClip::DRAW, nsIntRegion(), Manager()->GetPaintedLayerCallbackData());
#if 0
static int count;
char buf[400];
sprintf(buf, "wrout%d.png", count++);
gfxUtils::WriteAsPNG(target, buf);
#endif
WRImageKey key;
{
unsigned char* data;
IntSize size;
int32_t stride;
SurfaceFormat format;
target->LockBits(&data, &size, &stride, &format);
gfx::ByteBuffer buf(size.height * stride, data);
WRBridge()->SendAddImage(size.width, size.height, stride, RGBA8, buf, &key);
target->ReleaseBits(data);
}
// Since we are creating a stacking context below using the visible region of
// this layer, we need to make sure the image display item has coordinates
// relative to the visible region.
@ -143,11 +74,9 @@ WebRenderPaintedLayer::RenderLayer()
WRBridge()->AddWebRenderCommand(
OpDPPushStackingContext(ToWRRect(relBounds), ToWRRect(overflow), Nothing(), transform, FrameMetrics::NULL_SCROLL_ID));
WRBridge()->AddWebRenderCommand(OpDPPushImage(ToWRRect(rect), ToWRRect(clip), Nothing(), key));
Manager()->AddImageKeyForDiscard(key);
ContentClientRemoteBuffer* contentClientRemote = static_cast<ContentClientRemoteBuffer*>(mContentClient.get());
visibleRegion.MoveBy(-contentClientRemote->BufferRect().x, -contentClientRemote->BufferRect().y);
WRBridge()->AddWebRenderCommand(OpDPPushExternalImageId(visibleRegion, ToWRRect(rect), ToWRRect(clip), Nothing(), mExternalImageId));
if (gfxPrefs::LayersDump()) printf_stderr("PaintedLayer %p using %s as bounds/overflow, %s for transform\n", this, Stringify(relBounds).c_str(), Stringify(transform).c_str());
WRBridge()->AddWebRenderCommand(OpDPPopStackingContext());
}

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

@ -7,7 +7,6 @@
#define GFX_WEBRENDERPAINTEDLAYER_H
#include "Layers.h"
#include "mozilla/layers/ContentClient.h"
#include "WebRenderLayerManager.h"
namespace mozilla {
@ -16,12 +15,9 @@ namespace layers {
class WebRenderPaintedLayer : public WebRenderLayer,
public PaintedLayer {
public:
typedef RotatedContentBuffer::PaintState PaintState;
typedef RotatedContentBuffer::ContentType ContentType;
explicit WebRenderPaintedLayer(WebRenderLayerManager* aLayerManager)
: PaintedLayer(aLayerManager, static_cast<WebRenderLayer*>(this), LayerManager::NONE),
mExternalImageId(0)
: PaintedLayer(aLayerManager, static_cast<WebRenderLayer*>(this), LayerManager::NONE)
{
MOZ_COUNT_CTOR(WebRenderPaintedLayer);
}
@ -30,17 +26,12 @@ protected:
virtual ~WebRenderPaintedLayer()
{
MOZ_COUNT_DTOR(WebRenderPaintedLayer);
if (mExternalImageId) {
WRBridge()->DeallocExternalImageId(mExternalImageId);
}
}
WebRenderLayerManager* Manager()
{
return static_cast<WebRenderLayerManager*>(mManager);
}
uint64_t mExternalImageId;
public:
virtual void InvalidateRegion(const nsIntRegion& aRegion) override
{
@ -50,9 +41,6 @@ public:
Layer* GetLayer() override { return this; }
void RenderLayer() override;
void PaintThebes();
void RenderLayerWithReadback(ReadbackProcessor *aReadback);
RefPtr<ContentClient> mContentClient;
};
} // namespace layers

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

@ -1802,7 +1802,7 @@ fuzzy-if(OSX==1006,2,30) == 933264-1.html 933264-1-ref.html
== 936670-1.svg 936670-1-ref.svg
== 941940-1.html 941940-1-ref.html
fails == 942017.html 942017-ref.html # bug 942017
fuzzy-if(Android,1,1) fuzzy-if(skiaContent,1,160000) == 942672-1.html 942672-1-ref.html
fuzzy-if(Android,1,1) fuzzy-if(skiaContent,1,160000) fails-if(webrender) == 942672-1.html 942672-1-ref.html
== 953334-win32-clipping.html 953334-win32-clipping-ref.html
fuzzy-if(skiaContent,1,5) == 956513-1.svg 956513-1-ref.svg
== 944291-1.html 944291-1-ref.html

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

@ -4650,11 +4650,7 @@ pref("layers.offmainthreadcomposition.async-animations", true);
// Whether to log information about off main thread animations to stderr
pref("layers.offmainthreadcomposition.log-animations", false);
#ifdef MOZ_ENABLE_WEBRENDER
pref("layers.bufferrotation.enabled", false);
#else
pref("layers.bufferrotation.enabled", true);
#endif
pref("layers.componentalpha.enabled", true);
pref("layers.draw-mask-debug", false);