Backed out 2 changesets (bug 1193557, bug 1209278) for build bustage

Backed out changeset 755b9088813c (bug 1193557)
Backed out changeset 21356fa4e353 (bug 1209278)

--HG--
extra : commitid : 5hf8aSA5FhN
This commit is contained in:
Wes Kocher 2016-02-23 10:39:08 -08:00
parent 1db0b39f51
commit a9ea5f6a56
13 changed files with 236 additions and 41 deletions

View File

@ -783,6 +783,7 @@ struct ParamTraits<mozilla::layers::TextureFactoryIdentifier>
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, aParam.mParentBackend);
WriteParam(aMsg, aParam.mSupportedBlendModes.serialize());
WriteParam(aMsg, aParam.mMaxTextureSize);
WriteParam(aMsg, aParam.mSupportsTextureBlitting);
WriteParam(aMsg, aParam.mSupportsPartialUploads);
@ -791,11 +792,14 @@ struct ParamTraits<mozilla::layers::TextureFactoryIdentifier>
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
uint32_t supportedBlendModes = 0;
bool result = ReadParam(aMsg, aIter, &aResult->mParentBackend) &&
ReadParam(aMsg, aIter, &supportedBlendModes) &&
ReadParam(aMsg, aIter, &aResult->mMaxTextureSize) &&
ReadParam(aMsg, aIter, &aResult->mSupportsTextureBlitting) &&
ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads) &&
ReadParam(aMsg, aIter, &aResult->mSyncHandle);
aResult->mSupportedBlendModes.deserialize(supportedBlendModes);
return result;
}
};

View File

@ -161,6 +161,7 @@ struct TextureFactoryIdentifier
{
LayersBackend mParentBackend;
GeckoProcessType mParentProcessId;
EnumSet<gfx::CompositionOp> mSupportedBlendModes;
int32_t mMaxTextureSize;
bool mSupportsTextureBlitting;
bool mSupportsPartialUploads;
@ -174,6 +175,7 @@ struct TextureFactoryIdentifier
SyncHandle aSyncHandle = 0)
: mParentBackend(aLayersBackend)
, mParentProcessId(aParentProcessId)
, mSupportedBlendModes(gfx::CompositionOp::OP_OVER)
, mMaxTextureSize(aMaxTextureSize)
, mSupportsTextureBlitting(aSupportsTextureBlitting)
, mSupportsPartialUploads(aSupportsPartialUploads)

View File

@ -640,6 +640,17 @@ public:
mRegionToClear = aRegion;
}
virtual bool SupportsMixBlendModes(EnumSet<gfx::CompositionOp>& aMixBlendModes)
{
return false;
}
bool SupportsMixBlendMode(gfx::CompositionOp aMixBlendMode)
{
EnumSet<gfx::CompositionOp> modes(aMixBlendMode);
return SupportsMixBlendModes(modes);
}
virtual float RequestProperty(const nsAString& property) { return -1; }
const TimeStamp& GetAnimationReadyTime() const {

View File

@ -116,6 +116,11 @@ BasicCompositor::GetTextureFactoryIdentifier()
TextureFactoryIdentifier ident(LayersBackend::LAYERS_BASIC,
XRE_GetProcessType(),
GetMaxTextureSize());
// All composition ops are supported in software.
for (uint8_t op = 0; op < uint8_t(CompositionOp::OP_COUNT); op++) {
ident.mSupportedBlendModes += CompositionOp(op);
}
return ident;
}

View File

@ -160,6 +160,8 @@ public:
virtual int32_t GetMaxTextureSize() const override { return INT32_MAX; }
bool CompositorMightResample() { return mCompositorMightResample; }
virtual bool SupportsMixBlendModes(EnumSet<gfx::CompositionOp>& aMixBlendModes) override { return true; }
protected:
enum TransactionPhase {
PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD

View File

@ -202,6 +202,11 @@ public:
const mozilla::TimeStamp& aCompositeStart,
const mozilla::TimeStamp& aCompositeEnd);
virtual bool SupportsMixBlendModes(EnumSet<gfx::CompositionOp>& aMixBlendModes) override
{
return (GetTextureFactoryIdentifier().mSupportedBlendModes & aMixBlendModes) == aMixBlendModes;
}
virtual bool AreComponentAlphaLayersEnabled() override;
// Log APZ test data for the current paint. We supply the paint sequence

View File

@ -461,6 +461,11 @@ CompositorD3D11::GetTextureFactoryIdentifier()
ident.mParentProcessId = XRE_GetProcessType();
ident.mParentBackend = LayersBackend::LAYERS_D3D11;
ident.mSyncHandle = mAttachments->mSyncHandle;
for (uint8_t op = 0; op < uint8_t(gfx::CompositionOp::OP_COUNT); op++) {
if (BlendOpIsMixBlendMode(gfx::CompositionOp(op))) {
ident.mSupportedBlendModes += gfx::CompositionOp(op);
}
}
return ident;
}

View File

@ -73,6 +73,11 @@ CompositorD3D9::GetTextureFactoryIdentifier()
ident.mMaxTextureSize = GetMaxTextureSize();
ident.mParentBackend = LayersBackend::LAYERS_D3D9;
ident.mParentProcessId = XRE_GetProcessType();
for (uint8_t op = 0; op < uint8_t(gfx::CompositionOp::OP_COUNT); op++) {
if (BlendOpIsMixBlendMode(gfx::CompositionOp(op))) {
ident.mSupportedBlendModes += gfx::CompositionOp(op);
}
}
return ident;
}

View File

@ -215,6 +215,12 @@ public:
GetMaxTextureSize(),
mFBOTextureTarget == LOCAL_GL_TEXTURE_2D,
SupportsPartialTextureUpdate());
result.mSupportedBlendModes += gfx::CompositionOp::OP_SOURCE;
for (uint8_t op = 0; op < uint8_t(gfx::CompositionOp::OP_COUNT); op++) {
if (BlendOpIsMixBlendMode(gfx::CompositionOp(op))) {
result.mSupportedBlendModes += gfx::CompositionOp(op);
}
}
return result;
}

View File

@ -608,13 +608,13 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
mUsedAGRBudget(0),
mDirtyRect(-1,-1,-1,-1),
mGlassDisplayItem(nullptr),
mScrollInfoItemsForHoisting(nullptr),
mPendingScrollInfoItems(nullptr),
mCommittedScrollInfoItems(nullptr),
mMode(aMode),
mCurrentScrollParentId(FrameMetrics::NULL_SCROLL_ID),
mCurrentScrollbarTarget(FrameMetrics::NULL_SCROLL_ID),
mCurrentScrollbarFlags(0),
mPerspectiveItemIndex(0),
mSVGEffectsBuildingDepth(0),
mIsBuildingScrollbar(false),
mCurrentScrollbarWillHaveLayer(false),
mBuildCaret(aBuildCaret),
@ -1366,35 +1366,27 @@ nsDisplayListBuilder::AddToAGRBudget(nsIFrame* aFrame)
return onBudget;
}
void
nsDisplayListBuilder::EnterSVGEffectsContents(nsDisplayList* aHoistedItemsStorage)
nsDisplayList*
nsDisplayListBuilder::EnterScrollInfoItemHoisting(nsDisplayList* aScrollInfoItemStorage)
{
MOZ_ASSERT(mSVGEffectsBuildingDepth >= 0);
MOZ_ASSERT(aHoistedItemsStorage);
if (mSVGEffectsBuildingDepth == 0) {
MOZ_ASSERT(!mScrollInfoItemsForHoisting);
mScrollInfoItemsForHoisting = aHoistedItemsStorage;
}
mSVGEffectsBuildingDepth++;
MOZ_ASSERT(ShouldBuildScrollInfoItemsForHoisting());
nsDisplayList* old = mPendingScrollInfoItems;
mPendingScrollInfoItems = aScrollInfoItemStorage;
return old;
}
void
nsDisplayListBuilder::ExitSVGEffectsContents()
nsDisplayListBuilder::LeaveScrollInfoItemHoisting(nsDisplayList* aScrollInfoItemStorage)
{
mSVGEffectsBuildingDepth--;
MOZ_ASSERT(mSVGEffectsBuildingDepth >= 0);
MOZ_ASSERT(mScrollInfoItemsForHoisting);
if (mSVGEffectsBuildingDepth == 0) {
mScrollInfoItemsForHoisting = nullptr;
}
MOZ_ASSERT(ShouldBuildScrollInfoItemsForHoisting());
mPendingScrollInfoItems = aScrollInfoItemStorage;
}
void
nsDisplayListBuilder::AppendNewScrollInfoItemForHoisting(nsDisplayScrollInfoLayer* aScrollInfoItem)
{
MOZ_ASSERT(ShouldBuildScrollInfoItemsForHoisting());
MOZ_ASSERT(mScrollInfoItemsForHoisting);
mScrollInfoItemsForHoisting->AppendNewToTop(aScrollInfoItem);
mPendingScrollInfoItems->AppendNewToTop(aScrollInfoItem);
}
void
@ -4330,7 +4322,9 @@ nsDisplayMixBlendMode::GetLayerState(nsDisplayListBuilder* aBuilder,
{
CompositionOp op =
nsCSSRendering::GetGFXBlendMode(mFrame->StyleDisplay()->mMixBlendMode);
return LAYER_ACTIVE;
return aManager->SupportsMixBlendMode(op)
? LAYER_ACTIVE
: LAYER_INACTIVE;
}
// nsDisplayMixBlendMode uses layers for rendering
@ -4434,7 +4428,10 @@ nsDisplayBlendContainer::GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters)
{
return mCanBeActive ? mozilla::LAYER_ACTIVE : mozilla::LAYER_INACTIVE;
if (mCanBeActive && aManager->SupportsMixBlendModes(mContainedBlendModes)) {
return mozilla::LAYER_ACTIVE;
}
return mozilla::LAYER_INACTIVE;
}
bool nsDisplayBlendContainer::TryMerge(nsDisplayItem* aItem) {
@ -4902,6 +4899,7 @@ nsDisplayScrollInfoLayer::nsDisplayScrollInfoLayer(
, mScrollFrame(aScrollFrame)
, mScrolledFrame(aScrolledFrame)
, mScrollParentId(aBuilder->GetCurrentScrollParentId())
, mIgnoreIfCompositorSupportsBlending(false)
{
#ifdef NS_BUILD_REFCNT_LOGGING
MOZ_COUNT_CTOR(nsDisplayScrollInfoLayer);
@ -4925,6 +4923,16 @@ nsDisplayScrollInfoLayer::BuildLayer(nsDisplayListBuilder* aBuilder,
// cannot be layerized, and so needs to scroll synchronously. To handle those
// cases, we still want to generate scrollinfo layers.
if (mIgnoreIfCompositorSupportsBlending) {
// This item was created pessimistically because, during display list
// building, we encountered a mix blend mode. If our layer manager
// supports compositing this mix blend mode, we don't actually need to
// create a scroll info layer.
if (aManager->SupportsMixBlendModes(mContainedBlendModes)) {
return nullptr;
}
}
ContainerLayerParameters params = aContainerParameters;
if (mScrolledFrame->GetContent() &&
nsLayoutUtils::HasCriticalDisplayPort(mScrolledFrame->GetContent())) {
@ -4968,7 +4976,24 @@ nsDisplayScrollInfoLayer::ComputeFrameMetrics(Layer* aLayer,
return UniquePtr<FrameMetrics>(new FrameMetrics(metrics));
}
void
nsDisplayScrollInfoLayer::IgnoreIfCompositorSupportsBlending(BlendModeSet aBlendModes)
{
mContainedBlendModes += aBlendModes;
mIgnoreIfCompositorSupportsBlending = true;
}
void
nsDisplayScrollInfoLayer::UnsetIgnoreIfCompositorSupportsBlending()
{
mIgnoreIfCompositorSupportsBlending = false;
}
bool
nsDisplayScrollInfoLayer::ContainedInMixBlendMode() const
{
return mIgnoreIfCompositorSupportsBlending;
}
void
nsDisplayScrollInfoLayer::WriteDebugInfo(std::stringstream& aStream)

View File

@ -1056,11 +1056,26 @@ public:
*/
bool IsInWillChangeBudget(nsIFrame* aFrame, const nsSize& aSize);
void EnterSVGEffectsContents(nsDisplayList* aHoistedItemsStorage);
void ExitSVGEffectsContents();
void SetCommittedScrollInfoItemList(nsDisplayList* aScrollInfoItemStorage) {
mCommittedScrollInfoItems = aScrollInfoItemStorage;
}
nsDisplayList* CommittedScrollInfoItems() const {
return mCommittedScrollInfoItems;
}
bool ShouldBuildScrollInfoItemsForHoisting() const {
return IsPaintingToWindow();
}
bool ShouldBuildScrollInfoItemsForHoisting() const
{ return mSVGEffectsBuildingDepth > 0; }
// When building display lists for stacking contexts, we append scroll info
// items to a temporary list. If the stacking context would create an
// inactive layer, we commit these items to the final hoisted scroll items
// list. Otherwise, we propagate these items to the parent stacking
// context's list of pending scroll info items.
//
// EnterScrollInfoItemHoisting returns the parent stacking context's pending
// item list.
nsDisplayList* EnterScrollInfoItemHoisting(nsDisplayList* aScrollInfoItemStorage);
void LeaveScrollInfoItemHoisting(nsDisplayList* aScrollInfoItemStorage);
void AppendNewScrollInfoItemForHoisting(nsDisplayScrollInfoLayer* aScrollInfoItem);
@ -1227,12 +1242,14 @@ private:
LayoutDeviceIntRegion mWindowNoDraggingRegion;
// The display item for the Windows window glass background, if any
nsDisplayItem* mGlassDisplayItem;
// A temporary list that we append scroll info items to while building
// display items for the contents of frames with SVG effects.
// Only non-null when ShouldBuildScrollInfoItemsForHoisting() is true.
// This is a pointer and not a real nsDisplayList value because the
// nsDisplayList class is defined below this class, so we can't use it here.
nsDisplayList* mScrollInfoItemsForHoisting;
// When encountering inactive layers, we need to hoist scroll info items
// above these layers so APZ can deliver events to content. Such scroll
// info items are considered "committed" to the final hoisting list. If
// no hoisting is needed immediately, it may be needed later if a blend
// mode is introduced in a higher stacking context, so we keep all scroll
// info items until the end of display list building.
nsDisplayList* mPendingScrollInfoItems;
nsDisplayList* mCommittedScrollInfoItems;
nsTArray<DisplayItemScrollClip*> mScrollClipsToDestroy;
nsTArray<DisplayItemClip*> mDisplayItemClipsToDestroy;
Mode mMode;
@ -1242,7 +1259,6 @@ private:
BlendModeSet mContainedBlendModes;
Preserves3DContext mPreserves3DCtx;
uint32_t mPerspectiveItemIndex;
int32_t mSVGEffectsBuildingDepth;
bool mIsBuildingScrollbar;
bool mCurrentScrollbarWillHaveLayer;
bool mBuildCaret;
@ -3701,10 +3717,20 @@ public:
mozilla::UniquePtr<FrameMetrics> ComputeFrameMetrics(Layer* aLayer,
const ContainerLayerParameters& aContainerParameters);
void IgnoreIfCompositorSupportsBlending(BlendModeSet aBlendModes);
void UnsetIgnoreIfCompositorSupportsBlending();
bool ContainedInMixBlendMode() const;
protected:
nsIFrame* mScrollFrame;
nsIFrame* mScrolledFrame;
ViewID mScrollParentId;
// If the only reason for the ScrollInfoLayer is a blend mode, the blend
// mode may be supported in the compositor. We track it here to determine
// if so during layer construction.
BlendModeSet mContainedBlendModes;
bool mIgnoreIfCompositorSupportsBlending;
};
/**

View File

@ -3262,6 +3262,11 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
/* aAllowCreateDisplayPort = */ true);
}
nsDisplayList hoistedScrollItemStorage;
if (builder.IsPaintingToWindow()) {
builder.SetCommittedScrollInfoItemList(&hoistedScrollItemStorage);
}
nsRegion visibleRegion;
if (aFlags & PAINT_WIDGET_LAYERS) {
// This layer tree will be reused, so we'll need to calculate it

View File

@ -1830,6 +1830,87 @@ public:
}
};
class AutoHoistScrollInfoItems
{
nsDisplayListBuilder& mBuilder;
nsDisplayList* mParentPendingList;
nsDisplayList mPendingList;
public:
explicit AutoHoistScrollInfoItems(nsDisplayListBuilder& aBuilder)
: mBuilder(aBuilder),
mParentPendingList(nullptr)
{
if (!mBuilder.ShouldBuildScrollInfoItemsForHoisting()) {
return;
}
mParentPendingList = mBuilder.EnterScrollInfoItemHoisting(&mPendingList);
}
~AutoHoistScrollInfoItems() {
if (!mParentPendingList) {
// If we have no parent stacking context, we will throw out any scroll
// info items that are pending (meaning, we can safely ignore them since
// the scrollable layers they represent will not be flattened).
return;
}
mParentPendingList->AppendToTop(&mPendingList);
mBuilder.LeaveScrollInfoItemHoisting(mParentPendingList);
}
// The current stacking context will definitely be flattened, so commit all
// pending scroll info items and make sure they will not be optimized away
// in the case they were also inside a compositor-supported mix-blend-mode.
void Commit() {
nsDisplayItem* iter = nullptr;
while ((iter = mPendingList.RemoveBottom()) != nullptr) {
MOZ_ASSERT(iter->GetType() == nsDisplayItem::TYPE_SCROLL_INFO_LAYER);
auto item = static_cast<nsDisplayScrollInfoLayer*>(iter);
item->UnsetIgnoreIfCompositorSupportsBlending();
mBuilder.CommittedScrollInfoItems()->AppendToTop(item);
}
}
// The current stacking context will only be flattened if the given mix-blend
// mode is not supported in the compositor. Annotate the scroll info items
// and keep them in the pending list.
void AnnotateForBlendModes(BlendModeSet aBlendModes) {
for (nsDisplayItem* iter = mPendingList.GetBottom(); iter; iter = iter->GetAbove()) {
MOZ_ASSERT(iter->GetType() == nsDisplayItem::TYPE_SCROLL_INFO_LAYER);
auto item = static_cast<nsDisplayScrollInfoLayer*>(iter);
item->IgnoreIfCompositorSupportsBlending(aBlendModes);
}
}
bool IsRootStackingContext() {
// We're only finished building the hoisted list if we have no parent
// stacking context.
return !mParentPendingList;
}
// Any scroll info items which contain a mix-blend mode are moved into the
// parent display list.
void Finish(nsDisplayList* aResultList) {
MOZ_ASSERT(IsRootStackingContext());
nsDisplayItem* iter = nullptr;
while ((iter = mPendingList.RemoveBottom()) != nullptr) {
MOZ_ASSERT(iter->GetType() == nsDisplayItem::TYPE_SCROLL_INFO_LAYER);
nsDisplayScrollInfoLayer *item = static_cast<decltype(item)>(iter);
if (!item->ContainedInMixBlendMode()) {
// Discard the item, it was not committed for having an SVG effect nor
// was it contained with a mix-blend mode.
item->~nsDisplayScrollInfoLayer();
continue;
}
aResultList->AppendToTop(item);
}
}
};
static void
CheckForApzAwareEventHandlers(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
{
@ -2004,13 +2085,13 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
inTransform = true;
}
AutoHoistScrollInfoItems hoistedScrollInfoItems(*aBuilder);
bool usingSVGEffects = nsSVGIntegrationUtils::UsingEffectsForFrame(this);
nsRect dirtyRectOutsideSVGEffects = dirtyRect;
nsDisplayList hoistedScrollInfoItemsStorage;
if (usingSVGEffects) {
dirtyRect =
nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(this, dirtyRect);
aBuilder->EnterSVGEffectsContents(&hoistedScrollInfoItemsStorage);
}
bool useOpacity = HasVisualOpacity() && !nsSVGUtils::CanOptimizeOpacity(this);
@ -2155,10 +2236,6 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
/* List now emptied, so add the new list to the top. */
resultList.AppendNewToTop(
new (aBuilder) nsDisplaySVGEffects(aBuilder, this, &resultList));
// Also add the hoisted scroll info items. We need those for APZ scrolling
// because nsDisplaySVGEffects items can't build active layers.
aBuilder->ExitSVGEffectsContents();
resultList.AppendToTop(&hoistedScrollInfoItemsStorage);
}
else if (useOpacity && !resultList.IsEmpty() && !is3DContextRoot) {
/* If this element is the root of a preserve-3d context, then we want
@ -2277,8 +2354,25 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
*/
if (aBuilder->ContainsBlendMode()) {
resultList.AppendNewToTop(
new (aBuilder) nsDisplayBlendContainer(aBuilder, this, &resultList, aBuilder->ContainedBlendModes()));
resultList.AppendNewToTop(
new (aBuilder) nsDisplayBlendContainer(aBuilder, this, &resultList, aBuilder->ContainedBlendModes()));
}
if (aBuilder->ShouldBuildScrollInfoItemsForHoisting()) {
if (usingSVGEffects) {
// We know this stacking context will be flattened, so hoist any scroll
// info items we created.
hoistedScrollInfoItems.Commit();
} else if (aBuilder->ContainsBlendMode()) {
hoistedScrollInfoItems.AnnotateForBlendModes(aBuilder->ContainedBlendModes());
}
if (hoistedScrollInfoItems.IsRootStackingContext()) {
// If we're the root stacking context, no more mix-blend modes can be
// introduced and it's safe to hoist scroll info items.
resultList.AppendToTop(aBuilder->CommittedScrollInfoItems());
hoistedScrollInfoItems.Finish(&resultList);
}
}
/* If there's blending, wrap up the list in a blend-mode item. Note