Closed Bug 1516702 Opened 2 years ago Closed 2 years ago

Opacity change performance regression on


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




Tracking Status
firefox-esr60 --- unaffected
firefox64 --- unaffected
firefox65 --- unaffected
firefox66 --- verified
firefox67 --- verified


(Reporter: jan, Assigned: mattwoodrow)


(Blocks 1 open bug, )


(Keywords: nightly-community, regression)


(3 files)

Attached video first_bad.mp4
Debian Testing, X11, Macbook Pro

This opacity value will be updated as you scroll down or up:
> <div class="site-header-background" style="opacity: 0;"></div>

mozregression --good 2018-09-15 --bad 2018-12-28 --pref gfx.webrender.all:true -a
> 12:27.56 INFO: Last good revision: 0e8109eaef4b4427272e284b6dc9ef17a0045a0f
> 12:27.56 INFO: First bad revision: 0d3d0fa680d8ed6dcf0875c57f8c54d4cebe19b4
> 12:27.56 INFO: Pushlog:

> 0d3d0fa680d8	Matt Woodrow — Bug 1501382 - Cull items within an opacity:0 container when using WebRender. r=kats
> c62d53bdab79	Matt Woodrow — Bug 1501382 - Build display items within opacity:0 if we need them for APZ hit testing. r=kats
Attached video last_good.mp4
Flags: needinfo?(matt.woodrow)
Assignee: nobody → matt.woodrow
Priority: -- → P2

This regressed because of

The page has some opacity:0 content within SVG, and previously we skipped building this, but now we do.

Some of those invisible items are considerably bigger than the rest of the SVG, and we now include them in the size of the blob, so we spend a lot more time doing blob rasterization (mainly allocating and destroying memory for the tiles that don't actually get anything drawn to them).

The most obviously bad one is tour-content-illustration-toys-image.

There seem to be a lot of bugs here, none of which are particularly easy to fix:

  • nsDisplayOpacity items within SVG get optimized away (by nsSVGUtils::CanOptimizeOpacity), so we don't notice that the contained svg geometry is now entirely transparent.

  • If we fix that, we cull the geometry item, but nothing updates the bounds of the container display items outside of it, so the blob grouping code still thinks we have the larger bounds.

  • The SVG has a clip, but it's on the nsDisplayTransform, outside the nsDisplaySVGWrapper, so nobody knows that we can restrict our blob image size to it.

  • The transparent div (a 1000x1000 rect) also is clipped by something within the svg itself (the mask="url(#stars-mask)"), but the display list bounds aren't smart enough to understand this.

Flags: needinfo?(matt.woodrow)
Pushed by
Skip building nsDisplaySVGGeometry display items when they have opacity:0. r=jwatt
Pushed by
Skip building nsDisplaySVGGeometry display items when they have opacity:0. r=jwatt
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
Flags: needinfo?(matt.woodrow)

I managed to reproduce the issue using an older version of Nightly (2018-12-28) on macOS 10.14.
I retested everything using the latest Nightly 67.0a1 and beta 66.0b14 on the same platform. The bug is not reproducing anymore.

You need to log in before you can comment on or make changes to this bug.