Closed Bug 1683440 Opened 3 years ago Closed 3 years ago

mix-blend-mode forces an intermediate texture even when it has no effect

Categories

(Core :: Graphics: WebRender, defect)

defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: bradwerth, Assigned: bradwerth)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 7 obsolete files)

WR attempts to determine when mix-blend-mode has no effect and optimize the work away. However, in push_stacking_context we let Gecko request that the blend use an intermediate texture.

Since push_stacking_context comes first, there are at least two possible approaches:

  1. Make push_stacking_context do some of the analysis done by WR and avoid specifying the stacking context as isolated.
  2. Make WR fixup the earlier assumption about the stacking context when it determines that the mix-blend-mode will have no effect.

...and I've confirmed that both call sites noted in comment 1 are hit on the www.pixellot.tv site, which was the in-the-wild sighting for this issue.

(In reply to Brad Werth [:bradwerth] from comment #1)

...and I've confirmed that both call sites noted in comment 1 are hit on the www.pixellot.tv site, which was the in-the-wild sighting for this issue.

Yes, but: both call sites are hit, but for pixellot.tv the logic at the first site FlattenedStackingContext.is_redundant concludes that the stacking context is not redundant, which makes this potential optimization not useful for that site.

This may still have some value for cases where mix-blend-mode is applied to the first primitive in a stacking context, where FlattenedStackingContext.is_redundant returns true.

Blocks: 1684781
Attachment #9197221 - Attachment description: Bug 1683440 Part 1: Make WR stacking contexts retroactively discarded for optimized-away children. → Bug 1683440 Part 1: Make WR stacking contexts able to be made redundant retroactively.
Attached file skew-blend-scroll.html

This helper function compartmentalizes the logic to transfer the work done by
one stacking context into another stacking context, or to a tile_cache_builder
if no destination stacking context is provided.

Attachment #9197221 - Attachment description: Bug 1683440 Part 1: Make WR stacking contexts able to be made redundant retroactively. → Bug 1683440 Part 2: Make WR stacking contexts able to be made redundant retroactively.
Attachment #9198057 - Attachment is obsolete: true
Attachment #9197221 - Attachment is obsolete: true
Attachment #9201199 - Attachment description: Bug 1683440 Part 3: Add method DisplayListBuilder::IsLastStackingContextEmpty(). → Bug 1683440 Part 4: Add method DisplayListBuilder::IsLastStackingContextEmpty().
Attachment #9201200 - Attachment description: Bug 1683440 Part 4: Mark blend containers as needed when mix-blend-mode has an effect. → Bug 1683440 Part 5: Mark blend containers as needed when mix-blend-mode has an effect.

The testcase used here relies upon aberrant behavior noted in Bug 1599321. The optimization may still be useful, but once that Bug is fixed, the optimization will not be relevant for the testcase attachment 9197517 [details], which relies upon the body element having no specified color.

See Also: → 1599321

I haven't looked closely at this yet but I'm worried about the complexity that it brings. I'll take a closer look soon.

Attachment #9201199 - Attachment description: Bug 1683440 Part 4: Add method DisplayListBuilder::IsLastStackingContextEmpty(). → Bug 1683440 Part 4: Add method DisplayListBuilder::IsCurrentStackingContextEmpty().

New try push with updated Part 4 (which moved its implementation from Gecko into WebRender): https://treeherder.mozilla.org/#/jobs?repo=try&revision=bb5c109a8dc400cc4f794aab9cb1ecb6eefc1015

How practical would it be to detect the lack of anything to blend with during Gecko display list building instead of during WebRender display list building? It seems easy for background-blend-mode, I'm not as sure about mix-blend-mode.

Flags: needinfo?(mikokm)

This optimization is complicated, and the cases where it matters are avoidable by removing the mix-blend-mode which has no effect. The first sighting of this bug was on pixellot.tv, and with other improvements to mix-blend-mode performance, that site now scrolls in software WR without too much jank.

The solution here would be more elegant if we had an intermediate representation that could alter the structure of the display list when processing in parent-child order, but without committing the parent before evaluating the child.

For now, I'll mark this bug as WONTFIX.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
Flags: needinfo?(mikokm)
Attachment #9200567 - Attachment is obsolete: true
Attachment #9200568 - Attachment is obsolete: true
Attachment #9201913 - Attachment is obsolete: true
Attachment #9201199 - Attachment is obsolete: true
Attachment #9201200 - Attachment is obsolete: true
Blocks: 1684354
See Also: → 1664478
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: