Closed Bug 1504699 Opened 7 years ago Closed 7 years ago

Integrate animated frame recycling with WebRender

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: aosmond, Assigned: aosmond)

References

Details

Attachments

(7 files)

Bug 1465619 added support for reusing animated image frames instead of reallocating when we have to discard, and bug 1428558 added support for async animated frame updates to avoid scene rebuilding. However WebRender needs extra work to synchronous the content process and the GPU process buffer lifespan to allow recycling. Buffer allocating is a significant part of the animated image decoding cost when generating full frames, as is mapping/unmapping it from the GPU process memory. This will save thread time all around.
Assignee: nobody → aosmond
Priority: -- → P2
When we replace the external image ID an image key points to, the previous external image ID may still be used by WebRender. We currently wait until the frame has been rendered to release our hold on said surface. With this patch, we will communicate the image key and previous external image ID pairing to the owning process when releasing to let it know that it can reuse it (e.g. for an animated image). Additionally we now use the new textures updated checkpoint which should happen sooner than the frame rendered checkpoint, but guarantee that WebRender is no longer using the old external image ID.
SourceSurfaceSharedData can be wrapped by RecyclingDataSurface in order to facilitate its lifetime management. As long as the latter is alive, the former cannot be reused by the animated image decoder for a future frame's contents. SharedSurfacesAnimation will need to hold onto the RecyclingDataSurface as long as WebRender is using the surface. Depends on D10898
Originally it made sense to share the code, but now the latter has become too specialized to reuse it. Fork it off here and update it later parts in this series. Depends on D10900
Here we make use of the parts added in parts 1 and 2 to hold onto recycled surfaces for as long as necessary to prevent the animated image decoder from reusing them until WebRender is done with them. Depends on D10901
WebRender takes longer than OMTP to release its hold on the current frame. This is because it is in a separate process and holds onto the surface in between rendering frames, rather than getting a reference for each repaint. This patch makes us less aggressive about taking the most recent surface placed in the recycling queue out to avoid blocking on waiting for the surface to be released. Depends on D10902
Blocks: 1458387
Blocks: 1447351
Status: NEW → ASSIGNED
(In reply to Andrew Osmond [:aosmond] from comment #8) > try getting ready for landing: > https://treeherder.mozilla.org/#/ > jobs?repo=try&revision=1dc5eef0d62c5ecf541b9db0a63dff1538af0fdf Sigh. Last minute change, missing semicolon. try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=c3dd803d6c26a3d55ee3ccba8d53b2e319d8027c
Pushed by aosmond@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/73ddcfe25fa1 Part 1. Add signalling for WebRender to let owning process that surface may be recycled. r=nical https://hg.mozilla.org/integration/mozilla-inbound/rev/944b5385a342 Part 2. Add plumbing to WebRenderLayerManager to pass on frame released messages. r=nical https://hg.mozilla.org/integration/mozilla-inbound/rev/0871bc2a309c Part 3. Expose parent surface to SharedSurfacesAnimation. r=nical https://hg.mozilla.org/integration/mozilla-inbound/rev/0c50877a2132 Part 4. Add method to SharedSurfacesChild to cast to a shared surface. r=nical https://hg.mozilla.org/integration/mozilla-inbound/rev/a68766441449 Part 5. Stop sharing code between SharedUserData and SharedSurfacesAnimation. r=nical https://hg.mozilla.org/integration/mozilla-inbound/rev/ecddcae1b266 Part 6. Add lifetime management for recycled frames with WebRender. r=nical https://hg.mozilla.org/integration/mozilla-inbound/rev/ccfa531dea03 Part 7. Update animated image recycling queue to work well with WebRender. r=tnikkel
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: