162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci.. _planar-apis: 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci***************************** 662306a36Sopenharmony_ciSingle- and multi-planar APIs 762306a36Sopenharmony_ci***************************** 862306a36Sopenharmony_ci 962306a36Sopenharmony_ciSome devices require data for each input or output video frame to be 1062306a36Sopenharmony_ciplaced in discontiguous memory buffers. In such cases, one video frame 1162306a36Sopenharmony_cihas to be addressed using more than one memory address, i.e. one pointer 1262306a36Sopenharmony_ciper "plane". A plane is a sub-buffer of the current frame. For examples 1362306a36Sopenharmony_ciof such formats see :ref:`pixfmt`. 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ciInitially, V4L2 API did not support multi-planar buffers and a set of 1662306a36Sopenharmony_ciextensions has been introduced to handle them. Those extensions 1762306a36Sopenharmony_ciconstitute what is being referred to as the "multi-planar API". 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciSome of the V4L2 API calls and structures are interpreted differently, 2062306a36Sopenharmony_cidepending on whether single- or multi-planar API is being used. An 2162306a36Sopenharmony_ciapplication can choose whether to use one or the other by passing a 2262306a36Sopenharmony_cicorresponding buffer type to its ioctl calls. Multi-planar versions of 2362306a36Sopenharmony_cibuffer types are suffixed with an ``_MPLANE`` string. For a list of 2462306a36Sopenharmony_ciavailable multi-planar buffer types see enum 2562306a36Sopenharmony_ci:c:type:`v4l2_buf_type`. 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ciMulti-planar formats 2962306a36Sopenharmony_ci==================== 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ciMulti-planar API introduces new multi-planar formats. Those formats use 3262306a36Sopenharmony_cia separate set of FourCC codes. It is important to distinguish between 3362306a36Sopenharmony_cithe multi-planar API and a multi-planar format. Multi-planar API calls 3462306a36Sopenharmony_cican handle all single-planar formats as well (as long as they are passed 3562306a36Sopenharmony_ciin multi-planar API structures), while the single-planar API cannot 3662306a36Sopenharmony_cihandle multi-planar formats. 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ciCalls that distinguish between single and multi-planar APIs 4062306a36Sopenharmony_ci=========================================================== 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci:ref:`VIDIOC_QUERYCAP <VIDIOC_QUERYCAP>` 4362306a36Sopenharmony_ci Two additional multi-planar capabilities are added. They can be set 4462306a36Sopenharmony_ci together with non-multi-planar ones for devices that handle both 4562306a36Sopenharmony_ci single- and multi-planar formats. 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci:ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>`, :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`, :ref:`VIDIOC_TRY_FMT <VIDIOC_G_FMT>` 4862306a36Sopenharmony_ci New structures for describing multi-planar formats are added: struct 4962306a36Sopenharmony_ci :c:type:`v4l2_pix_format_mplane` and 5062306a36Sopenharmony_ci struct :c:type:`v4l2_plane_pix_format`. 5162306a36Sopenharmony_ci Drivers may define new multi-planar formats, which have distinct 5262306a36Sopenharmony_ci FourCC codes from the existing single-planar ones. 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci:ref:`VIDIOC_QBUF <VIDIOC_QBUF>`, :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>`, :ref:`VIDIOC_QUERYBUF <VIDIOC_QUERYBUF>` 5562306a36Sopenharmony_ci A new struct :c:type:`v4l2_plane` structure for 5662306a36Sopenharmony_ci describing planes is added. Arrays of this structure are passed in 5762306a36Sopenharmony_ci the new ``m.planes`` field of struct 5862306a36Sopenharmony_ci :c:type:`v4l2_buffer`. 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci:ref:`VIDIOC_REQBUFS <VIDIOC_REQBUFS>` 6162306a36Sopenharmony_ci Will allocate multi-planar buffers as requested. 62