1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>struct vb2_queue</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="mediadev.html#id-1.8.2" title="Video2Linux devices"><link rel="prev" href="API-struct-vb2-ops.html" title="struct vb2_ops"><link rel="next" href="API-vb2-is-streaming.html" title="vb2_is_streaming"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct vb2_queue</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-vb2-ops.html">Prev</a> </td><th width="60%" align="center">Video2Linux devices</th><td width="20%" align="right"> <a accesskey="n" href="API-vb2-is-streaming.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-vb2-queue"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct vb2_queue — 2 a videobuf queue 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting"> 4struct vb2_queue { 5 unsigned int type; 6 unsigned int io_modes; 7 unsigned fileio_read_once:1; 8 unsigned fileio_write_immediately:1; 9 unsigned allow_zero_bytesused:1; 10 struct mutex * lock; 11 void * owner; 12 const struct vb2_ops * ops; 13 const struct vb2_mem_ops * mem_ops; 14 const struct vb2_buf_ops * buf_ops; 15 void * drv_priv; 16 unsigned int buf_struct_size; 17 u32 timestamp_flags; 18 gfp_t gfp_flags; 19 u32 min_buffers_needed; 20}; </pre></div><div class="refsect1"><a name="id-1.8.2.94.5"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">type</span></dt><dd><p> 21 private buffer type whose content is defined by the vb2-core 22 caller. For example, for V4L2, it should match 23 the V4L2_BUF_TYPE_* in include/uapi/linux/videodev2.h 24 </p></dd><dt><span class="term">io_modes</span></dt><dd><p> 25 supported io methods (see vb2_io_modes enum) 26 </p></dd><dt><span class="term">fileio_read_once</span></dt><dd><p> 27 report EOF after reading the first buffer 28 </p></dd><dt><span class="term">fileio_write_immediately</span></dt><dd><p> 29 queue buffer after each <code class="function">write</code> call 30 </p></dd><dt><span class="term">allow_zero_bytesused</span></dt><dd><p> 31 allow bytesused == 0 to be passed to the driver 32 </p></dd><dt><span class="term">lock</span></dt><dd><p> 33 pointer to a mutex that protects the vb2_queue struct. The 34 driver can set this to a mutex to let the v4l2 core serialize 35 the queuing ioctls. If the driver wants to handle locking 36 itself, then this should be set to NULL. This lock is not used 37 by the videobuf2 core API. 38 </p></dd><dt><span class="term">owner</span></dt><dd><p> 39 The filehandle that 'owns' the buffers, i.e. the filehandle 40 that called reqbufs, create_buffers or started fileio. 41 This field is not used by the videobuf2 core API, but it allows 42 drivers to easily associate an owner filehandle with the queue. 43 </p></dd><dt><span class="term">ops</span></dt><dd><p> 44 driver-specific callbacks 45 </p></dd><dt><span class="term">mem_ops</span></dt><dd><p> 46 memory allocator specific callbacks 47 </p></dd><dt><span class="term">buf_ops</span></dt><dd><p> 48 callbacks to deliver buffer information 49 between user-space and kernel-space 50 </p></dd><dt><span class="term">drv_priv</span></dt><dd><p> 51 driver private data 52 </p></dd><dt><span class="term">buf_struct_size</span></dt><dd><p> 53 size of the driver-specific buffer structure; 54 <span class="quote">“<span class="quote">0</span>”</span> indicates the driver doesn't want to use a custom buffer 55 structure type. for example, sizeof(struct vb2_v4l2_buffer) 56 will be used for v4l2. 57 </p></dd><dt><span class="term">timestamp_flags</span></dt><dd><p> 58 Timestamp flags; V4L2_BUF_FLAG_TIMESTAMP_* and 59 V4L2_BUF_FLAG_TSTAMP_SRC_* 60 </p></dd><dt><span class="term">gfp_flags</span></dt><dd><p> 61 additional gfp flags used when allocating the buffers. 62 Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32 63 to force the buffer allocation to a specific memory zone. 64 </p></dd><dt><span class="term">min_buffers_needed</span></dt><dd><p> 65 the minimum number of buffers needed before 66 <code class="function">start_streaming</code> can be called. Used when a DMA engine 67 cannot be started unless at least this number of buffers 68 have been queued into the driver. 69 </p></dd></dl></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-vb2-ops.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="mediadev.html#id-1.8.2">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-vb2-is-streaming.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct vb2_ops</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">vb2_is_streaming</span></td></tr></table></div></body></html> 70