Closed
Bug 790508
Opened 12 years ago
Closed 12 years ago
Transition from Gaia lock screen --> home screen is <5 fps
Categories
(Core :: Graphics: Layers, defect)
Tracking
()
People
(Reporter: cjones, Assigned: dzbarsky)
References
(Depends on 1 open bug)
Details
Attachments
(4 files, 2 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
text/plain
|
Details | |
(deleted),
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
cjones
:
review+
|
Details | Diff | Splinter Review |
This is pretty much the first thing any new user of b2g will see, so we need to make sure we make a good impression. A <5fps animation is not a good impression! :)
I haven't analyzed this in any detail yet, but it might be related to the slow composition path Kan-Ru found we're hitting for the lock screen in bug 788408.
Comment 1•12 years ago
|
||
Is this being handle altogether with bug 788409?
Reporter | ||
Comment 2•12 years ago
|
||
That's most likely a separate bug. This is just the performance problem.
Reporter | ||
Comment 3•12 years ago
|
||
This animation is not being async-ified either, and the logging doesn't report that.
Assignee | ||
Comment 4•12 years ago
|
||
Could someone point me to the CSS for this animation?
Comment 5•12 years ago
|
||
(In reply to David Zbarsky (:dzbarsky) from comment #4)
> Could someone point me to the CSS for this animation?
https://github.com/mozilla-b2g/gaia/blob/master/apps/system/style/lockscreen/lockscreen.css#L25
Assignee | ||
Comment 6•12 years ago
|
||
Hmmm, it may have to do with the :not pseudo in the CSS rule. I'll try to look at this tonight.
Reporter | ||
Comment 7•12 years ago
|
||
So this is something you think is escaping the animation logging?
Reporter | ||
Comment 8•12 years ago
|
||
Aha!
I/Gecko ( 7933): Performance warning: Async animation disabled because frame was not marked active for opacity animation [div with id 'lockscreen'][ANIMATIONS LOG]
Must have missed this somehow, before.
Reporter | ||
Comment 9•12 years ago
|
||
(In reply to David Zbarsky (:dzbarsky) from comment #6)
> Hmmm, it may have to do with the :not pseudo in the CSS rule. I'll try to
> look at this tonight.
Removing that in favor of an "unlocked" class doesn't change anything, although I do see more warnings
I/Gecko (23144): Performance warning: Async animation disabled because frame was not marked active for opacity animation [span][ANIMATIONS LOG]
I/Gecko (23144): Performance warning: Async animation disabled because frame was not marked active for transform animation [div with id 'lockscreen-area-handle'][ANIMATIONS LOG]
I/Gecko (23144): Performance warning: Async animation disabled because frame was not marked active for opacity animation [div with id 'lockscreen'][ANIMATIONS LOG]
I/Gecko (23144): Performance warning: Async animation disabled because frame was not marked active for opacity animation [div with id 'lockscreen'][ANIMATIONS LOG]
Assignee | ||
Comment 10•12 years ago
|
||
Ah! I bet I know what may be happening here...
The transition has a delay, so we "run" it on the main thread for the first 0.3 seconds, but then the main thread is blocked so we don't get a chance to offload it to the compositor.
Assignee | ||
Comment 11•12 years ago
|
||
Nope, that's not the issue.
I'm not quite sure what's happening here. I think some of the async animation warnings are due to opacity transitions on descendants of #lockscreen.
I did notice that if I disable the opacity animation, the scale transform is at 60 fps.
Assignee | ||
Comment 12•12 years ago
|
||
Assignee | ||
Comment 13•12 years ago
|
||
Attachment #663612 -
Attachment is obsolete: true
Attachment #663612 -
Flags: review?(matt.woodrow)
Attachment #663624 -
Flags: review?(matt.woodrow)
Comment 14•12 years ago
|
||
Comment on attachment 663624 [details] [diff] [review]
Patch
I don't know the style change -> frames code well enough to review this sorry.
I think this is correct, and we only call MarkLayersActive on the primary frame for the content, but roc (or someone else who knows this code) should confirm this.
Attachment #663624 -
Flags: review?(matt.woodrow) → review?(roc)
Reporter | ||
Comment 15•12 years ago
|
||
I tried this out to see if it helped, but doesn't. Are asyncifying perspective? Do its frames get counted as active+prerendered?
Assignee | ||
Comment 16•12 years ago
|
||
How would that help? We don't do anything special for perspective (but we should probably count perspective and perspective-origin as geometric properties and disable transform animations when animating perspective).
Comment on attachment 663624 [details] [diff] [review]
Patch
Review of attachment 663624 [details] [diff] [review]:
-----------------------------------------------------------------
Can you explain why this is necessary? It's not obvious to me.
Assignee | ||
Comment 18•12 years ago
|
||
When we call MarkLayersActive, we always call it on an element's primary frame. I'm hitting a case where I set an element active for opacity and transform animations, but the nsDisplayOpacity ends up with a different underlying frame, so we can't perform the animation on the compositor.
Reporter | ||
Comment 19•12 years ago
|
||
(In reply to David Zbarsky (:dzbarsky) from comment #16)
> How would that help? We don't do anything special for perspective (but we
> should probably count perspective and perspective-origin as geometric
> properties and disable transform animations when animating perspective).
3D transforms force the entire frame to be prerendered. They should always count as prerendered wrt async animations.
(The fact that we do this doesn't make me very happy, but it's extremely hard to do anything else, and it matches webkit behavior. Having an escape hatch for authors to make their animations fast is also a good thing.)
Assignee | ||
Comment 20•12 years ago
|
||
(In reply to Chris Jones [:cjones] [:warhammer] from comment #19)
> (In reply to David Zbarsky (:dzbarsky) from comment #16)
> > How would that help? We don't do anything special for perspective (but we
> > should probably count perspective and perspective-origin as geometric
> > properties and disable transform animations when animating perspective).
>
> 3D transforms force the entire frame to be prerendered. They should always
> count as prerendered wrt async animations.
>
> (The fact that we do this doesn't make me very happy, but it's extremely
> hard to do anything else, and it matches webkit behavior. Having an escape
> hatch for authors to make their animations fast is also a good thing.)
With the patch in this bug the frames already end up prerendered. Is it possible that the the compositor isn't able to hit 60 fps?
Reporter | ||
Comment 21•12 years ago
|
||
Possible, but unlikely. If we're creating a bajillion intermediate fbos that could hurt. But like we discussed on IRC, I don't really see a difference on otoro with this patch vs. without.
Reporter | ||
Comment 22•12 years ago
|
||
But what I was trying to ask is, irrespective of the work here, do we optimize 3d transforms appropriately wrt async animations?
Assignee | ||
Comment 23•12 years ago
|
||
Chris, what do you see on otoro if you comment out the opacity transition?
https://github.com/mozilla-b2g/gaia/blob/master/apps/system/style/lockscreen/lockscreen.css#L28
We don't do anything differently for 3d transforms than for 2d. We already force own layer for async transform, which is the same thing we do for 3d transforms. I'm not sure I understand what you're asking.
Reporter | ||
Comment 24•12 years ago
|
||
(In reply to David Zbarsky (:dzbarsky) from comment #23)
> Chris, what do you see on otoro if you comment out the opacity transition?
> https://github.com/mozilla-b2g/gaia/blob/master/apps/system/style/lockscreen/
> lockscreen.css#L28
>
Will check later.
> We don't do anything differently for 3d transforms than for 2d. We already
> force own layer for async transform, which is the same thing we do for 3d
> transforms. I'm not sure I understand what you're asking.
My understanding from Matt is that we always fully pre-render frames that have 3d transforms. However, ShouldPrerender() (the version I wrote) will return false for frames that are larger than the screen size. I'm checking to see if we would still asynchronously animate a frame that's fully prerendered because it's 3d-transformed, even if ShouldPrerender() says "false".
I may have misunderstood Matt, though.
Reporter | ||
Comment 25•12 years ago
|
||
(In reply to Chris Jones [:cjones] [:warhammer] from comment #24)
> (In reply to David Zbarsky (:dzbarsky) from comment #23)
> > Chris, what do you see on otoro if you comment out the opacity transition?
> > https://github.com/mozilla-b2g/gaia/blob/master/apps/system/style/lockscreen/
> > lockscreen.css#L28
> >
>
> Will check later.
>
~60 fps. (Without your patch applied.)
(In reply to David Zbarsky (:dzbarsky) from comment #18)
> When we call MarkLayersActive, we always call it on an element's primary
> frame. I'm hitting a case where I set an element active for opacity and
> transform animations, but the nsDisplayOpacity ends up with a different
> underlying frame, so we can't perform the animation on the compositor.
Why are we creating nsDisplayOpacity for a different underlying frame? Can you say more about this situation? It sounds weird/wrong.
Assignee | ||
Comment 27•12 years ago
|
||
Setting a breakpoint at nsDisplayList.cpp:350, (where the CanUseAsyncAnimations check fails), I see the following:
(gdb) p aItem
$6 = (nsDisplayOpacity *) 0x10b1e9028
(gdb) p aItem->GetUnderlyingFrame()
$7 = (nsBlockFrame *) 0x10b746ea0
(gdb) p aItem->GetUnderlyingFrame()->GetContent()
$8 = (nsHTMLDivElement *) 0x12eb69cb0
(gdb) p aItem->GetUnderlyingFrame()->GetContent()->GetPrimaryFrame()
$9 = (nsHTMLScrollFrame *) 0x10b746be0
I'm not really sure why this happens - perhaps when we need a scrollframe we wrap the opacity around it instead of putting it inside?
I would expect the nsDisplayOpacity to be on the scrollframe, not the scrolled blockframe. Your debug output suggests it's on the blockframe.
Have you got a small testcase for this?
Assignee | ||
Comment 29•12 years ago
|
||
No, but I will try reducing the testcase I have.
If you can get a stacktrace for the creation of the nsDisplayOpacity while painting, that'll probably be enough data.
Assignee | ||
Comment 31•12 years ago
|
||
Aha, I think I know what the problem is! It seems nsIFrame::HasOpacity returns true for the scrolled blockframe. And that would be because "mContent && nsLayoutUtils::HasAnimationsForCompositor(mContent, eCSSProperty_opacity)" is true. Basically, *every* frame for a given element is going to return true for HasOpacity, but only the primary frame should.
So I think that check needs an additional "&& mContent->GetPrimaryFrame() == this".
Assignee | ||
Comment 33•12 years ago
|
||
Yup, good catch. Don't we also need the same check on IsTransformed to avoid creating extra nsDisplayTransforms?
Updated•12 years ago
|
blocking-basecamp: --- → ?
(In reply to David Zbarsky (:dzbarsky) from comment #33)
> Yup, good catch. Don't we also need the same check on IsTransformed to
> avoid creating extra nsDisplayTransforms?
Yes!
Updated•12 years ago
|
blocking-basecamp: ? → +
Assignee | ||
Updated•12 years ago
|
Whiteboard: [leave open]
Assignee | ||
Comment 35•12 years ago
|
||
Attachment #663624 -
Attachment is obsolete: true
Attachment #663624 -
Flags: review?(roc)
Attachment #665039 -
Flags: review?(roc)
Comment on attachment 665039 [details] [diff] [review]
Avoid creating extra nsDisplayOpacity and nsDisplayTransform
Review of attachment 665039 [details] [diff] [review]:
-----------------------------------------------------------------
Put the GetPrimaryFrame checks last since they'll normally be true.
Attachment #665039 -
Flags: review?(roc) → review+
Assignee | ||
Comment 37•12 years ago
|
||
I accidentally pushed this fix along with a warning fix:
https://hg.mozilla.org/integration/mozilla-inbound/rev/403ebae0552f
So I addressed roc's comment:
https://hg.mozilla.org/integration/mozilla-inbound/rev/81e6cc2d297f
Assignee | ||
Comment 38•12 years ago
|
||
And a bustage fix because I screwed up the merge:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ebb4e8d008c0
Comment 39•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/81e6cc2d297f
https://hg.mozilla.org/mozilla-central/rev/ebb4e8d008c0
Flags: in-testsuite-
Assignee | ||
Comment 41•12 years ago
|
||
Attachment #666441 -
Flags: review?(jones.chris.g)
Reporter | ||
Updated•12 years ago
|
Attachment #666441 -
Flags: review?(jones.chris.g) → review+
Assignee | ||
Comment 42•12 years ago
|
||
Whiteboard: [leave open]
Comment 43•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in
before you can comment on or make changes to this bug.
Description
•