Jank (rather than checkerboard) async animations when we reach the edge of the pre-rendered area
Categories
(Core :: Graphics: Layers, defect, P1)
Tracking
()
People
(Reporter: botond, Assigned: hiro)
References
(Blocks 4 open bugs)
Details
(Whiteboard: [gfx-noted]layout:backlog])
Attachments
(11 files)
|
5.97 MB,
video/webm
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
4.72 MB,
video/webm
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review | |
|
47 bytes,
text/x-phabricator-request
|
Details | Review |
| Reporter | ||
Comment 1•8 years ago
|
||
| Reporter | ||
Comment 2•7 years ago
|
||
| Assignee | ||
Comment 3•5 years ago
|
||
Left: nightly with enabling partial prerender pref (checkerboarding)
Center: with the patch to stop compositing (completely janky)
Right: with an additional patch to report the jank back to the main-thread and re-prerener there (still janky)
Apparently the right side looks much better than the center one, but still it doesn't look good.
To mitigate the jank in the right example, we probably should;
- have some margins for the prerendered area so that we can notify that we will try to composite outside of the prerender area before the animation reached to the edge of the prerender area
- calculate a future transform value (at two or three frames ahead) and use it to tell the jank will happen
I think both is worth trying (I guess we should have both and both should be defined by prefs).
Also I think the current layout.animation.prerender.viewport-ratio-limit-{x,y} is too small for this kind of rotate animations. I'd like to use a greater value (given that we cap the value to layout.animation.prerender.absolute-limit-{x,y} which is 4096).
| Assignee | ||
Comment 4•5 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #3)
- have some margins for the prerendered area so that we can notify that we will try to composite outside of the prerender area before the animation reached to the edge of the prerender area
It turns out that this margin doesn't bring us better results at all, it often causes janks, and choosing a reasonable value would be quite difficult. I did choose 100px initially and the result looks bad, it often causes janks, if I choose a smaller value, say 10px, it doesn't help to pre-detect janks if the animation has short duration (i.e. faster moving animations).
For 2), I did try to use one frame ahead time stamp to pre-detect the jank (it's easily done because we use a previous time stamp for animation), to be honest I don't see much differences there on my machine, so I am going to defer this to a follow-up bug.
Anyways, with changes in bug 1634616, simple rotation animations look quite nice.
Also I am going to defer the implementation making jank on WebRender into another bug.
| Assignee | ||
Comment 5•5 years ago
|
||
We just need this regardless of whether there appears checkerboarding or jank.
| Assignee | ||
Comment 6•5 years ago
|
||
Depends on D75727
| Assignee | ||
Comment 7•5 years ago
|
||
Depends on D75728
| Assignee | ||
Comment 8•5 years ago
|
||
nsDisplayTransform doesn't have enough room to store the partial prerender rect
and the overflowed SideBits unfortunately (it will exceed 512 bytes limit [1]).
So we get the partial prerender rect and calculate the overflowed SideBits just
before we send transform animation information to the compositor.
Depends on D75729
| Assignee | ||
Comment 9•5 years ago
|
||
Depends on D75730
| Assignee | ||
Comment 10•5 years ago
|
||
The machinery to report janked animations is;
- Store the partial pre-rendered animation id and the Animation object in a
hashtable in LayerManager - Store the animation id in the Animation object as well.
- When we detect jank, we send the animation id to the main-thread via an IPC
call - Find the Animation object with the id in the hashtable and update the
Animaiton. - Whenever the partial pre-rendered Animation stop running on the compositor
i.e. the Animation finished normall, the Animation's target element is
changed, etc. etc., remove the Animation from the hashtable.
Depends on D75731
| Assignee | ||
Comment 11•5 years ago
|
||
I've finished writing patches mostly, but there are a couple of questions/things we need to agree on.
-
I used GetCombinedClipRect to get the clip rectangle to check whether the pre-rendered area is not overflowed or not. Does this sound a reasonable way? I understand the clip rect doesn't contain any APZ transforms by APZ, but unfortunately at the time when we sample animations by CSS/Web-APIs we haven't done sampling animatiosn by APZ, so it's hard to factor APZ transforms into it. I am attaching a screencast to see a result with the current setup. As you can see there are checkerboard-ish things and flickers happens. I believe some of them were caused by the periodical 200m unthrottling for transform animations (I'd like to drop it in bug 1638717 though), so probably it's fine?
-
There is a corner case that the jank detection function (
ShouldBeJank) doesn't detect jank properly that is that the transform animation jumps to a position beyond the pre-rendered boundary in a single vsync tick. partial-prerender-translate-3.html is the reftest for this case. I am not sure we need to handle this case properly since even if there are such cases in the wild, it's probably hard to be noticeable since in such cases the expected visual result is "there is nothing to be composited" which mean it's the same result in the case we fail to detect the jank. -
There is another corner case that the jank detection fails. The case is position:absolute animation in a transformed element like below case. I have no idea how to handle this case properly. I'd like to defer this case in a later bug since I've never seen this case in test cases/real sites in blocking bugs of bug 1100357.
<div style="transform: translateX(400px);">
<div id="animating" style="position:absolute; top: 200px;"></div>
</div>
Botond, what do you think about these?
| Assignee | ||
Comment 12•5 years ago
|
||
CAUSION! The video in comment 11 may make you feel dizzy (it does make me dizzy). Please don't watch it repeatedly.
| Assignee | ||
Comment 13•5 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #11)
- There is a corner case that the jank detection function (
ShouldBeJank) doesn't detect jank properly that is that the transform animation jumps to a position beyond the pre-rendered boundary in a single vsync tick. partial-prerender-translate-3.html is the reftest for this case. I am not sure we need to handle this case properly since even if there are such cases in the wild, it's probably hard to be noticeable since in such cases the expected visual result is "there is nothing to be composited" which mean it's the same result in the case we fail to detect the jank.
"since in such cases the expected visual result is "there is nothing to be composited" which mean it's the same result in the case we fail to detect the jank." this explanation is wrong. This is explaining about partial-prerender-translate-1.html, partial-prerender-translate-3.html would be visually noticeable, it's hard to, I am guessing.
| Assignee | ||
Comment 14•5 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #11)
- There is another corner case that the jank detection fails. The case is position:absolute animation in a transformed element like below case. I have no idea how to handle this case properly. I'd like to defer this case in a later bug since I've never seen this case in test cases/real sites in blocking bugs of bug 1100357.
<div style="transform: translateX(400px);"> <div id="animating" style="position:absolute; top: 200px;"></div> </div>
I noticed we need to factor transforms relative to the active scrolled root?
(and I noticed I didn't set NI)
| Assignee | ||
Comment 15•5 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #11)
I used GetCombinedClipRect to get the clip rectangle to check whether the pre-rendered area is not overflowed or not. Does this sound a reasonable way? I understand the clip rect doesn't contain any APZ transforms by APZ, but unfortunately at the time when we sample animations by CSS/Web-APIs we haven't done sampling animatiosn by APZ, so it's hard to factor APZ transforms into it. I am attaching a screencast to see a result with the current setup. As you can see there are checkerboard-ish things and flickers happens. I believe some of them were caused by the periodical 200m unthrottling for transform animations (I'd like to drop it in bug 1638717 though), so probably it's fine?
There is a corner case that the jank detection function (
ShouldBeJank) doesn't detect jank properly that is that the transform animation jumps to a position beyond the pre-rendered boundary in a single vsync tick. partial-prerender-translate-3.html is the reftest for this case. I am not sure we need to handle this case properly since even if there are such cases in the wild, it's probably hard to be noticeable since in such cases the expected visual result is "there is nothing to be composited" which mean it's the same result in the case we fail to detect the jank.There is another corner case that the jank detection fails. The case is position:absolute animation in a transformed element like below case. I have no idea how to handle this case properly. I'd like to defer this case in a later bug since I've never seen this case in test cases/real sites in blocking bugs of bug 1100357.
I found ways to solve 1 and 2. But I found an issue on transform animations on position:fixed/stickyer. I will figure out a way to handle them. Then I am going to send review requests.
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 16•5 years ago
|
||
I've decided to defer the position sticky case into bug 1642547. As for the position fixed case, I noticed that it doesn't matter other than the case where position:fixed layers are moved along with the dynamic toolbar on Fenix, even so it will not be a big problem either since the dynamic toolbar transition is quite small.
| Assignee | ||
Comment 17•5 years ago
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #15)
- There is a corner case that the jank detection function (
ShouldBeJank) doesn't detect jank properly that is that the transform animation jumps to a position beyond the pre-rendered boundary in a single vsync tick. partial-prerender-translate-3.html is the reftest for this case. I am not sure we need to handle this case properly since even if there are such cases in the wild, it's probably hard to be noticeable since in such cases the expected visual result is "there is nothing to be composited" which mean it's the same result in the case we fail to detect the jank.
Filed bug 1642575 for this case.
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
| Assignee | ||
Comment 18•5 years ago
|
||
Depends on D75732
Updated•5 years ago
|
| Assignee | ||
Updated•5 years ago
|
| Assignee | ||
Comment 19•5 years ago
|
||
Depends on D75729
Updated•5 years ago
|
| Assignee | ||
Comment 20•5 years ago
|
||
Depends on D75730
Comment 21•5 years ago
|
||
Comment 22•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/6bc284863aff
https://hg.mozilla.org/mozilla-central/rev/8e6d4e9f5aa0
https://hg.mozilla.org/mozilla-central/rev/e6c74ba41007
https://hg.mozilla.org/mozilla-central/rev/84657a3522fb
https://hg.mozilla.org/mozilla-central/rev/732804c83add
https://hg.mozilla.org/mozilla-central/rev/4a4ae4bd95d1
https://hg.mozilla.org/mozilla-central/rev/fef36ff2ea3d
https://hg.mozilla.org/mozilla-central/rev/d6a01c6bc40e
https://hg.mozilla.org/mozilla-central/rev/75966ee1fe65
Comment 23•5 years ago
|
||
Backed out 9 changesets (bug 1324591) for linux build bustages on central on nsDisplayList.h.
https://hg.mozilla.org/integration/autoland/rev/65326426c5ecfe95b74f8097f0bdd9d8041bb42e
Failure log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=308603624&repo=mozilla-central&lineNumber=22119
Comment 24•5 years ago
|
||
Comment 25•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/c258d455b290
https://hg.mozilla.org/mozilla-central/rev/4e42d8d4df9d
https://hg.mozilla.org/mozilla-central/rev/b4248fe63414
https://hg.mozilla.org/mozilla-central/rev/2e9d5d1bd7db
https://hg.mozilla.org/mozilla-central/rev/a77c8f5e7ec7
https://hg.mozilla.org/mozilla-central/rev/face25a6c173
https://hg.mozilla.org/mozilla-central/rev/76d8caea7f12
https://hg.mozilla.org/mozilla-central/rev/5d5e5aafec2f
https://hg.mozilla.org/mozilla-central/rev/5c22eb861a63
| Assignee | ||
Comment 26•5 years ago
|
||
Finally! \o/ Thank you Botond for a long time your help!
| Reporter | ||
Comment 27•5 years ago
|
||
\o/ Thanks so much for working on this Hiro!
Updated•5 years ago
|
Description
•