Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1.. Permission is granted to copy, distribute and/or modify this
2.. document under the terms of the GNU Free Documentation License,
3.. Version 1.1 or any later version published by the Free Software
4.. Foundation, with no Invariant Sections, no Front-Cover Texts
5.. and no Back-Cover Texts. A copy of the license is included at
6.. Documentation/userspace-api/media/fdl-appendix.rst.
7..
8.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10.. _VIDIOC_G_DV_TIMINGS:
11
12**********************************************
13ioctl VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS
14**********************************************
15
16Name
17====
18
19VIDIOC_G_DV_TIMINGS - VIDIOC_S_DV_TIMINGS - VIDIOC_SUBDEV_G_DV_TIMINGS - VIDIOC_SUBDEV_S_DV_TIMINGS - Get or set DV timings for input or output
20
21
22Synopsis
23========
24
25.. c:function:: int ioctl( int fd, VIDIOC_G_DV_TIMINGS, struct v4l2_dv_timings *argp )
26 :name: VIDIOC_G_DV_TIMINGS
27
28.. c:function:: int ioctl( int fd, VIDIOC_S_DV_TIMINGS, struct v4l2_dv_timings *argp )
29 :name: VIDIOC_S_DV_TIMINGS
30
31.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_G_DV_TIMINGS, struct v4l2_dv_timings *argp )
32 :name: VIDIOC_SUBDEV_G_DV_TIMINGS
33
34.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_S_DV_TIMINGS, struct v4l2_dv_timings *argp )
35 :name: VIDIOC_SUBDEV_S_DV_TIMINGS
36
37
38Arguments
39=========
40
41``fd``
42 File descriptor returned by :ref:`open() <func-open>`.
43
44``argp``
45 Pointer to struct :c:type:`v4l2_dv_timings`.
46
47
48Description
49===========
50
51To set DV timings for the input or output, applications use the
52:ref:`VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl and to get the current timings,
53applications use the :ref:`VIDIOC_G_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl. The detailed timing
54information is filled in using the structure struct
55:c:type:`v4l2_dv_timings`. These ioctls take a
56pointer to the struct :c:type:`v4l2_dv_timings`
57structure as argument. If the ioctl is not supported or the timing
58values are not correct, the driver returns ``EINVAL`` error code.
59
60Calling ``VIDIOC_SUBDEV_S_DV_TIMINGS`` on a subdev device node that has been
61registered in read-only mode is not allowed. An error is returned and the errno
62variable is set to ``-EPERM``.
63
64The ``linux/v4l2-dv-timings.h`` header can be used to get the timings of
65the formats in the :ref:`cea861` and :ref:`vesadmt` standards. If
66the current input or output does not support DV timings (e.g. if
67:ref:`VIDIOC_ENUMINPUT` does not set the
68``V4L2_IN_CAP_DV_TIMINGS`` flag), then ``ENODATA`` error code is returned.
69
70
71Return Value
72============
73
74On success 0 is returned, on error -1 and the ``errno`` variable is set
75appropriately. The generic error codes are described at the
76:ref:`Generic Error Codes <gen-errors>` chapter.
77
78EINVAL
79 This ioctl is not supported, or the :ref:`VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>`
80 parameter was unsuitable.
81
82ENODATA
83 Digital video timings are not supported for this input or output.
84
85EBUSY
86 The device is busy and therefore can not change the timings.
87
88EPERM
89 ``VIDIOC_SUBDEV_S_DV_TIMINGS`` has been called on a read-only subdevice.
90
91.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
92
93.. c:type:: v4l2_bt_timings
94
95.. flat-table:: struct v4l2_bt_timings
96 :header-rows: 0
97 :stub-columns: 0
98 :widths: 1 1 2
99
100 * - __u32
101 - ``width``
102 - Width of the active video in pixels.
103 * - __u32
104 - ``height``
105 - Height of the active video frame in lines. So for interlaced
106 formats the height of the active video in each field is
107 ``height``/2.
108 * - __u32
109 - ``interlaced``
110 - Progressive (``V4L2_DV_PROGRESSIVE``) or interlaced (``V4L2_DV_INTERLACED``).
111 * - __u32
112 - ``polarities``
113 - This is a bit mask that defines polarities of sync signals. bit 0
114 (``V4L2_DV_VSYNC_POS_POL``) is for vertical sync polarity and bit
115 1 (``V4L2_DV_HSYNC_POS_POL``) is for horizontal sync polarity. If
116 the bit is set (1) it is positive polarity and if is cleared (0),
117 it is negative polarity.
118 * - __u64
119 - ``pixelclock``
120 - Pixel clock in Hz. Ex. 74.25MHz->74250000
121 * - __u32
122 - ``hfrontporch``
123 - Horizontal front porch in pixels
124 * - __u32
125 - ``hsync``
126 - Horizontal sync length in pixels
127 * - __u32
128 - ``hbackporch``
129 - Horizontal back porch in pixels
130 * - __u32
131 - ``vfrontporch``
132 - Vertical front porch in lines. For interlaced formats this refers
133 to the odd field (aka field 1).
134 * - __u32
135 - ``vsync``
136 - Vertical sync length in lines. For interlaced formats this refers
137 to the odd field (aka field 1).
138 * - __u32
139 - ``vbackporch``
140 - Vertical back porch in lines. For interlaced formats this refers
141 to the odd field (aka field 1).
142 * - __u32
143 - ``il_vfrontporch``
144 - Vertical front porch in lines for the even field (aka field 2) of
145 interlaced field formats. Must be 0 for progressive formats.
146 * - __u32
147 - ``il_vsync``
148 - Vertical sync length in lines for the even field (aka field 2) of
149 interlaced field formats. Must be 0 for progressive formats.
150 * - __u32
151 - ``il_vbackporch``
152 - Vertical back porch in lines for the even field (aka field 2) of
153 interlaced field formats. Must be 0 for progressive formats.
154 * - __u32
155 - ``standards``
156 - The video standard(s) this format belongs to. This will be filled
157 in by the driver. Applications must set this to 0. See
158 :ref:`dv-bt-standards` for a list of standards.
159 * - __u32
160 - ``flags``
161 - Several flags giving more information about the format. See
162 :ref:`dv-bt-flags` for a description of the flags.
163 * - struct :c:type:`v4l2_fract`
164 - ``picture_aspect``
165 - The picture aspect if the pixels are not square. Only valid if the
166 ``V4L2_DV_FL_HAS_PICTURE_ASPECT`` flag is set.
167 * - __u8
168 - ``cea861_vic``
169 - The Video Identification Code according to the CEA-861 standard.
170 Only valid if the ``V4L2_DV_FL_HAS_CEA861_VIC`` flag is set.
171 * - __u8
172 - ``hdmi_vic``
173 - The Video Identification Code according to the HDMI standard.
174 Only valid if the ``V4L2_DV_FL_HAS_HDMI_VIC`` flag is set.
175 * - __u8
176 - ``reserved[46]``
177 - Reserved for future extensions. Drivers and applications must set
178 the array to zero.
179
180
181.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}|
182
183.. c:type:: v4l2_dv_timings
184
185.. flat-table:: struct v4l2_dv_timings
186 :header-rows: 0
187 :stub-columns: 0
188 :widths: 1 1 2
189
190 * - __u32
191 - ``type``
192 - Type of DV timings as listed in :ref:`dv-timing-types`.
193 * - union {
194 - (anonymous)
195 * - struct :c:type:`v4l2_bt_timings`
196 - ``bt``
197 - Timings defined by BT.656/1120 specifications
198 * - __u32
199 - ``reserved``\ [32]
200 -
201 * - }
202 -
203
204.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
205
206.. _dv-timing-types:
207
208.. flat-table:: DV Timing types
209 :header-rows: 0
210 :stub-columns: 0
211 :widths: 1 1 2
212
213 * - Timing type
214 - value
215 - Description
216 * -
217 -
218 -
219 * - ``V4L2_DV_BT_656_1120``
220 - 0
221 - BT.656/1120 timings
222
223.. tabularcolumns:: |p{4.5cm}|p{12.8cm}|
224
225.. _dv-bt-standards:
226
227.. flat-table:: DV BT Timing standards
228 :header-rows: 0
229 :stub-columns: 0
230
231 * - Timing standard
232 - Description
233 * - ``V4L2_DV_BT_STD_CEA861``
234 - The timings follow the CEA-861 Digital TV Profile standard
235 * - ``V4L2_DV_BT_STD_DMT``
236 - The timings follow the VESA Discrete Monitor Timings standard
237 * - ``V4L2_DV_BT_STD_CVT``
238 - The timings follow the VESA Coordinated Video Timings standard
239 * - ``V4L2_DV_BT_STD_GTF``
240 - The timings follow the VESA Generalized Timings Formula standard
241 * - ``V4L2_DV_BT_STD_SDI``
242 - The timings follow the SDI Timings standard.
243 There are no horizontal syncs/porches at all in this format.
244 Total blanking timings must be set in hsync or vsync fields only.
245
246.. tabularcolumns:: |p{7.0cm}|p{10.5cm}|
247
248.. _dv-bt-flags:
249
250.. flat-table:: DV BT Timing flags
251 :header-rows: 0
252 :stub-columns: 0
253
254 * - Flag
255 - Description
256 * - ``V4L2_DV_FL_REDUCED_BLANKING``
257 - CVT/GTF specific: the timings use reduced blanking (CVT) or the
258 'Secondary GTF' curve (GTF). In both cases the horizontal and/or
259 vertical blanking intervals are reduced, allowing a higher
260 resolution over the same bandwidth. This is a read-only flag,
261 applications must not set this.
262 * - ``V4L2_DV_FL_CAN_REDUCE_FPS``
263 - CEA-861 specific: set for CEA-861 formats with a framerate that is
264 a multiple of six. These formats can be optionally played at 1 /
265 1.001 speed to be compatible with 60 Hz based standards such as
266 NTSC and PAL-M that use a framerate of 29.97 frames per second. If
267 the transmitter can't generate such frequencies, then the flag
268 will also be cleared. This is a read-only flag, applications must
269 not set this.
270 * - ``V4L2_DV_FL_REDUCED_FPS``
271 - CEA-861 specific: only valid for video transmitters or video
272 receivers that have the ``V4L2_DV_FL_CAN_DETECT_REDUCED_FPS``
273 set. This flag is cleared otherwise. It is also only valid for
274 formats with the ``V4L2_DV_FL_CAN_REDUCE_FPS`` flag set, for other
275 formats the flag will be cleared by the driver.
276
277 If the application sets this flag for a transmitter, then the
278 pixelclock used to set up the transmitter is divided by 1.001 to
279 make it compatible with NTSC framerates. If the transmitter can't
280 generate such frequencies, then the flag will be cleared.
281
282 If a video receiver detects that the format uses a reduced framerate,
283 then it will set this flag to signal this to the application.
284 * - ``V4L2_DV_FL_HALF_LINE``
285 - Specific to interlaced formats: if set, then the vertical
286 frontporch of field 1 (aka the odd field) is really one half-line
287 longer and the vertical backporch of field 2 (aka the even field)
288 is really one half-line shorter, so each field has exactly the
289 same number of half-lines. Whether half-lines can be detected or
290 used depends on the hardware.
291 * - ``V4L2_DV_FL_IS_CE_VIDEO``
292 - If set, then this is a Consumer Electronics (CE) video format.
293 Such formats differ from other formats (commonly called IT
294 formats) in that if R'G'B' encoding is used then by default the
295 R'G'B' values use limited range (i.e. 16-235) as opposed to full
296 range (i.e. 0-255). All formats defined in CEA-861 except for the
297 640x480p59.94 format are CE formats.
298 * - ``V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE``
299 - Some formats like SMPTE-125M have an interlaced signal with a odd
300 total height. For these formats, if this flag is set, the first
301 field has the extra line. Else, it is the second field.
302 * - ``V4L2_DV_FL_HAS_PICTURE_ASPECT``
303 - If set, then the picture_aspect field is valid. Otherwise assume that
304 the pixels are square, so the picture aspect ratio is the same as the
305 width to height ratio.
306 * - ``V4L2_DV_FL_HAS_CEA861_VIC``
307 - If set, then the cea861_vic field is valid and contains the Video
308 Identification Code as per the CEA-861 standard.
309 * - ``V4L2_DV_FL_HAS_HDMI_VIC``
310 - If set, then the hdmi_vic field is valid and contains the Video
311 Identification Code as per the HDMI standard (HDMI Vendor Specific
312 InfoFrame).
313 * - ``V4L2_DV_FL_CAN_DETECT_REDUCED_FPS``
314 - CEA-861 specific: only valid for video receivers, the flag is
315 cleared by transmitters.
316 If set, then the hardware can detect the difference between
317 regular framerates and framerates reduced by 1000/1001. E.g.:
318 60 vs 59.94 Hz, 30 vs 29.97 Hz or 24 vs 23.976 Hz.