Closed Bug 1670328 Opened 4 years ago Closed 4 years ago

Limit SwCompositeThread overhead

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: lsalzman, Assigned: lsalzman)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Currently every SwCompositor has a SwCompositeThread associated with it. Most of these threads are parked and not doing much though when their respective windows are not active. We might want to investigate stuffing these into a limited size thread-pool.

Alternatively, we might want to just limit the size of the SwCompositeThread's stack, since all the thread does is call Composite in a loop, and a large stack for each thread of these threads is wasteful.

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

We seem to be spending a significant amount of time inside crossbeam channels
sending jobs across. Sending multiple bands for a given job tends to relock the
channel multiple times when ideally we only want to queue the job once, or lock
the channel once (neither of which we can conveniently do with crossbeam). To
alleviate this, I've implemented a more custom solution with a mutexed VecDeque
and some Condvars. I also made compositor threads spawn from WR thread pool to
make thread termination a bit saner such that threads are spawned when
compositing starts and terminate when compositing is done.

Assignee: nobody → lsalzman
Status: NEW → ASSIGNED

There appears to be a substantial overhead for trying to wake cold threads
from a thread pool (especially with rayon), so for now let's leave the existing
thread spawning in place, but reduce the stack size for individual threads.
Since these threads only call into SWGL's composite routines and do little else,
there isn't much harm in having a small stack size.

Depends on D96732

Pushed by lsalzman@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e111e9ce3754
remove crossbeam usage from SwCompositor. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/8d47e408c578
use SwCompositeGraphNodeRef wrapper for cleaner node mutation. r=mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/fd235fdcca9e
reduce stack size for SwComposite threads. r=mattwoodrow
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
Regressions: 1731569
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: