1.. SPDX-License-Identifier: GPL-2.0
2
3The Virtual Media Controller Driver (vimc)
4==========================================
5
6The vimc driver emulates complex video hardware using the V4L2 API and the Media
7API. It has a capture device and three subdevices: sensor, debayer and scaler.
8
9Topology
10--------
11
12The topology is hardcoded, although you could modify it in vimc-core and
13recompile the driver to achieve your own topology. This is the default topology:
14
15.. _vimc_topology_graph:
16
17.. kernel-figure:: vimc.dot
18    :alt:   Diagram of the default media pipeline topology
19    :align: center
20
21    Media pipeline graph on vimc
22
23Configuring the topology
24~~~~~~~~~~~~~~~~~~~~~~~~
25
26Each subdevice will come with its default configuration (pixelformat, height,
27width, ...). One needs to configure the topology in order to match the
28configuration on each linked subdevice to stream frames through the pipeline.
29If the configuration doesn't match, the stream will fail. The ``v4l-utils``
30package is a bundle of user-space applications, that comes with ``media-ctl`` and
31``v4l2-ctl`` that can be used to configure the vimc configuration. This sequence
32of commands fits for the default topology:
33
34.. code-block:: bash
35
36        media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
37        media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
38        media-ctl -d platform:vimc -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]'
39        media-ctl -d platform:vimc -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]'
40        v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=1920,height=1440
41        v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
42        v4l2-ctl -z platform:vimc -d "Raw Capture 1" -v pixelformat=BA81
43
44Subdevices
45----------
46
47Subdevices define the behavior of an entity in the topology. Depending on the
48subdevice, the entity can have multiple pads of type source or sink.
49
50vimc-sensor:
51	Generates images in several formats using video test pattern generator.
52	Exposes:
53
54	* 1 Pad source
55
56vimc-debayer:
57	Transforms images in bayer format into a non-bayer format.
58	Exposes:
59
60	* 1 Pad sink
61	* 1 Pad source
62
63vimc-scaler:
64	Re-size the image to meet the source pad resolution. E.g.: if the sync
65	pad is configured to 360x480 and the source to 1280x720, the image will
66	be stretched to fit the source resolution. Works for any resolution
67	within the vimc limitations (even shrinking the image if necessary).
68	Exposes:
69
70	* 1 Pad sink
71	* 1 Pad source
72
73vimc-capture:
74	Exposes node /dev/videoX to allow userspace to capture the stream.
75	Exposes:
76
77	* 1 Pad sink
78	* 1 Pad source
79