xref: /openbmc/linux/Documentation/userspace-api/media/mediactl/media-request-ioc-queue.rst (revision cbecf716ca618fd44feda6bd9a64a8179d031fc5)
184d33341SMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
2*937e6805SMauro Carvalho Chehab.. c:namespace:: MC
354f38fcaSMauro Carvalho Chehab
454f38fcaSMauro Carvalho Chehab.. _media_request_ioc_queue:
554f38fcaSMauro Carvalho Chehab
654f38fcaSMauro Carvalho Chehab*****************************
754f38fcaSMauro Carvalho Chehabioctl MEDIA_REQUEST_IOC_QUEUE
854f38fcaSMauro Carvalho Chehab*****************************
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho ChehabName
1154f38fcaSMauro Carvalho Chehab====
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabMEDIA_REQUEST_IOC_QUEUE - Queue a request
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
18*937e6805SMauro Carvalho Chehab.. c:macro:: MEDIA_REQUEST_IOC_QUEUE
1954f38fcaSMauro Carvalho Chehab
20*937e6805SMauro Carvalho Chehab``int ioctl(int request_fd, MEDIA_REQUEST_IOC_QUEUE)``
2154f38fcaSMauro Carvalho Chehab
2254f38fcaSMauro Carvalho ChehabArguments
2354f38fcaSMauro Carvalho Chehab=========
2454f38fcaSMauro Carvalho Chehab
2554f38fcaSMauro Carvalho Chehab``request_fd``
2654f38fcaSMauro Carvalho Chehab    File descriptor returned by :ref:`MEDIA_IOC_REQUEST_ALLOC`.
2754f38fcaSMauro Carvalho Chehab
2854f38fcaSMauro Carvalho ChehabDescription
2954f38fcaSMauro Carvalho Chehab===========
3054f38fcaSMauro Carvalho Chehab
3154f38fcaSMauro Carvalho ChehabIf the media device supports :ref:`requests <media-request-api>`, then
3254f38fcaSMauro Carvalho Chehabthis request ioctl can be used to queue a previously allocated request.
3354f38fcaSMauro Carvalho Chehab
3454f38fcaSMauro Carvalho ChehabIf the request was successfully queued, then the file descriptor can be
3554f38fcaSMauro Carvalho Chehab:ref:`polled <request-func-poll>` to wait for the request to complete.
3654f38fcaSMauro Carvalho Chehab
3754f38fcaSMauro Carvalho ChehabIf the request was already queued before, then ``EBUSY`` is returned.
3854f38fcaSMauro Carvalho ChehabOther errors can be returned if the contents of the request contained
3954f38fcaSMauro Carvalho Chehabinvalid or inconsistent data, see the next section for a list of
4054f38fcaSMauro Carvalho Chehabcommon error codes. On error both the request and driver state are unchanged.
4154f38fcaSMauro Carvalho Chehab
4254f38fcaSMauro Carvalho ChehabOnce a request is queued, then the driver is required to gracefully handle
4354f38fcaSMauro Carvalho Chehaberrors that occur when the request is applied to the hardware. The
4454f38fcaSMauro Carvalho Chehabexception is the ``EIO`` error which signals a fatal error that requires
4554f38fcaSMauro Carvalho Chehabthe application to stop streaming to reset the hardware state.
4654f38fcaSMauro Carvalho Chehab
4754f38fcaSMauro Carvalho ChehabIt is not allowed to mix queuing requests with queuing buffers directly
4854f38fcaSMauro Carvalho Chehab(without a request). ``EBUSY`` will be returned if the first buffer was
4954f38fcaSMauro Carvalho Chehabqueued directly and you next try to queue a request, or vice versa.
5054f38fcaSMauro Carvalho Chehab
5154f38fcaSMauro Carvalho ChehabA request must contain at least one buffer, otherwise this ioctl will
5254f38fcaSMauro Carvalho Chehabreturn an ``ENOENT`` error.
5354f38fcaSMauro Carvalho Chehab
5454f38fcaSMauro Carvalho ChehabReturn Value
5554f38fcaSMauro Carvalho Chehab============
5654f38fcaSMauro Carvalho Chehab
5754f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
5854f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
5954f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
6054f38fcaSMauro Carvalho Chehab
6154f38fcaSMauro Carvalho ChehabEBUSY
6254f38fcaSMauro Carvalho Chehab    The request was already queued or the application queued the first
6354f38fcaSMauro Carvalho Chehab    buffer directly, but later attempted to use a request. It is not permitted
6454f38fcaSMauro Carvalho Chehab    to mix the two APIs.
6554f38fcaSMauro Carvalho ChehabENOENT
6654f38fcaSMauro Carvalho Chehab    The request did not contain any buffers. All requests are required
6754f38fcaSMauro Carvalho Chehab    to have at least one buffer. This can also be returned if some required
6854f38fcaSMauro Carvalho Chehab    configuration is missing in the request.
6954f38fcaSMauro Carvalho ChehabENOMEM
7054f38fcaSMauro Carvalho Chehab    Out of memory when allocating internal data structures for this
7154f38fcaSMauro Carvalho Chehab    request.
7254f38fcaSMauro Carvalho ChehabEINVAL
7354f38fcaSMauro Carvalho Chehab    The request has invalid data.
7454f38fcaSMauro Carvalho ChehabEIO
7554f38fcaSMauro Carvalho Chehab    The hardware is in a bad state. To recover, the application needs to
7654f38fcaSMauro Carvalho Chehab    stop streaming to reset the hardware state and then try to restart
7754f38fcaSMauro Carvalho Chehab    streaming.
78