doc-rst: linux_tv: don't use uppercases for syscall sections
[deliverable/linux.git] / Documentation / linux_tv / media / v4l / vidioc-subdev-g-fmt.rst
CommitLineData
5377d91f
MH
1.. -*- coding: utf-8; mode: rst -*-
2
af4a4d0d 3.. _VIDIOC_SUBDEV_G_FMT:
5377d91f
MH
4
5**********************************************
6ioctl VIDIOC_SUBDEV_G_FMT, VIDIOC_SUBDEV_S_FMT
7**********************************************
8
15e7d615 9Name
586027ce 10====
5377d91f 11
586027ce 12VIDIOC_SUBDEV_G_FMT - VIDIOC_SUBDEV_S_FMT - Get or set the data format 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_format *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_FMT, VIDIOC_SUBDEV_S_FMT
29
30``argp``
31
32
15e7d615 33Description
5377d91f
MH
34===========
35
36These ioctls are used to negotiate the frame format at specific subdev
37pads in the image pipeline.
38
39To retrieve the current format applications set the ``pad`` field of a
40struct :ref:`v4l2_subdev_format <v4l2-subdev-format>` to the desired
41pad number as reported by the media API and the ``which`` field to
42``V4L2_SUBDEV_FORMAT_ACTIVE``. When they call the
43``VIDIOC_SUBDEV_G_FMT`` ioctl with a pointer to this structure the
44driver fills the members of the ``format`` field.
45
46To change the current format applications set both the ``pad`` and
47``which`` fields and all members of the ``format`` field. When they call
48the ``VIDIOC_SUBDEV_S_FMT`` ioctl with a pointer to this structure the
49driver verifies the requested format, adjusts it based on the hardware
50capabilities and configures the device. Upon return the struct
51:ref:`v4l2_subdev_format <v4l2-subdev-format>` contains the current
52format as would be returned by a ``VIDIOC_SUBDEV_G_FMT`` call.
53
54Applications can query the device capabilities by setting the ``which``
55to ``V4L2_SUBDEV_FORMAT_TRY``. When set, 'try' formats are not applied
56to the device by the driver, but are changed exactly as active formats
57and stored in the sub-device file handle. Two applications querying the
58same sub-device would thus not interact with each other.
59
60For instance, to try a format at the output pad of a sub-device,
61applications would first set the try format at the sub-device input with
62the ``VIDIOC_SUBDEV_S_FMT`` ioctl. They would then either retrieve the
63default format at the output pad with the ``VIDIOC_SUBDEV_G_FMT`` ioctl,
64or set the desired output pad format with the ``VIDIOC_SUBDEV_S_FMT``
65ioctl and check the returned value.
66
67Try formats do not depend on active formats, but can depend on the
68current links configuration or sub-device controls value. For instance,
69a low-pass noise filter might crop pixels at the frame boundaries,
70modifying its output frame size.
71
72Drivers must not return an error solely because the requested format
73doesn't match the device capabilities. They must instead modify the
74format to match what the hardware can provide. The modified format
75should be as close as possible to the original request.
76
77
78.. _v4l2-subdev-format:
79
80.. flat-table:: struct v4l2_subdev_format
81 :header-rows: 0
82 :stub-columns: 0
83 :widths: 1 1 2
84
85
86 - .. row 1
87
88 - __u32
89
90 - ``pad``
91
92 - Pad number as reported by the media controller API.
93
94 - .. row 2
95
96 - __u32
97
98 - ``which``
99
100 - Format to modified, from enum
0579e6e3 101 :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
5377d91f
MH
102
103 - .. row 3
104
105 - struct :ref:`v4l2_mbus_framefmt <v4l2-mbus-framefmt>`
106
107 - ``format``
108
109 - Definition of an image format, see :ref:`v4l2-mbus-framefmt` for
0579e6e3 110 details.
5377d91f
MH
111
112 - .. row 4
113
114 - __u32
115
116 - ``reserved``\ [8]
117
118 - Reserved for future extensions. Applications and drivers must set
0579e6e3 119 the array to zero.
5377d91f
MH
120
121
122
123.. _v4l2-subdev-format-whence:
124
125.. flat-table:: enum v4l2_subdev_format_whence
126 :header-rows: 0
127 :stub-columns: 0
128 :widths: 3 1 4
129
130
131 - .. row 1
132
133 - V4L2_SUBDEV_FORMAT_TRY
134
135 - 0
136
137 - Try formats, used for querying device capabilities.
138
139 - .. row 2
140
141 - V4L2_SUBDEV_FORMAT_ACTIVE
142
143 - 1
144
145 - Active formats, applied to the hardware.
146
147
15e7d615 148Return Value
5377d91f
MH
149============
150
151On success 0 is returned, on error -1 and the ``errno`` variable is set
152appropriately. The generic error codes are described at the
153:ref:`Generic Error Codes <gen-errors>` chapter.
154
155EBUSY
156 The format can't be changed because the pad is currently busy. This
157 can be caused, for instance, by an active video stream on the pad.
158 The ioctl must not be retried without performing another action to
159 fix the problem first. Only returned by ``VIDIOC_SUBDEV_S_FMT``
160
161EINVAL
162 The struct :ref:`v4l2_subdev_format <v4l2-subdev-format>`
163 ``pad`` references a non-existing pad, or the ``which`` field
164 references a non-existing format.
165
166
5377d91f
MH
167============
168
169On success 0 is returned, on error -1 and the ``errno`` variable is set
170appropriately. The generic error codes are described at the
171:ref:`Generic Error Codes <gen-errors>` chapter.
This page took 0.057808 seconds and 5 git commands to generate.