blob: 50838a4a429e195aed9ecfb9b03ca152c99b0e80 [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -03003.. _VIDIOC_SUBDEV_G_SELECTION:
Markus Heiser5377d912016-06-30 15:18:56 +02004
5**********************************************************
6ioctl VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION
7**********************************************************
8
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -03009Name
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030010====
Markus Heiser5377d912016-06-30 15:18:56 +020011
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030012VIDIOC_SUBDEV_G_SELECTION - VIDIOC_SUBDEV_S_SELECTION - Get or set selection rectangles on a subdev pad
Markus Heiser5377d912016-06-30 15:18:56 +020013
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030014
15Synopsis
Markus Heiser5377d912016-06-30 15:18:56 +020016========
17
Mauro Carvalho Chehabb7e67f62016-07-02 09:49:16 -030018.. cpp:function:: int ioctl( int fd, int request, struct v4l2_subdev_selection *argp )
Markus Heiser5377d912016-06-30 15:18:56 +020019
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030020
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030021Arguments
Markus Heiser5377d912016-06-30 15:18:56 +020022=========
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
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030033Description
Markus Heiser5377d912016-06-30 15:18:56 +020034===========
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
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -030041:ref:`the old subdev crop API <VIDIOC_SUBDEV_G_CROP>`. All the
Markus Heiser5377d912016-06-30 15:18:56 +020042function 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
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030082 :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
Markus Heiser5377d912016-06-30 15:18:56 +020083
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
Mauro Carvalho Chehab8968da92016-07-13 08:43:30 -0300120 - ``reserved``\ [8]
Markus Heiser5377d912016-06-30 15:18:56 +0200121
122 - Reserved for future extensions. Applications and drivers must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300123 the array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200124
125
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -0300126Return Value
Markus Heiser5377d912016-06-30 15:18:56 +0200127============
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.