~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/userspace-api/media/v4l/vidioc-reqbufs.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/userspace-api/media/v4l/vidioc-reqbufs.rst (Version linux-6.12-rc7) and /Documentation/userspace-api/media/v4l/vidioc-reqbufs.rst (Version linux-5.8.18)


  1 .. SPDX-License-Identifier: GFDL-1.1-no-invari !!   1 .. Permission is granted to copy, distribute and/or modify this
  2 .. c:namespace:: V4L                           !!   2 .. document under the terms of the GNU Free Documentation License,
                                                   >>   3 .. Version 1.1 or any later version published by the Free Software
                                                   >>   4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
                                                   >>   5 .. and no Back-Cover Texts. A copy of the license is included at
                                                   >>   6 .. Documentation/userspace-api/media/fdl-appendix.rst.
                                                   >>   7 ..
                                                   >>   8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
  3                                                     9 
  4 .. _VIDIOC_REQBUFS:                                10 .. _VIDIOC_REQBUFS:
  5                                                    11 
  6 ********************                               12 ********************
  7 ioctl VIDIOC_REQBUFS                               13 ioctl VIDIOC_REQBUFS
  8 ********************                               14 ********************
  9                                                    15 
 10 Name                                               16 Name
 11 ====                                               17 ====
 12                                                    18 
 13 VIDIOC_REQBUFS - Initiate Memory Mapping, User     19 VIDIOC_REQBUFS - Initiate Memory Mapping, User Pointer I/O or DMA buffer I/O
 14                                                    20 
                                                   >>  21 
 15 Synopsis                                           22 Synopsis
 16 ========                                           23 ========
 17                                                    24 
 18 .. c:macro:: VIDIOC_REQBUFS                    !!  25 .. c:function:: int ioctl( int fd, VIDIOC_REQBUFS, struct v4l2_requestbuffers *argp )
                                                   >>  26     :name: VIDIOC_REQBUFS
 19                                                    27 
 20 ``int ioctl(int fd, VIDIOC_REQBUFS, struct v4l << 
 21                                                    28 
 22 Arguments                                          29 Arguments
 23 =========                                          30 =========
 24                                                    31 
 25 ``fd``                                             32 ``fd``
 26     File descriptor returned by :c:func:`open( !!  33     File descriptor returned by :ref:`open() <func-open>`.
 27                                                    34 
 28 ``argp``                                           35 ``argp``
 29     Pointer to struct :c:type:`v4l2_requestbuf     36     Pointer to struct :c:type:`v4l2_requestbuffers`.
 30                                                    37 
 31 Description                                        38 Description
 32 ===========                                        39 ===========
 33                                                    40 
 34 This ioctl is used to initiate :ref:`memory ma     41 This ioctl is used to initiate :ref:`memory mapped <mmap>`,
 35 :ref:`user pointer <userp>` or :ref:`DMABUF <d     42 :ref:`user pointer <userp>` or :ref:`DMABUF <dmabuf>` based I/O.
 36 Memory mapped buffers are located in device me     43 Memory mapped buffers are located in device memory and must be allocated
 37 with this ioctl before they can be mapped into     44 with this ioctl before they can be mapped into the application's address
 38 space. User buffers are allocated by applicati     45 space. User buffers are allocated by applications themselves, and this
 39 ioctl is merely used to switch the driver into     46 ioctl is merely used to switch the driver into user pointer I/O mode and
 40 to setup some internal structures. Similarly,      47 to setup some internal structures. Similarly, DMABUF buffers are
 41 allocated by applications through a device dri     48 allocated by applications through a device driver, and this ioctl only
 42 configures the driver into DMABUF I/O mode wit     49 configures the driver into DMABUF I/O mode without performing any direct
 43 allocation.                                        50 allocation.
 44                                                    51 
 45 To allocate device buffers applications initia     52 To allocate device buffers applications initialize all fields of the
 46 struct :c:type:`v4l2_requestbuffers` structure     53 struct :c:type:`v4l2_requestbuffers` structure. They set the ``type``
 47 field to the respective stream or buffer type,     54 field to the respective stream or buffer type, the ``count`` field to
 48 the desired number of buffers, ``memory`` must     55 the desired number of buffers, ``memory`` must be set to the requested
 49 I/O method and the ``reserved`` array must be      56 I/O method and the ``reserved`` array must be zeroed. When the ioctl is
 50 called with a pointer to this structure the dr     57 called with a pointer to this structure the driver will attempt to
 51 allocate the requested number of buffers and i     58 allocate the requested number of buffers and it stores the actual number
 52 allocated in the ``count`` field. It can be sm     59 allocated in the ``count`` field. It can be smaller than the number
 53 requested, even zero, when the driver runs out     60 requested, even zero, when the driver runs out of free memory. A larger
 54 number is also possible when the driver requir     61 number is also possible when the driver requires more buffers to
 55 function correctly. For example video output r     62 function correctly. For example video output requires at least two
 56 buffers, one displayed and one filled by the a     63 buffers, one displayed and one filled by the application.
 57                                                    64 
 58 When the I/O method is not supported the ioctl     65 When the I/O method is not supported the ioctl returns an ``EINVAL`` error
 59 code.                                              66 code.
 60                                                    67 
 61 Applications can call :ref:`VIDIOC_REQBUFS` ag     68 Applications can call :ref:`VIDIOC_REQBUFS` again to change the number of
 62 buffers. Note that if any buffers are still ma     69 buffers. Note that if any buffers are still mapped or exported via DMABUF,
 63 then :ref:`VIDIOC_REQBUFS` can only succeed if     70 then :ref:`VIDIOC_REQBUFS` can only succeed if the
 64 ``V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS`` capabi     71 ``V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS`` capability is set. Otherwise
 65 :ref:`VIDIOC_REQBUFS` will return the ``EBUSY`     72 :ref:`VIDIOC_REQBUFS` will return the ``EBUSY`` error code.
 66 If ``V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS`` is      73 If ``V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS`` is set, then these buffers are
 67 orphaned and will be freed when they are unmap     74 orphaned and will be freed when they are unmapped or when the exported DMABUF
 68 fds are closed. A ``count`` value of zero free     75 fds are closed. A ``count`` value of zero frees or orphans all buffers, after
 69 aborting or finishing any DMA in progress, an      76 aborting or finishing any DMA in progress, an implicit
 70 :ref:`VIDIOC_STREAMOFF <VIDIOC_STREAMON>`.         77 :ref:`VIDIOC_STREAMOFF <VIDIOC_STREAMON>`.
 71                                                    78 
                                                   >>  79 
 72 .. c:type:: v4l2_requestbuffers                    80 .. c:type:: v4l2_requestbuffers
 73                                                    81 
 74 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm !!  82 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
 75                                                << 
 76 .. cssclass:: longtable                        << 
 77                                                    83 
 78 .. flat-table:: struct v4l2_requestbuffers         84 .. flat-table:: struct v4l2_requestbuffers
 79     :header-rows:  0                               85     :header-rows:  0
 80     :stub-columns: 0                               86     :stub-columns: 0
 81     :widths:       1 1 2                           87     :widths:       1 1 2
 82                                                    88 
 83     * - __u32                                      89     * - __u32
 84       - ``count``                                  90       - ``count``
 85       - The number of buffers requested or gra     91       - The number of buffers requested or granted.
 86     * - __u32                                      92     * - __u32
 87       - ``type``                                   93       - ``type``
 88       - Type of the stream or buffers, this is     94       - Type of the stream or buffers, this is the same as the struct
 89         :c:type:`v4l2_format` ``type`` field.      95         :c:type:`v4l2_format` ``type`` field. See
 90         :c:type:`v4l2_buf_type` for valid valu     96         :c:type:`v4l2_buf_type` for valid values.
 91     * - __u32                                      97     * - __u32
 92       - ``memory``                                 98       - ``memory``
 93       - Applications set this field to ``V4L2_     99       - Applications set this field to ``V4L2_MEMORY_MMAP``,
 94         ``V4L2_MEMORY_DMABUF`` or ``V4L2_MEMOR    100         ``V4L2_MEMORY_DMABUF`` or ``V4L2_MEMORY_USERPTR``. See
 95         :c:type:`v4l2_memory`.                    101         :c:type:`v4l2_memory`.
 96     * - __u32                                     102     * - __u32
 97       - ``capabilities``                          103       - ``capabilities``
 98       - Set by the driver. If 0, then the driv    104       - Set by the driver. If 0, then the driver doesn't support
 99         capabilities. In that case all you kno    105         capabilities. In that case all you know is that the driver is
100         guaranteed to support ``V4L2_MEMORY_MM    106         guaranteed to support ``V4L2_MEMORY_MMAP`` and *might* support
101         other :c:type:`v4l2_memory` types. It     107         other :c:type:`v4l2_memory` types. It will not support any other
102         capabilities.                             108         capabilities.
103                                                   109 
104         If you want to query the capabilities     110         If you want to query the capabilities with a minimum of side-effects,
105         then this can be called with ``count``    111         then this can be called with ``count`` set to 0, ``memory`` set to
106         ``V4L2_MEMORY_MMAP`` and ``type`` set     112         ``V4L2_MEMORY_MMAP`` and ``type`` set to the buffer type. This will
107         free any previously allocated buffers,    113         free any previously allocated buffers, so this is typically something
108         that will be done at the start of the     114         that will be done at the start of the application.
109     * - __u8                                   !! 115     * - __u32
110       - ``flags``                              !! 116       - ``reserved``\ [1]
111       - Specifies additional buffer management !! 117       - A place holder for future extensions. Drivers and applications
112         See :ref:`memory-flags`.               !! 118         must set the array to zero.
113     * - __u8                                   !! 119 
114       - ``reserved``\ [3]                      !! 120 .. tabularcolumns:: |p{6.1cm}|p{2.2cm}|p{8.7cm}|
115       - Reserved for future extensions.        << 
116                                                   121 
117 .. _v4l2-buf-capabilities:                        122 .. _v4l2-buf-capabilities:
118 .. _V4L2-BUF-CAP-SUPPORTS-MMAP:                   123 .. _V4L2-BUF-CAP-SUPPORTS-MMAP:
119 .. _V4L2-BUF-CAP-SUPPORTS-USERPTR:                124 .. _V4L2-BUF-CAP-SUPPORTS-USERPTR:
120 .. _V4L2-BUF-CAP-SUPPORTS-DMABUF:                 125 .. _V4L2-BUF-CAP-SUPPORTS-DMABUF:
121 .. _V4L2-BUF-CAP-SUPPORTS-REQUESTS:               126 .. _V4L2-BUF-CAP-SUPPORTS-REQUESTS:
122 .. _V4L2-BUF-CAP-SUPPORTS-ORPHANED-BUFS:          127 .. _V4L2-BUF-CAP-SUPPORTS-ORPHANED-BUFS:
123 .. _V4L2-BUF-CAP-SUPPORTS-M2M-HOLD-CAPTURE-BUF    128 .. _V4L2-BUF-CAP-SUPPORTS-M2M-HOLD-CAPTURE-BUF:
124 .. _V4L2-BUF-CAP-SUPPORTS-MMAP-CACHE-HINTS:    !! 129 
125 .. _V4L2-BUF-CAP-SUPPORTS-MAX-NUM-BUFFERS:     !! 130 .. cssclass:: longtable
126 .. _V4L2-BUF-CAP-SUPPORTS-REMOVE-BUFS:         << 
127                                                   131 
128 .. flat-table:: V4L2 Buffer Capabilities Flags    132 .. flat-table:: V4L2 Buffer Capabilities Flags
129     :header-rows:  0                              133     :header-rows:  0
130     :stub-columns: 0                              134     :stub-columns: 0
131     :widths:       3 1 4                          135     :widths:       3 1 4
132                                                   136 
133     * - ``V4L2_BUF_CAP_SUPPORTS_MMAP``            137     * - ``V4L2_BUF_CAP_SUPPORTS_MMAP``
134       - 0x00000001                                138       - 0x00000001
135       - This buffer type supports the ``V4L2_M    139       - This buffer type supports the ``V4L2_MEMORY_MMAP`` streaming mode.
136     * - ``V4L2_BUF_CAP_SUPPORTS_USERPTR``         140     * - ``V4L2_BUF_CAP_SUPPORTS_USERPTR``
137       - 0x00000002                                141       - 0x00000002
138       - This buffer type supports the ``V4L2_M    142       - This buffer type supports the ``V4L2_MEMORY_USERPTR`` streaming mode.
139     * - ``V4L2_BUF_CAP_SUPPORTS_DMABUF``          143     * - ``V4L2_BUF_CAP_SUPPORTS_DMABUF``
140       - 0x00000004                                144       - 0x00000004
141       - This buffer type supports the ``V4L2_M    145       - This buffer type supports the ``V4L2_MEMORY_DMABUF`` streaming mode.
142     * - ``V4L2_BUF_CAP_SUPPORTS_REQUESTS``        146     * - ``V4L2_BUF_CAP_SUPPORTS_REQUESTS``
143       - 0x00000008                                147       - 0x00000008
144       - This buffer type supports :ref:`reques    148       - This buffer type supports :ref:`requests <media-request-api>`.
145     * - ``V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS`    149     * - ``V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS``
146       - 0x00000010                                150       - 0x00000010
147       - The kernel allows calling :ref:`VIDIOC    151       - The kernel allows calling :ref:`VIDIOC_REQBUFS` while buffers are still
148         mapped or exported via DMABUF. These o    152         mapped or exported via DMABUF. These orphaned buffers will be freed
149         when they are unmapped or when the exp    153         when they are unmapped or when the exported DMABUF fds are closed.
150     * - ``V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTU    154     * - ``V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF``
151       - 0x00000020                                155       - 0x00000020
152       - Only valid for stateless decoders. If     156       - Only valid for stateless decoders. If set, then userspace can set the
153         ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF``    157         ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` flag to hold off on returning the
154         capture buffer until the OUTPUT timest    158         capture buffer until the OUTPUT timestamp changes.
155     * - ``V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HIN << 
156       - 0x00000040                             << 
157       - This capability is set by the driver t << 
158         cache and memory management hints. How << 
159         queue is used for :ref:`memory mapping << 
160         :ref:`V4L2_BUF_FLAG_NO_CACHE_INVALIDAT << 
161         :ref:`V4L2_BUF_FLAG_NO_CACHE_CLEAN <V4 << 
162         :ref:`V4L2_MEMORY_FLAG_NON_COHERENT <V << 
163     * - ``V4L2_BUF_CAP_SUPPORTS_MAX_NUM_BUFFER << 
164       - 0x00000080                             << 
165       - If set, then the ``max_num_buffers`` f << 
166         is valid. If not set, then the maximum << 
167     * - ``V4L2_BUF_CAP_SUPPORTS_REMOVE_BUFS``  << 
168       - 0x00000100                             << 
169       - If set, then ``VIDIOC_REMOVE_BUFS`` is << 
170                                                << 
171 .. _memory-flags:                              << 
172 .. _V4L2-MEMORY-FLAG-NON-COHERENT:             << 
173                                                << 
174 .. flat-table:: Memory Consistency Flags       << 
175     :header-rows:  0                           << 
176     :stub-columns: 0                           << 
177     :widths:       3 1 4                       << 
178                                                << 
179     * - ``V4L2_MEMORY_FLAG_NON_COHERENT``      << 
180       - 0x00000001                             << 
181       - A buffer is allocated either in cohere << 
182         coherent between the CPU and the bus)  << 
183         latter can provide performance gains,  << 
184         sync/flush operations can be avoided i << 
185         corresponding device only and the CPU  << 
186         buffer. However, this requires extra c << 
187         guarantee memory consistency by issuin << 
188         consistency is needed. If this flag is << 
189         allocate the buffer in non-coherent me << 
190         only if the buffer is used for :ref:`m << 
191         queue reports the :ref:`V4L2_BUF_CAP_S << 
192         <V4L2-BUF-CAP-SUPPORTS-MMAP-CACHE-HINT << 
193                                                << 
194 .. raw:: latex                                 << 
195                                                << 
196    \normalsize                                 << 
197                                                   159 
198 Return Value                                      160 Return Value
199 ============                                      161 ============
200                                                   162 
201 On success 0 is returned, on error -1 and the     163 On success 0 is returned, on error -1 and the ``errno`` variable is set
202 appropriately. The generic error codes are des    164 appropriately. The generic error codes are described at the
203 :ref:`Generic Error Codes <gen-errors>` chapte    165 :ref:`Generic Error Codes <gen-errors>` chapter.
204                                                   166 
205 EINVAL                                            167 EINVAL
206     The buffer type (``type`` field) or the re    168     The buffer type (``type`` field) or the requested I/O method
207     (``memory``) is not supported.                169     (``memory``) is not supported.
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php