blob: 0f8b31874002c79777e58a3e33892742ab10e495 [file] [log] [blame]
Alexandre Courbotcbb6a7f2018-05-21 04:54:54 -04001.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections
2
3.. _media_ioc_request_alloc:
4
5*****************************
6ioctl MEDIA_IOC_REQUEST_ALLOC
7*****************************
8
9Name
10====
11
12MEDIA_IOC_REQUEST_ALLOC - Allocate a request
13
14
15Synopsis
16========
17
18.. c:function:: int ioctl( int fd, MEDIA_IOC_REQUEST_ALLOC, int *argp )
19 :name: MEDIA_IOC_REQUEST_ALLOC
20
21
22Arguments
23=========
24
25``fd``
26 File descriptor returned by :ref:`open() <media-func-open>`.
27
28``argp``
29 Pointer to an integer.
30
31
32Description
33===========
34
35If the media device supports :ref:`requests <media-request-api>`, then
36this ioctl can be used to allocate a request. If it is not supported, then
37``errno`` is set to ``ENOTTY``. A request is accessed through a file descriptor
38that is returned in ``*argp``.
39
40If the request was successfully allocated, then the request file descriptor
41can be passed to the :ref:`VIDIOC_QBUF <VIDIOC_QBUF>`,
42:ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`,
43:ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` and
44:ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctls.
45
46In addition, the request can be queued by calling
47:ref:`MEDIA_REQUEST_IOC_QUEUE` and re-initialized by calling
48:ref:`MEDIA_REQUEST_IOC_REINIT`.
49
50Finally, the file descriptor can be :ref:`polled <request-func-poll>` to wait
51for the request to complete.
52
53The request will remain allocated until all the file descriptors associated
54with it are closed by :ref:`close() <request-func-close>` and the driver no
Hans Verkuild4215ed2018-08-28 05:11:04 -040055longer uses the request internally. See also
56:ref:`here <media-request-life-time>` for more information.
Alexandre Courbotcbb6a7f2018-05-21 04:54:54 -040057
58Return Value
59============
60
61On success 0 is returned, on error -1 and the ``errno`` variable is set
62appropriately. The generic error codes are described at the
63:ref:`Generic Error Codes <gen-errors>` chapter.
64
65ENOTTY
66 The driver has no support for requests.