1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L
354f38fcaSMauro Carvalho Chehab
454f38fcaSMauro Carvalho Chehab.. _VIDIOC_PREPARE_BUF:
554f38fcaSMauro Carvalho Chehab
654f38fcaSMauro Carvalho Chehab************************
754f38fcaSMauro Carvalho Chehabioctl VIDIOC_PREPARE_BUF
854f38fcaSMauro Carvalho Chehab************************
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho ChehabName
1154f38fcaSMauro Carvalho Chehab====
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabVIDIOC_PREPARE_BUF - Prepare a buffer for I/O
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_PREPARE_BUF
1954f38fcaSMauro Carvalho Chehab
20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_PREPARE_BUF, struct v4l2_buffer *argp)``
2154f38fcaSMauro Carvalho Chehab
2254f38fcaSMauro Carvalho ChehabArguments
2354f38fcaSMauro Carvalho Chehab=========
2454f38fcaSMauro Carvalho Chehab
2554f38fcaSMauro Carvalho Chehab``fd``
26407e84cdSMauro Carvalho Chehab    File descriptor returned by :c:func:`open()`.
2754f38fcaSMauro Carvalho Chehab
2854f38fcaSMauro Carvalho Chehab``argp``
2954f38fcaSMauro Carvalho Chehab    Pointer to struct :c:type:`v4l2_buffer`.
3054f38fcaSMauro Carvalho Chehab
3154f38fcaSMauro Carvalho ChehabDescription
3254f38fcaSMauro Carvalho Chehab===========
3354f38fcaSMauro Carvalho Chehab
3454f38fcaSMauro Carvalho ChehabApplications can optionally call the :ref:`VIDIOC_PREPARE_BUF` ioctl to
3554f38fcaSMauro Carvalho Chehabpass ownership of the buffer to the driver before actually enqueuing it,
3654f38fcaSMauro Carvalho Chehabusing the :ref:`VIDIOC_QBUF <VIDIOC_QBUF>` ioctl, and to prepare it for future I/O. Such
3754f38fcaSMauro Carvalho Chehabpreparations may include cache invalidation or cleaning. Performing them
3854f38fcaSMauro Carvalho Chehabin advance saves time during the actual I/O.
3954f38fcaSMauro Carvalho Chehab
4054f38fcaSMauro Carvalho ChehabThe struct :c:type:`v4l2_buffer` structure is specified in
4154f38fcaSMauro Carvalho Chehab:ref:`buffer`.
4254f38fcaSMauro Carvalho Chehab
4354f38fcaSMauro Carvalho ChehabReturn Value
4454f38fcaSMauro Carvalho Chehab============
4554f38fcaSMauro Carvalho Chehab
4654f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
4754f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
4854f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
4954f38fcaSMauro Carvalho Chehab
5054f38fcaSMauro Carvalho ChehabEBUSY
5154f38fcaSMauro Carvalho Chehab    File I/O is in progress.
5254f38fcaSMauro Carvalho Chehab
5354f38fcaSMauro Carvalho ChehabEINVAL
5454f38fcaSMauro Carvalho Chehab    The buffer ``type`` is not supported, or the ``index`` is out of
5554f38fcaSMauro Carvalho Chehab    bounds, or no buffers have been allocated yet, or the ``userptr`` or
5654f38fcaSMauro Carvalho Chehab    ``length`` are invalid.
57