dmx-reqbufs.rst 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: DTV.dmx
  3. .. _DMX_REQBUFS:
  4. *****************
  5. ioctl DMX_REQBUFS
  6. *****************
  7. Name
  8. ====
  9. DMX_REQBUFS - Initiate Memory Mapping and/or DMA buffer I/O
  10. .. warning:: this API is still experimental
  11. Synopsis
  12. ========
  13. .. c:macro:: DMX_REQBUFS
  14. ``int ioctl(int fd, DMX_REQBUFS, struct dmx_requestbuffers *argp)``
  15. Arguments
  16. =========
  17. ``fd``
  18. File descriptor returned by :c:func:`open()`.
  19. ``argp``
  20. Pointer to struct :c:type:`dmx_requestbuffers`.
  21. Description
  22. ===========
  23. This ioctl is used to initiate a memory mapped or DMABUF based demux I/O.
  24. Memory mapped buffers are located in device memory and must be allocated
  25. with this ioctl before they can be mapped into the application's address
  26. space. User buffers are allocated by applications themselves, and this
  27. ioctl is merely used to switch the driver into user pointer I/O mode and
  28. to setup some internal structures. Similarly, DMABUF buffers are
  29. allocated by applications through a device driver, and this ioctl only
  30. configures the driver into DMABUF I/O mode without performing any direct
  31. allocation.
  32. To allocate device buffers applications initialize all fields of the
  33. struct :c:type:`dmx_requestbuffers` structure. They set the ``count`` field
  34. to the desired number of buffers, and ``size`` to the size of each
  35. buffer.
  36. When the ioctl is called with a pointer to this structure, the driver will
  37. attempt to allocate the requested number of buffers and it stores the actual
  38. number allocated in the ``count`` field. The ``count`` can be smaller than the number requested, even zero, when the driver runs out of free memory. A larger
  39. number is also possible when the driver requires more buffers to
  40. function correctly. The actual allocated buffer size can is returned
  41. at ``size``, and can be smaller than what's requested.
  42. When this I/O method is not supported, the ioctl returns an ``EOPNOTSUPP``
  43. error code.
  44. Applications can call :ref:`DMX_REQBUFS` again to change the number of
  45. buffers, however this cannot succeed when any buffers are still mapped.
  46. A ``count`` value of zero frees all buffers, after aborting or finishing
  47. any DMA in progress.
  48. Return Value
  49. ============
  50. On success 0 is returned, on error -1 and the ``errno`` variable is set
  51. appropriately. The generic error codes are described at the
  52. :ref:`Generic Error Codes <gen-errors>` chapter.
  53. EOPNOTSUPP
  54. The the requested I/O method is not supported.