Open Bug 1624030 Opened 6 years ago Updated 2 years ago

On macOS, kick off shader compilation of a certain set of shaders before the first draw

Categories

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

All
macOS
enhancement

Tracking

()

REOPENED

People

(Reporter: mstange, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Whiteboard: wr-planning)

Attachments

(3 files, 1 external file)

Profile: https://perfht.ml/2WvDuUB

The first paint of a freshly-launched Firefox process takes an extra long time with WebRender on macOS because macOS doesn't let us cache OpenGL shaders.
Bug 1604615 aims at making shader compilation faster.

Another thing we can do is to trigger shader compilation ahead-of-time. During startup, there is a window of time before the first paint during which the Renderer thread is already alive but the main thread is still busy with other stuff. We can use that window to front-load some shader compilation, of a set of shaders that we expect to be used during the first paint.

Depends on: 1624042
Priority: -- → P3

It looks like we can accomplish this by starting shader compilation in webrender::shade::Shaders::new()

Assignee: nobody → dlu

Profile prior to bug patch: https://share.firefox.dev/2M5Vj6a

Profile following bug patch: https://share.firefox.dev/3enDHid

It seems the large chunk where the parent process gets blocked was reduced from about 235ms to 195ms (~20%) as a result of the precompilation.

Status: NEW → ASSIGNED

Looks great! Eliminating the remaining time would probably require bug 1624042, as a follow-up.

It would be interesting to time the individual shaders to see if the bulk of the time is being spent in some or if it's spread evenly.

(In reply to Jeff Muizelaar [:jrmuizel] from comment #6)

It would be interesting to time the individual shaders to see if the bulk of the time is being spent in some or if it's spread evenly.

I'll look into it soon!

Blocks: wr-mac-block
No longer blocks: wr-mac
Whiteboard: wr-planning

It looks like this causes a major startup regression:
https://treeherder.mozilla.org/perf.html#/compare?originalProject=mozilla-central&newProject=try&newRevision=3fb282e4005a86db8532d78265418b0bf7ec448b&framework=1&selectedTimeRange=172800

Next steps might be to try to reduce the shaders that are precompiled. Because the list was chosen based on macOS perhaps we're compiling shaders that we wouldn't otherwise be.

Ah got it, thanks! I'll look into it

The bug assignee didn't login in Bugzilla in the last 7 months.
:bhood, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: dlu → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(bhood)
Flags: needinfo?(bhood)
Severity: normal → S3
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX

This is still relevant. Shader compilation still causes an appreciable amount of delay during startup. Updated profile on a faster machine: https://share.firefox.dev/3TF63Lc

Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Blocks: wr-todos
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: