<refentry id="vidioc-prepare-buf"> <refmeta> <refentrytitle>ioctl VIDIOC_PREPARE_BUF</refentrytitle> &manvol; </refmeta> <refnamediv> <refname>VIDIOC_PREPARE_BUF</refname> <refpurpose>Prepare a buffer for I/O</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef>int <function>ioctl</function></funcdef> <paramdef>int <parameter>fd</parameter></paramdef> <paramdef>int <parameter>request</parameter></paramdef> <paramdef>struct v4l2_buffer *<parameter>argp</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1> <title>Arguments</title> <variablelist> <varlistentry> <term><parameter>fd</parameter></term> <listitem> <para>&fd;</para> </listitem> </varlistentry> <varlistentry> <term><parameter>request</parameter></term> <listitem> <para>VIDIOC_PREPARE_BUF</para> </listitem> </varlistentry> <varlistentry> <term><parameter>argp</parameter></term> <listitem> <para></para> </listitem> </varlistentry> </variablelist> </refsect1> <refsect1> <title>Description</title> <note> <title>Experimental</title> <para>This is an <link linkend="experimental"> experimental </link> interface and may change in the future.</para> </note> <para>Applications can optionally call the <constant>VIDIOC_PREPARE_BUF</constant> ioctl to pass ownership of the buffer to the driver before actually enqueuing it, using the <constant>VIDIOC_QBUF</constant> ioctl, and to prepare it for future I/O. Such preparations may include cache invalidation or cleaning. Performing them in advance saves time during the actual I/O. In case such cache operations are not required, the application can use one of <constant>V4L2_BUF_FLAG_NO_CACHE_INVALIDATE</constant> and <constant>V4L2_BUF_FLAG_NO_CACHE_CLEAN</constant> flags to skip the respective step.</para> <para>The <structname>v4l2_buffer</structname> structure is specified in <xref linkend="buffer" />.</para> </refsect1> <refsect1> &return-value; <variablelist> <varlistentry> <term><errorcode>EBUSY</errorcode></term> <listitem> <para>File I/O is in progress.</para> </listitem> </varlistentry> <varlistentry> <term><errorcode>EINVAL</errorcode></term> <listitem> <para>The buffer <structfield>type</structfield> is not supported, or the <structfield>index</structfield> is out of bounds, or no buffers have been allocated yet, or the <structfield>userptr</structfield> or <structfield>length</structfield> are invalid.</para> </listitem> </varlistentry> </variablelist> </refsect1> </refentry>