vimc.rst 3.3 KB

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