Closed Bug 1409446 Opened 7 years ago Closed 7 years ago

Rewrite the ScrollingLayersHelper code to use the explicit parent APIs

Categories

(Core :: Graphics: WebRender, enhancement, P1)

Other Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox57 --- unaffected
firefox58 --- unaffected

People

(Reporter: kats, Assigned: kats)

References

Details

(Whiteboard: [wr-mvp] [gfx-noted])

Attachments

(12 files)

59 bytes, text/x-review-board-request
jrmuizel
: review+
Details
59 bytes, text/x-review-board-request
jrmuizel
: review+
Details
59 bytes, text/x-review-board-request
jrmuizel
: review+
Details
59 bytes, text/x-review-board-request
mstange
: review+
Details
59 bytes, text/x-review-board-request
ethlin
: review+
mstange
: review+
Details
59 bytes, text/x-review-board-request
mstange
: review+
Details
59 bytes, text/x-review-board-request
mstange
: review+
Details
59 bytes, text/x-review-board-request
mstange
: review+
Details
59 bytes, text/x-review-board-request
mstange
: review+
Details
59 bytes, text/x-review-board-request
ethlin
: review+
mstange
: review+
Details
59 bytes, text/x-review-board-request
mstange
: review+
Details
59 bytes, text/x-review-board-request
mstange
: review+
Details
Splitting off this bug as an intermediate step to fixing bug 1405359. Right now when defining a clip or a scroll layer, we are required to define it only after pushing the appropriate ancestor onto the stack. In servo/webrender#1796 (later modified with #1849 and #1857) I added an API that allows us to explicitly pass the desired ancestor id when defining a clip or scroll layer. This allows us to skip the pushing/popping of the ancestor. This bug is to update ScrollingLayersHelper to use this new API and save on some of the pushing/popping that happens.
Status: NEW → ASSIGNED
Priority: P3 → P1
Whiteboard: [gfx-noted][wr-mvp][triage] → [wr-mvp] [gfx-noted]
Comment on attachment 8919427 [details] Bug 1409446 - Wire up the DefineClip and DefineScrollLayer APIs to allow specifying ancestry. https://reviewboard.mozilla.org/r/190254/#review195592
Attachment #8919427 - Flags: review?(jmuizelaar) → review+
Attachment #8919428 - Flags: review?(jmuizelaar) → review+
Attachment #8919429 - Flags: review?(jmuizelaar) → review+
Comment on attachment 8919431 [details] Bug 1409446 - Modify the extra-clip flag to instead track more useful information. https://reviewboard.mozilla.org/r/190262/#review195754
Attachment #8919431 - Flags: review?(ethlin) → review+
Attachment #8919436 - Flags: review?(ethlin) → review+
Comment on attachment 8919430 [details] Bug 1409446 - Write the new recursive method to define clip chains. https://reviewboard.mozilla.org/r/190260/#review196920 ::: gfx/layers/wr/ScrollingLayersHelper.cpp:102 (Diff revision 1) > + // aChain->mASR == aAsr => recurse(aAsr, aChain->mParent), > + // then define aChain > + // aChain->mASR != aAsr => recurse(aAsr->mParent, aChain), > + // then define aAsr > + // > + // These basically be collapsed down into two codepaths; one that recurses I think this is missing the word "can" ::: gfx/layers/wr/ScrollingLayersHelper.cpp:110 (Diff revision 1) > + if (aChain && aChain->mASR == aAsr) { > + return RecurseAndDefineClip(aItem, aAsr, aChain, aAppUnitsPerDevPixel, aStackingContext, aCache); > + } > + if (aAsr) { > + return RecurseAndDefineAsr(aItem, aAsr, aChain, aAppUnitsPerDevPixel, aStackingContext, aCache); > + } > + > + MOZ_ASSERT(!aChain && !aAsr); Especially looking at the assert below, the if statements seem a bit verbose. It seems the "return RecourseAndDefineClip(...)" could just happen inside a single if (aChain || aAsr) {...}. Or did you do it the way you did it to stay closer to the comment above?
Attachment #8919430 - Flags: review?(mstange) → review+
Comment on attachment 8919431 [details] Bug 1409446 - Modify the extra-clip flag to instead track more useful information. https://reviewboard.mozilla.org/r/190262/#review197736 I'm a bit unhappy about the layering violation where renderers now need to know about nsDisplayItem, but I don't have any good ideas for how to avoid that. ::: gfx/webrender_bindings/WebRenderAPI.h:432 (Diff revision 1) > - uint32_t mExtraClipCount; > + // clips that are generated by display items but that ScrollingLayersHelper > + // doesn't know about. These are called "cache overrides" because while we're > + // inside one of these clips, the WR clip stack is different from what > + // ScrollingLayersHelper thinks it actually is (because of the out-of-band > + // clip that was pushed onto the stack) and so ScrollingLayersHelper cannot > + // use it's clip cache as-is. Instead, any time ScrollingLayersHelper wants it's -> its
Attachment #8919431 - Flags: review?(mstange) → review+
Comment on attachment 8919432 [details] Bug 1409446 - Properly handle out-of-band clips in the new ScrollingLayersHelper code. https://reviewboard.mozilla.org/r/190264/#review197742
Attachment #8919432 - Flags: review?(mstange) → review+
Comment on attachment 8919433 [details] Bug 1409446 - Deal with scenario of two interchangeable DisplayItemClipChain objects causing a cache miss. https://reviewboard.mozilla.org/r/190266/#review197744
Attachment #8919433 - Flags: review?(mstange) → review+
Comment on attachment 8919434 [details] Bug 1409446 - Work around the dual-ancestor case that WR doesn't handle yet. https://reviewboard.mozilla.org/r/190268/#review197746
Attachment #8919434 - Flags: review?(mstange) → review+
Attachment #8919435 - Flags: review?(mstange) → review+
Attachment #8919436 - Flags: review?(mstange) → review+
Attachment #8919437 - Flags: review?(mstange) → review+
Attachment #8919438 - Flags: review?(mstange) → review+
Comment on attachment 8919430 [details] Bug 1409446 - Write the new recursive method to define clip chains. https://reviewboard.mozilla.org/r/190260/#review197760 ::: gfx/layers/wr/ScrollingLayersHelper.cpp:110 (Diff revision 1) > + if (aChain && aChain->mASR == aAsr) { > + return RecurseAndDefineClip(aItem, aAsr, aChain, aAppUnitsPerDevPixel, aStackingContext, aCache); > + } > + if (aAsr) { > + return RecurseAndDefineAsr(aItem, aAsr, aChain, aAppUnitsPerDevPixel, aStackingContext, aCache); > + } > + > + MOZ_ASSERT(!aChain && !aAsr); Oops, I missed that this was calling different functions.
(In reply to Markus Stange [:mstange] from comment #23) > > + // These basically be collapsed down into two codepaths; one that recurses > > I think this is missing the word "can" Fixed > Especially looking at the assert below, the if statements seem a bit > verbose. It seems the "return RecourseAndDefineClip(...)" could just happen > inside a single if (aChain || aAsr) {...}. Or did you do it the way you did > it to stay closer to the comment above? Different functions, but also yes, I wanted to keep the structure of the code closer to the comment so that it would be easier to follow. (In reply to Markus Stange [:mstange] from comment #24) > I'm a bit unhappy about the layering violation where renderers now need to > know about nsDisplayItem, but I don't have any good ideas for how to avoid > that. Ah, I didn't even realize it was a layering violation, thanks for pointing that out. Technically the only thing I need is the clipchain which I could pass as a void* if we really want to avoid abuse of the nsDisplayItem*. I can't think of any other ways to avoid this either. > ::: gfx/webrender_bindings/WebRenderAPI.h:432 > > + // use it's clip cache as-is. Instead, any time ScrollingLayersHelper wants > > it's -> its Fixed.
Pushed by kgupta@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/793acbd73126 Wire up the DefineClip and DefineScrollLayer APIs to allow specifying ancestry. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/4ae5fc22aecf Remove unused function. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/b1465f5c3f35 Unify the clip stack in WebRenderAPI. r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/408acda8e5e5 Write the new recursive method to define clip chains. r=mstange https://hg.mozilla.org/integration/autoland/rev/75e3a4777a7f Modify the extra-clip flag to instead track more useful information. r=ethlin,mstange https://hg.mozilla.org/integration/autoland/rev/15f491515ba6 Properly handle out-of-band clips in the new ScrollingLayersHelper code. r=mstange https://hg.mozilla.org/integration/autoland/rev/40c84480b4d4 Deal with scenario of two interchangeable DisplayItemClipChain objects causing a cache miss. r=mstange https://hg.mozilla.org/integration/autoland/rev/4a1434cdcae3 Work around the dual-ancestor case that WR doesn't handle yet. r=mstange https://hg.mozilla.org/integration/autoland/rev/debf2683f01f Handle nested display item scenarios. r=mstange https://hg.mozilla.org/integration/autoland/rev/4d8523e88330 Treat sticky clips as out-of-band clips. r=ethlin,mstange https://hg.mozilla.org/integration/autoland/rev/53894a33da8c Switch over to the new code. r=mstange https://hg.mozilla.org/integration/autoland/rev/e036a5afa854 Remove old code that is now unused. r=mstange
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: