Open Bug 1853207 Opened 2 years ago Updated 1 year ago

CSS filter with transition makes 2D placeholder canvas (controlled by OffscreenCanvas) flicker

Categories

(Core :: Graphics: Canvas2D, defect)

Firefox 117
x86_64
Linux
defect

Tracking

()

People

(Reporter: maluscat, Unassigned, NeedInfo)

References

Details

Attachments

(2 files)

Attached file Simple test case

Setup: Create an OffscreenCanvas from a visible canvas via transferControlToOffscreen. The visible canvas is now the placeholder of the OffscreenCanvas, mirroring it.

Apply a filter with a transition to the visible canvas or any of it's parents (the canvas just needs to be affected by the filter in any way). It can be any filter property, not just blur.

Starting the transition results in the canvas content flickering briefly on transition start and end, irregularly.

Setting gfx.webrender.software to true prevents this behavior.

This is perhaps related to Bug 1837070

Can repro with gpu-canvas enabled.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(lsalzman)
Attached file about:support
Flags: needinfo?(lsalzman) → needinfo?(aosmond)

If I add will-change: filter; to #canvas it solves the flickering, so this seems related to the addition/removal of the stacking context that applies the blur.

Flags: needinfo?(aosmond)

Similar to setting gfx.webrender.software to true, setting gfx.canvas.accelerated to false also fixes it. The changing stacking context plus the asynchronous nature of the flush are what causes the flicker:
https://searchfox.org/mozilla-central/rev/b741ddde6c678ca7025858952202d20664491555/layout/generic/nsHTMLCanvasFrame.cpp#115

This depends on bug 1837070, although it isn't really a regression, since I think without bug 1837070 we would display nothing.

Depends on: 1837070

When we recreate the async pipeline for the canvas because of the stacking context addition/removal, we actually set it with an empty display list, even if we might already have content:
https://searchfox.org/mozilla-central/rev/b741ddde6c678ca7025858952202d20664491555/gfx/layers/wr/WebRenderBridgeParent.cpp#1820

Severity: -- → S3

This is fixed for me on Windows+gpu-canvas. The Bisection points to :

https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=382081ff53ef2dd62a058d17e7022ca0a6bf929a&tochange=3fd71c45d9fc05e5912ec6c9ba191a9a3a7f2038

Andrew, can this bug be closed or is there more to be done here?

Flags: needinfo?(aosmond)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: