1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>ioctl VIDIOC_PREPARE_BUF</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="user-func.html" title="Appendix A. Function Reference"><link rel="prev" href="vidioc-overlay.html" title="ioctl VIDIOC_OVERLAY"><link rel="next" href="vidioc-qbuf.html" title="ioctl VIDIOC_QBUF, VIDIOC_DQBUF"></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">ioctl VIDIOC_PREPARE_BUF</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="vidioc-overlay.html">Prev</a> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="vidioc-qbuf.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="vidioc-prepare-buf"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_PREPARE_BUF — Prepare a buffer for I/O</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">ioctl</b>(</code></td><td>int <var class="pdparam">fd</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">request</var>, </td></tr><tr><td> </td><td>struct v4l2_buffer *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1115555180"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>fd</code></em></span></dt><dd><p>File descriptor returned by <a class="link" href="func-open.html" title="V4L2 open()"><code class="function">open()</code></a>.</p></dd><dt><span class="term"><em class="parameter"><code>request</code></em></span></dt><dd><p>VIDIOC_PREPARE_BUF</p></dd><dt><span class="term"><em class="parameter"><code>argp</code></em></span></dt><dd><p></p></dd></dl></div></div><div class="refsect1"><a name="idp1115615708"></a><h2>Description</h2><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Experimental</h3><p>This is an <a class="link" href="hist-v4l2.html#experimental" title="Experimental API Elements"> experimental </a> 2 interface and may change in the future.</p></div><p>Applications can optionally call the 3<code class="constant">VIDIOC_PREPARE_BUF</code> ioctl to pass ownership of the buffer 4to the driver before actually enqueuing it, using the 5<code class="constant">VIDIOC_QBUF</code> ioctl, and to prepare it for future I/O. 6Such preparations may include cache invalidation or cleaning. Performing them 7in advance saves time during the actual I/O. In case such cache operations are 8not required, the application can use one of 9<code class="constant">V4L2_BUF_FLAG_NO_CACHE_INVALIDATE</code> and 10<code class="constant">V4L2_BUF_FLAG_NO_CACHE_CLEAN</code> flags to skip the respective 11step.</p><p>The <span class="structname">v4l2_buffer</span> structure is 12specified in <a class="xref" href="buffer.html" title="Buffers">the section called “Buffers”</a>.</p></div><div class="refsect1"><a name="idp1115619516"></a><h2>Return Value</h2><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">EBUSY</span></span></dt><dd><p>File I/O is in progress.</p></dd><dt><span class="term"><span class="errorcode">EINVAL</span></span></dt><dd><p>The buffer <em class="structfield"><code>type</code></em> is not 13supported, or the <em class="structfield"><code>index</code></em> is out of bounds, 14or no buffers have been allocated yet, or the 15<em class="structfield"><code>userptr</code></em> or 16<em class="structfield"><code>length</code></em> are invalid.</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="vidioc-overlay.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="user-func.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="vidioc-qbuf.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_OVERLAY </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ioctl VIDIOC_QBUF, VIDIOC_DQBUF</td></tr></table></div></body></html> 17