18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci.. c:namespace:: MC 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci.. _media_ioc_request_alloc: 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci***************************** 78c2ecf20Sopenharmony_ciioctl MEDIA_IOC_REQUEST_ALLOC 88c2ecf20Sopenharmony_ci***************************** 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciName 118c2ecf20Sopenharmony_ci==== 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciMEDIA_IOC_REQUEST_ALLOC - Allocate a request 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciSynopsis 168c2ecf20Sopenharmony_ci======== 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci.. c:macro:: MEDIA_IOC_REQUEST_ALLOC 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci``int ioctl(int fd, MEDIA_IOC_REQUEST_ALLOC, int *argp)`` 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciArguments 238c2ecf20Sopenharmony_ci========= 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci``fd`` 268c2ecf20Sopenharmony_ci File descriptor returned by :c:func:`open()`. 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci``argp`` 298c2ecf20Sopenharmony_ci Pointer to an integer. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciDescription 328c2ecf20Sopenharmony_ci=========== 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciIf the media device supports :ref:`requests <media-request-api>`, then 358c2ecf20Sopenharmony_cithis ioctl can be used to allocate a request. If it is not supported, then 368c2ecf20Sopenharmony_ci``errno`` is set to ``ENOTTY``. A request is accessed through a file descriptor 378c2ecf20Sopenharmony_cithat is returned in ``*argp``. 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciIf the request was successfully allocated, then the request file descriptor 408c2ecf20Sopenharmony_cican be passed to the :ref:`VIDIOC_QBUF <VIDIOC_QBUF>`, 418c2ecf20Sopenharmony_ci:ref:`VIDIOC_G_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>`, 428c2ecf20Sopenharmony_ci:ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` and 438c2ecf20Sopenharmony_ci:ref:`VIDIOC_TRY_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` ioctls. 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ciIn addition, the request can be queued by calling 468c2ecf20Sopenharmony_ci:ref:`MEDIA_REQUEST_IOC_QUEUE` and re-initialized by calling 478c2ecf20Sopenharmony_ci:ref:`MEDIA_REQUEST_IOC_REINIT`. 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciFinally, the file descriptor can be :ref:`polled <request-func-poll>` to wait 508c2ecf20Sopenharmony_cifor the request to complete. 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciThe request will remain allocated until all the file descriptors associated 538c2ecf20Sopenharmony_ciwith it are closed by :c:func:`close()` and the driver no 548c2ecf20Sopenharmony_cilonger uses the request internally. See also 558c2ecf20Sopenharmony_ci:ref:`here <media-request-life-time>` for more information. 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ciReturn Value 588c2ecf20Sopenharmony_ci============ 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 618c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the 628c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ciENOTTY 658c2ecf20Sopenharmony_ci The driver has no support for requests. 66