Closed Bug 878977 Opened 11 years ago Closed 11 years ago

HwcComposer2D doesn't render Camera or Video frames

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: diego, Assigned: bjacob)

References

Details

This was definitely working at some point. Currently it fails here:

https://mxr.mozilla.org/mozilla-b2g18/source/widget/gonk/HwcComposer2D.cpp#351

and it falls back to GPU rendering.
This is causing problems in video playback. Either the GPU or HwcComposer2d holds on to a buffer longer than needed so eventually there's a genlock error:

E/libgenlock(  132): perform_lock_unlock_operation: GENLOCK_IOC_DREADLOCK failed (lockType0x1,        >err=Connection timed out fd=31)
E/omx_vdec(  132): Failed to acquire genlock, ret = 1

If you just skip rendering canvas layers by returing True here:

https://mxr.mozilla.org/mozilla-b2g18/source/widget/gonk/HwcComposer2D.cpp#352

Playback will never lock this way anymore.
Blocks: 878343
Is this the case where the screen stays frozen, but the audio continues to play?
(In reply to Mike Habicher [:mikeh] from comment #2)
> Is this the case where the screen stays frozen, but the audio continues to
> play?

Yep
Blocks: 877024
(In reply to Diego Wilson [:diego] from comment #1)
> This is causing problems in video playback. Either the GPU or HwcComposer2d
> holds on to a buffer longer than needed so eventually there's a genlock
> error:
> 
> E/libgenlock(  132): perform_lock_unlock_operation: GENLOCK_IOC_DREADLOCK
> failed (lockType0x1,        >err=Connection timed out fd=31)
> E/omx_vdec(  132): Failed to acquire genlock, ret = 1
> 
> If you just skip rendering canvas layers by returing True here:

What does it mean to change to true? Can you explain about it?
(In reply to Sotaro Ikeda [:sotaro] from comment #4)
> What does it mean to change to true? Can you explain about it?

This function is called once per each layer to be rendered.

If you return "false", the Hwc compositing will fail and it will fall back to GPU rendering.

If you return "true" before adding the layer into the compositing list, the layer is ignored, but all other layers in the compositing list are rendered.
How do you know it's a CanvasLayer? Using the debugger?
We need an owner for this bug. Sorry Benoit :-)
Assignee: nobody → bjacob
Diego, was this on mozilla-b2g18 or mozilla-central?
Flags: needinfo?(dwilson)
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #8)
> Diego, was this on mozilla-b2g18 or mozilla-central?

This was on mozilla-b2g18.
Flags: needinfo?(dwilson)
I think I figured out why this causes the genlock error and screen freeze:

1. The status bar displays a "network activity" animation in a canvas (CanvasLayer).
2. HwcComposer2D can't render it because for some reason it's not gralloc backed. The ShadowCanvasLayer is backed by an Shmem descriptor.
3. When HwcComposer2D can't render it falls back to GPU rendering.
4. This causes continues fluctuation between Hwc and GPU rendering everytime there's network activity.
5. It appears ImageLayerOGL does not unlock external buffers properly. This causes the genlock issue when the HW decoder or HWC try to reuse the buffer.

I filed bug 879297 for fixing the ImageLayerOGL lock issue. I have a working patch that I'll share ASAP there.
No longer blocks: 878343
Summary: HwcComposer2D can't render CanvasLayers anymore → HwcComposer2D doesn't render Camera or Video frames
OK, now that bug 879297 has been fixed we can come back to this bug. Camera and Video are the key hardware composer use cases. I may need nrc's help figuring out how hwc is supposed to fetch the CanvasLayer buffer using composite layers.
(In reply to Diego Wilson [:diego] from comment #11)
> OK, now that bug 879297 has been fixed we can come back to this bug. Camera
> and Video are the key hardware composer use cases. I may need nrc's help
> figuring out how hwc is supposed to fetch the CanvasLayer buffer using
> composite layers.

In current Firefox OS use case, camera and video frames are rendered by ImageLayer. Is there a use case for using CanvasLayer for them now?
Flags: needinfo?(dwilson)
(In reply to Sotaro Ikeda [:sotaro] from comment #12)
> (In reply to Diego Wilson [:diego] from comment #11)
> > OK, now that bug 879297 has been fixed we can come back to this bug. Camera
> > and Video are the key hardware composer use cases. I may need nrc's help
> > figuring out how hwc is supposed to fetch the CanvasLayer buffer using
> > composite layers.
> 
> In current Firefox OS use case, camera and video frames are rendered by
> ImageLayer. Is there a use case for using CanvasLayer for them now?

You're totally right! I created bug 885345 for video and camera hwc.

Closing this bug as the fact that powerskull works means CanvasLayer is at least rendering, albeit with some artifacts.
Flags: needinfo?(dwilson)
I don't understand the difference between bug 885345 and this bug.
(In reply to Diego Wilson [:diego] from comment #13)
> Closing this bug as the fact that powerskull works means CanvasLayer is at
> least rendering, albeit with some artifacts.

Did you mean to actually close the present bug? And bug 885345 is the one that should be worked on now?

(Didn't realize that I was the assignee until today).
Flags: needinfo?(dwilson)
Sorry, meant to close this bug. Please follow up on bug 885245.
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: needinfo?(dwilson)
Resolution: --- → INCOMPLETE
Arg s/bug 885245/bug 885345
Depends on: 909851
No longer depends on: 909851
You need to log in before you can comment on or make changes to this bug.