xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/media/vimc.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunThe Virtual Media Controller Driver (vimc)
4*4882a593Smuzhiyun==========================================
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThe vimc driver emulates complex video hardware using the V4L2 API and the Media
7*4882a593SmuzhiyunAPI. It has a capture device and three subdevices: sensor, debayer and scaler.
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunTopology
10*4882a593Smuzhiyun--------
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunThe topology is hardcoded, although you could modify it in vimc-core and
13*4882a593Smuzhiyunrecompile the driver to achieve your own topology. This is the default topology:
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun.. _vimc_topology_graph:
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun.. kernel-figure:: vimc.dot
18*4882a593Smuzhiyun    :alt:   Diagram of the default media pipeline topology
19*4882a593Smuzhiyun    :align: center
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun    Media pipeline graph on vimc
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunConfiguring the topology
24*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunEach subdevice will come with its default configuration (pixelformat, height,
27*4882a593Smuzhiyunwidth, ...). One needs to configure the topology in order to match the
28*4882a593Smuzhiyunconfiguration on each linked subdevice to stream frames through the pipeline.
29*4882a593SmuzhiyunIf the configuration doesn't match, the stream will fail. The ``v4l-utils``
30*4882a593Smuzhiyunpackage is a bundle of user-space applications, that comes with ``media-ctl`` and
31*4882a593Smuzhiyun``v4l2-ctl`` that can be used to configure the vimc configuration. This sequence
32*4882a593Smuzhiyunof commands fits for the default topology:
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun.. code-block:: bash
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun        media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
37*4882a593Smuzhiyun        media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
38*4882a593Smuzhiyun        media-ctl -d platform:vimc -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]'
39*4882a593Smuzhiyun        media-ctl -d platform:vimc -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]'
40*4882a593Smuzhiyun        v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=1920,height=1440
41*4882a593Smuzhiyun        v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
42*4882a593Smuzhiyun        v4l2-ctl -z platform:vimc -d "Raw Capture 1" -v pixelformat=BA81
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunSubdevices
45*4882a593Smuzhiyun----------
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunSubdevices define the behavior of an entity in the topology. Depending on the
48*4882a593Smuzhiyunsubdevice, the entity can have multiple pads of type source or sink.
49*4882a593Smuzhiyun
50*4882a593Smuzhiyunvimc-sensor:
51*4882a593Smuzhiyun	Generates images in several formats using video test pattern generator.
52*4882a593Smuzhiyun	Exposes:
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun	* 1 Pad source
55*4882a593Smuzhiyun
56*4882a593Smuzhiyunvimc-debayer:
57*4882a593Smuzhiyun	Transforms images in bayer format into a non-bayer format.
58*4882a593Smuzhiyun	Exposes:
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun	* 1 Pad sink
61*4882a593Smuzhiyun	* 1 Pad source
62*4882a593Smuzhiyun
63*4882a593Smuzhiyunvimc-scaler:
64*4882a593Smuzhiyun	Scale up the image by a factor of 3. E.g.: a 640x480 image becomes a
65*4882a593Smuzhiyun        1920x1440 image. (this value can be configured, see at
66*4882a593Smuzhiyun        `Module options`_).
67*4882a593Smuzhiyun	Exposes:
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun	* 1 Pad sink
70*4882a593Smuzhiyun	* 1 Pad source
71*4882a593Smuzhiyun
72*4882a593Smuzhiyunvimc-capture:
73*4882a593Smuzhiyun	Exposes node /dev/videoX to allow userspace to capture the stream.
74*4882a593Smuzhiyun	Exposes:
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun	* 1 Pad sink
77*4882a593Smuzhiyun	* 1 Pad source
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun
80*4882a593SmuzhiyunModule options
81*4882a593Smuzhiyun--------------
82*4882a593Smuzhiyun
83*4882a593SmuzhiyunVimc has a module parameter to configure the driver.
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun* ``sca_mult=<unsigned int>``
86*4882a593Smuzhiyun
87*4882a593Smuzhiyun        Image size multiplier factor to be used to multiply both width and
88*4882a593Smuzhiyun        height, so the image size will be ``sca_mult^2`` bigger than the
89*4882a593Smuzhiyun        original one. Currently, only supports scaling up (the default value
90*4882a593Smuzhiyun        is 3).
91