1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>ioctl VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION</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-subdev-g-frame-interval.html" title="ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL"><link rel="next" href="vidioc-subscribe-event.html" title="ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT"></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_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="vidioc-subdev-g-frame-interval.html">Prev</a> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="vidioc-subscribe-event.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="vidioc-subdev-g-selection"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION — Get or set selection rectangles on a subdev pad</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_subdev_selection *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1116827060"></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_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION</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="idp1116831172"></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>The selections are used to configure various image 3 processing functionality performed by the subdevs which affect the 4 image size. This currently includes cropping, scaling and 5 composition.</p><p>The selection API replaces <a class="link" href="vidioc-subdev-g-crop.html" title="ioctl VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP">the old subdev crop API</a>. All 6 the function of the crop API, and more, are supported by the 7 selections API.</p><p>See <a class="xref" href="subdev.html" title="Sub-device Interface">the section called “Sub-device Interface”</a> for 8 more information on how each selection target affects the image 9 processing pipeline inside the subdevice.</p><div class="refsect2"><a name="idp1116834540"></a><h3>Types of selection targets</h3><p>There are two types of selection targets: actual and bounds. The 10 actual targets are the targets which configure the hardware. The BOUNDS 11 target will return a rectangle that contain all possible actual 12 rectangles.</p></div><div class="refsect2"><a name="idp1116835388"></a><h3>Discovering supported features</h3><p>To discover which targets are supported, the user can 13 perform <code class="constant">VIDIOC_SUBDEV_G_SELECTION</code> on them. 14 Any unsupported target will return 15 <code class="constant">EINVAL</code>.</p><p>Selection targets and flags are documented in <a class="xref" href="apb.html#v4l2-selections-common" title="Common selection definitions">the section called “Common selection definitions”</a>.</p><div class="table"><a name="v4l2-subdev-selection"></a><p class="title"><b>Table A.109. struct <span class="structname">v4l2_subdev_selection</span></b></p><div class="table-contents"><table summary="struct v4l2_subdev_selection" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>which</code></em></td><td valign="top">Active or try selection, from 16 enum <a class="link" href="vidioc-subdev-g-fmt.html#v4l2-subdev-format-whence" title="Table A.107. enum v4l2_subdev_format_whence">v4l2_subdev_format_whence</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>pad</code></em></td><td valign="top">Pad number as reported by the media framework.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>target</code></em></td><td valign="top">Target selection rectangle. See 17 <a class="xref" href="apb.html#v4l2-selections-common" title="Common selection definitions">the section called “Common selection definitions”</a>.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>flags</code></em></td><td valign="top">Flags. See 18 <a class="xref" href="apb.html#v4l2-selection-flags" title="Selection flags">the section called “Selection flags”</a>.</td></tr><tr><td valign="top">struct <a class="link" href="overlay.html#v4l2-rect" title="Table 4.3. struct v4l2_rect">v4l2_rect</a></td><td valign="top"><em class="structfield"><code>r</code></em></td><td valign="top">Selection rectangle, in pixels.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>reserved</code></em>[8]</td><td valign="top">Reserved for future extensions. Applications and drivers must 19 set the array to zero.</td></tr></tbody></table></div></div><br class="table-break"></div></div><div class="refsect1"><a name="idp1116847396"></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>The selection rectangle can't be changed because the 20 pad is currently busy. This can be caused, for instance, by 21 an active video stream on the pad. The ioctl must not be 22 retried without performing another action to fix the problem 23 first. Only returned by 24 <code class="constant">VIDIOC_SUBDEV_S_SELECTION</code></p></dd><dt><span class="term"><span class="errorcode">EINVAL</span></span></dt><dd><p>The struct <a class="link" href="vidioc-subdev-g-selection.html#v4l2-subdev-selection" title="Table A.109. struct v4l2_subdev_selection">v4l2_subdev_selection</a> 25 <em class="structfield"><code>pad</code></em> references a non-existing 26 pad, the <em class="structfield"><code>which</code></em> field references a 27 non-existing format, or the selection target is not 28 supported on the given subdev pad.</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-subdev-g-frame-interval.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-subscribe-event.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</td></tr></table></div></body></html> 29