blob: 49f9f4c181de75e76e300ed3c847bae7e8069643 [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 Chehab41d80462016-08-19 16:53:38 -030018.. c:function:: int ioctl( int fd, VIDIOC_PREPARE_BUF, struct v4l2_buffer *argp )
19 :name: VIDIOC_PREPARE_BUF
Markus Heiser5377d912016-06-30 15:18:56 +020020
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030021
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030022Arguments
Markus Heiser5377d912016-06-30 15:18:56 +020023=========
24
25``fd``
26 File descriptor returned by :ref:`open() <func-open>`.
27
Markus Heiser5377d912016-06-30 15:18:56 +020028``argp``
Mauro Carvalho Chehab1473c752017-09-02 09:54:48 -040029 Pointer to struct :c:type:`v4l2_buffer`.
Markus Heiser5377d912016-06-30 15:18:56 +020030
31
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030032Description
Markus Heiser5377d912016-06-30 15:18:56 +020033===========
34
Mauro Carvalho Chehab2212ff22016-07-01 14:33:56 -030035Applications can optionally call the :ref:`VIDIOC_PREPARE_BUF` ioctl to
Markus Heiser5377d912016-06-30 15:18:56 +020036pass ownership of the buffer to the driver before actually enqueuing it,
Alexandre Courbotac09b2a2018-02-04 21:24:43 -050037using the :ref:`VIDIOC_QBUF <VIDIOC_QBUF>` ioctl, and to prepare it for future I/O. Such
Markus Heiser5377d912016-06-30 15:18:56 +020038preparations may include cache invalidation or cleaning. Performing them
39in advance saves time during the actual I/O. In case such cache
40operations are not required, the application can use one of
41``V4L2_BUF_FLAG_NO_CACHE_INVALIDATE`` and
42``V4L2_BUF_FLAG_NO_CACHE_CLEAN`` flags to skip the respective step.
43
Mauro Carvalho Chehabfc78c7c2016-09-08 05:43:01 -030044The struct :c:type:`v4l2_buffer` structure is specified in
Markus Heiser5377d912016-06-30 15:18:56 +020045:ref:`buffer`.
46
47
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030048Return Value
Markus Heiser5377d912016-06-30 15:18:56 +020049============
50
51On success 0 is returned, on error -1 and the ``errno`` variable is set
52appropriately. The generic error codes are described at the
53:ref:`Generic Error Codes <gen-errors>` chapter.
54
55EBUSY
56 File I/O is in progress.
57
58EINVAL
59 The buffer ``type`` is not supported, or the ``index`` is out of
60 bounds, or no buffers have been allocated yet, or the ``userptr`` or
61 ``length`` are invalid.