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