Closed Bug 1699023 Opened 3 years ago Closed 3 years ago

[wpt-sync] Sync PR 28054 - [composite-bgcolor-animation] Decouple paint and compositing

Categories

(Core :: Layout: Images, Video, and HTML Frames, task, P4)

task

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 28054 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/28054
Details from upstream follow.

b'Xida Chen <xidachen@chromium.org>' wrote:

[composite-bgcolor-animation] Decouple paint and compositing

Currently, the CheckCanStartAnimationOnCompositor is called twice
for composite background-color animation, once during paint time
and once during the compositing stage. The reason is that we
need the decision during paint and compositing consistent. That
is, if the paint stage says the background color must be paint
on the main thread, then compositing stage has to agree with
that, and vice versa. However, this is dangerous because between
the paint and compositing stage, things could change, especially
the PaintArtifactCompositor, which is used by the
CheckCanStartAnimationOnCompositor. For example, it could
happen that at paint time we have not produced / updated the
property nodes for the current frame and we can make decision
based on what was composited on the previous frame. Then
at Precommit we have potentially updated / added / removed
property tree nodes. In this case, the return value of
CheckCanStartAnimationOnCompositor can be different, as a
result, the background color animation won't run correctly.

The reason we needed to know whether the animation could be
composited here is that we didn't have a way to paint
the background color off the main thread. More specifically,
the BackgroundColorPaintWorklet::Paint() function can paint the
background color only if the animation is running on the
compositor thread.

This CL makes following changes:

  1. Make the BackgroundColorPaintWorklet::Paint() have the
    ability to paint the background color even if the animation is
    running on the main thread. The function needs two things:
    the current progress of the animation and the artifacts about
    the animation. So all we need is just getting the progress
    when the animation is running on the main thread.
  2. With #1 being done, we no longer need to call the
    CheckCanStartAnimationOnCompositor during the paint step.
    As a result, whether or not the animation can be running on
    the compositor thread is solely the decision during the
    compositing stage. This is much safer than the current code,
    because we no longer need to make a compositing decision during
    the paint stage.

We don't need to add any new tests because we already have
sufficient layout tests for background color animation being
run on the compositor as well as on the main thread. As long
as all tests pass, this should be safe.

The main benefit of this change is that the code is now more
robust, meaning that we don't need to worry about the decision
made by the paint and compositing stage being different.
This change is also a performance win because we no longer
need to call the CheckCanStartAnimationOnCompositor twice.

Bug: 1185272, 1182261
Change-Id: Ie072714fd1d05e6537e05cad45ad1da99e20125b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2740697
Reviewed-by: Robert Flack \<flackr@chromium.org>
Commit-Queue: Xida Chen \<xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#863622}

Component: web-platform-tests → Layout: Images, Video, and HTML Frames
Product: Testing → Core

CI Results

Ran 15 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 2 tests

Status Summary

Firefox

PASS: 2

Chrome

PASS: 2

Safari

PASS: 2

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/44dff3a9cc50
[wpt PR 28054] - [composite-bgcolor-animation] Decouple paint and compositing, a=testonly
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
You need to log in before you can comment on or make changes to this bug.