xref: /linux/Documentation/admin-guide/media/vimc.rst (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
103f4175bSAndré Almeida.. SPDX-License-Identifier: GPL-2.0
203f4175bSAndré Almeida
303f4175bSAndré AlmeidaThe Virtual Media Controller Driver (vimc)
403f4175bSAndré Almeida==========================================
503f4175bSAndré Almeida
603f4175bSAndré AlmeidaThe vimc driver emulates complex video hardware using the V4L2 API and the Media
703f4175bSAndré AlmeidaAPI. It has a capture device and three subdevices: sensor, debayer and scaler.
803f4175bSAndré Almeida
903f4175bSAndré AlmeidaTopology
1003f4175bSAndré Almeida--------
1103f4175bSAndré Almeida
1203f4175bSAndré AlmeidaThe topology is hardcoded, although you could modify it in vimc-core and
1303f4175bSAndré Almeidarecompile the driver to achieve your own topology. This is the default topology:
1403f4175bSAndré Almeida
1503f4175bSAndré Almeida.. _vimc_topology_graph:
1603f4175bSAndré Almeida
1703f4175bSAndré Almeida.. kernel-figure:: vimc.dot
18edb0b4e2SAndré Almeida    :alt:   Diagram of the default media pipeline topology
1903f4175bSAndré Almeida    :align: center
2003f4175bSAndré Almeida
2103f4175bSAndré Almeida    Media pipeline graph on vimc
2203f4175bSAndré Almeida
2303f4175bSAndré AlmeidaConfiguring the topology
2403f4175bSAndré Almeida~~~~~~~~~~~~~~~~~~~~~~~~
2503f4175bSAndré Almeida
2603f4175bSAndré AlmeidaEach subdevice will come with its default configuration (pixelformat, height,
2703f4175bSAndré Almeidawidth, ...). One needs to configure the topology in order to match the
2803f4175bSAndré Almeidaconfiguration on each linked subdevice to stream frames through the pipeline.
2903f4175bSAndré AlmeidaIf the configuration doesn't match, the stream will fail. The ``v4l-utils``
3003f4175bSAndré Almeidapackage is a bundle of user-space applications, that comes with ``media-ctl`` and
3103f4175bSAndré Almeida``v4l2-ctl`` that can be used to configure the vimc configuration. This sequence
3203f4175bSAndré Almeidaof commands fits for the default topology:
3303f4175bSAndré Almeida
3403f4175bSAndré Almeida.. code-block:: bash
3503f4175bSAndré Almeida
3603f4175bSAndré Almeida        media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
3703f4175bSAndré Almeida        media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
3803f4175bSAndré Almeida        media-ctl -d platform:vimc -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]'
3903f4175bSAndré Almeida        media-ctl -d platform:vimc -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]'
4003f4175bSAndré Almeida        v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=1920,height=1440
4103f4175bSAndré Almeida        v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
4203f4175bSAndré Almeida        v4l2-ctl -z platform:vimc -d "Raw Capture 1" -v pixelformat=BA81
4303f4175bSAndré Almeida
4403f4175bSAndré AlmeidaSubdevices
4503f4175bSAndré Almeida----------
4603f4175bSAndré Almeida
4703f4175bSAndré AlmeidaSubdevices define the behavior of an entity in the topology. Depending on the
4803f4175bSAndré Almeidasubdevice, the entity can have multiple pads of type source or sink.
4903f4175bSAndré Almeida
5003f4175bSAndré Almeidavimc-sensor:
5103f4175bSAndré Almeida	Generates images in several formats using video test pattern generator.
5203f4175bSAndré Almeida	Exposes:
5303f4175bSAndré Almeida
5403f4175bSAndré Almeida	* 1 Pad source
5503f4175bSAndré Almeida
5603f4175bSAndré Almeidavimc-debayer:
5703f4175bSAndré Almeida	Transforms images in bayer format into a non-bayer format.
5803f4175bSAndré Almeida	Exposes:
5903f4175bSAndré Almeida
6003f4175bSAndré Almeida	* 1 Pad sink
6103f4175bSAndré Almeida	* 1 Pad source
6203f4175bSAndré Almeida
6303f4175bSAndré Almeidavimc-scaler:
6403f4175bSAndré Almeida	Scale up the image by a factor of 3. E.g.: a 640x480 image becomes a
6503f4175bSAndré Almeida        1920x1440 image. (this value can be configured, see at
6603f4175bSAndré Almeida        `Module options`_).
6703f4175bSAndré Almeida	Exposes:
6803f4175bSAndré Almeida
6903f4175bSAndré Almeida	* 1 Pad sink
7003f4175bSAndré Almeida	* 1 Pad source
7103f4175bSAndré Almeida
7203f4175bSAndré Almeidavimc-capture:
7303f4175bSAndré Almeida	Exposes node /dev/videoX to allow userspace to capture the stream.
7403f4175bSAndré Almeida	Exposes:
7503f4175bSAndré Almeida
7603f4175bSAndré Almeida	* 1 Pad sink
7703f4175bSAndré Almeida	* 1 Pad source
7803f4175bSAndré Almeida
7978364ccfSShuah Khan
8003f4175bSAndré AlmeidaModule options
8178364ccfSShuah Khan--------------
8203f4175bSAndré Almeida
83*76df2e6cSArthur Moraes do LagoVimc has a module parameter to configure the driver.
8403f4175bSAndré Almeida
8578364ccfSShuah Khan* ``sca_mult=<unsigned int>``
8603f4175bSAndré Almeida
8703f4175bSAndré Almeida        Image size multiplier factor to be used to multiply both width and
8803f4175bSAndré Almeida        height, so the image size will be ``sca_mult^2`` bigger than the
8903f4175bSAndré Almeida        original one. Currently, only supports scaling up (the default value
9003f4175bSAndré Almeida        is 3).
91