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