Closed Bug 1828248 Opened 3 years ago Closed 3 years ago

Twitter.com - stuttering and input lag - Caused by backdrop-filter(Adreno 330)

Categories

(Core :: Graphics: WebRender, defect)

Unspecified
Android
defect

Tracking

()

RESOLVED FIXED
115 Branch
Tracking Status
firefox114 --- wontfix
firefox115 --- fixed

People

(Reporter: djdisodo, Assigned: jnicol)

References

Details

Attachments

(2 files)

+++ This bug was initially created as a clone of Bug #1809738 +++

From github: https://github.com/mozilla-mobile/fenix/issues/28436.

Steps to reproduce

Visiting the mobile twitter site and scrolling around

Expected behavior

Fast device and 120hz screen should provide smooth scrolling like other sites

Actual behavior

The website is very stuttery and has input lag.
If I view the desktop site it's fine.
It seems related to the backdrop-filter CSS performance. If I block backdrop-filter on ublock origin to stop the blur effect on the Twitter mobile page it will work correctly and be very smooth.

Device information

  • Android device: 13 (2023-01-05 patch) - Pixel 7 Pro
  • Fenix version: 108.1.1 - present in beta and nightly.

┆Issue is synchronized with this Jira Task

Change performed by the Move to Bugzilla add-on.

I'm having stuttering caused by backdrop-filter, on webpages like twitter.com
found this issue that seems to be related
there was no lag if i disabled backdrop-filter on about:config

i also tested "Minimal testcase showing poor picture caching with both position: fixed and backdrop-filter" on the original issue posted

i don't clearly remember but i once had lg g6(Adreno 530) and it was stuttering on twitter too

i don't have any other device in my hand for now than galaxy s5(Adreno 330)
there might be more devices that has this lag

Thanks for the bug report. Backdrop filter is very resource intensive and it's unfortunately unavoidable that it has a performance penalty associated. However, I can confirm that on a Nexus 5 (also Adreno 330) performance is especially bad. That is somewhat less so the case on a Nexus 5X (Adreno 418). And by the time I get to a Pixel 2 (Adreno 540), performance is acceptable for me.

There are a couple things going on here. When investigating bug 1809738 we realized that backdrop filter means we are unable to put the fixed position items in their own picture cache slice separate from the scrollable content. This means that the bottom and top tile of the page are constantly invalidating whilst scrolling, which is unfortunate but not the end of the world. However, since then, in the presence of backdrop filter we are unable to correctly detect the scrollable root at all, meaning that the entire screen is invalidated on every scroll. This was regressed by bug 1800358. I'll follow a separate bug for that.

Secondly, and most importantly: In bug 1809738 the issue was that the GPU struggled with the several large render targets we must use due to the backdrop filter. We suspect it was expensive copying their contents from slow memory in to fast tile memory and back. In that case, on the Mali GPU, ensuring we performed unscissored clear was enough to allow the driver to optimize away some of these copies. The older Adreno driver does not appear to be as smart.

However, there exists an extension QCOM_tiled_rendering that appears to allow us to explicitly tell the driver "we only need this region of a render target, you can skip reading it in from tiled memory, and only have to resolve the color attachment back". I have prototyped using this and see a large improvement in performance on my Nexus 5. (From unusable to just about acceptable)

See Also: → 1829186

This provides us with QCOM_tiled_rendering, which will be used in the
next patch in this series.

Assignee: nobody → jnicol
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

We have seen reports that various websites, including twitter, perform
poorly on older Adreno devices due, to backdrop filter. We previously
encountered similar on Mali-G710 devices in bug 1809738, and it
appeared to be due to having to copy the contents of large
framebuffers--required to render the backdrop filter--to and from the
GPU's tile memory. On Mali we were able to avoid this penalty by
ensuring we performed an unscissored clear immediately after binding
the framebuffer, allowing the driver to omit initalizing the contents
of tile memory prior to rendering.

It's plausible that older Adreno drivers are not clever enough to be
able to make this optimization. However, there exists an extension
QCOM_tiled_rendering, which allows us to explicitly tell the driver
which subregion of a render target we are rendering too, and whether
it must be pre-initilized or post-resolved.

This patch makes use of this extension when rendering to color and
picture cache targets. In both cases we supply the region that is
being rendered and must only resolve the color attachment back to main
memory. In most cases we can additionally avoid initializing tile
memory prior to rendering, with the exception being in
draw_color_target() when we do not perform an initial clear, in which
case we must initialize the color attachment.

This results in a significant performance improvement on twitter when
tested on a Nexus 5 (Adreno 330) device.

Depends on D176153

The above patches significantly improve performance on a few Adreno 3xx and 4xx devices that I have tested, though we still fall well short of hitting a smooth 60FPS. If we can find a fix for bug 1829186 that should help further, but realistically it may be very difficult to get this running smoothly. Important to note that Twitter is fairly laggy on Chrome too on these devices.

Pushed by jnicol@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/85d5bfd8f946 Update gleam to 0.15. r=gfx-reviewers,supply-chain-reviewers,jrmuizel https://hg.mozilla.org/integration/autoland/rev/d6cb8770e9ba Use QCOM_tiled_rendering when rendering color and picture cache targets. r=gfx-reviewers,nical

Whoops, forgot to update webrender's Cargo.lock

Flags: needinfo?(jnicol)
Pushed by jnicol@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5ec09fef9385 Update gleam to 0.15. r=gfx-reviewers,supply-chain-reviewers,jrmuizel https://hg.mozilla.org/integration/autoland/rev/7a9431bded9e Use QCOM_tiled_rendering when rendering color and picture cache targets. r=gfx-reviewers,nical

Sorry! A line was too long for servo-tidy's liking

Flags: needinfo?(jnicol)
Pushed by jnicol@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/290aaac29717 Update gleam to 0.15. r=gfx-reviewers,supply-chain-reviewers,jrmuizel https://hg.mozilla.org/integration/autoland/rev/a578872091a4 Use QCOM_tiled_rendering when rendering color and picture cache targets. r=gfx-reviewers,nical
Regressions: 1829772
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch

Backed out a578872091a4 as per https://bugzilla.mozilla.org/show_bug.cgi?id=1829772#c4 for causing Bug 1829772

Status: RESOLVED → REOPENED
Flags: needinfo?(jnicol)
Resolution: FIXED → ---
Target Milestone: 114 Branch → ---
Backout by ncsoregi@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/17ea6f29654b Backed out changeset a578872091a4 for causing Bug 1829772. CLOSED TREE

The test failure in bug 1829772 appears to be due to a driver bug in the implementation of QCOM_tiled_rendering on various Adreno devices.

I have been able to reproduce on a Pixel 4 (Adreno 640), which is what we run our CI tests on, as well as a Pixel 2 (Adreno 540) and Pixel 3 (Adreno 630). I tested each of these running various versions of Android, and while the android version itself doesn't matter, the bug only reproduces when the adreno driver version is V@0490.

I could not reproduce on a OnePlus 6 or OnePlus 8 (Adreno 630 and 650, respectively) with driver versions V@408 or V@0502.

So I am fairly confident the bug affects a reasonably wide range of Adreno GPUs, but is limited to driver version V@0490.

I will update the patch to disable this optimization on affected driver versions, then re-land.

Flags: needinfo?(jnicol)
Attachment #9329712 - Attachment description: Bug 1828248 - Use QCOM_tiled_rendering when rendering color and picture cache targets. r?#gfx-reviewers → Bug 1828248 - Use QCOM_tiled_rendering when rendering color and picture cache targets. r=nical
Pushed by jnicol@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/93f6c1afaa3f Use QCOM_tiled_rendering when rendering color and picture cache targets. r=gfx-reviewers,nical
Status: REOPENED → RESOLVED
Closed: 3 years ago → 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch

tested on nightly now it's a lot better

Jamie, do you think this is worth uplifting to a 114 dot release (already planned for other fixes next week or the week after)? Your fix has been baking on Nightly for most of the Nightly 115 cycle.

Flags: needinfo?(jnicol)

No, I don't think we should. It only helps a limited number of devices and is not without risk.

Flags: needinfo?(jnicol)
Regressions: 1843749
Regressions: 1847319
See Also: → 1847319
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: