Closed Bug 1415932 Opened 2 years ago Closed 2 years ago
Do a better job collapsing equivalent clip rects in Scrolling
I was looking some more at the motionmark page (see URL) for bug and noticed the nsDisplayTransform for each bouncing star has a DisplayItemClipChain item that is equivalent but not the same. That is the pointer values are different, but DisplayItemClipChain::Equal would return true for them. That means that the hash we use to cache the clip ids in ScrollingLayersHelper will treat them all as separate clips and we won't get to reuse them. I had made a note of this  as a potential future optimization, and it looks like it would help on this page so we should consider doing it.  http://searchfox.org/mozilla-central/rev/c99d035f00dd894feff38e4ad28a73fb679c63a6/gfx/layers/wr/ScrollingLayersHelper.h#73
Whiteboard: [gfx-noted][wr-mvp][triage] → [wr-mvp][triage][gfx-noted]
Turns out doing this is not as easy as I thought. Attempting to do this exposed a latent issue where the clip chain pointer of a nsDisplayMask can be null, which results in the PushClip call at  *not* creating cache overrides in the wr::DisplayListBuilder. I tried hacking around this by making  return true in this case anyway. That didn't work fully because without the cache overrides the parent clip on items inside the nsDisplayMask doesn't get set to the mask clip, and the mask is effectively ignored by WR. Trying to fix this gets pretty hairy. I think if we fix servo/webrender#1964 and expose that mechanism via some API, that will make things better. Then we can just intersect the clip chains the way they're meant to be, instead of trying to glue them all into a single long chain which doesn't always work.  http://searchfox.org/mozilla-central/rev/c99d035f00dd894feff38e4ad28a73fb679c63a6/layout/painting/nsDisplayList.cpp#9462  http://searchfox.org/mozilla-central/rev/c99d035f00dd894feff38e4ad28a73fb679c63a6/gfx/webrender_bindings/WebRenderAPI.h#422
2 years ago
Whiteboard: [wr-mvp][triage][gfx-noted][wr-reserve-candidate] → [wr-reserve] [gfx-noted]
2 years ago
Priority: P3 → P2
I think we're doing as good a job of collapsing as we can now.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.