Closed Bug 1961724 Opened 26 days ago Closed 3 days ago

[HDR] Invesitigate extra GL operations while video direct rendering from external surfaces

Categories

(Core :: Graphics: WebRender, defect)

defect

Tracking

()

RESOLVED FIXED
140 Branch
Tracking Status
firefox140 --- fixed

People

(Reporter: stransky, Assigned: stransky)

References

(Blocks 1 open bug)

Details

(Keywords: perf-alert)

Attachments

(2 files)

There's reported extra GL operation over decoded video frames in HDR mode which we don't need. We should get rid of it to save GPU cycles.

Flags: needinfo?(stransky)
Severity: -- → S4
Priority: -- → P3

Thanks for working on this issue. Just for your reference, I found the following stacktrace may related to this GPU usage by firefox when HDR mode is enabled.
https://gist.github.com/alen6516/b48c2d0adc9481d3d38988a6b8547680

Looks like we call glFlush() at webrender::renderer::Renderer::draw_frame() which we may not need on native compositor under Linux.

Component: Audio/Video: Playback → Graphics: WebRender
#6  0x00007f0bc1f3ad2c in st_flush (st=0x7f0bbcae7000, fence=0x0, flags=0) at ../src/mesa/state_tracker/st_cb_flush.c:63
#7  0x00007f0bc1f3ae5e in st_glFlush (ctx=0x7f0bbca03000, gallium_flush_flags=0) at ../src/mesa/state_tracker/st_cb_flush.c:99
#8  0x00007f0bc216b8b2 in _mesa_flush (ctx=0x7f0bbca03000) at ../src/mesa/main/context.c:1624
#9  0x00007f0bc216b9df in _mesa_Flush () at ../src/mesa/main/context.c:1658
#10 0x00007f0bdb0b01f7 in webrender::renderer::Renderer::draw_frame ()
    at /home/alan/firefox_build/firefox_138_nightly/firefox/libxul.so
#11 0x00007f0bdb0a57b9 in webrender::renderer::Renderer::render_impl ()
    at /home/alan/firefox_build/firefox_138_nightly/firefox/libxul.so
#12 0x00007f0bdb2aba53 in webrender::renderer::Renderer::render ()
    at /home/alan/firefox_build/firefox_138_nightly/firefox/libxul.so
#13 0x00007f0bdb2ab26f in wr_renderer_render () at /home/alan/firefox_build/firefox_138_nightly/firefox/libxul.so

The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit BugBot documentation.

Priority: P3 → --

The call comes from these two places:
https://searchfox.org/mozilla-central/source/gfx/wr/webrender/src/renderer/mod.rs#1596
https://searchfox.org/mozilla-central/source/gfx/wr/webrender/src/renderer/mod.rs#5049

I think we need it for case we paint to texture by GL and then put that on screen. But it can be avoided if the content is already there - for instance external video overlay from HW decoder.

Glenn, do you think it's possible to skip glFlush for that case and save some GPU power here?
Thanks.

Flags: needinfo?(stransky) → needinfo?(gwatson)

I think we could actually just remove that flush altogether, I'm not convinced that we need it.

Flags: needinfo?(gwatson)

(In reply to Glenn Watson [:gw] from comment #6)

I think we could actually just remove that flush altogether, I'm not convinced that we need it.

It's needed on Wayland if we paint by GL to framebuffer and then export as dmabuf/wl_buffer. But that can be easily moved to WaylandLayer code where framebuffer is managed. So +1 here.

Flags: needinfo?(stransky)
Assignee: nobody → stransky
Status: NEW → ASSIGNED
Flags: needinfo?(stransky)
Pushed by stransky@redhat.com: https://hg.mozilla.org/integration/autoland/rev/800a73315195 Remove device.gl().flush() r=gw https://hg.mozilla.org/integration/autoland/rev/6be9c2492a2c [Linux] Flush GL rendering at NativeLayerWaylandRender::NotifySurfaceReady() as we need to have complete GL rendering for wl_buffer export r=gw

seems to have improved some SVGX subtests by 10.4%

Also improved TART tests on Windows!

Status: ASSIGNED → RESOLVED
Closed: 3 days ago
Resolution: --- → FIXED
Target Milestone: --- → 140 Branch

(In reply to Sandor Molnar[:smolnar] from comment #12)

https://hg.mozilla.org/mozilla-central/rev/800a73315195
https://hg.mozilla.org/mozilla-central/rev/6be9c2492a2c

Perfherder has detected a talos performance change from push 6be9c2492a2c6fca50a3bc6601dcde5116be244e.

If you have any questions, please reach out to a performance sheriff. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
4% tsvgx linux1804-64-shippable-qr e10s fission stylo webrender 221.16 -> 212.85

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

If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a performance sheriff to do that for you.

You can run all of these tests on try with ./mach try perf --alert 45152

The following documentation link provides more information about this command.

Keywords: perf-alert
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: