Skip to content

Commit 6fefa38

Browse files
6by9popcornmix
authored andcommitted
staging: vc04_services: Add a V4L2 M2M codec driver
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. raspberrypi#4040 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
1 parent 618917d commit 6fefa38

7 files changed

Lines changed: 3043 additions & 0 deletions

File tree

‎drivers/staging/vc04_services/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ source "drivers/staging/vc04_services/bcm2835-audio/Kconfig"
4444
source "drivers/staging/vc04_services/bcm2835-camera/Kconfig"
4545

4646
source "drivers/staging/vc04_services/vc-sm-cma/Kconfig"
47+
source "drivers/staging/vc04_services/bcm2835-codec/Kconfig"
4748

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

‎drivers/staging/vc04_services/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ obj-$(CONFIG_SND_BCM2835) += bcm2835-audio/
1515
obj-$(CONFIG_VIDEO_BCM2835) += bcm2835-camera/
1616
obj-$(CONFIG_BCM2835_VCHIQ_MMAL) += vchiq-mmal/
1717
obj-$(CONFIG_BCM_VC_SM_CMA) += vc-sm-cma/
18+
obj-$(CONFIG_VIDEO_CODEC_BCM2835) += bcm2835-codec/
1819

1920
ccflags-y += -I $(srctree)/$(src)/include
2021

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
config VIDEO_CODEC_BCM2835
2+
tristate "BCM2835 Video codec support"
3+
depends on MEDIA_SUPPORT && MEDIA_CONTROLLER
4+
depends on VIDEO_V4L2 && (ARCH_BCM2835 || COMPILE_TEST)
5+
select BCM2835_VCHIQ_MMAL
6+
select VIDEOBUF2_DMA_CONTIG
7+
select V4L2_MEM2MEM_DEV
8+
help
9+
Say Y here to enable the V4L2 video codecs for
10+
Broadcom BCM2835 SoC. This operates over the VCHIQ interface
11+
to a service running on VideoCore.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
bcm2835-codec-objs := bcm2835-v4l2-codec.o
3+
4+
obj-$(CONFIG_VIDEO_CODEC_BCM2835) += bcm2835-codec.o
5+
6+
ccflags-y += \
7+
-I$(srctree)/drivers/staging/vc04_services \
8+
-D__VCCOREVER__=0x04000000
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
No issues. Depends on VCHIQ which is in staging.

0 commit comments

Comments
 (0)