media-request-ioc-queue.rst 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: MC
  3. .. _media_request_ioc_queue:
  4. *****************************
  5. ioctl MEDIA_REQUEST_IOC_QUEUE
  6. *****************************
  7. Name
  8. ====
  9. MEDIA_REQUEST_IOC_QUEUE - Queue a request
  10. Synopsis
  11. ========
  12. .. c:macro:: MEDIA_REQUEST_IOC_QUEUE
  13. ``int ioctl(int request_fd, MEDIA_REQUEST_IOC_QUEUE)``
  14. Arguments
  15. =========
  16. ``request_fd``
  17. File descriptor returned by :ref:`MEDIA_IOC_REQUEST_ALLOC`.
  18. Description
  19. ===========
  20. If the media device supports :ref:`requests <media-request-api>`, then
  21. this request ioctl can be used to queue a previously allocated request.
  22. If the request was successfully queued, then the file descriptor can be
  23. :ref:`polled <request-func-poll>` to wait for the request to complete.
  24. If the request was already queued before, then ``EBUSY`` is returned.
  25. Other errors can be returned if the contents of the request contained
  26. invalid or inconsistent data, see the next section for a list of
  27. common error codes. On error both the request and driver state are unchanged.
  28. Once a request is queued, then the driver is required to gracefully handle
  29. errors that occur when the request is applied to the hardware. The
  30. exception is the ``EIO`` error which signals a fatal error that requires
  31. the application to stop streaming to reset the hardware state.
  32. It is not allowed to mix queuing requests with queuing buffers directly
  33. (without a request). ``EBUSY`` will be returned if the first buffer was
  34. queued directly and you next try to queue a request, or vice versa.
  35. A request must contain at least one buffer, otherwise this ioctl will
  36. return an ``ENOENT`` error.
  37. Return Value
  38. ============
  39. On success 0 is returned, on error -1 and the ``errno`` variable is set
  40. appropriately. The generic error codes are described at the
  41. :ref:`Generic Error Codes <gen-errors>` chapter.
  42. EBUSY
  43. The request was already queued or the application queued the first
  44. buffer directly, but later attempted to use a request. It is not permitted
  45. to mix the two APIs.
  46. ENOENT
  47. The request did not contain any buffers. All requests are required
  48. to have at least one buffer. This can also be returned if some required
  49. configuration is missing in the request.
  50. ENOMEM
  51. Out of memory when allocating internal data structures for this
  52. request.
  53. EINVAL
  54. The request has invalid data.
  55. EIO
  56. The hardware is in a bad state. To recover, the application needs to
  57. stop streaming to reset the hardware state and then try to restart
  58. streaming.