blob: 0f51082f8c93a67ec4b6f4d7ccf67184fc8cd3de [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 Chehab586027c2016-07-05 07:58:48 -03009NAME
10====
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 Chehab586027c2016-07-05 07:58:48 -030014SYNOPSIS
Markus Heiser5377d912016-06-30 15:18:56 +020015========
16
Mauro Carvalho Chehabb7e67f62016-07-02 09:49:16 -030017.. cpp:function:: int ioctl( int fd, int request, struct v4l2_buffer *argp )
Markus Heiser5377d912016-06-30 15:18:56 +020018
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030019
20ARGUMENTS
Markus Heiser5377d912016-06-30 15:18:56 +020021=========
22
23``fd``
24 File descriptor returned by :ref:`open() <func-open>`.
25
26``request``
27 VIDIOC_PREPARE_BUF
28
29``argp``
30
31
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -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,
Mauro Carvalho Chehab2212ff22016-07-01 14:33:56 -030037using the :ref:`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 Chehabacf309a2016-07-03 13:28:28 -030044The :ref:`struct v4l2_buffer <v4l2-buffer>` structure is specified in
Markus Heiser5377d912016-06-30 15:18:56 +020045:ref:`buffer`.
46
47
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -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.