Closed Bug 1022164 Opened 10 years ago Closed 10 years ago

[flame] High overdraw prevents us from using hardware composer

Categories

(Core :: Graphics: Layers, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

()

RESOLVED FIXED
2.0 S6 (18july)
blocking-b2g 2.0+
feature-b2g -
Tracking Status
b2g-v2.0 --- fixed
b2g-v2.1 --- fixed

People

(Reporter: sotaro, Assigned: BenWa)

References

Details

(Keywords: perf, power, Whiteboard: [c=power p= s=2014.07.18.t u=2.0,flame])

Attachments

(3 files)

+++ This bug was initially created as a clone of Bug #1017389 +++ This bug is created based on Bug 1017389 Comment 9. crystallskull does not use HwComposer. crystalskull is a application in gaia. It uses WebGL for drawing. The app shows only WebGL canvas except status bar. This kind of very simple application should use HwComposer. But status bar add a lot of extra rendering area. It causes flame device's HwComposer quit rendering.
HwComposer rendering reduce cpu usage and compositor thread locking compared to OpenGL composition. HwComposer usage could improve the app's rendering performance. It is important for game using WebGL.
Nominate to b2g-v1.4. It could affect WebGL game's performance and power usage.
blocking-b2g: --- → 1.4?
Attached file layer dump (deleted) —
layer dump of crystal app on master flame.
This over paining added when showing status bar is very bad for performance in general.
As in Bug 1017389 Comment 9, "crystallskull + status bar" rendering result in "2.9 * actual frame buffer area size" rendering. It is insane. "crystallskull" part has only one WebGL canvas layer. starus bar is just small area on the display.
Keywords: perf, power
Sotaro, Here is HWC layer list of Crystal Skull frame: HWC layer[0]::ThebesLayer: dst=[0 30 480 800] src=[0 0 30 480 800] Tr=0 Blend=0x100 HWC layer[1]::ColorLayerComposite: dst=[0 30 480 800] src=[0 0 480 770] Color=ffffffff Blend=0x100 HWC layer[2]::CanvasLayerComposite: dst=[0 30 480 800] src=[0 0 320 513] Tr=2 Blend=0x105 HWC layer[3]::ThebesLayer: dst=[0 0 480 30] src=[0 0 480 30] Tr=0 Blend=0x100 H/W Composition failed As Color Layer is just a solid color, no RGBA data fetching is involved. So HAL does not count Color layer in total RGBA render area, so actually it is (1.9 x FB area), which is more than threshold limit of HWC (which is 1.5 x FB area) on non-H/W overlay device. If we see the layer configuration in this frame. HWC layer[0] is totally hidden under opaque content layer[1], so it is invisible but still it is sent for Composition, which does not make sense. So we have 2 possible ways to fix it: 1. Fix it in the rendering phase (painting). Layer[0] should not be in layer tree sent to Compositor. OR its GetEffectiveVisibleRegion() should return empty, so that it will not be included in composition as per check: http://mxr.mozilla.org/mozilla-central/source/widget/gonk/HwcComposer2D.cpp#203 . 2. Even if we get such a hidden layer. HwComposer2D should have a logic, not to include it in the created HWC layer list, which is sent to HWC HAL. BTW, SurfaceFlinger does not include such a hidden layer in HWC layer list. What do you say ?
Flags: needinfo?(sotaro.ikeda.g)
What is the power usage issue here? Please provide data.
blocking-b2g: 1.4? → backlog
Oh and - not blocking because Crystal Skull isn't a partner app.
(In reply to Sushil from comment #6) > Sotaro, > > Here is HWC layer list of Crystal Skull frame: > HWC layer[0]::ThebesLayer: dst=[0 30 480 800] src=[0 0 30 480 800] Tr=0 > Blend=0x100 > HWC layer[1]::ColorLayerComposite: dst=[0 30 480 800] src=[0 0 480 770] > Color=ffffffff Blend=0x100 > HWC layer[2]::CanvasLayerComposite: dst=[0 30 480 800] src=[0 0 320 513] > Tr=2 Blend=0x105 > HWC layer[3]::ThebesLayer: dst=[0 0 480 30] src=[0 0 480 30] Tr=0 Blend=0x100 > H/W Composition failed > > As Color Layer is just a solid color, no RGBA data fetching is involved. So > HAL does not count Color layer in total RGBA render area, so actually it is > (1.9 x FB area), which is more than threshold limit of HWC (which is 1.5 x > FB area) on non-H/W overlay device. If we see the layer configuration in > this frame. HWC layer[0] is totally hidden under opaque content layer[1], so > it is invisible but still it is sent for Composition, which does not make > sense. > > So we have 2 possible ways to fix it: > 1. Fix it in the rendering phase (painting). Layer[0] should not be in layer > tree sent to Compositor. OR its GetEffectiveVisibleRegion() should return > empty, Does the hw compositor side rendering work correctly by the above?
(In reply to Sushil from comment #6) > > 2. Even if we get such a hidden layer. HwComposer2D should have a logic, not > to include it in the created HWC layer list, which is sent to HWC HAL. BTW, > SurfaceFlinger does not include such a hidden layer in HWC layer list. > > What do you say ? I am not sure if it is possible on Compositor. It might be a role of display list. BenWa, can you comment to the above question?
Flags: needinfo?(sotaro.ikeda.g) → needinfo?(bgirard)
Sotaro, Option 1 needs change in the painting phase (Layer tree formation). Option 2 needs change in HwcComposer2D. In comment 9, which option are you referring to? For testing Option 2, I need to make change in HwcComposer2D and verify.
Flags: needinfo?(sotaro.ikeda.g)
The displaylist isn't propagated to the compositor. Option 2 sounds like bug 981732 which is in the tree.
Flags: needinfo?(bgirard)
Sotaro, the bug 981732 covers only full screen use case, I can extend it to non-full screen use cases which is Option 2 (mentioned in Comment 6). So are we planning to go with Option 2 in this bug ? Benwa, is it possible to fix it in the painting phase (layer tree formation) ?
Flags: needinfo?(bgirard)
Doing this kind of optimization in the HWC isn't ideal but we want to avoid doing this regardless of where we composite. Really we would want to do global culling before compositing regardless if we use HWC/OGL or even D3D. Regardless we should fix as much as possible during layer tree building. This should deal with most cases *except* async layer transform where only the compositor can perform the culling.
Flags: needinfo?(bgirard)
(In reply to Sushil from comment #11) > Sotaro, > > Option 1 needs change in the painting phase (Layer tree formation). > Option 2 needs change in HwcComposer2D. > > In comment 9, which option are you referring to? For testing Option 2, I > need to make change in HwcComposer2D and verify. Sorry, I just seems to misunderstand the Option1. Did you said color layer should not be created by an application? I think that this should be fixed around displaylist creation like comment 12. > 1. Fix it in the rendering phase (painting). Layer[0] should not be in layer > tree sent to Compositor. OR its GetEffectiveVisibleRegion() should return > empty,
Flags: needinfo?(sotaro.ikeda.g)
> Did you said color layer > should not be created by an application? I think that this should be fixed > around displaylist creation like comment 12. > No, I was pointing to Layer[0] (Thebes layer) as per Comment 6. It seems to be a potential issue in the logic used during layer tree creation and defining the visible region of layer[0]. It is totally hidden under layer[1] (Color layer), so ideally the effective visible region of layer[0] should be Empty OR layer[0] should not be present in layer tree at all. So, are you guys planning to fix this bug in the painting phase then (layer tree creation)? Let me know, if you want me to handle this in HwcComposer2D.
Flags: needinfo?(sotaro.ikeda.g)
As in Comment 14, doing optimization in HwComposer is not ideal. This bug could be a bug to fix this problem. Right now, no one is assigned to this bug. If correct priority is assigned to this bug. Someone who know well around layout is going to handle this bug.
Flags: needinfo?(sotaro.ikeda.g)
Milan, can we assign someone to this bug? This bug failed to become 1.4+. But we need to fix this problem. Can we set target to b2g-v2.1?
Flags: needinfo?(milan)
On one webgl game, there was 16% cpu usage difference between OpenGL composition and HwComposer composition. It show HwComposer composition could improve b2g performance. - OpenGL composition: 74 % cpu usage - HwComposer composition: 58% cpu usage I used "adb shell top -t -m 6" command to check it. More information is at Bug 1022823 Comment 25.
(In reply to Sotaro Ikeda [:sotaro] from comment #19) > On one webgl game, there was 16% cpu usage difference between OpenGL > composition and HwComposer composition. It show HwComposer composition could > improve b2g performance. > - OpenGL composition: 74 % cpu usage > - HwComposer composition: 58% cpu usage > > I used "adb shell top -t -m 6" command to check it. More information is at > Bug 1022823 Comment 25. Correction: The above is based on incorrect data. When HwComposer was used, FPS was dropped.
Assigning to :benwa, but I don't know how deep into layout we need to delve. :tn, can you assist or take over depending on what the answer to that ends up being?
Assignee: nobody → bgirard
feature-b2g: --- → 2.1
Flags: needinfo?(milan) → needinfo?(tnikkel)
To understand why we are getting a thebeslayer that is completely covered we need a display list dump. Can someone post one to this bug?
Flags: needinfo?(tnikkel)
Attached file Display list (deleted) —
The problem seems to be coming from the parent process. The layers from the content process (where this display list dump looks like it is from) look good, just a canvas layer, and a thebeslayer with empty vis region, which should be ignored.
Attached file System displaylist (deleted) —
Depends on: 1024148
The remote iframe is contained in an opacity item with opacity 1, meaning there is either will-change or some animation on opacity on (some ancestor of) the remote iframe for the current app. This forces us to treat the foreground app as transparent.
Status: NEW → ASSIGNED
Priority: -- → P2
Whiteboard: [c=power p= s= u=flame]
(In reply to Timothy Nikkel (:tn) from comment #26) > The remote iframe is contained in an opacity item with opacity 1, meaning > there is either will-change or some animation on opacity on (some ancestor > of) the remote iframe for the current app. This forces us to treat the > foreground app as transparent. I landed bug 1024742 which will tell us if it's will-change. I strongly suspect then that is the case. Meanwhile bug 1024148 should simplify the system app along with a lot of pages.
Bug 1026240 seems to be responsible for all the extra layers we have received.
Depends on: 1026240
I just confirmed with sotaro' help, the problem is we're compositing over 150% of the screen area. We need to remove the overdraw coming from the app background. A quick look at the display list it should be optimized into a color layer but isn't.
Depends on: 1027231
Block graphic feature for FFOS 2.1 meta bug for tracking.
Blocks: 1016796
Blocks: 1010638
Note that this now blocks bug 1010638, which is currently marked as a 2.0 blocker. Sotaro, can you comment on this, specifically in terms of simplifying the layer tree that we need for that bug, and how much of this bug is related specifically to that.
This may be a simple fix, but I wouldn't count on there being a solution in the 2.0 timeframe, it depends on what ends up being an underlying issue.
Sorry, forgot to add needinfo...
Flags: needinfo?(sotaro.ikeda.g)
(In reply to Jon Hylands [:jhylands] from comment #31) > Note that this now blocks bug 1010638, which is currently marked as a 2.0 > blocker. Sotaro, can you comment on this, specifically in terms of > simplifying the layer tree that we need for that bug, and how much of this > bug is related specifically to that. Sorry, BenWa is correct person to answer the question.
Flags: needinfo?(sotaro.ikeda.g)
BenWa, can you answer the question?
Flags: needinfo?(bgirard)
I believe this can be fixed entirely in gaia. We need bug 1027231 fixed and I will verify bug 1026240 once I come back from vacation. Applying fixes locally with App manager to remove extra will-change and fix subpixel alignment I was able to get crystal skull to render with HWC on the flame.
Flags: needinfo?(bgirard)
bgirard - I appreciate the report, but I guess I wasn't very clear in what I was asking. I'm interested in this bug because we believe it might relate to bug 1010638, which appears to have power consumption issues caused by an overly complex layer tree. Is that the basic premise of what you're trying to fix here, or is that just one part of it?
Flags: needinfo?(bgirard)
Yes, the this bug is caused by a complex layer tree and they do look related. It will certainly help since all app on the Flame are getting a bad layer tree. But I can't say if it will be sufficient.
Flags: needinfo?(bgirard)
Depends on: 1034347
Per Benoit's comment 54 in bug 1010638, I'm changing this to a 2.0?
blocking-b2g: backlog → 2.0?
feature-b2g: 2.1 → -
Severity: normal → blocker
blocking-b2g: 2.0? → 2.0+
Priority: P2 → P1
Whiteboard: [c=power p= s= u=flame] → [c=power p= s= u=2.0,flame]
Back to 2.0? because of comment 8.
blocking-b2g: 2.0+ → 2.0?
Keep in mind that the underlying issue we're tracking is that we can't efficiently handle a fullscreen webgl app. Crystal skull is just a trivial test case.
Keeping in mind comment #41 and keeping in mind that this blocks 1010638 and is a reduced testcase, blocking on this.
blocking-b2g: 2.0? → 2.0+
OK, let's clarify what we're tracking in this bug. We talk about Crystall Skull game in the summary, but it sounds like we want to track all WebGL apps in here. We are also talking about this blocking a bug that doesn't do any WebGL work, so are we using this bug for the fact that high overdraw stops us from using hardware composer? Which one is it?
Flags: needinfo?(bgirard)
(In reply to Milan Sreckovic [:milan] from comment #43) > so are we using this bug for the fact that high overdraw > stops us from using hardware composer? Yes, I am using this bug to track that high overdraw is preventing us from using HWC even in the most trivial cases. I've updated the description to reflect this.
Flags: needinfo?(bgirard)
Summary: [flame] crystalskull does not use hardware composer → [flame] High overdraw prevents us from using hardware composer
This should be fixed on master now. b2g-2.0 is waiting for bug 1034347 to be uplifted.
We can now use HWC given that the app has an appropriate layer tree (like crystal skull).
Triage: Hey Benoit, can we close this now based on comment 46? Thanks!
Flags: needinfo?(bgirard)
Opps, meant to close.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: needinfo?(bgirard)
Resolution: --- → FIXED
Whiteboard: [c=power p= s= u=2.0,flame] → [c=power p= s=2014.07.18.t u=2.0,flame]
Target Milestone: --- → mozilla33
Target Milestone: mozilla33 → 2.0 S6 (18july)
Unable to verify the issue. This bug and dependencies do not have sufficient STRs and/or seem to be back end issues.
QA Whiteboard: [QAnalyst-Triage?][QAnalyst-verify-]
Flags: needinfo?(ktucker)
QA Whiteboard: [QAnalyst-Triage?][QAnalyst-verify-] → [QAnalyst-Triage+][QAnalyst-verify-]
Flags: needinfo?(ktucker)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: