Skip to content

Commit

Permalink
staging: vc04_services: Add a V4L2 M2M codec driver
Browse files Browse the repository at this point in the history
This adds a V4L2 memory to memory device that wraps the MMAL
video decode and video_encode components for H264 and MJPEG encode
and decode, MPEG4, H263, and VP8 decode (and MPEG2 decode
if the appropriate licence has been purchased).

This patch squashes all the work done in developing the driver
on the Raspberry Pi rpi-5.4.y kernel branch.
Thanks to Kieran Bingham, Aman Gupta, Chen-Yu Tsai, and
Marek Behún for their contributions. Please refer to the
rpi-5.4.y branch for the full history.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

staging/bcm2835-codec: Ensure OUTPUT timestamps are always forwarded

The firmware by default tries to ensure that decoded frame
timestamps always increment. This is counter to the V4L2 API
which wants exactly the OUTPUT queue timestamps passed to the
CAPTURE queue buffers.

Disable the firmware option.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

staging/vc04_services/codec: Add support for CID MPEG_HEADER_MODE

Control V4L2_CID_MPEG_VIDEO_HEADER_MODE controls whether the encoder
is meant to emit the header bytes as a separate packet or with the
first encoded frame.
Add support for it.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

staging/vc04_services/codec: Clear last buf dequeued flag on START

It appears that the V4L2 M2M framework requires the driver to manually
call vb2_clear_last_buffer_dequeued on the CAPTURE queue during a
V4L2_DEC_CMD_START.
Add such a call.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

staging/vc04-services/codec: Fix logical precedence issue

Two issues identified with operator precedence in logical
expressions. Fix them.

#4040

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
  • Loading branch information
6by9 authored and popcornmix committed Feb 16, 2021
1 parent 78f4d04 commit 891be43
Show file tree
Hide file tree
Showing 7 changed files with 3,041 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/staging/vc04_services/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ source "drivers/staging/vc04_services/bcm2835-audio/Kconfig"
source "drivers/staging/vc04_services/bcm2835-camera/Kconfig"

source "drivers/staging/vc04_services/vc-sm-cma/Kconfig"
source "drivers/staging/vc04_services/bcm2835-codec/Kconfig"

source "drivers/staging/vc04_services/vchiq-mmal/Kconfig"

Expand Down
1 change: 1 addition & 0 deletions drivers/staging/vc04_services/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ obj-$(CONFIG_SND_BCM2835) += bcm2835-audio/
obj-$(CONFIG_VIDEO_BCM2835) += bcm2835-camera/
obj-$(CONFIG_BCM2835_VCHIQ_MMAL) += vchiq-mmal/
obj-$(CONFIG_BCM_VC_SM_CMA) += vc-sm-cma/
obj-$(CONFIG_VIDEO_CODEC_BCM2835) += bcm2835-codec/

ccflags-y += -I $(srctree)/$(src)/include -D__VCCOREVER__=0x04000000

11 changes: 11 additions & 0 deletions drivers/staging/vc04_services/bcm2835-codec/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
config VIDEO_CODEC_BCM2835
tristate "BCM2835 Video codec support"
depends on MEDIA_SUPPORT && MEDIA_CONTROLLER
depends on VIDEO_V4L2 && (ARCH_BCM2835 || COMPILE_TEST)
select BCM2835_VCHIQ_MMAL
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
help
Say Y here to enable the V4L2 video codecs for
Broadcom BCM2835 SoC. This operates over the VCHIQ interface
to a service running on VideoCore.
8 changes: 8 additions & 0 deletions drivers/staging/vc04_services/bcm2835-codec/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-License-Identifier: GPL-2.0
bcm2835-codec-objs := bcm2835-v4l2-codec.o

obj-$(CONFIG_VIDEO_CODEC_BCM2835) += bcm2835-codec.o

ccflags-y += \
-I$(srctree)/drivers/staging/vc04_services \
-D__VCCOREVER__=0x04000000
1 change: 1 addition & 0 deletions drivers/staging/vc04_services/bcm2835-codec/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No issues. Depends on VCHIQ which is in staging.
Loading

0 comments on commit 891be43

Please sign in to comment.