Closed Bug 2010036 Opened 7 months ago Closed 7 months ago

Avoid compiling default composite shader if not required

Categories

(Core :: Graphics: WebRender, task)

task

Tracking

()

RESOLVED FIXED
149 Branch
Tracking Status
firefox149 --- fixed

People

(Reporter: jnicol, Assigned: jnicol)

References

Details

(Keywords: perf-alert)

Attachments

(1 file)

In draw_tile_list() we always start by binding the default composite shader (i.e. non-fast-path, ImageBufferKind::Texture2D). Then we iterate through the tiles, and when we need a different shader variant (e.g. fast path, or different ImageBufferKind), we flush the batch and bind the next shader.

This is usually fine, but binding a shader can be expensive on some devices, eg because loading cached program binaries is expensive (bug 1954587). Or the shader cache doesn't work at all, or it's the first run.

Often only the fast path composite shader will be required for a page, and compiling the non-fast path variant is therefore a waste of time. For example our android applink-startup tests. We should restructure this function to bind the shader immediately before submitting the draw call, when we know which variant we require.

The webrender draw compositor's draw_tile_list() function was eagerly
binding the default composite shader prior to iterating through its
tile list. In practice, many pages only require the fast path
composite shader. Typically this is not a major issue, but on certain
devices loading program binaries may be slow (bug 1954587), or the
shader cache may be disabled or just empty on the first run. In which
case compiling a shader that is not yet required is a significant
waste of time and slows down first paint.

Instead of binding the default composite shader at the start, then
binding each new shader after submitting a batch, this patch makes
it so that we bind the required shader just before submitting each
batch, meaning we only bind the shaders we actually use.

Assignee: nobody → jnicol
Status: NEW → ASSIGNED
Pushed by jnicol@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/bb4ede4f14fc https://hg.mozilla.org/integration/autoland/rev/ace7a636195c Avoid compiling default composite shader variant when not required. r=gfx-reviewers,lsalzman
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 149 Branch

(In reply to Norisz Fay [:noriszfay] from comment #3)

https://hg.mozilla.org/mozilla-central/rev/ace7a636195c

Perfherder has detected a mozperftest performance change from push ace7a636195caa9e23462f1a26714b1fd8f879f7.

No action is required from the author; this comment is provided for informational purposes only.

Improvement Test Platform Options Absolute values [old vs new]
6% tab-restore-shopify org.mozilla.fenix:gpu-cpu-time android-hw-a55-14-0-aarch64-shippable 803.33 ms -> 757.33 ms

Need Help or Information?

If you have any questions, please reach out to fbilt@mozilla.com. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

Keywords: perf-alert
Regressions: 2011887
QA Whiteboard: [qa-triage-done-c150/b149]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: