Merge git://www.linux-watchdog.org/linux-watchdog
[deliverable/linux.git] / Documentation / media / uapi / v4l / vidioc-subdev-g-selection.rst
CommitLineData
5377d91f
MH
1.. -*- coding: utf-8; mode: rst -*-
2
af4a4d0d 3.. _VIDIOC_SUBDEV_G_SELECTION:
5377d91f
MH
4
5**********************************************************
6ioctl VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION
7**********************************************************
8
15e7d615 9Name
586027ce 10====
5377d91f 11
586027ce 12VIDIOC_SUBDEV_G_SELECTION - VIDIOC_SUBDEV_S_SELECTION - Get or set selection rectangles on a subdev pad
5377d91f 13
15e7d615
MCC
14
15Synopsis
5377d91f
MH
16========
17
b7e67f6c 18.. cpp:function:: int ioctl( int fd, int request, struct v4l2_subdev_selection *argp )
5377d91f 19
586027ce 20
15e7d615 21Arguments
5377d91f
MH
22=========
23
24``fd``
25 File descriptor returned by :ref:`open() <func-open>`.
26
27``request``
28 VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION
29
30``argp``
31
32
15e7d615 33Description
5377d91f
MH
34===========
35
36The selections are used to configure various image processing
37functionality performed by the subdevs which affect the image size. This
38currently includes cropping, scaling and composition.
39
40The selection API replaces
af4a4d0d 41:ref:`the old subdev crop API <VIDIOC_SUBDEV_G_CROP>`. All the
5377d91f
MH
42function of the crop API, and more, are supported by the selections API.
43
44See :ref:`subdev` for more information on how each selection target
45affects the image processing pipeline inside the subdevice.
46
47
48Types of selection targets
49--------------------------
50
51There are two types of selection targets: actual and bounds. The actual
52targets are the targets which configure the hardware. The BOUNDS target
53will return a rectangle that contain all possible actual rectangles.
54
55
56Discovering supported features
57------------------------------
58
59To discover which targets are supported, the user can perform
60``VIDIOC_SUBDEV_G_SELECTION`` on them. Any unsupported target will
61return ``EINVAL``.
62
63Selection targets and flags are documented in
64:ref:`v4l2-selections-common`.
65
66
67.. _v4l2-subdev-selection:
68
69.. flat-table:: struct v4l2_subdev_selection
70 :header-rows: 0
71 :stub-columns: 0
72 :widths: 1 1 2
73
74
75 - .. row 1
76
77 - __u32
78
79 - ``which``
80
81 - Active or try selection, from enum
0579e6e3 82 :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
5377d91f
MH
83
84 - .. row 2
85
86 - __u32
87
88 - ``pad``
89
90 - Pad number as reported by the media framework.
91
92 - .. row 3
93
94 - __u32
95
96 - ``target``
97
98 - Target selection rectangle. See :ref:`v4l2-selections-common`.
99
100 - .. row 4
101
102 - __u32
103
104 - ``flags``
105
106 - Flags. See :ref:`v4l2-selection-flags`.
107
108 - .. row 5
109
110 - struct :ref:`v4l2_rect <v4l2-rect>`
111
112 - ``r``
113
114 - Selection rectangle, in pixels.
115
116 - .. row 6
117
118 - __u32
119
8968da9b 120 - ``reserved``\ [8]
5377d91f
MH
121
122 - Reserved for future extensions. Applications and drivers must set
0579e6e3 123 the array to zero.
5377d91f
MH
124
125
15e7d615 126Return Value
5377d91f
MH
127============
128
129On success 0 is returned, on error -1 and the ``errno`` variable is set
130appropriately. The generic error codes are described at the
131:ref:`Generic Error Codes <gen-errors>` chapter.
132
133EBUSY
134 The selection rectangle can't be changed because the pad is
135 currently busy. This can be caused, for instance, by an active video
136 stream on the pad. The ioctl must not be retried without performing
137 another action to fix the problem first. Only returned by
138 ``VIDIOC_SUBDEV_S_SELECTION``
139
140EINVAL
141 The struct :ref:`v4l2_subdev_selection <v4l2-subdev-selection>`
142 ``pad`` references a non-existing pad, the ``which`` field
143 references a non-existing format, or the selection target is not
144 supported on the given subdev pad.
This page took 0.067027 seconds and 5 git commands to generate.