Improve opacity flattening
Categories
(Core :: Graphics: WebRender, enhancement, P3)
Tracking
()
People
(Reporter: jrmuizel, Assigned: bradwerth)
References
(Blocks 2 open bugs)
Details
(Keywords: perf-alert)
Attachments
(4 files, 1 obsolete file)
Currently it seems like WebRender will draw things into a temporary even if the opacity could be flattened directly into a single item. Examples of this are images or gradients.
In the non-WebRender case we go to some effort to flatten these to avoid the the cost of the temporary. Not doing this flattening shows up especially with sw-wr.
Reporter | ||
Comment 1•4 years ago
|
||
I double checked and it looks like the existing opacity flattening that we have is already being performed at the gecko display list level and doesn't apply to gradient backgrounds. Is this true Miko?
Reporter | ||
Comment 2•4 years ago
|
||
It looks like Chrome will fold opacity into most single display items:
https://source.chromium.org/chromium/chromium/src/+/master:cc/paint/paint_op_buffer.cc;l=2698;drc=7a942548e0af7397f79bf07b4ca03ade10d04019;bpv=0;bpt=1
So I'd expect them to fold it into the drawImage with a gradient.
Comment 3•4 years ago
•
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #1)
I double checked and it looks like the existing opacity flattening that we have is already being performed at the gecko display list level and doesn't apply to gradient backgrounds. Is this true Miko?
This is correct. I wrote a quick patch to enable this for nsDisplayBackgroundImage
items, can you try if it helps with bug 1669520?
Comment 4•4 years ago
|
||
Reporter | ||
Comment 5•4 years ago
|
||
It looks like this should fix the problem I was seeing but it also looks like this will break opacity on regular images because nsImageRenderer::BuildWebRenderDisplayItems seems to only use its aOpacity parameter for gradients.
Updated•4 years ago
|
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Updated•4 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 6•3 years ago
|
||
Depends on D92941
Updated•3 years ago
|
Assignee | ||
Comment 7•3 years ago
|
||
Updated•3 years ago
|
Pushed by bwerth@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/555f8ed5cc85 Allow applying opacity to nsDisplayBackgroundImage items r=jrmuizel https://hg.mozilla.org/integration/autoland/rev/55707a03f41d Part 2: Make nsImageRenderer::BuildWebRenderDisplayItems premultiply alpha with provided opacity. r=miko,jrmuizel
Comment 9•3 years ago
|
||
Backed out 2 changesets (Bug 1669840) for causing reftest failures CLOSED TREE
Failure log: https://treeherder.mozilla.org/logviewer?job_id=328586996&repo=autoland&lineNumber=12710
https://treeherder.mozilla.org/logviewer?job_id=328587195&repo=autoland&lineNumber=11880
https://treeherder.mozilla.org/logviewer?job_id=328587168&repo=autoland&lineNumber=16720
Backout: https://hg.mozilla.org/integration/autoland/rev/8f846270c507fddf3f8554fbd3c78ccfdd7c642d
Assignee | ||
Comment 10•3 years ago
|
||
Hopefully these fixes will put things right: https://treeherder.mozilla.org/#/jobs?repo=try&revision=81529a523d6bf178bb928d7c485edf8c8ee47dad
Assignee | ||
Comment 11•3 years ago
|
||
Depends on D103130
Assignee | ||
Comment 12•3 years ago
|
||
Comment 13•3 years ago
|
||
Pushed by bwerth@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/396931075ff1 Allow applying opacity to nsDisplayBackgroundImage items r=jrmuizel,mstange https://hg.mozilla.org/integration/autoland/rev/d54787a62ba0 Part 2: Make nsImageRenderer::BuildWebRenderDisplayItems premultiply alpha with provided opacity. r=miko,jrmuizel https://hg.mozilla.org/integration/autoland/rev/7ceccf133786 Part 3: Update test expectations. r=jrmuizel
Comment 14•3 years ago
|
||
Backed out 3 changesets (bug 1669840) for Reftest failures in layout/reftests/layers/opacity-background-1.html. CLOSED TREE
Log:
https://treeherder.mozilla.org/logviewer?job_id=328768263&repo=autoland&lineNumber=6202
Push with failures:
https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&revision=7ceccf1337861d9dc291e8720992956c5ff0ec97
Backout:
https://hg.mozilla.org/integration/autoland/rev/1ba9347926736cac6baa78dd360fdc4a9efc2dc9
Assignee | ||
Comment 15•3 years ago
|
||
Comment 16•3 years ago
|
||
Pushed by bwerth@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1582820076e0 Allow applying opacity to nsDisplayBackgroundImage items r=jrmuizel,mstange https://hg.mozilla.org/integration/autoland/rev/b4f43fdd6d04 Part 2: Make nsImageRenderer::BuildWebRenderDisplayItems premultiply alpha with provided opacity. r=miko,jrmuizel https://hg.mozilla.org/integration/autoland/rev/c648cec12f77 Part 3: Update test expectations. r=jrmuizel
Comment 17•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1582820076e0
https://hg.mozilla.org/mozilla-central/rev/b4f43fdd6d04
https://hg.mozilla.org/mozilla-central/rev/c648cec12f77
Comment 18•3 years ago
|
||
(In reply to Pulsebot from comment #16)
Pushed by bwerth@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1582820076e0
Allow applying opacity to nsDisplayBackgroundImage items r=jrmuizel,mstange
https://hg.mozilla.org/integration/autoland/rev/b4f43fdd6d04
Part 2: Make nsImageRenderer::BuildWebRenderDisplayItems premultiply alpha
with provided opacity. r=miko,jrmuizel
https://hg.mozilla.org/integration/autoland/rev/c648cec12f77
Part 3: Update test expectations. r=jrmuizel
== Change summary for alert #28670 (as of Mon, 08 Feb 2021 10:31:22 GMT) ==
Improvements:
Ratio | Suite | Test | Platform | Options | Absolute values (old vs new) |
---|---|---|---|---|---|
25% | rasterflood_gradient | linux64-shippable | e10s stylo | 1,092.92 -> 1,365.75 | |
25% | rasterflood_gradient | linux64-shippable | e10s stylo | 1,093.75 -> 1,366.00 | |
16% | rasterflood_gradient | macosx1014-64-shippable-qr | e10s stylo webrender-sw | 363.46 -> 420.58 | |
8% | rasterflood_gradient | linux64-shippable-qr | e10s stylo webrender-sw | 458.00 -> 492.67 | |
5% | rasterflood_gradient | windows10-64-shippable-qr | e10s stylo webrender-sw | 437.46 -> 459.58 |
For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=28670
Assignee | ||
Updated•3 years ago
|
Comment 19•3 years ago
|
||
Backed out of beta 87 for causing bug 1696761
https://hg.mozilla.org/releases/mozilla-beta/rev/b143a917a99b5e5a27716697d9b90c5d5c9968b2
Comment 20•3 years ago
|
||
Per discussion with Brad, we're backing this out from m-c as well while he works on finding a solution to bug 1696761.
https://hg.mozilla.org/integration/autoland/rev/f2aa3c52790966347d5206922245ea968bc428e3
Comment 21•3 years ago
|
||
Backout merged: https://hg.mozilla.org/mozilla-central/rev/f2aa3c527909
Comment 22•3 years ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM] from comment #20)
Per discussion with Brad, we're backing this out from m-c as well while he works on finding a solution to bug 1696761.
https://hg.mozilla.org/integration/autoland/rev/f2aa3c52790966347d5206922245ea968bc428e3
== Change summary for alert #29390 (as of Tue, 23 Mar 2021 05:13:18 GMT) ==
Regressions:
Ratio | Suite | Test | Platform | Options | Absolute values (old vs new) |
---|---|---|---|---|---|
67% | rasterflood_gradient | windows10-64-shippable-qr | e10s stylo webrender-sw | 1,196.92 -> 389.08 | |
65% | rasterflood_gradient | windows10-64-shippable-qr | e10s stylo webrender-sw | 1,299.92 -> 458.33 | |
19% | rasterflood_gradient | linux1804-64-shippable | e10s stylo | 745.08 -> 602.67 | |
7% | rasterflood_gradient | windows10-64-shippable | e10s stylo | 1,329.08 -> 1,239.75 |
For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=29390
Updated•3 years ago
|
Comment 23•3 years ago
|
||
Comment on attachment 9180427 [details]
Bug 1669840 Part 1 - Allow applying opacity to nsDisplayBackgroundImage items
Revision D92941 was moved to bug 1696761. Setting attachment 9180427 [details] to obsolete.
Comment 24•3 years ago
|
||
Comment on attachment 9199424 [details]
Bug 1669840 Part 2: Make nsImageRenderer::BuildWebRenderDisplayItems premultiply alpha with provided opacity.
Revision D103130 was moved to bug 1696761. Setting attachment 9199424 [details] to obsolete.
Comment 25•3 years ago
|
||
Comment on attachment 9200948 [details]
Bug 1669840 Part 4: Update test expectations.
Revision D103938 was moved to bug 1696761. Setting attachment 9200948 [details] to obsolete.
Assignee | ||
Comment 26•3 years ago
|
||
Update on what it will take to land these patches again. The regression tracked in Bug 1696761 is the reason why these patches can't be re-landed. The testcase attachment 9208516 [details] there is useful. Loading that testcase, you'll see a black background (on macOS) or a transparent black background (on Linux) when you should see an opaque 0.1 gray background. This is happening because the compositor is providing an uninitialized surface as a background and blending a 0.1 alpha black GIF against it. On macOS the compositor gives a default fill of 1.0 alpha black. On Linux, the compositor gives a fill of 0.0 alpha.
I haven't been able to track down where those surfaces are created or handed off without first being cleared to the 1.0 alpha white color, as they should be.
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 27•3 years ago
|
||
Depends on D103938
Assignee | ||
Comment 28•3 years ago
|
||
Assignee | ||
Comment 29•3 years ago
|
||
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Comment 30•3 years ago
|
||
Pushed by bwerth@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8444d88d1869 Part 1 - Allow applying opacity to nsDisplayBackgroundImage items r=jrmuizel,mstange https://hg.mozilla.org/integration/autoland/rev/7716542373a3 Part 2: Make nsImageRenderer::BuildWebRenderDisplayItems premultiply alpha with provided opacity. r=miko,jrmuizel https://hg.mozilla.org/integration/autoland/rev/31dfd306b953 Part 3: Include image instance color alpha in check for opaque backdrop. r=gfx-reviewers,lsalzman https://hg.mozilla.org/integration/autoland/rev/be66ef46592b Part 4: Update test expectations. r=jrmuizel
Comment 31•3 years ago
•
|
||
Backed out 4 changesets (Bug 1669840) for causing reftest failures in border-collapse-opacity-table-row-group.html CLOSED TREE
Log: https://treeherder.mozilla.org/logviewer?job_id=340340040&repo=autoland&lineNumber=24449
https://treeherder.mozilla.org/logviewer?job_id=340340270&repo=autoland&lineNumber=23276
Backout: https://hg.mozilla.org/integration/autoland/rev/a56053133efafefb12b8914fefed2731090429f1
Comment 32•3 years ago
|
||
Pushed by bwerth@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a4d21aa2f97d Part 1 - Allow applying opacity to nsDisplayBackgroundImage items r=jrmuizel,mstange https://hg.mozilla.org/integration/autoland/rev/17d1706271a9 Part 2: Make nsImageRenderer::BuildWebRenderDisplayItems premultiply alpha with provided opacity. r=miko,jrmuizel https://hg.mozilla.org/integration/autoland/rev/dc8740f5d193 Part 3: Include image instance color alpha in check for opaque backdrop. r=gfx-reviewers,lsalzman https://hg.mozilla.org/integration/autoland/rev/b0dc93c36fb5 Part 4: Update test expectations. r=jrmuizel
Comment 33•3 years ago
|
||
Backed out 4 changesets (Bug 1669840) for causing reftest failures in opacity-background-1.html CLOSED TREE
Log: https://treeherder.mozilla.org/logviewer?job_id=340391920&repo=autoland&lineNumber=23152
Backout: https://hg.mozilla.org/integration/autoland/rev/473928548dd730fbde37f2bc547f51f6cbc44777
Assignee | ||
Comment 34•3 years ago
|
||
Trying to get this comprehensively sorted out: https://treeherder.mozilla.org/jobs?repo=try&revision=8c2234f5f86f15a46c89f9c777e1abf347d4b52c
Comment 35•3 years ago
|
||
Pushed by bwerth@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/04e81660c75f Part 1 - Allow applying opacity to nsDisplayBackgroundImage items r=jrmuizel,mstange https://hg.mozilla.org/integration/autoland/rev/ab9ae661da2c Part 2: Make nsImageRenderer::BuildWebRenderDisplayItems premultiply alpha with provided opacity. r=miko,jrmuizel https://hg.mozilla.org/integration/autoland/rev/73d45273bf7f Part 3: Include image instance color alpha in check for opaque backdrop. r=gfx-reviewers,lsalzman https://hg.mozilla.org/integration/autoland/rev/9a3c2b7dfe84 Part 4: Update test expectations. r=jrmuizel
Comment 36•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/04e81660c75f
https://hg.mozilla.org/mozilla-central/rev/ab9ae661da2c
https://hg.mozilla.org/mozilla-central/rev/73d45273bf7f
https://hg.mozilla.org/mozilla-central/rev/9a3c2b7dfe84
Comment 37•3 years ago
|
||
Since the status are different for nightly and release, what's the status for beta?
For more information, please visit auto_nag documentation.
Assignee | ||
Updated•3 years ago
|
Updated•3 years ago
|
Comment 38•3 years ago
|
||
perf key word?
Assignee | ||
Comment 39•3 years ago
|
||
(In reply to Worcester12345 from comment #38)
perf key word?
This optimization is not protected behind a preference.
Comment 40•3 years ago
|
||
(In reply to Pulsebot from comment #35)
Pushed by bwerth@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/04e81660c75f
Part 1 - Allow applying opacity to nsDisplayBackgroundImage items
r=jrmuizel,mstange
https://hg.mozilla.org/integration/autoland/rev/ab9ae661da2c
Part 2: Make nsImageRenderer::BuildWebRenderDisplayItems premultiply alpha
with provided opacity. r=miko,jrmuizel
https://hg.mozilla.org/integration/autoland/rev/73d45273bf7f
Part 3: Include image instance color alpha in check for opaque backdrop.
r=gfx-reviewers,lsalzman
https://hg.mozilla.org/integration/autoland/rev/9a3c2b7dfe84
Part 4: Update test expectations. r=jrmuizel
== Change summary for alert #30198 (as of Tue, 25 May 2021 09:39:06 GMT) ==
Improvements:
Ratio | Suite | Test | Platform | Options | Absolute values (old vs new) |
---|---|---|---|---|---|
21% | rasterflood_gradient (docs) | linux1804-64-shippable | e10s stylo | 628.83 -> 759.17 | |
20% | rasterflood_gradient (docs) | windows10-64-shippable-qr | e10s stylo webrender-sw | 1,114.33 -> 1,334.17 | |
19% | rasterflood_gradient (docs) | linux1804-64-shippable-qr | e10s stylo webrender-sw | 1,117.88 -> 1,335.50 | |
15% | rasterflood_gradient (docs) | macosx1015-64-shippable-qr | e10s stylo webrender-sw | 975.25 -> 1,125.25 | |
6% | rasterflood_gradient (docs) | windows10-64-shippable | e10s stylo | 1,253.96 -> 1,332.75 |
For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=30198
Description
•