18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_PREPARE_BUF:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci************************
78c2ecf20Sopenharmony_ciioctl VIDIOC_PREPARE_BUF
88c2ecf20Sopenharmony_ci************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_PREPARE_BUF - Prepare a buffer for I/O
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_PREPARE_BUF
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_PREPARE_BUF, struct v4l2_buffer *argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciArguments
238c2ecf20Sopenharmony_ci=========
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci``fd``
268c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci``argp``
298c2ecf20Sopenharmony_ci    Pointer to struct :c:type:`v4l2_buffer`.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciDescription
328c2ecf20Sopenharmony_ci===========
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciApplications can optionally call the :ref:`VIDIOC_PREPARE_BUF` ioctl to
358c2ecf20Sopenharmony_cipass ownership of the buffer to the driver before actually enqueuing it,
368c2ecf20Sopenharmony_ciusing the :ref:`VIDIOC_QBUF <VIDIOC_QBUF>` ioctl, and to prepare it for future I/O. Such
378c2ecf20Sopenharmony_cipreparations may include cache invalidation or cleaning. Performing them
388c2ecf20Sopenharmony_ciin advance saves time during the actual I/O.
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciThe struct :c:type:`v4l2_buffer` structure is specified in
418c2ecf20Sopenharmony_ci:ref:`buffer`.
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciReturn Value
448c2ecf20Sopenharmony_ci============
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
478c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
488c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciEBUSY
518c2ecf20Sopenharmony_ci    File I/O is in progress.
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciEINVAL
548c2ecf20Sopenharmony_ci    The buffer ``type`` is not supported, or the ``index`` is out of
558c2ecf20Sopenharmony_ci    bounds, or no buffers have been allocated yet, or the ``userptr`` or
568c2ecf20Sopenharmony_ci    ``length`` are invalid.
57