Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V4L2 stateful decode update #4593

Merged
merged 11 commits into from
Sep 23, 2021
Merged

Conversation

6by9
Copy link
Contributor

@6by9 6by9 commented Sep 20, 2021

A couple of fixes for the stateful decode (wants fw 1239).

Also adds support for H&V flips to the ISP wrapper.

@popcornmix
Copy link
Collaborator

popcornmix commented Sep 21, 2021

I tested this (along with firmware changes) with kodi, and didn't see any issues (no observable change).

@6by9
Copy link
Contributor Author

6by9 commented Sep 21, 2021

Added one further commit that resolves a refcounting issue should you reuse the same MMAL component instance after a timeout returning buffers. That makes Chromium happier.

…URE)

The V4L2 stateful video decoder API requires that you can STREAMON
on only the OUTPUT queue, feed in buffers, and wait for the
SOURCE_CHANGE event.
This requires that we enable the MMAL output port at the same time
as the input port, because the output port is the one that creates
the SOURCE_CHANGED event.

Signed-off-by: Dave Stevenson <[email protected]>
With video decode we now enable both input and output ports on
the component. This means that buffers will get passed to the VPU
earlier than desired if they are queued befoer STREAMON.

Check that the queue is streaming before sending buffers to the VPU.

Signed-off-by: Dave Stevenson <[email protected]>
The list of includes was slightly over generic, and wasn't
in alphabetical order. Clean it up.

Signed-off-by: Dave Stevenson <[email protected]>
@6by9 6by9 changed the title V4L2 stateful decode update WIP: V4L2 stateful decode update Sep 22, 2021
@6by9 6by9 force-pushed the rpi-5.10.y-codecs branch from ffa4802 to 0dcf5b9 Compare September 22, 2021 16:19
@6by9
Copy link
Contributor Author

6by9 commented Sep 22, 2021

Rebased and tweaked some patches. Added WIP tag as John needs to test under Chromium.
FFmpeg and GStreamer seem happy.

When a format changed event occurs, the spec says that it
triggers an implicit drain, and that needs to be signalled
via -EPIPE.

For BCM2835, the format changed event happens at the point
the format change occurs, so no further buffers exist from
before the resolution changed point. We therefore signal the
last buffer immediately.
We don't have a V4L2 available to us at this point, so set
the videobuf2 queue last_buffer_dequeued flag directly.

Signed-off-by: Dave Stevenson <[email protected]>
The firmware defaults to not stopping video decode if only the
pixel aspect ratio or colourspace change. V4L2 requires us
to stop decoding on any change, therefore tell the firmware
of the desire for this alternate behaviour.

Signed-off-by: Dave Stevenson <[email protected]>
Adds a module parameter "debug" to enable various logging levels.

Signed-off-by: Dave Stevenson <[email protected]>
When a buffer is returned on a port that is disabled, return it
to the videobuf2 QUEUED state instead of DONE which returns it
to the client.

Signed-off-by: Dave Stevenson <[email protected]>
Should we go through the timeout failure case with port_disable
not returning all buffers for whatever reason, the
buffers_with_vpu counter gets left at a non-zero value, which
will cause reference counting issues should the instance be
reused.

Reset the count when the port is enabled again, but before
any buffers have been sent to the VPU.

Signed-off-by: Dave Stevenson <[email protected]>
Completions don't reference count, so setting the completion
on the first buffer returned and then not reinitialising it
means that the flush function doesn't behave as intended.

Signal the completion when the last buffer is returned.

Signed-off-by: Dave Stevenson <[email protected]>
Currently the code was only setting some controls from
bcm2835_codec_set_ctrls, but it's simpler to use
v4l2_ctrl_handler_setup to avoid forgetting to adding new
controls to the list.

Signed-off-by: Dave Stevenson <[email protected]>
The ISP can do H & V flips whilst resizing or converting
the image, so expose that via V4L2_CID_[H|V]FLIP.

Signed-off-by: Dave Stevenson <[email protected]>
@6by9 6by9 force-pushed the rpi-5.10.y-codecs branch from 0dcf5b9 to 3da0a09 Compare September 23, 2021 10:36
@6by9 6by9 changed the title WIP: V4L2 stateful decode update V4L2 stateful decode update Sep 23, 2021
@6by9
Copy link
Contributor Author

6by9 commented Sep 23, 2021

Updated again as we've resolved the Chromium issue.

If @popcornmix could check against Kodi that would be useful, otherwise I think we're good to go.

@popcornmix
Copy link
Collaborator

Kodi appears fine with this PR (and latest firmware) in a quick test.

@popcornmix
Copy link
Collaborator

Okay to merge?

@6by9
Copy link
Contributor Author

6by9 commented Sep 23, 2021

Thank popcornmix.
I've tested against Chromium with both Buster and Bullseye, FFmpeg (predominantly Bullseye), and GStreamer. That covers most of the main clients.

@pelwell pelwell merged commit edded5e into raspberrypi:rpi-5.10.y Sep 23, 2021
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Sep 23, 2021
See: raspberrypi/linux#4593

kernel: rpivid: Ensure IRQs have completed before uniniting context
See: raspberrypi/linux#4599

kernel: net: phy: lan87xx: Allow more time for link detect
See: raspberrypi/linux#4598
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Sep 23, 2021
See: raspberrypi/linux#4593

kernel: rpivid: Ensure IRQs have completed before uniniting context
See: raspberrypi/linux#4599

kernel: net: phy: lan87xx: Allow more time for link detect
See: raspberrypi/linux#4598
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants