Closed Bug 1779085 Opened 3 years ago Closed 3 years ago

Scrolling is not smooth on privacyguides.org with backdrop-filter enabled

Categories

(Core :: Graphics: WebRender, defect)

Firefox 104
Unspecified
Android
defect

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox-esr102 --- unaffected
firefox102 --- unaffected
firefox103 --- wontfix
firefox104 --- fixed

People

(Reporter: ksenia, Assigned: gw)

References

(Regression, )

Details

(Keywords: regression)

This was originally reported in https://github.com/webcompat/web-bugs/issues/106028

To reproduce, visit https://www.privacyguides.org/tools/ in Firefox Nightly 104.0a1 on Android and try to scroll down.

Expected:
Scrolling is smooth

Actual:
Scrolling is staggering

Mozregression result:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=c2cd1e58dd94f78e6ed04798669635259a546964&tochange=e7cc9622ec6a955a42bb1e258ca2debb424bee57

Scrolling becomes smooth once I disable backdrop-filter rule for .md-header element or set layout.css.backdrop-filter.enabled to false and restart the browser.
Also, this doesn't seem to be an issue on desktop, at least on MacOS.

Hi Glenn, wonder if you can take a look at this, please?

Flags: needinfo?(gwatson)
Assignee: nobody → gwatson
Flags: needinfo?(gwatson)

Set release status flags based on info from the regressing bug 1578503

Janky on desktop Windows too : https://share.firefox.dev/3yxYDyT

Component: Layout → Graphics: WebRender

Hi :gw, what's the severity/priority of this bug?
(next week is RC week for 103, the final 103 beta builds today)

Flags: needinfo?(gwatson)
Severity: -- → S3
Flags: needinfo?(gwatson)

I can reproduce locally. The main issue seems to be that we select a fixed position scroll root during picture cache assignment - this means that when scrolling we end up invalidating and redrawing everything every frame on this page. Next step will be to work out why we select a fixed position scroll root, which will determine whether this is a relatively simple bug fix or something more complex going on.

I have a relatively simple fix for that, but there's a second problem that is also causing slowness. We seem to be failing in batching or something like that, related to clip masks. The backdrop-filter issue just makes the batching issue more noticeable as we cache less things and constantly redraw. I'm seeing >4k draw calls on that frame during scrolling, so we need find the root cause of this and solve that too.

This also results in >1k alpha passes, which is shockingly high and clearly points towards a bug, given the site content.

The cause here is that the render task graph sort selects task render pass when they can be drawn safely, but doesn't move them earlier where possible. This trips up the current logic that decides whether to use a shared surface or not. Need to think of the best way to handle this, there's a few options.

I was wrong in comment 8 - the problem is a bit more subtle and tricky than that. The task graph sort does pop them in the correct order - but with backdrop-filter present, it's possible that tiles can end up in different passes, but require use of the same child task. This, combined with many segmented primitives on this page, where many of them have box-shadow masks, leads to a large number of tasks that don't get allocated on a shared surface.

Depends on: 1780321, 1780320

On a very high-end desktop, the frame time on this page was averaging ~17 ms. With the two changes above, this drops to ~3.5 ms. Mobile devices are likely to see the same or higher ratio performance improvement, since binding and resolving all those extra render targets is probably every more expensive on those GPUs.

Profile with latest nightly : https://share.firefox.dev/3v80s4B

That profile looks good to me, from a quick scan - did it feel like it was smooth on your machine now?

It was quite smooth on my high-end laptop. Might be worthwhile to test it on a mobile phone, which was the device used by the original reporter.
@ :ksenia, could you please test the latest nightly on an android mobile phone and see if the performance is better now?

Flags: needinfo?(kberezina)

Yes, it is much better, I don't observe any staggering when scrolling the page in the latest Nightly on my Android device anymore.
Thanks for looking into this!

Flags: needinfo?(kberezina)

Thanks for checking!

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
You need to log in before you can comment on or make changes to this bug.