media-ioc-request-alloc.rst 1.8 KB

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