Commit f9e82502 authored by Dave Stevenson's avatar Dave Stevenson Committed by popcornmix
Browse files

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

Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.org>
parent f4d2776a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+5 −4
Original line number Diff line number Diff line
@@ -14,6 +14,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 += -Idrivers/staging/vc04_services -D__VCCOREVER__=0x04000000
+11 −0
Original line number Diff line number Diff line
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 −0
Original line number Diff line number Diff line
# 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 −0
Original line number Diff line number Diff line
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.
 No newline at end of file
Loading