xref: /linux/Documentation/userspace-api/media/v4l/dev-mem2mem.rst (revision 778b8ebe5192e7a7f00563a7456517dfa63e1d90)
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2.. c:namespace:: V4L
3
4.. _mem2mem:
5
6********************************
7Video Memory-To-Memory Interface
8********************************
9
10A V4L2 memory-to-memory device can compress, decompress, transform, or
11otherwise convert video data from one format into another format, in memory.
12Such memory-to-memory devices set the ``V4L2_CAP_VIDEO_M2M`` or
13``V4L2_CAP_VIDEO_M2M_MPLANE`` capability. Examples of memory-to-memory
14devices are codecs, scalers, deinterlacers or format converters (i.e.
15converting from YUV to RGB).
16
17A memory-to-memory video node acts just like a normal video node, but it
18supports both output (sending frames from memory to the hardware)
19and capture (receiving the processed frames from the hardware into
20memory) stream I/O. An application will have to setup the stream I/O for
21both sides and finally call :ref:`VIDIOC_STREAMON <VIDIOC_STREAMON>`
22for both capture and output to start the hardware.
23
24Memory-to-memory devices function as a shared resource: you can
25open the video node multiple times, each application setting up their
26own properties that are local to the file handle, and each can use
27it independently from the others. The driver will arbitrate access to
28the hardware and reprogram it whenever another file handler gets access.
29This is different from the usual video node behavior where the video
30properties are global to the device (i.e. changing something through one
31file handle is visible through another file handle).
32
33One of the most common memory-to-memory device is the codec. Codecs
34are more complicated than most and require additional setup for
35their codec parameters. This is done through codec controls.
36See :ref:`codec-controls`. More details on how to use codec memory-to-memory
37devices are given in the following sections.
38
39.. toctree::
40    :maxdepth: 1
41
42    dev-decoder
43    dev-encoder
44    dev-stateless-decoder
45