€•¦pŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ2/translations/zh_CN/userspace-api/media/v4l/dmabuf”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/zh_TW/userspace-api/media/v4l/dmabuf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/it_IT/userspace-api/media/v4l/dmabuf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/ja_JP/userspace-api/media/v4l/dmabuf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/ko_KR/userspace-api/media/v4l/dmabuf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/pt_BR/userspace-api/media/v4l/dmabuf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ2/translations/sp_SP/userspace-api/media/v4l/dmabuf”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ8SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later”h]”hŒ8SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒL/var/lib/git/docbuild/linux/Documentation/userspace-api/media/v4l/dmabuf.rst”h´KubhŒtarget”“”)”}”(hŒ .. _dmabuf:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œdmabuf”uh1hÈh´Khhh²hh³hÇubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ$Streaming I/O (DMA buffer importing)”h]”hŒ$Streaming I/O (DMA buffer importing)”…””}”(hhÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhØh²hh³hÇh´KubhŒ paragraph”“”)”}”(hX­The DMABUF framework provides a generic method for sharing buffers between multiple devices. Device drivers that support DMABUF can export a DMA buffer to userspace as a file descriptor (known as the exporter role), import a DMA buffer from userspace using a file descriptor previously exported for a different or the same device (known as the importer role), or both. This section describes the DMABUF importer role API in V4L2.”h]”hX­The DMABUF framework provides a generic method for sharing buffers between multiple devices. Device drivers that support DMABUF can export a DMA buffer to userspace as a file descriptor (known as the exporter role), import a DMA buffer from userspace using a file descriptor previously exported for a different or the same device (known as the importer role), or both. This section describes the DMABUF importer role API in V4L2.”…””}”(hhíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K hhØh²hubhì)”}”(hŒuRefer to :ref:`DMABUF exporting ` for details about exporting V4L2 buffers as DMABUF file descriptors.”h]”(hŒ Refer to ”…””}”(hhûh²hh³Nh´Nubh)”}”(hŒ':ref:`DMABUF exporting `”h]”hŒinline”“”)”}”(hjh]”hŒDMABUF exporting”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”(Œxref”Œstd”Œstd-ref”eh"]”h$]”h&]”uh1jhjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”Œuserspace-api/media/v4l/dmabuf”Œ refdomain”jŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆŒ reftarget”Œ vidioc_expbuf”uh1hh³hÇh´KhhûubhŒE for details about exporting V4L2 buffers as DMABUF file descriptors.”…””}”(hhûh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KhhØh²hubhì)”}”(hX°Input and output devices support the streaming I/O method when the ``V4L2_CAP_STREAMING`` flag in the ``capabilities`` field of struct :c:type:`v4l2_capability` returned by the :ref:`VIDIOC_QUERYCAP ` ioctl is set. Whether importing DMA buffers through DMABUF file descriptors is supported is determined by calling the :ref:`VIDIOC_REQBUFS ` ioctl with the memory type set to ``V4L2_MEMORY_DMABUF``.”h]”(hŒCInput and output devices support the streaming I/O method when the ”…””}”(hj2h²hh³Nh´NubhŒliteral”“”)”}”(hŒ``V4L2_CAP_STREAMING``”h]”hŒV4L2_CAP_STREAMING”…””}”(hj<h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j:hj2ubhŒ flag in the ”…””}”(hj2h²hh³Nh´Nubj;)”}”(hŒ``capabilities``”h]”hŒ capabilities”…””}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j:hj2ubhŒ field of struct ”…””}”(hj2h²hh³Nh´Nubh)”}”(hŒ:c:type:`v4l2_capability`”h]”j;)”}”(hjbh]”hŒv4l2_capability”…””}”(hjdh²hh³Nh´Nubah}”(h]”h ]”(jŒc”Œc-type”eh"]”h$]”h&]”uh1j:hj`ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jnŒreftype”Œtype”Œ refexplicit”‰Œrefwarn”‰Œ c:parent_key”Œsphinx.domains.c”Œ LookupKey”“”)”}”Œdata”]”j€Œ ASTIdentifier”“”)”}”Œ identifier”ŒV4L”sbN†”asbj&Œv4l2_capability”uh1hh³hÇh´Khj2ubhŒ returned by the ”…””}”(hj2h²hh³Nh´Nubh)”}”(hŒ(:ref:`VIDIOC_QUERYCAP `”h]”j)”}”(hj•h]”hŒVIDIOC_QUERYCAP”…””}”(hj—h²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj“ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”j¡Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œvidioc_querycap”uh1hh³hÇh´Khj2ubhŒw ioctl is set. Whether importing DMA buffers through DMABUF file descriptors is supported is determined by calling the ”…””}”(hj2h²hh³Nh´Nubh)”}”(hŒ&:ref:`VIDIOC_REQBUFS `”h]”j)”}”(hj¹h]”hŒVIDIOC_REQBUFS”…””}”(hj»h²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj·ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jÅŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œvidioc_reqbufs”uh1hh³hÇh´Khj2ubhŒ# ioctl with the memory type set to ”…””}”(hj2h²hh³Nh´Nubj;)”}”(hŒ``V4L2_MEMORY_DMABUF``”h]”hŒV4L2_MEMORY_DMABUF”…””}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j:hj2ubhŒ.”…””}”(hj2h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KhhØh²hubhì)”}”(hXšThis I/O method is dedicated to sharing DMA buffers between different devices, which may be V4L devices or other video-related devices (e.g. DRM). Buffers (planes) are allocated by a driver on behalf of an application. Next, these buffers are exported to the application as file descriptors using an API which is specific for an allocator driver. Only such file descriptor are exchanged. The descriptors and meta-information are passed in struct :c:type:`v4l2_buffer` (or in struct :c:type:`v4l2_plane` in the multi-planar API case). The driver must be switched into DMABUF I/O mode by calling the :ref:`VIDIOC_REQBUFS ` with the desired buffer type.”h]”(hX¾This I/O method is dedicated to sharing DMA buffers between different devices, which may be V4L devices or other video-related devices (e.g. DRM). Buffers (planes) are allocated by a driver on behalf of an application. Next, these buffers are exported to the application as file descriptors using an API which is specific for an allocator driver. Only such file descriptor are exchanged. The descriptors and meta-information are passed in struct ”…””}”(hjóh²hh³Nh´Nubh)”}”(hŒ:c:type:`v4l2_buffer`”h]”j;)”}”(hjýh]”hŒ v4l2_buffer”…””}”(hjÿh²hh³Nh´Nubah}”(h]”h ]”(jjnŒc-type”eh"]”h$]”h&]”uh1j:hjûubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jnŒreftype”Œtype”Œ refexplicit”‰Œrefwarn”‰jjƒj&Œ v4l2_buffer”uh1hh³hÇh´KhjóubhŒ (or in struct ”…””}”(hjóh²hh³Nh´Nubh)”}”(hŒ:c:type:`v4l2_plane`”h]”j;)”}”(hj h]”hŒ v4l2_plane”…””}”(hj"h²hh³Nh´Nubah}”(h]”h ]”(jjnŒc-type”eh"]”h$]”h&]”uh1j:hjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jnŒreftype”Œtype”Œ refexplicit”‰Œrefwarn”‰jjƒj&Œ v4l2_plane”uh1hh³hÇh´KhjóubhŒ` in the multi-planar API case). The driver must be switched into DMABUF I/O mode by calling the ”…””}”(hjóh²hh³Nh´Nubh)”}”(hŒ&:ref:`VIDIOC_REQBUFS `”h]”j)”}”(hjCh]”hŒVIDIOC_REQBUFS”…””}”(hjEh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhjAubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jOŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œvidioc_reqbufs”uh1hh³hÇh´KhjóubhŒ with the desired buffer type.”…””}”(hjóh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KhhØh²hubh×)”}”(hhh]”(hÜ)”}”(hŒ>Example: Initiating streaming I/O with DMABUF file descriptors”h]”hŒ>Example: Initiating streaming I/O with DMABUF file descriptors”…””}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjkh²hh³hÇh´K)ubhŒ literal_block”“”)”}”(hX„struct v4l2_requestbuffers reqbuf; memset(&reqbuf, 0, sizeof (reqbuf)); reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; reqbuf.memory = V4L2_MEMORY_DMABUF; reqbuf.count = 1; if (ioctl(fd, VIDIOC_REQBUFS, &reqbuf) == -1) { if (errno == EINVAL) printf("Video capturing or DMABUF streaming is not supported\\n"); else perror("VIDIOC_REQBUFS"); exit(EXIT_FAILURE); }”h]”hX„struct v4l2_requestbuffers reqbuf; memset(&reqbuf, 0, sizeof (reqbuf)); reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; reqbuf.memory = V4L2_MEMORY_DMABUF; reqbuf.count = 1; if (ioctl(fd, VIDIOC_REQBUFS, &reqbuf) == -1) { if (errno == EINVAL) printf("Video capturing or DMABUF streaming is not supported\\n"); else perror("VIDIOC_REQBUFS"); exit(EXIT_FAILURE); }”…””}”hj~sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”jnŒhighlight_args”}”uh1j|h³hÇh´K+hjkh²hubhì)”}”(hXSThe buffer (plane) file descriptor is passed on the fly with the :ref:`VIDIOC_QBUF ` ioctl. In case of multiplanar buffers, every plane can be associated with a different DMABUF descriptor. Although buffers are commonly cycled, applications can pass a different DMABUF descriptor at each :ref:`VIDIOC_QBUF ` call.”h]”(hŒAThe buffer (plane) file descriptor is passed on the fly with the ”…””}”(hjh²hh³Nh´Nubh)”}”(hŒ :ref:`VIDIOC_QBUF `”h]”j)”}”(hjšh]”hŒ VIDIOC_QBUF”…””}”(hjœh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj˜ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”j¦Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œ vidioc_qbuf”uh1hh³hÇh´K=hjubhŒÌ ioctl. In case of multiplanar buffers, every plane can be associated with a different DMABUF descriptor. Although buffers are commonly cycled, applications can pass a different DMABUF descriptor at each ”…””}”(hjh²hh³Nh´Nubh)”}”(hŒ :ref:`VIDIOC_QBUF `”h]”j)”}”(hj¾h]”hŒ VIDIOC_QBUF”…””}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj¼ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jÊŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œ vidioc_qbuf”uh1hh³hÇh´K=hjubhŒ call.”…””}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K=hjkh²hubeh}”(h]”Œ=example-initiating-streaming-i-o-with-dmabuf-file-descriptors”ah ]”h"]”Œ>example: initiating streaming i/o with dmabuf file descriptors”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K)ubh×)”}”(hhh]”(hÜ)”}”(hŒ/Example: Queueing DMABUF using single plane API”h]”hŒ/Example: Queueing DMABUF using single plane API”…””}”(hjñh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjîh²hh³hÇh´KDubj})”}”(hXjint buffer_queue(int v4lfd, int index, int dmafd) { struct v4l2_buffer buf; memset(&buf, 0, sizeof buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_DMABUF; buf.index = index; buf.m.fd = dmafd; if (ioctl(v4lfd, VIDIOC_QBUF, &buf) == -1) { perror("VIDIOC_QBUF"); return -1; } return 0; }”h]”hXjint buffer_queue(int v4lfd, int index, int dmafd) { struct v4l2_buffer buf; memset(&buf, 0, sizeof buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_DMABUF; buf.index = index; buf.m.fd = dmafd; if (ioctl(v4lfd, VIDIOC_QBUF, &buf) == -1) { perror("VIDIOC_QBUF"); return -1; } return 0; }”…””}”hjÿsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjŒ‰jjnjŽ}”uh1j|h³hÇh´KFhjîh²hubeh}”(h]”Œ.example-queueing-dmabuf-using-single-plane-api”ah ]”h"]”Œ/example: queueing dmabuf using single plane api”ah$]”h&]”uh1hÖhhØh²hh³hÇh´KDubh×)”}”(hhh]”(hÜ)”}”(hŒ2Example 3.6. Queueing DMABUF using multi plane API”h]”hŒ2Example 3.6. Queueing DMABUF using multi plane API”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjh²hh³hÇh´K[ubj})”}”(hXTint buffer_queue_mp(int v4lfd, int index, int dmafd[], int n_planes) { struct v4l2_buffer buf; struct v4l2_plane planes[VIDEO_MAX_PLANES]; int i; memset(&buf, 0, sizeof buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; buf.memory = V4L2_MEMORY_DMABUF; buf.index = index; buf.m.planes = planes; buf.length = n_planes; memset(&planes, 0, sizeof planes); for (i = 0; i < n_planes; ++i) buf.m.planes[i].m.fd = dmafd[i]; if (ioctl(v4lfd, VIDIOC_QBUF, &buf) == -1) { perror("VIDIOC_QBUF"); return -1; } return 0; }”h]”hXTint buffer_queue_mp(int v4lfd, int index, int dmafd[], int n_planes) { struct v4l2_buffer buf; struct v4l2_plane planes[VIDEO_MAX_PLANES]; int i; memset(&buf, 0, sizeof buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; buf.memory = V4L2_MEMORY_DMABUF; buf.index = index; buf.m.planes = planes; buf.length = n_planes; memset(&planes, 0, sizeof planes); for (i = 0; i < n_planes; ++i) buf.m.planes[i].m.fd = dmafd[i]; if (ioctl(v4lfd, VIDIOC_QBUF, &buf) == -1) { perror("VIDIOC_QBUF"); return -1; } return 0; }”…””}”hj'sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjŒ‰jjnjŽ}”uh1j|h³hÇh´K]hjh²hubhì)”}”(hXWCaptured or displayed buffers are dequeued with the :ref:`VIDIOC_DQBUF ` ioctl. The driver can unlock the buffer at any time between the completion of the DMA and this ioctl. The memory is also unlocked when :ref:`VIDIOC_STREAMOFF ` is called, :ref:`VIDIOC_REQBUFS `, or when the device is closed.”h]”(hŒ4Captured or displayed buffers are dequeued with the ”…””}”(hj6h²hh³Nh´Nubh)”}”(hŒ!:ref:`VIDIOC_DQBUF `”h]”j)”}”(hj@h]”hŒ VIDIOC_DQBUF”…””}”(hjBh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj>ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jLŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œ vidioc_qbuf”uh1hh³hÇh´Kyhj6ubhŒˆ ioctl. The driver can unlock the buffer at any time between the completion of the DMA and this ioctl. The memory is also unlocked when ”…””}”(hj6h²hh³Nh´Nubh)”}”(hŒ):ref:`VIDIOC_STREAMOFF `”h]”j)”}”(hjdh]”hŒVIDIOC_STREAMOFF”…””}”(hjfh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhjbubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jpŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œvidioc_streamon”uh1hh³hÇh´Kyhj6ubhŒ is called, ”…””}”(hj6h²hh³Nh´Nubh)”}”(hŒ&:ref:`VIDIOC_REQBUFS `”h]”j)”}”(hjˆh]”hŒVIDIOC_REQBUFS”…””}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj†ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”j”Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œvidioc_reqbufs”uh1hh³hÇh´Kyhj6ubhŒ, or when the device is closed.”…””}”(hj6h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Kyhjh²hubhì)”}”(hX¨For capturing applications it is customary to enqueue a number of empty buffers, to start capturing and enter the read loop. Here the application waits until a filled buffer can be dequeued, and re-enqueues the buffer when the data is no longer needed. Output applications fill and enqueue buffers, when enough buffers are stacked up output is started. In the write loop, when the application runs out of free buffers it must wait until an empty buffer can be dequeued and reused. Two methods exist to suspend execution of the application until one or more buffers can be dequeued. By default :ref:`VIDIOC_DQBUF ` blocks when no buffer is in the outgoing queue. When the ``O_NONBLOCK`` flag was given to the :c:func:`open()` function, :ref:`VIDIOC_DQBUF ` returns immediately with an ``EAGAIN`` error code when no buffer is available. The :c:func:`select()` and :c:func:`poll()` functions are always available.”h]”(hXQFor capturing applications it is customary to enqueue a number of empty buffers, to start capturing and enter the read loop. Here the application waits until a filled buffer can be dequeued, and re-enqueues the buffer when the data is no longer needed. Output applications fill and enqueue buffers, when enough buffers are stacked up output is started. In the write loop, when the application runs out of free buffers it must wait until an empty buffer can be dequeued and reused. Two methods exist to suspend execution of the application until one or more buffers can be dequeued. By default ”…””}”(hj°h²hh³Nh´Nubh)”}”(hŒ!:ref:`VIDIOC_DQBUF `”h]”j)”}”(hjºh]”hŒ VIDIOC_DQBUF”…””}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj¸ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jÆŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œ vidioc_qbuf”uh1hh³hÇh´K€hj°ubhŒ: blocks when no buffer is in the outgoing queue. When the ”…””}”(hj°h²hh³Nh´Nubj;)”}”(hŒ``O_NONBLOCK``”h]”hŒ O_NONBLOCK”…””}”(hjÜh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j:hj°ubhŒ flag was given to the ”…””}”(hj°h²hh³Nh´Nubh)”}”(hŒ:c:func:`open()`”h]”j;)”}”(hjðh]”hŒopen()”…””}”(hjòh²hh³Nh´Nubah}”(h]”h ]”(jjnŒc-func”eh"]”h$]”h&]”uh1j:hjîubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jnŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jjƒj&Œopen”uh1hh³hÇh´K€hj°ubhŒ function, ”…””}”(hj°h²hh³Nh´Nubh)”}”(hŒ!:ref:`VIDIOC_DQBUF `”h]”j)”}”(hjh]”hŒ VIDIOC_DQBUF”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œ vidioc_qbuf”uh1hh³hÇh´K€hj°ubhŒ returns immediately with an ”…””}”(hj°h²hh³Nh´Nubj;)”}”(hŒ ``EAGAIN``”h]”hŒEAGAIN”…””}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j:hj°ubhŒ- error code when no buffer is available. The ”…””}”(hj°h²hh³Nh´Nubh)”}”(hŒ:c:func:`select()`”h]”j;)”}”(hjIh]”hŒselect()”…””}”(hjKh²hh³Nh´Nubah}”(h]”h ]”(jjnŒc-func”eh"]”h$]”h&]”uh1j:hjGubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jnŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jjƒj&Œselect”uh1hh³hÇh´K€hj°ubhŒ and ”…””}”(hj°h²hh³Nh´Nubh)”}”(hŒ:c:func:`poll()`”h]”j;)”}”(hjlh]”hŒpoll()”…””}”(hjnh²hh³Nh´Nubah}”(h]”h ]”(jjnŒc-func”eh"]”h$]”h&]”uh1j:hjjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jnŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jjƒj&Œpoll”uh1hh³hÇh´K€hj°ubhŒ functions are always available.”…””}”(hj°h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K€hjh²hubhì)”}”(hŒžTo start and stop capturing or displaying applications call the :ref:`VIDIOC_STREAMON ` and :ref:`VIDIOC_STREAMOFF ` ioctls.”h]”(hŒ@To start and stop capturing or displaying applications call the ”…””}”(hj“h²hh³Nh´Nubh)”}”(hŒ(:ref:`VIDIOC_STREAMON `”h]”j)”}”(hjh]”hŒVIDIOC_STREAMON”…””}”(hjŸh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj›ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”j©Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œvidioc_streamon”uh1hh³hÇh´Khj“ubhŒ and ”…””}”(hj“h²hh³Nh´Nubh)”}”(hŒ):ref:`VIDIOC_STREAMOFF `”h]”j)”}”(hjÁh]”hŒVIDIOC_STREAMOFF”…””}”(hjÃh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj¿ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jÍŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œvidioc_streamon”uh1hh³hÇh´Khj“ubhŒ ioctls.”…””}”(hj“h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Khjh²hubhŒnote”“”)”}”(hX`:ref:`VIDIOC_STREAMOFF ` removes all buffers from both queues and unlocks all buffers as a side effect. Since there is no notion of doing anything "now" on a multitasking system, if an application needs to synchronize with another event it should examine the struct :c:type:`v4l2_buffer` ``timestamp`` of captured or outputted buffers.”h]”hì)”}”(hX`:ref:`VIDIOC_STREAMOFF ` removes all buffers from both queues and unlocks all buffers as a side effect. Since there is no notion of doing anything "now" on a multitasking system, if an application needs to synchronize with another event it should examine the struct :c:type:`v4l2_buffer` ``timestamp`` of captured or outputted buffers.”h]”(h)”}”(hŒ):ref:`VIDIOC_STREAMOFF `”h]”j)”}”(hjõh]”hŒVIDIOC_STREAMOFF”…””}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhjóubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œvidioc_streamon”uh1hh³hÇh´K–hjïubhŒö removes all buffers from both queues and unlocks all buffers as a side effect. Since there is no notion of doing anything “now†on a multitasking system, if an application needs to synchronize with another event it should examine the struct ”…””}”(hjïh²hh³Nh´Nubh)”}”(hŒ:c:type:`v4l2_buffer`”h]”j;)”}”(hjh]”hŒ v4l2_buffer”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”(jjnŒc-type”eh"]”h$]”h&]”uh1j:hjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jnŒreftype”Œtype”Œ refexplicit”‰Œrefwarn”‰jjƒj&Œ v4l2_buffer”uh1hh³hÇh´K–hjïubhŒ ”…””}”(hjïh²hh³Nh´Nubj;)”}”(hŒ ``timestamp``”h]”hŒ timestamp”…””}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j:hjïubhŒ" of captured or outputted buffers.”…””}”(hjïh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K–hjëubah}”(h]”h ]”h"]”h$]”h&]”uh1jéhjh²hh³hÇh´Nubhì)”}”(hXADrivers implementing DMABUF importing I/O must support the :ref:`VIDIOC_REQBUFS `, :ref:`VIDIOC_QBUF `, :ref:`VIDIOC_DQBUF `, :ref:`VIDIOC_STREAMON ` and :ref:`VIDIOC_STREAMOFF ` ioctls, and the :c:func:`select()` and :c:func:`poll()` functions.”h]”(hŒ;Drivers implementing DMABUF importing I/O must support the ”…””}”(hjXh²hh³Nh´Nubh)”}”(hŒ&:ref:`VIDIOC_REQBUFS `”h]”j)”}”(hjbh]”hŒVIDIOC_REQBUFS”…””}”(hjdh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj`ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jnŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œvidioc_reqbufs”uh1hh³hÇh´KhjXubhŒ, ”…””}”(hjXh²hh³Nh´Nubh)”}”(hŒ :ref:`VIDIOC_QBUF `”h]”j)”}”(hj†h]”hŒ VIDIOC_QBUF”…””}”(hjˆh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj„ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”j’Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œ vidioc_qbuf”uh1hh³hÇh´KhjXubhŒ, ”…””}”(hjXh²hh³Nh´Nubh)”}”(hŒ!:ref:`VIDIOC_DQBUF `”h]”j)”}”(hjªh]”hŒ VIDIOC_DQBUF”…””}”(hj¬h²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhj¨ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”j¶Œreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œ vidioc_qbuf”uh1hh³hÇh´KhjXubhŒ, ”…””}”hjXsbh)”}”(hŒ(:ref:`VIDIOC_STREAMON `”h]”j)”}”(hjÎh]”hŒVIDIOC_STREAMON”…””}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhjÌubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jÚŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œvidioc_streamon”uh1hh³hÇh´KhjXubhŒ and ”…””}”(hjXh²hh³Nh´Nubh)”}”(hŒ):ref:`VIDIOC_STREAMOFF `”h]”j)”}”(hjòh]”hŒVIDIOC_STREAMOFF”…””}”(hjôh²hh³Nh´Nubah}”(h]”h ]”(jŒstd”Œstd-ref”eh"]”h$]”h&]”uh1jhjðubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jþŒreftype”Œref”Œ refexplicit”ˆŒrefwarn”ˆj&Œvidioc_streamon”uh1hh³hÇh´KhjXubhŒ ioctls, and the ”…””}”(hjXh²hh³Nh´Nubh)”}”(hŒ:c:func:`select()`”h]”j;)”}”(hjh]”hŒselect()”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”(jjnŒc-func”eh"]”h$]”h&]”uh1j:hjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jnŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jjƒj&Œselect”uh1hh³hÇh´KhjXubhŒ and ”…””}”hjXsbh)”}”(hŒ:c:func:`poll()`”h]”j;)”}”(hj9h]”hŒpoll()”…””}”(hj;h²hh³Nh´Nubah}”(h]”h ]”(jjnŒc-func”eh"]”h$]”h&]”uh1j:hj7ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j Œ refdomain”jnŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jjƒj&Œpoll”uh1hh³hÇh´KhjXubhŒ functions.”…””}”(hjXh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´Khjh²hubeh}”(h]”Œ1example-3-6-queueing-dmabuf-using-multi-plane-api”ah ]”h"]”Œ2example 3.6. queueing dmabuf using multi plane api”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K[ubeh}”(h]”(Œ"streaming-i-o-dma-buffer-importing”hÕeh ]”h"]”(Œ$streaming i/o (dma buffer importing)”Œdmabuf”eh$]”h&]”uh1hÖhhh²hh³hÇh´KŒexpect_referenced_by_name”}”jnhÊsŒexpect_referenced_by_id”}”hÕhÊsubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÛNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j˜Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”hÕ]”hÊasŒnameids”}”(jnhÕjmjjjëjèjjjejbuŒ nametypes”}”(jnˆjm‰jë‰j‰je‰uh}”(hÕhØjjhØjèjkjjîjbjuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”hŒsystem_message”“”)”}”(hhh]”hì)”}”(hhh]”hŒ,Hyperlink target "dmabuf" is not referenced.”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”uh1hëhjÿubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”hÇŒline”Kuh1jýubaŒ transformer”NŒ include_log”]”Œ decoration”Nh²hub.