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).

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
  • Loading branch information
6by9 authored and pelwell committed Dec 3, 2018
1 parent 9ee46cd commit 3060e40
Show file tree
Hide file tree
Showing 6 changed files with 2,408 additions and 4 deletions.
1 change: 1 addition & 0 deletions drivers/staging/vc04_services/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ source "drivers/staging/vc04_services/bcm2835-audio/Kconfig"
source "drivers/staging/vc04_services/bcm2835-camera/Kconfig"
source "drivers/staging/vc04_services/vchiq-mmal/Kconfig"
source "drivers/staging/vc04_services/vc-sm-cma/Kconfig"
source "drivers/staging/vc04_services/bcm2835-codec/Kconfig"

endif

9 changes: 5 additions & 4 deletions drivers/staging/vc04_services/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ vchiq-objs := \
interface/vchiq_arm/vchiq_util.o \
interface/vchiq_arm/vchiq_connected.o \

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_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 += -Idrivers/staging/vc04_services -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
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 += \
-Idrivers/staging/vc04_services \
-D__VCCOREVER__=0x04000000
24 changes: 24 additions & 0 deletions drivers/staging/vc04_services/bcm2835-codec/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
1) Convert to be a platform driver.

Right now when the module probes, it tries to initialize VCHI and
errors out if it wasn't ready yet. If bcm2835-v4l2 was built in, then
VCHI generally isn't ready because it depends on both the firmware and
mailbox drivers having already loaded.

We should have VCHI create a platform device once it's initialized,
and have this driver bind to it, so that we automatically load the
v4l2 module after VCHI loads.

2) Support SELECTION API to define crop region on the image for encode.

Particularly for resolutions that aren't a multiple of the macroblock
size, the codec will report a resolution that is a multiple of the macroblock
size (it has to have the memory to decode into), and then a different crop
region within that buffer.
The most common example is 1080P, where the buffer will be 1920x1088 with a
crop region of 1920x1080.

3) Refactor so that the component creation is only on queue_setup, not open.

Fixes v4l2-compliance failure on trying to open 100 instances of the
device.
Loading

0 comments on commit 3060e40

Please sign in to comment.