0001 .. SPDX-License-Identifier: GPL-2.0
0002
0003 The Virtual Media Controller Driver (vimc)
0004 ==========================================
0005
0006 The vimc driver emulates complex video hardware using the V4L2 API and the Media
0007 API. It has a capture device and three subdevices: sensor, debayer and scaler.
0008
0009 Topology
0010 --------
0011
0012 The topology is hardcoded, although you could modify it in vimc-core and
0013 recompile the driver to achieve your own topology. This is the default topology:
0014
0015 .. _vimc_topology_graph:
0016
0017 .. kernel-figure:: vimc.dot
0018 :alt: Diagram of the default media pipeline topology
0019 :align: center
0020
0021 Media pipeline graph on vimc
0022
0023 Configuring the topology
0024 ~~~~~~~~~~~~~~~~~~~~~~~~
0025
0026 Each subdevice will come with its default configuration (pixelformat, height,
0027 width, ...). One needs to configure the topology in order to match the
0028 configuration on each linked subdevice to stream frames through the pipeline.
0029 If the configuration doesn't match, the stream will fail. The ``v4l-utils``
0030 package is a bundle of user-space applications, that comes with ``media-ctl`` and
0031 ``v4l2-ctl`` that can be used to configure the vimc configuration. This sequence
0032 of commands fits for the default topology:
0033
0034 .. code-block:: bash
0035
0036 media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
0037 media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
0038 media-ctl -d platform:vimc -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]'
0039 media-ctl -d platform:vimc -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]'
0040 v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=1920,height=1440
0041 v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
0042 v4l2-ctl -z platform:vimc -d "Raw Capture 1" -v pixelformat=BA81
0043
0044 Subdevices
0045 ----------
0046
0047 Subdevices define the behavior of an entity in the topology. Depending on the
0048 subdevice, the entity can have multiple pads of type source or sink.
0049
0050 vimc-sensor:
0051 Generates images in several formats using video test pattern generator.
0052 Exposes:
0053
0054 * 1 Pad source
0055
0056 vimc-lens:
0057 Ancillary lens for a sensor. Supports auto focus control. Linked to
0058 a vimc-sensor using an ancillary link. The lens supports FOCUS_ABSOLUTE
0059 control.
0060
0061 .. code-block:: bash
0062
0063 media-ctl -p
0064 ...
0065 - entity 28: Lens A (0 pad, 0 link)
0066 type V4L2 subdev subtype Lens flags 0
0067 device node name /dev/v4l-subdev6
0068 - entity 29: Lens B (0 pad, 0 link)
0069 type V4L2 subdev subtype Lens flags 0
0070 device node name /dev/v4l-subdev7
0071 v4l2-ctl -d /dev/v4l-subdev7 -C focus_absolute
0072 focus_absolute: 0
0073
0074
0075 vimc-debayer:
0076 Transforms images in bayer format into a non-bayer format.
0077 Exposes:
0078
0079 * 1 Pad sink
0080 * 1 Pad source
0081
0082 vimc-scaler:
0083 Re-size the image to meet the source pad resolution. E.g.: if the sync
0084 pad is configured to 360x480 and the source to 1280x720, the image will
0085 be stretched to fit the source resolution. Works for any resolution
0086 within the vimc limitations (even shrinking the image if necessary).
0087 Exposes:
0088
0089 * 1 Pad sink
0090 * 1 Pad source
0091
0092 vimc-capture:
0093 Exposes node /dev/videoX to allow userspace to capture the stream.
0094 Exposes:
0095
0096 * 1 Pad sink
0097 * 1 Pad source
0098
0099 Module options
0100 --------------
0101
0102 Vimc has a module parameter to configure the driver.
0103
0104 * ``allocator=<unsigned int>``
0105
0106 memory allocator selection, default is 0. It specifies the way buffers
0107 will be allocated.
0108
0109 - 0: vmalloc
0110 - 1: dma-contig