Open Bug 1654938 Opened 4 years ago Updated 7 months ago

Share the WebRender instance between windows (using a WR "document" per window) when the GL context is shared

Categories

(Core :: Graphics: WebRender, task, P3)

task

Tracking

()

People

(Reporter: mstange, Unassigned)

References

(Blocks 2 open bugs)

Details

In WebRender Firefox, each new window currently comes with a fair amount of overhead: Extra threads (1 render backend thread, 2 scene builder threads), a new texture cache, and probably a bunch of other things. It would make sense to share all of these things between windows.
The renderer thread is already shared between windows, and windows are rendered consecutively.

On platforms where we share a GL context between multiple windows, sharing all those WR resources should be possible using the WR "document" API: There would be one WR instance per GL context (usually just one, except in multi-GPU configurations), and each window would be a "document" that has its own OS compositor.
This should make WR windows lightweight enough that we can use them even for tiny things such as tooltips or menus.

It would also help a lot on Android, where each tab is a "window" (see bug 1619409).

Severity: -- → N/A
Priority: -- → P3

We've discussed deprecating / removing the document API from WR previously - I'd like to discuss this further before we move ahead with any plans based on the above.

We discussed this briefly in matrix. The general idea is to keep the document API, but restrict it by allowing only a single document to be drawn to a given framebuffer / OS compositor. This would allow the sharing mentioned above, while allowing us to remove the WR complexity related to documents with different origins / z-indices in the same render.

See Also: → 1727993
Blocks: 1745996

Linux now deletes compositor if popup window is closed (Bug 1882462). It's because every opened/closed popup permanently takes ~200MB of memory so you can easily end up with 1-2 GB of RAM hold by popups/menus only which is released only if Firefox main window is closed.

See Also: → 1883308
You need to log in before you can comment on or make changes to this bug.