Closed Bug 1428558 Opened 2 years ago Closed Last year

Support async animated image updates


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




Tracking Status
firefox65 --- fixed


(Reporter: jrmuizel, Assigned: aosmond)


(Blocks 1 open bug)



(8 files)

These should work really well with webrender and will avoid us having to do any display list building or scene building.
Blocks: 1449521
I've already been doing the prep work for this.
Assignee: nobody → aosmond
Depends on: 1337111
Hey Andrew & Jeff -- What more is required here once bug 1337111 lands?  How important is this to WR MVP?
Flags: needinfo?(jmuizelaar)
Flags: needinfo?(aosmond)
I think it is reasonably important. Not only will it avoid scene rebuilds for animated images, it will reduce texture uploads as well for animated images that only animate in parts. Both of these will be commonly hit, although the latter really only matters for larger GIFs like those seen in bug 1447351. I'll see if I can put this together on top of bug 1337111 this week, assuming nothing else preempts me. If it takes me much longer than that, we can consider pushing it to block bug 1386674. It definitely shouldn't go to the back of the queue though :).
Flags: needinfo?(aosmond)
Update: I got this partly working today. Still some bugs to iron out / understand.
Flags: needinfo?(jmuizelaar)
Animated images will require scheduling a composite of the frame in
addition to updating the ImageKey/external image ID bindings. It would
be good if this could be done as part of the same IPDL message.
Additionally a page may have many animated images that we update the
frame for at the same time, so these updates should be batched together.
In the event that we needed to regenerate the display list, or produce
an empty transaction, ideally we would just throw these resource updates
in with the rest of the changes. This patch allows us to do all of that
without unnecessarily burdening the caller with tracking extra state.
Animated images will work by changing the external image ID that an
ImageKey points to. We cannot allow the old external image to be
released and potentially unmapped until we have produced a new frame
with the new external image ID. We currently wait until the epoch has
advanced, but in the future when we don't rebuild the scene to animate
an image, the epoch will remain the same. This could cause us to hold
onto no longer used surfaces for much longer than expected. As such, in
this patch we switch to waiting for a FrameRendered notification from
WebRender, which works even if the scene rebuild was avoided.

Depends on D7499
This is a non-functional change. It allows objects that build on top of
these helper classes to be exposed outside of SharedSurfacesChild in
future patches in this series.

Depends on D7500
This patch embeds a SharedSurfacesAnimation object inside an
ImageContainer. This allows any consumers of the container to get the
single shared ImageKey for an animation, despite whatever surfaces may
be held inside the container at a given time.

Depends on D7502
This patch allows us to intercept invalidation requests for display
items, and avoid regenerating the display list for animated images which
are using SharedSurfacesAnimation.

Depends on D7503
This patch makes ImageContainer create a SharedSurfacesAnimation object
when it detects that we are using shared surfaces and are producing full

Depends on D7504
Async animated images need a single ImageKey which can point to any
frame represented by its own external image ID. Additionally a frame
could be referenced again directly (e.g. something shows/uses the first
frame of the animated image).

Before this patch, the ownership between an ImageKey and an external
image ID for a shared surface was not clearly expressed. This resulted
in a special command to release the reference to the external image
separately from deleting the image key.

This patch makes the strong reference to an external image ID and an
ImageKey directly related. Not only does this facilitate multiple
ImageKeys owning the same surface, it also simplifies the ownership
See Also: → 1458387
Attachment #9013746 - Attachment description: Bug 1428558 - Part 2. Improve plumbing to sending resource updates to WebRender → Bug 1428558 - Part 2. Improve plumbing to sending resource updates to WebRender.
Blocks: 1458387
Pushed by
Part 1. Streamline mappings between an ImageKey and an ExternalImageId for shared surfaces. r=nical
Part 2. Improve plumbing to sending resource updates to WebRender. r=nical
Part 3. Release our reference to an external image ID as soon as possible. r=nical
Part 4. Move ImageKeyData/SharedUserData definition to SharedSurfacesChild header. r=nical
Part 5. Add SharedSurfacesAnimation to manage single ImageKey for animated images. r=nical
Part 6. Integrate SharedSurfacesAnimation with ImageContainer. r=nical
Part 7. Suppress display list regeneration for animated image updates. r=nical
Part 8. Integrate SharedSurfacesAnimation with the rest of imagelib. r=nical
You need to log in before you can comment on or make changes to this bug.