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