Closed Bug 1047058 Opened 8 years ago Closed 8 years ago

Homescreen layers retained while using other apps

Categories

(Core :: Graphics: Layers, defect)

ARM
Gonk (Firefox OS)
defect
Not set
blocker

Tracking

()

RESOLVED DUPLICATE of bug 1047390
blocking-b2g 2.1+

People

(Reporter: botond, Unassigned)

References

Details

(Keywords: perf, regression)

Attachments

(2 files)

While looking at B2G layers dumps, I noticed that the layers corresponding to the homescreen are retained even while using another app.

BenWa tells me this shouldn't be happening.

Example layer tree, while using the Browser app:

I/Gecko   ( 4755): LayerManager (0xaf2e18a0)
I/Gecko   ( 4755):   ContainerLayerComposite (0xb013a000) [shadow-visible=< (x=0, y=0, w=480, h=854); >] [visible=< (x=0, y=0, w=480, h=854); >] [opaqueContent] [metrics={ cb=(x=0.000000, y=0.000000, w=480.000000, h=854.000000) sr=(x=0.000000, y=0.000000, w=320.000000, h=569.333313) s=(x=0.000000, y=0.000000) dp=(x=0.000000, y=0.000000, w=0.000000, h=0.000000) cdp=(x=0.000000, y=0.000000, w=0.000000, h=0.000000) scrollId=0 z=1.500 }]
I/Gecko   ( 4755):     ThebesLayerComposite (0xb0183400) [shadow-clip=(x=0, y=0, w=0, h=0)] [clip=(x=0, y=0, w=0, h=0)] [not visible]
I/Gecko   ( 4755):     ColorLayerComposite (0xb06e6800) [not visible] [opaqueContent] [color=rgba(0, 0, 0, 1)]
I/Gecko   ( 4755):     ContainerLayerComposite (0xb0184000) [shadow-clip=(x=0, y=0, w=480, h=854)] [shadow-visible=< (x=0, y=0, w=480, h=854); >] [clip=(x=0, y=0, w=480, h=854)] [visible=< (x=0, y=0, w=480, h=854); >] [opaqueContent]
I/Gecko   ( 4755):       ThebesLayerComposite (0xb01b8400) [shadow-visible=< (x=0, y=0, w=480, h=854); >] [visible=< (x=0, y=0, w=480, h=854); >] [opaqueContent] [valid=< (x=0, y=0, w=480, h=854); >]
I/Gecko   ( 4755):         ContentHost (0xb0ed5d00) [buffer-rect=(x=0, y=0, w=480, h=854)] [buffer-rotation=(x=0, y=0)]
I/Gecko   ( 4755):           GrallocTextureHostOGL (0xad39d700) [size=(w=480, h=854)] [format=SurfaceFormat::B8G8R8X8] [flags=TextureFlags::ALLOW_REPEAT]
I/Gecko   ( 4755):       ContainerLayerComposite (0xb16dd400) [shadow-clip=(x=0, y=0, w=480, h=854)] [shadow-visible=< (x=0, y=0, w=480, h=854); >] [clip=(x=0, y=0, w=480, h=854)] [visible=< (x=0, y=0, w=480, h=854); >]
I/Gecko   ( 4755):         RefLayerComposite (0xb16de000) [shadow-clip=(x=0, y=36, w=480, h=818)] [shadow-transform=[ 1 0; 0 1; 0 36; ]] [clip=(x=0, y=36, w=480, h=818)] [transform=[ 1 0; 0 1; 0 36; ]] [not visible] [id=2]
I/Gecko   ( 4755):           ContainerLayerComposite (0xaec0e400) [shadow-visible=< (x=0, y=0, w=480, h=818); >] [visible=< (x=0, y=0, w=480, h=818); >] [componentAlpha] [metrics={ cb=(x=0.000000, y=0.000000, w=480.000000, h=818.000000) sr=(x=0.000000, y=0.000000, w=320.000000, h=545.333313) s=(x=0.000000, y=0.000000) dp=(x=0.000000, y=0.000000, w=320.000000, h=545.333313) cdp=(x=0.000000, y=0.000000, w=320.000000, h=545.333313) scrollId=3 z=1.500 }]
I/Gecko   ( 4755):             ThebesLayerComposite (0xaec11000) [not visible] [opaqueContent]
I/Gecko   ( 4755):             ThebesLayerComposite (0xaecca400) [shadow-clip=(x=0, y=0, w=0, h=0)] [clip=(x=0, y=0, w=0, h=0)] [not visible]
I/Gecko   ( 4755):             ColorLayerComposite (0xaecd3000) [shadow-visible=< (x=0, y=0, w=480, h=818); >] [visible=< (x=0, y=0, w=480, h=818); >] [isFixedPosition anchor=0.000000,0.000000 margin=0.000000,0.000000,0.000000,-1.000000] [color=rgba(0, 0, 0, 0.0980392)]
I/Gecko   ( 4755):             ContainerLayerComposite (0xaeccb000) [shadow-clip=(x=0, y=0, w=480, h=818)] [shadow-visible=< (x=0, y=0, w=480, h=818); >] [clip=(x=0, y=0, w=480, h=818)] [visible=< (x=0, y=0, w=480, h=818); >] [componentAlpha] [metrics={ cb=(x=0.000000, y=0.000000, w=480.000000, h=818.000000) sr=(x=0.000000, y=0.000000, w=320.000000, h=2195.000000) s=(x=0.000000, y=0.000000) dp=(x=0.000000, y=0.000000, w=320.000000, h=2195.000000) cdp=(x=0.000000, y=0.000000, w=320.000000, h=1536.000000) scrollId=4 z=1.500 }] [scrollParent=3]
I/Gecko   ( 4755):               ThebesLayerComposite (0xaeccb400) [shadow-visible=< (x=0, y=0, w=480, h=2866); (x=5, y=2874, w=472, h=172); (x=3, y=3054, w=154, h=172); (x=163, y=3054, w=154, h=172); >] [visible=< (x=0, y=0, w=480, h=2866); (x=5, y=2874, w=472, h=172); (x=3, y=3054, w=154, h=172); (x=163, y=3054, w=154, h=172); >] [componentAlpha] [valid=< (x=0, y=0, w=480, h=2304); >]
I/Gecko   ( 4755):         ThebesLayerComposite (0xb16de800) [shadow-visible=< (x=0, y=0, w=480, h=854); >] [visible=< (x=0, y=0, w=480, h=854); >] [opaqueContent] [valid=< (x=0, y=0, w=480, h=854); >]
I/Gecko   ( 4755):           ContentHost (0xad4c9480) [buffer-rect=(x=0, y=0, w=480, h=854)] [buffer-rotation=(x=0, y=0)] [paint-will-resample]
I/Gecko   ( 4755):             GrallocTextureHostOGL (0xaec6f7c0) [size=(w=480, h=854)] [format=SurfaceFormat::B8G8R8X8] [flags=]
I/Gecko   ( 4755):       ContainerLayerComposite (0xaeb22c00) [shadow-clip=(x=0, y=0, w=480, h=854)] [shadow-visible=< (x=0, y=0, w=480, h=854); >] [clip=(x=0, y=0, w=480, h=854)] [visible=< (x=0, y=0, w=480, h=854); >] [componentAlpha]
I/Gecko   ( 4755):         ThebesLayerComposite (0xaeb4c400) [shadow-visible=< (x=0, y=36, w=480, h=818); >] [visible=< (x=0, y=36, w=480, h=818); >] [opaqueContent] [valid=< (x=0, y=36, w=480, h=818); >]
I/Gecko   ( 4755):           ContentHost (0xabfd3180) [buffer-rect=(x=0, y=36, w=480, h=818)] [buffer-rotation=(x=0, y=0)]
I/Gecko   ( 4755):             GrallocTextureHostOGL (0xb059eac0) [size=(w=480, h=818)] [format=SurfaceFormat::B8G8R8X8] [flags=TextureFlags::ALLOW_REPEAT]
I/Gecko   ( 4755):         ContainerLayerComposite (0xaeb4d000) [shadow-clip=(x=0, y=36, w=480, h=818)] [shadow-transform=[ 1 0; 0 1; 0 36; ]] [shadow-visible=< (x=0, y=0, w=480, h=751); >] [clip=(x=0, y=36, w=480, h=818)] [transform=[ 1 0; 0 1; 0 36; ]] [visible=< (x=0, y=0, w=480, h=751); >]
I/Gecko   ( 4755):           ThebesLayerComposite (0xaeb4d400) [shadow-visible=< (x=0, y=0, w=480, h=751); >] [visible=< (x=0, y=0, w=480, h=751); >] [valid=< (x=0, y=0, w=480, h=751); >]
I/Gecko   ( 4755):             ContentHost (0xad45a280) [buffer-rect=(x=0, y=0, w=480, h=751)] [buffer-rotation=(x=0, y=0)]
I/Gecko   ( 4755):               GrallocTextureHostOGL (0xabf394c0) [size=(w=480, h=751)] [format=SurfaceFormat::B8G8R8A8] [flags=TextureFlags::ALLOW_REPEAT]
I/Gecko   ( 4755):           RefLayerComposite (0xaeb53800) [shadow-clip=(x=0, y=75, w=480, h=676)] [shadow-transform=[ 1 0; 0 1; 0 75; ]] [shadow-visible=< (x=0, y=0, w=480, h=676); >] [clip=(x=0, y=75, w=480, h=676)] [transform=[ 1 0; 0 1; 0 75; ]] [visible=< (x=0, y=0, w=480, h=676); >] [id=6]
I/Gecko   ( 4755):             ContainerLayerComposite (0xab011800) [shadow-visible=< (x=0, y=0, w=480, h=2491); >] [visible=< (x=0, y=0, w=480, h=2491); >] [metrics={ cb=(x=0.000000, y=0.000000, w=480.000000, h=676.000000) sr=(x=0.000000, y=0.000000, w=320.000000, h=1660.333374) s=(x=0.000000, y=0.000000) dp=(x=0.000000, y=0.000000, w=320.000000, h=1660.333374) cdp=(x=0.000000, y=0.000000, w=320.000000, h=1365.333374) scrollId=3 z=1.500 }]
I/Gecko   ( 4755):               ThebesLayerComposite (0xab011c00) [shadow-visible=< (x=0, y=0, w=480, h=2491); >] [visible=< (x=0, y=0, w=480, h=2491); >] [opaqueContent] [valid=< (x=0, y=0, w=480, h=2048); >]
I/Gecko   ( 4755):                 TiledContentHost (0xac640300)
I/Gecko   ( 4755):         ThebesLayerComposite (0xaf01bc00) [shadow-visible=< (x=0, y=0, w=480, h=37); (x=0, y=785, w=480, h=69); >] [visible=< (x=0, y=0, w=480, h=37); (x=0, y=785, w=480, h=69); >] [componentAlpha] [valid=< (x=0, y=0, w=480, h=37); (x=0, y=785, w=480, h=69); >]
I/Gecko   ( 4755):           ContentHost (0xb056d380) [buffer-rect=(x=0, y=0, w=480, h=854)] [buffer-rotation=(x=0, y=0)]
I/Gecko   ( 4755):             GrallocTextureHostOGL (0xabf39520) [size=(w=480, h=854)] [format=SurfaceFormat::B8G8R8A8] [flags=TextureFlags::ALLOW_REPEAT]

Notice the two RefLayers. The one with id=2 is the Homescreen, and the one with id=6 is the Browser app.

This problem is not specific to the Browser app; I see it with every app I've tried.
CC'ing Vivien and Chris in case this is related to the rocketbar changes.
Keywords: regression
[Blocking Requested - why for this release]: This will lead to bad performance and increased memory usage.
Severity: normal → blocker
blocking-b2g: --- → 2.1?
This is a regression from 2.0?  Marking 2.1+ assuming we regressed from 2.0.  If not, should make it 2.0?
blocking-b2g: 2.1? → 2.1+
We have similar badness with animated items in bug 1046055, though I imagine for completely different reasons.
Attached is a display list dump from the parent process. That should give us some clues as to why two ref layers are being retained.
I see this also on Hamachi and Flame running recent master code. Pretty sure it's a recent regression because I wasn't seeing it last week.
(In reply to Botond Ballo [:botond] from comment #5)
> Attached is a display list dump from the parent process. That should give us
> some clues as to why two ref layers are being retained.

The only display item associated with the homescreen's ref layer is an nsDisplayRemote (I suppose that's normal). Its parent display item is an nsDisplayTransform with "will-change=transform" - is that causing the retaining?
(In reply to Milan Sreckovic [:milan] from comment #3)
> This is a regression from 2.0?  Marking 2.1+ assuming we regressed from 2.0.
> If not, should make it 2.0?

In order to do a window here, we'll need a way to be able to test this on pvtbuilds with reproducible STR, expected/actual results. Can someone on your team provide that information?
Flags: needinfo?(milan)
:benwa, :botond, can we infer this from the overdraw numbers?  I'm not sure if there is anything QA can do to help us find the range if they have to examine display list dumps, as those would also require custom builds...
Flags: needinfo?(milan)
Flags: needinfo?(botond)
Flags: needinfo?(bgirard)
Here's two easy way to check this in any build:
1) Run with layers dump. Load a few apps. Put Settings in the foreground. Check the layers dump. There should be only one RefLayer node per tree, if there's two or more then this bug is occurring. When the indentation is reset to zero this marks a new dump.

or

1) Run with FPS counter. Load a few apps. Put Settings in the foreground. Check the 3rd leftmost counter. It should read ~200(%). In my build it shows 600(%) which indicates that this regression is present.

Note that 1) is a more robust way to check. 2) could lead to false positive. Probably doesn't hurt to just check both.
Flags: needinfo?(bgirard)
(In reply to Milan Sreckovic [:milan] from comment #9)
> :benwa, :botond, can we infer this from the overdraw numbers?  I'm not sure
> if there is anything QA can do to help us find the range if they have to
> examine display list dumps, as those would also require custom builds...

Whether the homescreen layers are retained can be determined from layer dumps, which can be enabled in release builds with a pref.

STR:
  1. Enable layer dumps by running './edit-prefs.sh' and adding the line
     user_pref("layers.dump", true);
  2. Open the Browser app (or any other app).
     (Make sure the Keyboard is *not* open.)
  3. Use 'adb logcat' to look at a layer dump.
  4. Count the number of RefLayers in the layer dump.
     If there are two RefLayers, the bug reproduces.
       (One corresponds to the open app, and the other to the Homescreen,
        which shouldn't be there).
     If there is one RefLayer, the bug does not reproduce.
       (It corresponds to the open app).

The reason it's important to make sure the Keyboard is not open, is that the Keyboard (legitimately) gets its own RefLayer.
Flags: needinfo?(botond)
(In reply to Botond Ballo [:botond] from comment #7)
> (In reply to Botond Ballo [:botond] from comment #5)
> > Attached is a display list dump from the parent process. That should give us
> > some clues as to why two ref layers are being retained.
> 
> The only display item associated with the homescreen's ref layer is an
> nsDisplayRemote (I suppose that's normal). Its parent display item is an
> nsDisplayTransform with "will-change=transform" - is that causing the
> retaining?

I tried removing the will-change=transform (it originates at [1]) to see if that fixes the issue, but it does not - the Homescreen layers are still retained.

[1] https://github.com/mozilla-b2g/gaia/blob/16d7b63ef790963a50e260a0adacbf03d7f79717/apps/system/style/window.css#L506
Following up on my hunch that this is a Gaia regression, I did a Gaia regression window, and found that the retaining of the homescreen layers was introduced in the following commit:

commit a6d415335e8e73bf8bca00cd8591fd59164f915a
Author: Vivien Nicolas <vnicolas@mozilla.com>
Date:   Sun Jul 27 16:22:26 2014 +0200

    Revert "Revert "Bug 1042744 - Add a container around app iframes and some chrome UI. r=alive" under suspicion of breaking JB emulator builds"
    
    This reverts commit ebb824c7e4c1be271d68c773ac75ae0cfb79238d

Vivien, do you know what change in this commit might have caused this issue?
Flags: needinfo?(21)
We should back this out:
- This regresses overdraw. It impossible to test overdraw on apps.
- This regresses memory usage.
- This regresses scrolling on many apps. Even the simple Settings app on the flame now scrolls at 45 FPS instead of 60 FPS

It's effectively going to lead to incorrect performance and memory measurements across the device and thus seriously impedes performance work.

It's unfortunate that our integration didn't identify something so major :(.
Keywords: perf
Blocks: 1042744
On another note we did just land a patch today to make scrolling performance better: https://github.com/mozilla-b2g/gaia/commit/16d7b63ef790963a50e260a0adacbf03d7f79717

Benoit - Can you tell us if you tested with that patch that landed this morning? It appears that we may not have been hiding offscreen windows, but this should now be fixed.
Flags: needinfo?(bgirard)
Depends on: 1047390
(In reply to Kevin Grandon :kgrandon from comment #16)
> On another note we did just land a patch today to make scrolling performance
> better:
> https://github.com/mozilla-b2g/gaia/commit/
> 16d7b63ef790963a50e260a0adacbf03d7f79717
> 
> Benoit - Can you tell us if you tested with that patch that landed this
> morning? It appears that we may not have been hiding offscreen windows, but
> this should now be fixed.

That patch does appear to fix the problem! Closing as duplicate.
Status: NEW → RESOLVED
Closed: 8 years ago
Flags: needinfo?(bgirard)
Flags: needinfo?(21)
Resolution: --- → DUPLICATE
Duplicate of bug: 1047390
Yay, thanks for the quick turn around :D
You need to log in before you can comment on or make changes to this bug.