blob: 79076dff46fdae056eab91403703d9d18e0dc1ab [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -03003.. _VIDIOC_PREPARE_BUF:
Markus Heiser5377d912016-06-30 15:18:56 +02004
5************************
6ioctl VIDIOC_PREPARE_BUF
7************************
8
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -03009Name
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030010====
Markus Heiser5377d912016-06-30 15:18:56 +020011
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030012VIDIOC_PREPARE_BUF - Prepare a buffer for I/O
Markus Heiser5377d912016-06-30 15:18:56 +020013
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030014
15Synopsis
Markus Heiser5377d912016-06-30 15:18:56 +020016========
17
Mauro Carvalho Chehabb7e67f62016-07-02 09:49:16 -030018.. cpp:function:: int ioctl( int fd, int request, struct v4l2_buffer *argp )
Markus Heiser5377d912016-06-30 15:18:56 +020019
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030020
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030021Arguments
Markus Heiser5377d912016-06-30 15:18:56 +020022=========
23
24``fd``
25 File descriptor returned by :ref:`open() <func-open>`.
26
27``request``
28 VIDIOC_PREPARE_BUF
29
30``argp``
31
32
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030033Description
Markus Heiser5377d912016-06-30 15:18:56 +020034===========
35
Mauro Carvalho Chehab2212ff22016-07-01 14:33:56 -030036Applications can optionally call the :ref:`VIDIOC_PREPARE_BUF` ioctl to
Markus Heiser5377d912016-06-30 15:18:56 +020037pass ownership of the buffer to the driver before actually enqueuing it,
Mauro Carvalho Chehab2212ff22016-07-01 14:33:56 -030038using the :ref:`VIDIOC_QBUF` ioctl, and to prepare it for future I/O. Such
Markus Heiser5377d912016-06-30 15:18:56 +020039preparations may include cache invalidation or cleaning. Performing them
40in advance saves time during the actual I/O. In case such cache
41operations are not required, the application can use one of
42``V4L2_BUF_FLAG_NO_CACHE_INVALIDATE`` and
43``V4L2_BUF_FLAG_NO_CACHE_CLEAN`` flags to skip the respective step.
44
Mauro Carvalho Chehabacf309a2016-07-03 13:28:28 -030045The :ref:`struct v4l2_buffer <v4l2-buffer>` structure is specified in
Markus Heiser5377d912016-06-30 15:18:56 +020046:ref:`buffer`.
47
48
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030049Return Value
Markus Heiser5377d912016-06-30 15:18:56 +020050============
51
52On success 0 is returned, on error -1 and the ``errno`` variable is set
53appropriately. The generic error codes are described at the
54:ref:`Generic Error Codes <gen-errors>` chapter.
55
56EBUSY
57 File I/O is in progress.
58
59EINVAL
60 The buffer ``type`` is not supported, or the ``index`` is out of
61 bounds, or no buffers have been allocated yet, or the ``userptr`` or
62 ``length`` are invalid.