FxOS Camera app should use HWComposer instead of GPU

RESOLVED DUPLICATE of bug 1049198

Status

()

RESOLVED DUPLICATE of bug 1049198
4 years ago
4 years ago

People

(Reporter: djf, Unassigned)

Tracking

Trunk
x86
Mac OS X
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
In order to reduce power consumption, CAF needs the FxOS 2.0 camera app to be able to compose the camera UI on top of the video preview stream in HWC instead of on the GPU. 

We're working in bug 1049198 on reducing CSS complexity to simplify the layer tree. But this bug is specific for whatever lower-level work is needed to get that simplified layer tree to run on the HWC.
(Reporter)

Comment 1

4 years ago
This bug blocks 1049086, which is a high-priority CAF 2.0+ blocker.
Blocks: 1049086
(Reporter)

Comment 2

4 years ago
Here is more information from an email thread with CAF, describing their findings after applying the patch in bug 1049198:

We checked with both patches: 22641 and 22647. We are still seeing 5+
layers are being painted in frame. Camcorder recording frame is falling
back to GPU Composition, it is not using HWC Composition. So there is no
point in taking power numbers. Here is layer configuration of Camcorder
recording frame:

These 3 Color layers are visible but not considered for Composition (but
they still they being painted by CPU):
E/HWComposer( 226): HWC layer[0]::ColorLayerComposite: dst=[0 36 480 800]
src=[0 0 480 764] Transform=ff000000 Blend=0x100
E/HWComposer( 226): HWC layer[0]::ColorLayerComposite: dst=[0 0 480 800]
src=[0 0 480 800] Transform=ff000000 Blend=0x100
E/HWComposer( 226): HWC layer[0]::ColorLayerComposite: dst=[0 0 480 800]
src=[0 0 480 800] Transform=ff000000 Blend=0x100

Below layers are visible and should be composed but the new layer which
blends on top of Video layer, does not have any Gralloc buffer that is why
it is falling back to GPU Composition. Please see NULL gralloc buffer
error below:

E/HWComposer( 226): HWC layer[0]::ColorLayerComposite: dst=[0 0 480 800]
src=[0 0 480 800] Transform=ff000000 Blend=0x100
E/HWComposer( 226): HWC layer[1]::ImageLayerComposite: dst=[0 1 480 800]
src=[0 24 719 456] Transform=4 Blend=0x100
E/HWComposer( 226): ThebesLayerComposite Layer doesn't have a gralloc buffer

We were expecting these 2 layer configurations to profile optimal power:

1. 2 layers in frame:
- Full screen Video layer
- Translucent layer with timer and button

OR

2. 3 layers in frame:
- Full screen Video layer
- Small layer for Timer
- Small layer for Button
(Reporter)

Comment 3

4 years ago
And here's a followup on that same email thread:

Yes, we do not see Thebes background layer with latest patch from 22641.
But our concern is that frame is falling back to GPU Composition, so we
cannot measure power numbers. Here is layer configuration of frame. There
are total 4+ layers.

These layers are visible and should be composed but the new layer which
blends on top of Video layer, does not have any Gralloc buffer that is why
it is falling back to GPU Composition. HWC Composition cannot compose with
NULL gralloc buffer for any layer. Please see NULL gralloc buffer error
below:

E/HWComposer( 228): HWC layer[0]::ColorLayerComposite: dst=[0 0 480 800]
src=[0.000000 0.000000 480.000000 800.000000] Transform=ff000000
Blend=0x100
E/HWComposer( 228): HWC layer[1]::ImageLayerComposite: dst=[0 1 480 800]
src=[0.000000 24.000000 719.000000 456.000000] Transform=4 Blend=0x100
E/HWComposer( 228): ThebesLayerComposite Layer doesn't have a gralloc buffer

You can check with Sotaro, if you have any doubt in above error. HWC
Composition fails here:
http://mxr.mozilla.org/mozilla-central/source/widget/gonk/HwcComposer2D.cpp#271
. So please fix the new layer in App.

Bottom 2 color layers are still being painted visible (but not composed):
E/HWComposer( 228): HWC layer[0]::ColorLayerComposite: dst=[0 36 480 800]
src=[0.000000 0.000000 480.000000 764.000000] Transform=ff000000
Blend=0x100
E/HWComposer( 228): HWC layer[0]::ColorLayerComposite: dst=[0 0 480 800]
src=[0.000000 0.000000 480.000000 800.000000] Transform=ff000000
Blend=0x100
(Reporter)

Comment 4

4 years ago
Milan: would you ask someone from your team to investigate this and help Justin and I understand what we can do in bug 1049198 to get on to the HWC path?

Benoit: is this something you can work on?  When we discussed HWC yesterday I think you said that you would not expect the camera app to be able to use that.  Is that a limitation in our hardware?  Is the QRD device more capable, and do we need to alter something in gecko to take advantage of the more capable chipset?  And does this line from the comment above indicate a bug that we can fix:

> E/HWComposer( 228): ThebesLayerComposite Layer doesn't have a gralloc buffer

Thanks!
Flags: needinfo?(milan)
Flags: needinfo?(bgirard)
I'm planning on having a look at the Camera power usage this week.

HWC should support the Camera app *if* we can simplify the structure of the page. That error message indicates that we're likely getting a scrollable layer or running out of gralloc memory.
Flags: needinfo?(milan)

Comment 6

4 years ago
[Blocking Requested - why for this release]:
blocking-b2g: --- → 2.0?

Updated

4 years ago
Blocks: 1052095

Updated

4 years ago
No longer blocks: 1052095
Depends on: 1052095

Comment 7

4 years ago
Please note that Camera/Camcorder is using HWC on v2.0 tip. Fallback to GPU Compsition is seen only on pulling following Gaia patches shared from Bug https://bugzilla.mozilla.org/show_bug.cgi?id=1049198:
https://github.com/mozilla-b2g/gaia/pull/22641
https://github.com/mozilla-b2g/gaia/pull/22647
(In reply to Sushil from comment #7)
> Please note that Camera/Camcorder is using HWC on v2.0 tip. Fallback to GPU
> Compsition is seen only on pulling following Gaia patches shared from Bug
> https://bugzilla.mozilla.org/show_bug.cgi?id=1049198:
> https://github.com/mozilla-b2g/gaia/pull/22641
> https://github.com/mozilla-b2g/gaia/pull/22647

What device are you using? On Flame, the HWC is *not* being used in Camera which is the reason for this bug and Bug 1049086. From what I understand, falling back on the GPU and not using HWC is what is causing the increased power consumption. An overdraw increase regression is being tracked in Bug 1052095.
Flags: needinfo?(sushilchauhan)

Comment 9

4 years ago
(In reply to Justin D'Arcangelo [:justindarc] from comment #8)
> What device are you using? On Flame, the HWC is *not* being used in Camera
> which is the reason for this bug and Bug 1049086. From what I understand,
> falling back on the GPU and not using HWC is what is causing the increased
> power consumption. An overdraw increase regression is being tracked in Bug
> 1052095.

On KK Flame device (which is [480 x 800]) with v2.0 tip, Camera is using HWC. Bug 1049086 has been created to fix unnecessary painting (overdraw) which is Bug 1052095 and reduce layers or data fetch in the composition, which you are working in Bug 1049198. All these factors affect power numbers even in HWC Composition. Please see Comment 0 of Bug 1049086 for details.
Flags: needinfo?(sushilchauhan)
Bug 1049086 is blocking already - the camera power consumption issue will get fixed on way or another.

When you agree upon a conclusion about whether to use HWC or not, please renominate for blocking on this particular bug.

Thanks!

-d
blocking-b2g: 2.0? → ---

Updated

4 years ago
Flags: needinfo?(bgirard)
Resolved as part of Bug 1049198
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1049198
You need to log in before you can comment on or make changes to this bug.