Open Bug 1678265 Opened 5 years ago Updated 5 years ago

A lot of time spent in SwapBuffer on https://eteam-eteam.4flow.cloud/#

Categories

(Core :: Graphics: WebRender, enhancement)

enhancement

Tracking

()

People

(Reporter: gsvelto, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

Attachments

(1 file)

A friend of mine pointed me to this page:

https://eteam-eteam.4flow.cloud/#

It has a background that appears to be some kind animated SVG that changes every few seconds or so with some kind of fade-in/fade-out effect. Every time it does I can see a very large CPU spike in the main process. The animation appears to be running at 60FPS on my machine (Ryzen 3800X, Radeon RX 580 on Linux) but it consumes up to 60% CPU time to get there which seems a lot for such a simple effect.

Profile with Wintel+ WR :https://share.firefox.dev/32ZBCGf

Component: SVG → Graphics

:gsvelto, can you provide, about:support to this bug?

Flags: needinfo?(gsvelto)

When I tested with WebRender on Ubuntu18.04. Wait happened at GLContextGLX::SwapBuffers() on RenderThread. From it, the SVG animation seems like heavy weight for GPU with WebRender.
https://share.firefox.dev/33cTDkn

:gw, can you comment to the bug?

Flags: needinfo?(gwatson)
Component: Graphics → Graphics: WebRender
Severity: -- → S3
Attached file about:support
Flags: needinfo?(gsvelto)

If this is SVG, it might be updating a very large texture each frame it is animated?

nical or jrmuizel might know more about where to look for this, it seems likely that it would be related to blob code.

Flags: needinfo?(nical.bugzilla)
Flags: needinfo?(jmuizelaar)
Flags: needinfo?(gwatson)

I gave a peek at the page sources and I think it's SVG but I'm not 100% positive.

The animated background is just 6 jpegs stacked on top with varying opacitys. WebRender should handle this fine. None of the profiles on the bug show anything particularly bad happening. For me cpu usage is around 30% which isn't great, but not terrible either.

Flags: needinfo?(jmuizelaar)
Blocks: wr-renderer-perf
No longer blocks: wr-perf
Flags: needinfo?(nical.bugzilla)

I'm getting high renderer times (nothing crazy but fairly high still), with most of the time spent in SwapBuffer. There's also a noticeable portion of the time submitting draw calls (althought the amount of daw calls is farily low). GPU time is high as well (around 15ms) on the 4k intel (linux) which is probably why we end up waiting in SwapBuffer.

Summary: Very high CPU usage for SVG animation → A lot of time spent in SwapBuffer on https://eteam-eteam.4flow.cloud/#

Can you investigate further?

Flags: needinfo?(nical.bugzilla)

I looked at what happens on the GPU: the large images are first blit from the texture cache to their own intermediate targets (likely because they are too large to both fit in one), and rendered into the screen with the opacity shader.
This is obviously super wasteful because we could draw the images directly off of the texture cache and save ourselves two intermediate targets each frame.
It would save a lot of GPU time but also avoid driver overhead associated with submitting work for the intermediate targets so some Renderer time as well.

What we want is some way to optimize away intermediate targets. This is the same as bug 1664478.

Flags: needinfo?(nical.bugzilla)
See Also: → 1664478

Hey Jim, could you take a look here, we're in need of a plan on how to improve things. Miko has been working on this as well.

No longer depends on: sw-wr-perf-opacity
Flags: needinfo?(jimb)
See Also: → sw-wr-perf-opacity

Sure.

Flags: needinfo?(jimb)
No longer blocks: gfx-triage
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: