Allow SWGL render compositor to work asynchronously during picture cache tile updates
Categories
(Core :: Graphics: WebRender, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox80 | --- | fixed |
People
(Reporter: lsalzman, Assigned: lsalzman)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
Now that we have do SWGL compositing entirely in software for some platforms, it can show up as a substantial portion of profiles during scrolling, around 25% which was mostly not present with the older OpenGL compositing path. We can pipeline some of this overhead between compositing and updating of picture cache tiles, since many picture cache tiles that are still cached from previous frames have no dependencies on the ones currently being updated or must be composited before the updating one anyway (such as a background).
In the best case scenario, this allows compositing overhead to almost entirely be hidden, so long as there is another core around that is not busy. As updating picture cache tiles tends to take much more time than compositing, this gives plenty of time to composite asynchronously in the background.
Initial testing on a few sites with a prototype shows this can drop about 20% or more off the profile again, bringing us pretty close to the performance of the older OpenGL compositing.
Assignee | ||
Comment 1•5 years ago
|
||
This restructures the WR Compositor interface a bit to support compositing
earlier in the frame. An invalidate_tile hook is added that gets called
first to signal that some picture cache tiles will be modified later in the
frame. The renderer then calls add_surface earlier before the picture cache
tiles are updated, so that any tiles that aren't invalid can proceed to
composite early before that. Finally, bind/unbind get called after so that
it can work potentially work in parallel with any tiles that are already
compositing early.
Assignee | ||
Comment 2•5 years ago
|
||
This spawns a new SwComposite thread inside SwCompositor. Tile composite jobs
are submitted over a channel to the thread, with a condition being signaled
after all jobs are processed. The SwCompositor computes a dependency order for
the tiles based on whether it overlaps a tile that has been invalidated and
needs to be updated during the current frame. As tiles are gradually updated,
all tiles that would depend on the update as denoted by the dependency order get
submitted so that composition can proceed. Ultimately, this allows tile updates
and compositing to work in parallel, pipelining much of the cost of compositing.
Depends on D82473
Assignee | ||
Comment 3•5 years ago
|
||
SwCompositor needs to send SWGL textures references safely to the SwComposite
thread. However, the SWGL context's texture store may grow and make accessing
these tables unsafe. To work around this, this patch adds a LockedResource
API that locks down access to these textures ahead of time both to ensure that
no table access is necessary and to help detect any unexpected modifications
of these textures while they are locked. These LockedResource objects can then
be composited safely in another thread without interfering with normal SWGL
operation in the original that that isn't simultaneously using these textures.
Depends on D82474
Comment 6•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/fceb25f6286b
https://hg.mozilla.org/mozilla-central/rev/b013dfd51ff6
https://hg.mozilla.org/mozilla-central/rev/97f04a5dac7c
https://hg.mozilla.org/mozilla-central/rev/0823783b08d6
Description
•