Alexandre Courbot | cbb6a7f | 2018-05-21 04:54:54 -0400 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections |
| 2 | |
| 3 | .. _media_ioc_request_alloc: |
| 4 | |
| 5 | ***************************** |
| 6 | ioctl MEDIA_IOC_REQUEST_ALLOC |
| 7 | ***************************** |
| 8 | |
| 9 | Name |
| 10 | ==== |
| 11 | |
| 12 | MEDIA_IOC_REQUEST_ALLOC - Allocate a request |
| 13 | |
| 14 | |
| 15 | Synopsis |
| 16 | ======== |
| 17 | |
| 18 | .. c:function:: int ioctl( int fd, MEDIA_IOC_REQUEST_ALLOC, int *argp ) |
| 19 | :name: MEDIA_IOC_REQUEST_ALLOC |
| 20 | |
| 21 | |
| 22 | Arguments |
| 23 | ========= |
| 24 | |
| 25 | ``fd`` |
| 26 | File descriptor returned by :ref:`open() <media-func-open>`. |
| 27 | |
| 28 | ``argp`` |
| 29 | Pointer to an integer. |
| 30 | |
| 31 | |
| 32 | Description |
| 33 | =========== |
| 34 | |
| 35 | If the media device supports :ref:`requests <media-request-api>`, then |
| 36 | this 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 |
| 38 | that is returned in ``*argp``. |
| 39 | |
| 40 | If the request was successfully allocated, then the request file descriptor |
| 41 | can 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 | |
| 46 | In 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 | |
| 50 | Finally, the file descriptor can be :ref:`polled <request-func-poll>` to wait |
| 51 | for the request to complete. |
| 52 | |
| 53 | The request will remain allocated until all the file descriptors associated |
| 54 | with it are closed by :ref:`close() <request-func-close>` and the driver no |
Hans Verkuil | d4215ed | 2018-08-28 05:11:04 -0400 | [diff] [blame] | 55 | longer uses the request internally. See also |
| 56 | :ref:`here <media-request-life-time>` for more information. |
Alexandre Courbot | cbb6a7f | 2018-05-21 04:54:54 -0400 | [diff] [blame] | 57 | |
| 58 | Return Value |
| 59 | ============ |
| 60 | |
| 61 | On success 0 is returned, on error -1 and the ``errno`` variable is set |
| 62 | appropriately. The generic error codes are described at the |
| 63 | :ref:`Generic Error Codes <gen-errors>` chapter. |
| 64 | |
| 65 | ENOTTY |
| 66 | The driver has no support for requests. |