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