High CPU usage with WebGL content on GTK backend
Categories
(Core :: Graphics: CanvasWebGL, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox118 | --- | fixed |
People
(Reporter: david.turner, Assigned: david.turner)
References
(Blocks 2 open bugs)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0
Steps to reproduce:
Load this UFO test: https://www.testufo.com/stutter#demo=smooth&foreground=ffffff&background=000000&pps=720
Actual results:
- On an i7-12700H using Firefox 116.0,
MOZ_ENABLE_WAYLAND=1, on Debian Bookworm with GNOME, I see CPU usage of 50% of a core. See attachedabout:support - On a Raspberry Pi 4 the CPU usage is about 120% of a core and the content only renders around 50fps.
- CPU usage is similar with Xwayland and with native X11.
- CPU usage is the same in current
bookmarks/central
Expected results:
On Windows CPU usage is only about 3% of a core, so I expect Firefox CPU usage to be similar on Linux.
| Assignee | ||
Comment 1•2 years ago
|
||
See profile at https://share.firefox.dev/3QzkBfI
Looking at the CanvasRenderer thread, I noticed that we are creating a new DMABufSurface for every frame, so a lot of CPU time is going into the GBM BO allocations.
Looking in GLScreenBuffer.cpp I can see a DMA buffer pooling mechanism used on Android to limit the number of surface allocations (bug 1646073). I did a quick hack to enable this buffer pool on Linux/GTK and this halved the CPU usage. I'll push up a patch for this after I've done some clean-up and testing.
Comment 2•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Graphics: CanvasWebGL' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
| Assignee | ||
Comment 3•2 years ago
|
||
I think the texture-recycling part of this is equivalent to Bug 1800205 so I will talk to sotaro
| Assignee | ||
Comment 4•2 years ago
|
||
Currently WebGL on the GTK backend constantly creates new DMAbuf
surfaces for every frame, causing high CPU usage (Bug 1848171). At
60fps on a high-end Intel CPU this uses 50% of a core. On a Raspberry Pi
4 this uses around 100% of a core and limits FPS to about 50.
This patch allows DMABufSurfaces to be recycled and so greatly reduces
CPU usage on WebGL content (on a Raspberry Pi 4 this halves the CPU
usage on https://www.testufo.com/stutter#demo=smooth&foreground=ffffff&background=000000&pps=720
This patch was originally authored by Sotaro Ikeda but did not solve
their problem, I am co-opting it to fix Bug 1848171.
Updated•2 years ago
|
Comment 6•2 years ago
|
||
| bugherder | ||
Updated•2 years ago
|
Description
•