Closed Bug 1415932 Opened 2 years ago Closed 2 years ago

Do a better job collapsing equivalent clip rects in ScrollingLayersHelper


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

Other Branch



Tracking Status
firefox57 --- unaffected
firefox58 --- unaffected


(Reporter: kats, Unassigned)


(Blocks 2 open bugs, )


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

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 [1] as a potential future optimization, and it looks like it would help on this page so we should consider doing it.

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 [1] *not* creating cache overrides in the wr::DisplayListBuilder. I tried hacking around this by making [2] 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.

Whiteboard: [wr-mvp][triage][gfx-noted] → [wr-mvp][triage][gfx-noted][wr-reserve-candidate]
Whiteboard: [wr-mvp][triage][gfx-noted][wr-reserve-candidate] → [wr-reserve] [gfx-noted]
I think we're doing as good a job of collapsing as we can now.
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.