xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/media/vivid.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunThe Virtual Video Test Driver (vivid)
4*4882a593Smuzhiyun=====================================
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThis driver emulates video4linux hardware of various types: video capture, video
7*4882a593Smuzhiyunoutput, vbi capture and output, metadata capture and output, radio receivers and
8*4882a593Smuzhiyuntransmitters, touch capture and a software defined radio receiver. In addition a
9*4882a593Smuzhiyunsimple framebuffer device is available for testing capture and output overlays.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunUp to 64 vivid instances can be created, each with up to 16 inputs and 16 outputs.
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunEach input can be a webcam, TV capture device, S-Video capture device or an HDMI
14*4882a593Smuzhiyuncapture device. Each output can be an S-Video output device or an HDMI output
15*4882a593Smuzhiyundevice.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunThese inputs and outputs act exactly as a real hardware device would behave. This
18*4882a593Smuzhiyunallows you to use this driver as a test input for application development, since
19*4882a593Smuzhiyunyou can test the various features without requiring special hardware.
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunThis document describes the features implemented by this driver:
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun- Support for read()/write(), MMAP, USERPTR and DMABUF streaming I/O.
24*4882a593Smuzhiyun- A large list of test patterns and variations thereof
25*4882a593Smuzhiyun- Working brightness, contrast, saturation and hue controls
26*4882a593Smuzhiyun- Support for the alpha color component
27*4882a593Smuzhiyun- Full colorspace support, including limited/full RGB range
28*4882a593Smuzhiyun- All possible control types are present
29*4882a593Smuzhiyun- Support for various pixel aspect ratios and video aspect ratios
30*4882a593Smuzhiyun- Error injection to test what happens if errors occur
31*4882a593Smuzhiyun- Supports crop/compose/scale in any combination for both input and output
32*4882a593Smuzhiyun- Can emulate up to 4K resolutions
33*4882a593Smuzhiyun- All Field settings are supported for testing interlaced capturing
34*4882a593Smuzhiyun- Supports all standard YUV and RGB formats, including two multiplanar YUV formats
35*4882a593Smuzhiyun- Raw and Sliced VBI capture and output support
36*4882a593Smuzhiyun- Radio receiver and transmitter support, including RDS support
37*4882a593Smuzhiyun- Software defined radio (SDR) support
38*4882a593Smuzhiyun- Capture and output overlay support
39*4882a593Smuzhiyun- Metadata capture and output support
40*4882a593Smuzhiyun- Touch capture support
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunThese features will be described in more detail below.
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunConfiguring the driver
45*4882a593Smuzhiyun----------------------
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunBy default the driver will create a single instance that has a video capture
48*4882a593Smuzhiyundevice with webcam, TV, S-Video and HDMI inputs, a video output device with
49*4882a593SmuzhiyunS-Video and HDMI outputs, one vbi capture device, one vbi output device, one
50*4882a593Smuzhiyunradio receiver device, one radio transmitter device and one SDR device.
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunThe number of instances, devices, video inputs and outputs and their types are
53*4882a593Smuzhiyunall configurable using the following module options:
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun- n_devs:
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun	number of driver instances to create. By default set to 1. Up to 64
58*4882a593Smuzhiyun	instances can be created.
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun- node_types:
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun	which devices should each driver instance create. An array of
63*4882a593Smuzhiyun	hexadecimal values, one for each instance. The default is 0x1d3d.
64*4882a593Smuzhiyun	Each value is a bitmask with the following meaning:
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun		- bit 0: Video Capture node
67*4882a593Smuzhiyun		- bit 2-3: VBI Capture node: 0 = none, 1 = raw vbi, 2 = sliced vbi, 3 = both
68*4882a593Smuzhiyun		- bit 4: Radio Receiver node
69*4882a593Smuzhiyun		- bit 5: Software Defined Radio Receiver node
70*4882a593Smuzhiyun		- bit 8: Video Output node
71*4882a593Smuzhiyun		- bit 10-11: VBI Output node: 0 = none, 1 = raw vbi, 2 = sliced vbi, 3 = both
72*4882a593Smuzhiyun		- bit 12: Radio Transmitter node
73*4882a593Smuzhiyun		- bit 16: Framebuffer for testing overlays
74*4882a593Smuzhiyun		- bit 17: Metadata Capture node
75*4882a593Smuzhiyun		- bit 18: Metadata Output node
76*4882a593Smuzhiyun		- bit 19: Touch Capture node
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun	So to create four instances, the first two with just one video capture
79*4882a593Smuzhiyun	device, the second two with just one video output device you would pass
80*4882a593Smuzhiyun	these module options to vivid:
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun	.. code-block:: none
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun		n_devs=4 node_types=0x1,0x1,0x100,0x100
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun- num_inputs:
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun	the number of inputs, one for each instance. By default 4 inputs
89*4882a593Smuzhiyun	are created for each video capture device. At most 16 inputs can be created,
90*4882a593Smuzhiyun	and there must be at least one.
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun- input_types:
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun	the input types for each instance, the default is 0xe4. This defines
95*4882a593Smuzhiyun	what the type of each input is when the inputs are created for each driver
96*4882a593Smuzhiyun	instance. This is a hexadecimal value with up to 16 pairs of bits, each
97*4882a593Smuzhiyun	pair gives the type and bits 0-1 map to input 0, bits 2-3 map to input 1,
98*4882a593Smuzhiyun	30-31 map to input 15. Each pair of bits has the following meaning:
99*4882a593Smuzhiyun
100*4882a593Smuzhiyun		- 00: this is a webcam input
101*4882a593Smuzhiyun		- 01: this is a TV tuner input
102*4882a593Smuzhiyun		- 10: this is an S-Video input
103*4882a593Smuzhiyun		- 11: this is an HDMI input
104*4882a593Smuzhiyun
105*4882a593Smuzhiyun	So to create a video capture device with 8 inputs where input 0 is a TV
106*4882a593Smuzhiyun	tuner, inputs 1-3 are S-Video inputs and inputs 4-7 are HDMI inputs you
107*4882a593Smuzhiyun	would use the following module options:
108*4882a593Smuzhiyun
109*4882a593Smuzhiyun	.. code-block:: none
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun		num_inputs=8 input_types=0xffa9
112*4882a593Smuzhiyun
113*4882a593Smuzhiyun- num_outputs:
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun	the number of outputs, one for each instance. By default 2 outputs
116*4882a593Smuzhiyun	are created for each video output device. At most 16 outputs can be
117*4882a593Smuzhiyun	created, and there must be at least one.
118*4882a593Smuzhiyun
119*4882a593Smuzhiyun- output_types:
120*4882a593Smuzhiyun
121*4882a593Smuzhiyun	the output types for each instance, the default is 0x02. This defines
122*4882a593Smuzhiyun	what the type of each output is when the outputs are created for each
123*4882a593Smuzhiyun	driver instance. This is a hexadecimal value with up to 16 bits, each bit
124*4882a593Smuzhiyun	gives the type and bit 0 maps to output 0, bit 1 maps to output 1, bit
125*4882a593Smuzhiyun	15 maps to output 15. The meaning of each bit is as follows:
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun		- 0: this is an S-Video output
128*4882a593Smuzhiyun		- 1: this is an HDMI output
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun	So to create a video output device with 8 outputs where outputs 0-3 are
131*4882a593Smuzhiyun	S-Video outputs and outputs 4-7 are HDMI outputs you would use the
132*4882a593Smuzhiyun	following module options:
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun	.. code-block:: none
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun		num_outputs=8 output_types=0xf0
137*4882a593Smuzhiyun
138*4882a593Smuzhiyun- vid_cap_nr:
139*4882a593Smuzhiyun
140*4882a593Smuzhiyun	give the desired videoX start number for each video capture device.
141*4882a593Smuzhiyun	The default is -1 which will just take the first free number. This allows
142*4882a593Smuzhiyun	you to map capture video nodes to specific videoX device nodes. Example:
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun	.. code-block:: none
145*4882a593Smuzhiyun
146*4882a593Smuzhiyun		n_devs=4 vid_cap_nr=2,4,6,8
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun	This will attempt to assign /dev/video2 for the video capture device of
149*4882a593Smuzhiyun	the first vivid instance, video4 for the next up to video8 for the last
150*4882a593Smuzhiyun	instance. If it can't succeed, then it will just take the next free
151*4882a593Smuzhiyun	number.
152*4882a593Smuzhiyun
153*4882a593Smuzhiyun- vid_out_nr:
154*4882a593Smuzhiyun
155*4882a593Smuzhiyun	give the desired videoX start number for each video output device.
156*4882a593Smuzhiyun	The default is -1 which will just take the first free number.
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun- vbi_cap_nr:
159*4882a593Smuzhiyun
160*4882a593Smuzhiyun	give the desired vbiX start number for each vbi capture device.
161*4882a593Smuzhiyun	The default is -1 which will just take the first free number.
162*4882a593Smuzhiyun
163*4882a593Smuzhiyun- vbi_out_nr:
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun	give the desired vbiX start number for each vbi output device.
166*4882a593Smuzhiyun	The default is -1 which will just take the first free number.
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun- radio_rx_nr:
169*4882a593Smuzhiyun
170*4882a593Smuzhiyun	give the desired radioX start number for each radio receiver device.
171*4882a593Smuzhiyun	The default is -1 which will just take the first free number.
172*4882a593Smuzhiyun
173*4882a593Smuzhiyun- radio_tx_nr:
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun	give the desired radioX start number for each radio transmitter
176*4882a593Smuzhiyun	device. The default is -1 which will just take the first free number.
177*4882a593Smuzhiyun
178*4882a593Smuzhiyun- sdr_cap_nr:
179*4882a593Smuzhiyun
180*4882a593Smuzhiyun	give the desired swradioX start number for each SDR capture device.
181*4882a593Smuzhiyun	The default is -1 which will just take the first free number.
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun- meta_cap_nr:
184*4882a593Smuzhiyun
185*4882a593Smuzhiyun        give the desired videoX start number for each metadata capture device.
186*4882a593Smuzhiyun        The default is -1 which will just take the first free number.
187*4882a593Smuzhiyun
188*4882a593Smuzhiyun- meta_out_nr:
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun        give the desired videoX start number for each metadata output device.
191*4882a593Smuzhiyun        The default is -1 which will just take the first free number.
192*4882a593Smuzhiyun
193*4882a593Smuzhiyun- touch_cap_nr:
194*4882a593Smuzhiyun
195*4882a593Smuzhiyun        give the desired v4l-touchX start number for each touch capture device.
196*4882a593Smuzhiyun        The default is -1 which will just take the first free number.
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun- ccs_cap_mode:
199*4882a593Smuzhiyun
200*4882a593Smuzhiyun	specify the allowed video capture crop/compose/scaling combination
201*4882a593Smuzhiyun	for each driver instance. Video capture devices can have any combination
202*4882a593Smuzhiyun	of cropping, composing and scaling capabilities and this will tell the
203*4882a593Smuzhiyun	vivid driver which of those is should emulate. By default the user can
204*4882a593Smuzhiyun	select this through controls.
205*4882a593Smuzhiyun
206*4882a593Smuzhiyun	The value is either -1 (controlled by the user) or a set of three bits,
207*4882a593Smuzhiyun	each enabling (1) or disabling (0) one of the features:
208*4882a593Smuzhiyun
209*4882a593Smuzhiyun	- bit 0:
210*4882a593Smuzhiyun
211*4882a593Smuzhiyun		Enable crop support. Cropping will take only part of the
212*4882a593Smuzhiyun		incoming picture.
213*4882a593Smuzhiyun	- bit 1:
214*4882a593Smuzhiyun
215*4882a593Smuzhiyun		Enable compose support. Composing will copy the incoming
216*4882a593Smuzhiyun		picture into a larger buffer.
217*4882a593Smuzhiyun
218*4882a593Smuzhiyun	- bit 2:
219*4882a593Smuzhiyun
220*4882a593Smuzhiyun		Enable scaling support. Scaling can scale the incoming
221*4882a593Smuzhiyun		picture. The scaler of the vivid driver can enlarge up
222*4882a593Smuzhiyun		or down to four times the original size. The scaler is
223*4882a593Smuzhiyun		very simple and low-quality. Simplicity and speed were
224*4882a593Smuzhiyun		key, not quality.
225*4882a593Smuzhiyun
226*4882a593Smuzhiyun	Note that this value is ignored by webcam inputs: those enumerate
227*4882a593Smuzhiyun	discrete framesizes and that is incompatible with cropping, composing
228*4882a593Smuzhiyun	or scaling.
229*4882a593Smuzhiyun
230*4882a593Smuzhiyun- ccs_out_mode:
231*4882a593Smuzhiyun
232*4882a593Smuzhiyun	specify the allowed video output crop/compose/scaling combination
233*4882a593Smuzhiyun	for each driver instance. Video output devices can have any combination
234*4882a593Smuzhiyun	of cropping, composing and scaling capabilities and this will tell the
235*4882a593Smuzhiyun	vivid driver which of those is should emulate. By default the user can
236*4882a593Smuzhiyun	select this through controls.
237*4882a593Smuzhiyun
238*4882a593Smuzhiyun	The value is either -1 (controlled by the user) or a set of three bits,
239*4882a593Smuzhiyun	each enabling (1) or disabling (0) one of the features:
240*4882a593Smuzhiyun
241*4882a593Smuzhiyun	- bit 0:
242*4882a593Smuzhiyun
243*4882a593Smuzhiyun		Enable crop support. Cropping will take only part of the
244*4882a593Smuzhiyun		outgoing buffer.
245*4882a593Smuzhiyun
246*4882a593Smuzhiyun	- bit 1:
247*4882a593Smuzhiyun
248*4882a593Smuzhiyun		Enable compose support. Composing will copy the incoming
249*4882a593Smuzhiyun		buffer into a larger picture frame.
250*4882a593Smuzhiyun
251*4882a593Smuzhiyun	- bit 2:
252*4882a593Smuzhiyun
253*4882a593Smuzhiyun		Enable scaling support. Scaling can scale the incoming
254*4882a593Smuzhiyun		buffer. The scaler of the vivid driver can enlarge up
255*4882a593Smuzhiyun		or down to four times the original size. The scaler is
256*4882a593Smuzhiyun		very simple and low-quality. Simplicity and speed were
257*4882a593Smuzhiyun		key, not quality.
258*4882a593Smuzhiyun
259*4882a593Smuzhiyun- multiplanar:
260*4882a593Smuzhiyun
261*4882a593Smuzhiyun	select whether each device instance supports multi-planar formats,
262*4882a593Smuzhiyun	and thus the V4L2 multi-planar API. By default device instances are
263*4882a593Smuzhiyun	single-planar.
264*4882a593Smuzhiyun
265*4882a593Smuzhiyun	This module option can override that for each instance. Values are:
266*4882a593Smuzhiyun
267*4882a593Smuzhiyun		- 1: this is a single-planar instance.
268*4882a593Smuzhiyun		- 2: this is a multi-planar instance.
269*4882a593Smuzhiyun
270*4882a593Smuzhiyun- vivid_debug:
271*4882a593Smuzhiyun
272*4882a593Smuzhiyun	enable driver debugging info
273*4882a593Smuzhiyun
274*4882a593Smuzhiyun- no_error_inj:
275*4882a593Smuzhiyun
276*4882a593Smuzhiyun	if set disable the error injecting controls. This option is
277*4882a593Smuzhiyun	needed in order to run a tool like v4l2-compliance. Tools like that
278*4882a593Smuzhiyun	exercise all controls including a control like 'Disconnect' which
279*4882a593Smuzhiyun	emulates a USB disconnect, making the device inaccessible and so
280*4882a593Smuzhiyun	all tests that v4l2-compliance is doing will fail afterwards.
281*4882a593Smuzhiyun
282*4882a593Smuzhiyun	There may be other situations as well where you want to disable the
283*4882a593Smuzhiyun	error injection support of vivid. When this option is set, then the
284*4882a593Smuzhiyun	controls that select crop, compose and scale behavior are also
285*4882a593Smuzhiyun	removed. Unless overridden by ccs_cap_mode and/or ccs_out_mode the
286*4882a593Smuzhiyun	will default to enabling crop, compose and scaling.
287*4882a593Smuzhiyun
288*4882a593Smuzhiyun- allocators:
289*4882a593Smuzhiyun
290*4882a593Smuzhiyun	memory allocator selection, default is 0. It specifies the way buffers
291*4882a593Smuzhiyun	will be allocated.
292*4882a593Smuzhiyun
293*4882a593Smuzhiyun		- 0: vmalloc
294*4882a593Smuzhiyun		- 1: dma-contig
295*4882a593Smuzhiyun
296*4882a593Smuzhiyun- cache_hints:
297*4882a593Smuzhiyun
298*4882a593Smuzhiyun	specifies if the device should set queues' user-space cache and memory
299*4882a593Smuzhiyun	consistency hint capability (V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS).
300*4882a593Smuzhiyun	The hints are valid only when using MMAP streaming I/O. Default is 0.
301*4882a593Smuzhiyun
302*4882a593Smuzhiyun		- 0: forbid hints
303*4882a593Smuzhiyun		- 1: allow hints
304*4882a593Smuzhiyun
305*4882a593SmuzhiyunTaken together, all these module options allow you to precisely customize
306*4882a593Smuzhiyunthe driver behavior and test your application with all sorts of permutations.
307*4882a593SmuzhiyunIt is also very suitable to emulate hardware that is not yet available, e.g.
308*4882a593Smuzhiyunwhen developing software for a new upcoming device.
309*4882a593Smuzhiyun
310*4882a593Smuzhiyun
311*4882a593SmuzhiyunVideo Capture
312*4882a593Smuzhiyun-------------
313*4882a593Smuzhiyun
314*4882a593SmuzhiyunThis is probably the most frequently used feature. The video capture device
315*4882a593Smuzhiyuncan be configured by using the module options num_inputs, input_types and
316*4882a593Smuzhiyunccs_cap_mode (see section 1 for more detailed information), but by default
317*4882a593Smuzhiyunfour inputs are configured: a webcam, a TV tuner, an S-Video and an HDMI
318*4882a593Smuzhiyuninput, one input for each input type. Those are described in more detail
319*4882a593Smuzhiyunbelow.
320*4882a593Smuzhiyun
321*4882a593SmuzhiyunSpecial attention has been given to the rate at which new frames become
322*4882a593Smuzhiyunavailable. The jitter will be around 1 jiffie (that depends on the HZ
323*4882a593Smuzhiyunconfiguration of your kernel, so usually 1/100, 1/250 or 1/1000 of a second),
324*4882a593Smuzhiyunbut the long-term behavior is exactly following the framerate. So a
325*4882a593Smuzhiyunframerate of 59.94 Hz is really different from 60 Hz. If the framerate
326*4882a593Smuzhiyunexceeds your kernel's HZ value, then you will get dropped frames, but the
327*4882a593Smuzhiyunframe/field sequence counting will keep track of that so the sequence
328*4882a593Smuzhiyuncount will skip whenever frames are dropped.
329*4882a593Smuzhiyun
330*4882a593Smuzhiyun
331*4882a593SmuzhiyunWebcam Input
332*4882a593Smuzhiyun~~~~~~~~~~~~
333*4882a593Smuzhiyun
334*4882a593SmuzhiyunThe webcam input supports three framesizes: 320x180, 640x360 and 1280x720. It
335*4882a593Smuzhiyunsupports frames per second settings of 10, 15, 25, 30, 50 and 60 fps. Which ones
336*4882a593Smuzhiyunare available depends on the chosen framesize: the larger the framesize, the
337*4882a593Smuzhiyunlower the maximum frames per second.
338*4882a593Smuzhiyun
339*4882a593SmuzhiyunThe initially selected colorspace when you switch to the webcam input will be
340*4882a593SmuzhiyunsRGB.
341*4882a593Smuzhiyun
342*4882a593Smuzhiyun
343*4882a593SmuzhiyunTV and S-Video Inputs
344*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~
345*4882a593Smuzhiyun
346*4882a593SmuzhiyunThe only difference between the TV and S-Video input is that the TV has a
347*4882a593Smuzhiyuntuner. Otherwise they behave identically.
348*4882a593Smuzhiyun
349*4882a593SmuzhiyunThese inputs support audio inputs as well: one TV and one Line-In. They
350*4882a593Smuzhiyunboth support all TV standards. If the standard is queried, then the Vivid
351*4882a593Smuzhiyuncontrols 'Standard Signal Mode' and 'Standard' determine what
352*4882a593Smuzhiyunthe result will be.
353*4882a593Smuzhiyun
354*4882a593SmuzhiyunThese inputs support all combinations of the field setting. Special care has
355*4882a593Smuzhiyunbeen taken to faithfully reproduce how fields are handled for the different
356*4882a593SmuzhiyunTV standards. This is particularly noticeable when generating a horizontally
357*4882a593Smuzhiyunmoving image so the temporal effect of using interlaced formats becomes clearly
358*4882a593Smuzhiyunvisible. For 50 Hz standards the top field is the oldest and the bottom field
359*4882a593Smuzhiyunis the newest in time. For 60 Hz standards that is reversed: the bottom field
360*4882a593Smuzhiyunis the oldest and the top field is the newest in time.
361*4882a593Smuzhiyun
362*4882a593SmuzhiyunWhen you start capturing in V4L2_FIELD_ALTERNATE mode the first buffer will
363*4882a593Smuzhiyuncontain the top field for 50 Hz standards and the bottom field for 60 Hz
364*4882a593Smuzhiyunstandards. This is what capture hardware does as well.
365*4882a593Smuzhiyun
366*4882a593SmuzhiyunFinally, for PAL/SECAM standards the first half of the top line contains noise.
367*4882a593SmuzhiyunThis simulates the Wide Screen Signal that is commonly placed there.
368*4882a593Smuzhiyun
369*4882a593SmuzhiyunThe initially selected colorspace when you switch to the TV or S-Video input
370*4882a593Smuzhiyunwill be SMPTE-170M.
371*4882a593Smuzhiyun
372*4882a593SmuzhiyunThe pixel aspect ratio will depend on the TV standard. The video aspect ratio
373*4882a593Smuzhiyuncan be selected through the 'Standard Aspect Ratio' Vivid control.
374*4882a593SmuzhiyunChoices are '4x3', '16x9' which will give letterboxed widescreen video and
375*4882a593Smuzhiyun'16x9 Anamorphic' which will give full screen squashed anamorphic widescreen
376*4882a593Smuzhiyunvideo that will need to be scaled accordingly.
377*4882a593Smuzhiyun
378*4882a593SmuzhiyunThe TV 'tuner' supports a frequency range of 44-958 MHz. Channels are available
379*4882a593Smuzhiyunevery 6 MHz, starting from 49.25 MHz. For each channel the generated image
380*4882a593Smuzhiyunwill be in color for the +/- 0.25 MHz around it, and in grayscale for
381*4882a593Smuzhiyun+/- 1 MHz around the channel. Beyond that it is just noise. The VIDIOC_G_TUNER
382*4882a593Smuzhiyunioctl will return 100% signal strength for +/- 0.25 MHz and 50% for +/- 1 MHz.
383*4882a593SmuzhiyunIt will also return correct afc values to show whether the frequency is too
384*4882a593Smuzhiyunlow or too high.
385*4882a593Smuzhiyun
386*4882a593SmuzhiyunThe audio subchannels that are returned are MONO for the +/- 1 MHz range around
387*4882a593Smuzhiyuna valid channel frequency. When the frequency is within +/- 0.25 MHz of the
388*4882a593Smuzhiyunchannel it will return either MONO, STEREO, either MONO | SAP (for NTSC) or
389*4882a593SmuzhiyunLANG1 | LANG2 (for others), or STEREO | SAP.
390*4882a593Smuzhiyun
391*4882a593SmuzhiyunWhich one is returned depends on the chosen channel, each next valid channel
392*4882a593Smuzhiyunwill cycle through the possible audio subchannel combinations. This allows
393*4882a593Smuzhiyunyou to test the various combinations by just switching channels..
394*4882a593Smuzhiyun
395*4882a593SmuzhiyunFinally, for these inputs the v4l2_timecode struct is filled in in the
396*4882a593Smuzhiyundequeued v4l2_buffer struct.
397*4882a593Smuzhiyun
398*4882a593Smuzhiyun
399*4882a593SmuzhiyunHDMI Input
400*4882a593Smuzhiyun~~~~~~~~~~
401*4882a593Smuzhiyun
402*4882a593SmuzhiyunThe HDMI inputs supports all CEA-861 and DMT timings, both progressive and
403*4882a593Smuzhiyuninterlaced, for pixelclock frequencies between 25 and 600 MHz. The field
404*4882a593Smuzhiyunmode for interlaced formats is always V4L2_FIELD_ALTERNATE. For HDMI the
405*4882a593Smuzhiyunfield order is always top field first, and when you start capturing an
406*4882a593Smuzhiyuninterlaced format you will receive the top field first.
407*4882a593Smuzhiyun
408*4882a593SmuzhiyunThe initially selected colorspace when you switch to the HDMI input or
409*4882a593Smuzhiyunselect an HDMI timing is based on the format resolution: for resolutions
410*4882a593Smuzhiyunless than or equal to 720x576 the colorspace is set to SMPTE-170M, for
411*4882a593Smuzhiyunothers it is set to REC-709 (CEA-861 timings) or sRGB (VESA DMT timings).
412*4882a593Smuzhiyun
413*4882a593SmuzhiyunThe pixel aspect ratio will depend on the HDMI timing: for 720x480 is it
414*4882a593Smuzhiyunset as for the NTSC TV standard, for 720x576 it is set as for the PAL TV
415*4882a593Smuzhiyunstandard, and for all others a 1:1 pixel aspect ratio is returned.
416*4882a593Smuzhiyun
417*4882a593SmuzhiyunThe video aspect ratio can be selected through the 'DV Timings Aspect Ratio'
418*4882a593SmuzhiyunVivid control. Choices are 'Source Width x Height' (just use the
419*4882a593Smuzhiyunsame ratio as the chosen format), '4x3' or '16x9', either of which can
420*4882a593Smuzhiyunresult in pillarboxed or letterboxed video.
421*4882a593Smuzhiyun
422*4882a593SmuzhiyunFor HDMI inputs it is possible to set the EDID. By default a simple EDID
423*4882a593Smuzhiyunis provided. You can only set the EDID for HDMI inputs. Internally, however,
424*4882a593Smuzhiyunthe EDID is shared between all HDMI inputs.
425*4882a593Smuzhiyun
426*4882a593SmuzhiyunNo interpretation is done of the EDID data with the exception of the
427*4882a593Smuzhiyunphysical address. See the CEC section for more details.
428*4882a593Smuzhiyun
429*4882a593SmuzhiyunThere is a maximum of 15 HDMI inputs (if there are more, then they will be
430*4882a593Smuzhiyunreduced to 15) since that's the limitation of the EDID physical address.
431*4882a593Smuzhiyun
432*4882a593Smuzhiyun
433*4882a593SmuzhiyunVideo Output
434*4882a593Smuzhiyun------------
435*4882a593Smuzhiyun
436*4882a593SmuzhiyunThe video output device can be configured by using the module options
437*4882a593Smuzhiyunnum_outputs, output_types and ccs_out_mode (see section 1 for more detailed
438*4882a593Smuzhiyuninformation), but by default two outputs are configured: an S-Video and an
439*4882a593SmuzhiyunHDMI input, one output for each output type. Those are described in more detail
440*4882a593Smuzhiyunbelow.
441*4882a593Smuzhiyun
442*4882a593SmuzhiyunLike with video capture the framerate is also exact in the long term.
443*4882a593Smuzhiyun
444*4882a593Smuzhiyun
445*4882a593SmuzhiyunS-Video Output
446*4882a593Smuzhiyun~~~~~~~~~~~~~~
447*4882a593Smuzhiyun
448*4882a593SmuzhiyunThis output supports audio outputs as well: "Line-Out 1" and "Line-Out 2".
449*4882a593SmuzhiyunThe S-Video output supports all TV standards.
450*4882a593Smuzhiyun
451*4882a593SmuzhiyunThis output supports all combinations of the field setting.
452*4882a593Smuzhiyun
453*4882a593SmuzhiyunThe initially selected colorspace when you switch to the TV or S-Video input
454*4882a593Smuzhiyunwill be SMPTE-170M.
455*4882a593Smuzhiyun
456*4882a593Smuzhiyun
457*4882a593SmuzhiyunHDMI Output
458*4882a593Smuzhiyun~~~~~~~~~~~
459*4882a593Smuzhiyun
460*4882a593SmuzhiyunThe HDMI output supports all CEA-861 and DMT timings, both progressive and
461*4882a593Smuzhiyuninterlaced, for pixelclock frequencies between 25 and 600 MHz. The field
462*4882a593Smuzhiyunmode for interlaced formats is always V4L2_FIELD_ALTERNATE.
463*4882a593Smuzhiyun
464*4882a593SmuzhiyunThe initially selected colorspace when you switch to the HDMI output or
465*4882a593Smuzhiyunselect an HDMI timing is based on the format resolution: for resolutions
466*4882a593Smuzhiyunless than or equal to 720x576 the colorspace is set to SMPTE-170M, for
467*4882a593Smuzhiyunothers it is set to REC-709 (CEA-861 timings) or sRGB (VESA DMT timings).
468*4882a593Smuzhiyun
469*4882a593SmuzhiyunThe pixel aspect ratio will depend on the HDMI timing: for 720x480 is it
470*4882a593Smuzhiyunset as for the NTSC TV standard, for 720x576 it is set as for the PAL TV
471*4882a593Smuzhiyunstandard, and for all others a 1:1 pixel aspect ratio is returned.
472*4882a593Smuzhiyun
473*4882a593SmuzhiyunAn HDMI output has a valid EDID which can be obtained through VIDIOC_G_EDID.
474*4882a593Smuzhiyun
475*4882a593SmuzhiyunThere is a maximum of 15 HDMI outputs (if there are more, then they will be
476*4882a593Smuzhiyunreduced to 15) since that's the limitation of the EDID physical address. See
477*4882a593Smuzhiyunalso the CEC section for more details.
478*4882a593Smuzhiyun
479*4882a593SmuzhiyunVBI Capture
480*4882a593Smuzhiyun-----------
481*4882a593Smuzhiyun
482*4882a593SmuzhiyunThere are three types of VBI capture devices: those that only support raw
483*4882a593Smuzhiyun(undecoded) VBI, those that only support sliced (decoded) VBI and those that
484*4882a593Smuzhiyunsupport both. This is determined by the node_types module option. In all
485*4882a593Smuzhiyuncases the driver will generate valid VBI data: for 60 Hz standards it will
486*4882a593Smuzhiyungenerate Closed Caption and XDS data. The closed caption stream will
487*4882a593Smuzhiyunalternate between "Hello world!" and "Closed captions test" every second.
488*4882a593SmuzhiyunThe XDS stream will give the current time once a minute. For 50 Hz standards
489*4882a593Smuzhiyunit will generate the Wide Screen Signal which is based on the actual Video
490*4882a593SmuzhiyunAspect Ratio control setting and teletext pages 100-159, one page per frame.
491*4882a593Smuzhiyun
492*4882a593SmuzhiyunThe VBI device will only work for the S-Video and TV inputs, it will give
493*4882a593Smuzhiyunback an error if the current input is a webcam or HDMI.
494*4882a593Smuzhiyun
495*4882a593Smuzhiyun
496*4882a593SmuzhiyunVBI Output
497*4882a593Smuzhiyun----------
498*4882a593Smuzhiyun
499*4882a593SmuzhiyunThere are three types of VBI output devices: those that only support raw
500*4882a593Smuzhiyun(undecoded) VBI, those that only support sliced (decoded) VBI and those that
501*4882a593Smuzhiyunsupport both. This is determined by the node_types module option.
502*4882a593Smuzhiyun
503*4882a593SmuzhiyunThe sliced VBI output supports the Wide Screen Signal and the teletext signal
504*4882a593Smuzhiyunfor 50 Hz standards and Closed Captioning + XDS for 60 Hz standards.
505*4882a593Smuzhiyun
506*4882a593SmuzhiyunThe VBI device will only work for the S-Video output, it will give
507*4882a593Smuzhiyunback an error if the current output is HDMI.
508*4882a593Smuzhiyun
509*4882a593Smuzhiyun
510*4882a593SmuzhiyunRadio Receiver
511*4882a593Smuzhiyun--------------
512*4882a593Smuzhiyun
513*4882a593SmuzhiyunThe radio receiver emulates an FM/AM/SW receiver. The FM band also supports RDS.
514*4882a593SmuzhiyunThe frequency ranges are:
515*4882a593Smuzhiyun
516*4882a593Smuzhiyun	- FM: 64 MHz - 108 MHz
517*4882a593Smuzhiyun	- AM: 520 kHz - 1710 kHz
518*4882a593Smuzhiyun	- SW: 2300 kHz - 26.1 MHz
519*4882a593Smuzhiyun
520*4882a593SmuzhiyunValid channels are emulated every 1 MHz for FM and every 100 kHz for AM and SW.
521*4882a593SmuzhiyunThe signal strength decreases the further the frequency is from the valid
522*4882a593Smuzhiyunfrequency until it becomes 0% at +/- 50 kHz (FM) or 5 kHz (AM/SW) from the
523*4882a593Smuzhiyunideal frequency. The initial frequency when the driver is loaded is set to
524*4882a593Smuzhiyun95 MHz.
525*4882a593Smuzhiyun
526*4882a593SmuzhiyunThe FM receiver supports RDS as well, both using 'Block I/O' and 'Controls'
527*4882a593Smuzhiyunmodes. In the 'Controls' mode the RDS information is stored in read-only
528*4882a593Smuzhiyuncontrols. These controls are updated every time the frequency is changed,
529*4882a593Smuzhiyunor when the tuner status is requested. The Block I/O method uses the read()
530*4882a593Smuzhiyuninterface to pass the RDS blocks on to the application for decoding.
531*4882a593Smuzhiyun
532*4882a593SmuzhiyunThe RDS signal is 'detected' for +/- 12.5 kHz around the channel frequency,
533*4882a593Smuzhiyunand the further the frequency is away from the valid frequency the more RDS
534*4882a593Smuzhiyunerrors are randomly introduced into the block I/O stream, up to 50% of all
535*4882a593Smuzhiyunblocks if you are +/- 12.5 kHz from the channel frequency. All four errors
536*4882a593Smuzhiyuncan occur in equal proportions: blocks marked 'CORRECTED', blocks marked
537*4882a593Smuzhiyun'ERROR', blocks marked 'INVALID' and dropped blocks.
538*4882a593Smuzhiyun
539*4882a593SmuzhiyunThe generated RDS stream contains all the standard fields contained in a
540*4882a593Smuzhiyun0B group, and also radio text and the current time.
541*4882a593Smuzhiyun
542*4882a593SmuzhiyunThe receiver supports HW frequency seek, either in Bounded mode, Wrap Around
543*4882a593Smuzhiyunmode or both, which is configurable with the "Radio HW Seek Mode" control.
544*4882a593Smuzhiyun
545*4882a593Smuzhiyun
546*4882a593SmuzhiyunRadio Transmitter
547*4882a593Smuzhiyun-----------------
548*4882a593Smuzhiyun
549*4882a593SmuzhiyunThe radio transmitter emulates an FM/AM/SW transmitter. The FM band also supports RDS.
550*4882a593SmuzhiyunThe frequency ranges are:
551*4882a593Smuzhiyun
552*4882a593Smuzhiyun	- FM: 64 MHz - 108 MHz
553*4882a593Smuzhiyun	- AM: 520 kHz - 1710 kHz
554*4882a593Smuzhiyun	- SW: 2300 kHz - 26.1 MHz
555*4882a593Smuzhiyun
556*4882a593SmuzhiyunThe initial frequency when the driver is loaded is 95.5 MHz.
557*4882a593Smuzhiyun
558*4882a593SmuzhiyunThe FM transmitter supports RDS as well, both using 'Block I/O' and 'Controls'
559*4882a593Smuzhiyunmodes. In the 'Controls' mode the transmitted RDS information is configured
560*4882a593Smuzhiyunusing controls, and in 'Block I/O' mode the blocks are passed to the driver
561*4882a593Smuzhiyunusing write().
562*4882a593Smuzhiyun
563*4882a593Smuzhiyun
564*4882a593SmuzhiyunSoftware Defined Radio Receiver
565*4882a593Smuzhiyun-------------------------------
566*4882a593Smuzhiyun
567*4882a593SmuzhiyunThe SDR receiver has three frequency bands for the ADC tuner:
568*4882a593Smuzhiyun
569*4882a593Smuzhiyun	- 300 kHz
570*4882a593Smuzhiyun	- 900 kHz - 2800 kHz
571*4882a593Smuzhiyun	- 3200 kHz
572*4882a593Smuzhiyun
573*4882a593SmuzhiyunThe RF tuner supports 50 MHz - 2000 MHz.
574*4882a593Smuzhiyun
575*4882a593SmuzhiyunThe generated data contains the In-phase and Quadrature components of a
576*4882a593Smuzhiyun1 kHz tone that has an amplitude of sqrt(2).
577*4882a593Smuzhiyun
578*4882a593Smuzhiyun
579*4882a593SmuzhiyunMetadata Capture
580*4882a593Smuzhiyun----------------
581*4882a593Smuzhiyun
582*4882a593SmuzhiyunThe Metadata capture generates UVC format metadata. The PTS and SCR are
583*4882a593Smuzhiyuntransmitted based on the values set in vivid contols.
584*4882a593Smuzhiyun
585*4882a593SmuzhiyunThe Metadata device will only work for the Webcam input, it will give
586*4882a593Smuzhiyunback an error for all other inputs.
587*4882a593Smuzhiyun
588*4882a593Smuzhiyun
589*4882a593SmuzhiyunMetadata Output
590*4882a593Smuzhiyun---------------
591*4882a593Smuzhiyun
592*4882a593SmuzhiyunThe Metadata output can be used to set brightness, contrast, saturation and hue.
593*4882a593Smuzhiyun
594*4882a593SmuzhiyunThe Metadata device will only work for the Webcam output, it will give
595*4882a593Smuzhiyunback an error for all other outputs.
596*4882a593Smuzhiyun
597*4882a593Smuzhiyun
598*4882a593SmuzhiyunTouch Capture
599*4882a593Smuzhiyun-------------
600*4882a593Smuzhiyun
601*4882a593SmuzhiyunThe Touch capture generates touch patterns simulating single tap, double tap,
602*4882a593Smuzhiyuntriple tap, move from left to right, zoom in, zoom out, palm press (simulating
603*4882a593Smuzhiyuna large area being pressed on a touchpad), and simulating 16 simultaneous
604*4882a593Smuzhiyuntouch points.
605*4882a593Smuzhiyun
606*4882a593SmuzhiyunControls
607*4882a593Smuzhiyun--------
608*4882a593Smuzhiyun
609*4882a593SmuzhiyunDifferent devices support different controls. The sections below will describe
610*4882a593Smuzhiyuneach control and which devices support them.
611*4882a593Smuzhiyun
612*4882a593Smuzhiyun
613*4882a593SmuzhiyunUser Controls - Test Controls
614*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
615*4882a593Smuzhiyun
616*4882a593SmuzhiyunThe Button, Boolean, Integer 32 Bits, Integer 64 Bits, Menu, String, Bitmask and
617*4882a593SmuzhiyunInteger Menu are controls that represent all possible control types. The Menu
618*4882a593Smuzhiyuncontrol and the Integer Menu control both have 'holes' in their menu list,
619*4882a593Smuzhiyunmeaning that one or more menu items return EINVAL when VIDIOC_QUERYMENU is called.
620*4882a593SmuzhiyunBoth menu controls also have a non-zero minimum control value.  These features
621*4882a593Smuzhiyunallow you to check if your application can handle such things correctly.
622*4882a593SmuzhiyunThese controls are supported for every device type.
623*4882a593Smuzhiyun
624*4882a593Smuzhiyun
625*4882a593SmuzhiyunUser Controls - Video Capture
626*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
627*4882a593Smuzhiyun
628*4882a593SmuzhiyunThe following controls are specific to video capture.
629*4882a593Smuzhiyun
630*4882a593SmuzhiyunThe Brightness, Contrast, Saturation and Hue controls actually work and are
631*4882a593Smuzhiyunstandard. There is one special feature with the Brightness control: each
632*4882a593Smuzhiyunvideo input has its own brightness value, so changing input will restore
633*4882a593Smuzhiyunthe brightness for that input. In addition, each video input uses a different
634*4882a593Smuzhiyunbrightness range (minimum and maximum control values). Switching inputs will
635*4882a593Smuzhiyuncause a control event to be sent with the V4L2_EVENT_CTRL_CH_RANGE flag set.
636*4882a593SmuzhiyunThis allows you to test controls that can change their range.
637*4882a593Smuzhiyun
638*4882a593SmuzhiyunThe 'Gain, Automatic' and Gain controls can be used to test volatile controls:
639*4882a593Smuzhiyunif 'Gain, Automatic' is set, then the Gain control is volatile and changes
640*4882a593Smuzhiyunconstantly. If 'Gain, Automatic' is cleared, then the Gain control is a normal
641*4882a593Smuzhiyuncontrol.
642*4882a593Smuzhiyun
643*4882a593SmuzhiyunThe 'Horizontal Flip' and 'Vertical Flip' controls can be used to flip the
644*4882a593Smuzhiyunimage. These combine with the 'Sensor Flipped Horizontally/Vertically' Vivid
645*4882a593Smuzhiyuncontrols.
646*4882a593Smuzhiyun
647*4882a593SmuzhiyunThe 'Alpha Component' control can be used to set the alpha component for
648*4882a593Smuzhiyunformats containing an alpha channel.
649*4882a593Smuzhiyun
650*4882a593Smuzhiyun
651*4882a593SmuzhiyunUser Controls - Audio
652*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~
653*4882a593Smuzhiyun
654*4882a593SmuzhiyunThe following controls are specific to video capture and output and radio
655*4882a593Smuzhiyunreceivers and transmitters.
656*4882a593Smuzhiyun
657*4882a593SmuzhiyunThe 'Volume' and 'Mute' audio controls are typical for such devices to
658*4882a593Smuzhiyuncontrol the volume and mute the audio. They don't actually do anything in
659*4882a593Smuzhiyunthe vivid driver.
660*4882a593Smuzhiyun
661*4882a593Smuzhiyun
662*4882a593SmuzhiyunVivid Controls
663*4882a593Smuzhiyun~~~~~~~~~~~~~~
664*4882a593Smuzhiyun
665*4882a593SmuzhiyunThese vivid custom controls control the image generation, error injection, etc.
666*4882a593Smuzhiyun
667*4882a593Smuzhiyun
668*4882a593SmuzhiyunTest Pattern Controls
669*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^
670*4882a593Smuzhiyun
671*4882a593SmuzhiyunThe Test Pattern Controls are all specific to video capture.
672*4882a593Smuzhiyun
673*4882a593Smuzhiyun- Test Pattern:
674*4882a593Smuzhiyun
675*4882a593Smuzhiyun	selects which test pattern to use. Use the CSC Colorbar for
676*4882a593Smuzhiyun	testing colorspace conversions: the colors used in that test pattern
677*4882a593Smuzhiyun	map to valid colors in all colorspaces. The colorspace conversion
678*4882a593Smuzhiyun	is disabled for the other test patterns.
679*4882a593Smuzhiyun
680*4882a593Smuzhiyun- OSD Text Mode:
681*4882a593Smuzhiyun
682*4882a593Smuzhiyun	selects whether the text superimposed on the
683*4882a593Smuzhiyun	test pattern should be shown, and if so, whether only counters should
684*4882a593Smuzhiyun	be displayed or the full text.
685*4882a593Smuzhiyun
686*4882a593Smuzhiyun- Horizontal Movement:
687*4882a593Smuzhiyun
688*4882a593Smuzhiyun	selects whether the test pattern should
689*4882a593Smuzhiyun	move to the left or right and at what speed.
690*4882a593Smuzhiyun
691*4882a593Smuzhiyun- Vertical Movement:
692*4882a593Smuzhiyun
693*4882a593Smuzhiyun	does the same for the vertical direction.
694*4882a593Smuzhiyun
695*4882a593Smuzhiyun- Show Border:
696*4882a593Smuzhiyun
697*4882a593Smuzhiyun	show a two-pixel wide border at the edge of the actual image,
698*4882a593Smuzhiyun	excluding letter or pillarboxing.
699*4882a593Smuzhiyun
700*4882a593Smuzhiyun- Show Square:
701*4882a593Smuzhiyun
702*4882a593Smuzhiyun	show a square in the middle of the image. If the image is
703*4882a593Smuzhiyun	displayed with the correct pixel and image aspect ratio corrections,
704*4882a593Smuzhiyun	then the width and height of the square on the monitor should be
705*4882a593Smuzhiyun	the same.
706*4882a593Smuzhiyun
707*4882a593Smuzhiyun- Insert SAV Code in Image:
708*4882a593Smuzhiyun
709*4882a593Smuzhiyun	adds a SAV (Start of Active Video) code to the image.
710*4882a593Smuzhiyun	This can be used to check if such codes in the image are inadvertently
711*4882a593Smuzhiyun	interpreted instead of being ignored.
712*4882a593Smuzhiyun
713*4882a593Smuzhiyun- Insert EAV Code in Image:
714*4882a593Smuzhiyun
715*4882a593Smuzhiyun	does the same for the EAV (End of Active Video) code.
716*4882a593Smuzhiyun
717*4882a593Smuzhiyun
718*4882a593SmuzhiyunCapture Feature Selection Controls
719*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
720*4882a593Smuzhiyun
721*4882a593SmuzhiyunThese controls are all specific to video capture.
722*4882a593Smuzhiyun
723*4882a593Smuzhiyun- Sensor Flipped Horizontally:
724*4882a593Smuzhiyun
725*4882a593Smuzhiyun	the image is flipped horizontally and the
726*4882a593Smuzhiyun	V4L2_IN_ST_HFLIP input status flag is set. This emulates the case where
727*4882a593Smuzhiyun	a sensor is for example mounted upside down.
728*4882a593Smuzhiyun
729*4882a593Smuzhiyun- Sensor Flipped Vertically:
730*4882a593Smuzhiyun
731*4882a593Smuzhiyun	the image is flipped vertically and the
732*4882a593Smuzhiyun	V4L2_IN_ST_VFLIP input status flag is set. This emulates the case where
733*4882a593Smuzhiyun	a sensor is for example mounted upside down.
734*4882a593Smuzhiyun
735*4882a593Smuzhiyun- Standard Aspect Ratio:
736*4882a593Smuzhiyun
737*4882a593Smuzhiyun	selects if the image aspect ratio as used for the TV or
738*4882a593Smuzhiyun	S-Video input should be 4x3, 16x9 or anamorphic widescreen. This may
739*4882a593Smuzhiyun	introduce letterboxing.
740*4882a593Smuzhiyun
741*4882a593Smuzhiyun- DV Timings Aspect Ratio:
742*4882a593Smuzhiyun
743*4882a593Smuzhiyun	selects if the image aspect ratio as used for the HDMI
744*4882a593Smuzhiyun	input should be the same as the source width and height ratio, or if
745*4882a593Smuzhiyun	it should be 4x3 or 16x9. This may introduce letter or pillarboxing.
746*4882a593Smuzhiyun
747*4882a593Smuzhiyun- Timestamp Source:
748*4882a593Smuzhiyun
749*4882a593Smuzhiyun	selects when the timestamp for each buffer is taken.
750*4882a593Smuzhiyun
751*4882a593Smuzhiyun- Colorspace:
752*4882a593Smuzhiyun
753*4882a593Smuzhiyun	selects which colorspace should be used when generating the image.
754*4882a593Smuzhiyun	This only applies if the CSC Colorbar test pattern is selected,
755*4882a593Smuzhiyun	otherwise the test pattern will go through unconverted.
756*4882a593Smuzhiyun	This behavior is also what you want, since a 75% Colorbar
757*4882a593Smuzhiyun	should really have 75% signal intensity and should not be affected
758*4882a593Smuzhiyun	by colorspace conversions.
759*4882a593Smuzhiyun
760*4882a593Smuzhiyun	Changing the colorspace will result in the V4L2_EVENT_SOURCE_CHANGE
761*4882a593Smuzhiyun	to be sent since it emulates a detected colorspace change.
762*4882a593Smuzhiyun
763*4882a593Smuzhiyun- Transfer Function:
764*4882a593Smuzhiyun
765*4882a593Smuzhiyun	selects which colorspace transfer function should be used when
766*4882a593Smuzhiyun	generating an image. This only applies if the CSC Colorbar test pattern is
767*4882a593Smuzhiyun	selected, otherwise the test pattern will go through unconverted.
768*4882a593Smuzhiyun	This behavior is also what you want, since a 75% Colorbar
769*4882a593Smuzhiyun	should really have 75% signal intensity and should not be affected
770*4882a593Smuzhiyun	by colorspace conversions.
771*4882a593Smuzhiyun
772*4882a593Smuzhiyun	Changing the transfer function will result in the V4L2_EVENT_SOURCE_CHANGE
773*4882a593Smuzhiyun	to be sent since it emulates a detected colorspace change.
774*4882a593Smuzhiyun
775*4882a593Smuzhiyun- Y'CbCr Encoding:
776*4882a593Smuzhiyun
777*4882a593Smuzhiyun	selects which Y'CbCr encoding should be used when generating
778*4882a593Smuzhiyun	a Y'CbCr image.	This only applies if the format is set to a Y'CbCr format
779*4882a593Smuzhiyun	as opposed to an RGB format.
780*4882a593Smuzhiyun
781*4882a593Smuzhiyun	Changing the Y'CbCr encoding will result in the V4L2_EVENT_SOURCE_CHANGE
782*4882a593Smuzhiyun	to be sent since it emulates a detected colorspace change.
783*4882a593Smuzhiyun
784*4882a593Smuzhiyun- Quantization:
785*4882a593Smuzhiyun
786*4882a593Smuzhiyun	selects which quantization should be used for the RGB or Y'CbCr
787*4882a593Smuzhiyun	encoding when generating the test pattern.
788*4882a593Smuzhiyun
789*4882a593Smuzhiyun	Changing the quantization will result in the V4L2_EVENT_SOURCE_CHANGE
790*4882a593Smuzhiyun	to be sent since it emulates a detected colorspace change.
791*4882a593Smuzhiyun
792*4882a593Smuzhiyun- Limited RGB Range (16-235):
793*4882a593Smuzhiyun
794*4882a593Smuzhiyun	selects if the RGB range of the HDMI source should
795*4882a593Smuzhiyun	be limited or full range. This combines with the Digital Video 'Rx RGB
796*4882a593Smuzhiyun	Quantization Range' control and can be used to test what happens if
797*4882a593Smuzhiyun	a source provides you with the wrong quantization range information.
798*4882a593Smuzhiyun	See the description of that control for more details.
799*4882a593Smuzhiyun
800*4882a593Smuzhiyun- Apply Alpha To Red Only:
801*4882a593Smuzhiyun
802*4882a593Smuzhiyun	apply the alpha channel as set by the 'Alpha Component'
803*4882a593Smuzhiyun	user control to the red color of the test pattern only.
804*4882a593Smuzhiyun
805*4882a593Smuzhiyun- Enable Capture Cropping:
806*4882a593Smuzhiyun
807*4882a593Smuzhiyun	enables crop support. This control is only present if
808*4882a593Smuzhiyun	the ccs_cap_mode module option is set to the default value of -1 and if
809*4882a593Smuzhiyun	the no_error_inj module option is set to 0 (the default).
810*4882a593Smuzhiyun
811*4882a593Smuzhiyun- Enable Capture Composing:
812*4882a593Smuzhiyun
813*4882a593Smuzhiyun	enables composing support. This control is only
814*4882a593Smuzhiyun	present if the ccs_cap_mode module option is set to the default value of
815*4882a593Smuzhiyun	-1 and if the no_error_inj module option is set to 0 (the default).
816*4882a593Smuzhiyun
817*4882a593Smuzhiyun- Enable Capture Scaler:
818*4882a593Smuzhiyun
819*4882a593Smuzhiyun	enables support for a scaler (maximum 4 times upscaling
820*4882a593Smuzhiyun	and downscaling). This control is only present if the ccs_cap_mode
821*4882a593Smuzhiyun	module option is set to the default value of -1 and if the no_error_inj
822*4882a593Smuzhiyun	module option is set to 0 (the default).
823*4882a593Smuzhiyun
824*4882a593Smuzhiyun- Maximum EDID Blocks:
825*4882a593Smuzhiyun
826*4882a593Smuzhiyun	determines how many EDID blocks the driver supports.
827*4882a593Smuzhiyun	Note that the vivid driver does not actually interpret new EDID
828*4882a593Smuzhiyun	data, it just stores it. It allows for up to 256 EDID blocks
829*4882a593Smuzhiyun	which is the maximum supported by the standard.
830*4882a593Smuzhiyun
831*4882a593Smuzhiyun- Fill Percentage of Frame:
832*4882a593Smuzhiyun
833*4882a593Smuzhiyun	can be used to draw only the top X percent
834*4882a593Smuzhiyun	of the image. Since each frame has to be drawn by the driver, this
835*4882a593Smuzhiyun	demands a lot of the CPU. For large resolutions this becomes
836*4882a593Smuzhiyun	problematic. By drawing only part of the image this CPU load can
837*4882a593Smuzhiyun	be reduced.
838*4882a593Smuzhiyun
839*4882a593Smuzhiyun
840*4882a593SmuzhiyunOutput Feature Selection Controls
841*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
842*4882a593Smuzhiyun
843*4882a593SmuzhiyunThese controls are all specific to video output.
844*4882a593Smuzhiyun
845*4882a593Smuzhiyun- Enable Output Cropping:
846*4882a593Smuzhiyun
847*4882a593Smuzhiyun	enables crop support. This control is only present if
848*4882a593Smuzhiyun	the ccs_out_mode module option is set to the default value of -1 and if
849*4882a593Smuzhiyun	the no_error_inj module option is set to 0 (the default).
850*4882a593Smuzhiyun
851*4882a593Smuzhiyun- Enable Output Composing:
852*4882a593Smuzhiyun
853*4882a593Smuzhiyun	enables composing support. This control is only
854*4882a593Smuzhiyun	present if the ccs_out_mode module option is set to the default value of
855*4882a593Smuzhiyun	-1 and if the no_error_inj module option is set to 0 (the default).
856*4882a593Smuzhiyun
857*4882a593Smuzhiyun- Enable Output Scaler:
858*4882a593Smuzhiyun
859*4882a593Smuzhiyun	enables support for a scaler (maximum 4 times upscaling
860*4882a593Smuzhiyun	and downscaling). This control is only present if the ccs_out_mode
861*4882a593Smuzhiyun	module option is set to the default value of -1 and if the no_error_inj
862*4882a593Smuzhiyun	module option is set to 0 (the default).
863*4882a593Smuzhiyun
864*4882a593Smuzhiyun
865*4882a593SmuzhiyunError Injection Controls
866*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^
867*4882a593Smuzhiyun
868*4882a593SmuzhiyunThe following two controls are only valid for video and vbi capture.
869*4882a593Smuzhiyun
870*4882a593Smuzhiyun- Standard Signal Mode:
871*4882a593Smuzhiyun
872*4882a593Smuzhiyun	selects the behavior of VIDIOC_QUERYSTD: what should it return?
873*4882a593Smuzhiyun
874*4882a593Smuzhiyun	Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE
875*4882a593Smuzhiyun	to be sent since it emulates a changed input condition (e.g. a cable
876*4882a593Smuzhiyun	was plugged in or out).
877*4882a593Smuzhiyun
878*4882a593Smuzhiyun- Standard:
879*4882a593Smuzhiyun
880*4882a593Smuzhiyun	selects the standard that VIDIOC_QUERYSTD should return if the
881*4882a593Smuzhiyun	previous control is set to "Selected Standard".
882*4882a593Smuzhiyun
883*4882a593Smuzhiyun	Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE
884*4882a593Smuzhiyun	to be sent since it emulates a changed input standard.
885*4882a593Smuzhiyun
886*4882a593Smuzhiyun
887*4882a593SmuzhiyunThe following two controls are only valid for video capture.
888*4882a593Smuzhiyun
889*4882a593Smuzhiyun- DV Timings Signal Mode:
890*4882a593Smuzhiyun
891*4882a593Smuzhiyun	selects the behavior of VIDIOC_QUERY_DV_TIMINGS: what
892*4882a593Smuzhiyun	should it return?
893*4882a593Smuzhiyun
894*4882a593Smuzhiyun	Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE
895*4882a593Smuzhiyun	to be sent since it emulates a changed input condition (e.g. a cable
896*4882a593Smuzhiyun	was plugged in or out).
897*4882a593Smuzhiyun
898*4882a593Smuzhiyun- DV Timings:
899*4882a593Smuzhiyun
900*4882a593Smuzhiyun	selects the timings the VIDIOC_QUERY_DV_TIMINGS should return
901*4882a593Smuzhiyun	if the previous control is set to "Selected DV Timings".
902*4882a593Smuzhiyun
903*4882a593Smuzhiyun	Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE
904*4882a593Smuzhiyun	to be sent since it emulates changed input timings.
905*4882a593Smuzhiyun
906*4882a593Smuzhiyun
907*4882a593SmuzhiyunThe following controls are only present if the no_error_inj module option
908*4882a593Smuzhiyunis set to 0 (the default). These controls are valid for video and vbi
909*4882a593Smuzhiyuncapture and output streams and for the SDR capture device except for the
910*4882a593SmuzhiyunDisconnect control which is valid for all devices.
911*4882a593Smuzhiyun
912*4882a593Smuzhiyun- Wrap Sequence Number:
913*4882a593Smuzhiyun
914*4882a593Smuzhiyun	test what happens when you wrap the sequence number in
915*4882a593Smuzhiyun	struct v4l2_buffer around.
916*4882a593Smuzhiyun
917*4882a593Smuzhiyun- Wrap Timestamp:
918*4882a593Smuzhiyun
919*4882a593Smuzhiyun	test what happens when you wrap the timestamp in struct
920*4882a593Smuzhiyun	v4l2_buffer around.
921*4882a593Smuzhiyun
922*4882a593Smuzhiyun- Percentage of Dropped Buffers:
923*4882a593Smuzhiyun
924*4882a593Smuzhiyun	sets the percentage of buffers that
925*4882a593Smuzhiyun	are never returned by the driver (i.e., they are dropped).
926*4882a593Smuzhiyun
927*4882a593Smuzhiyun- Disconnect:
928*4882a593Smuzhiyun
929*4882a593Smuzhiyun	emulates a USB disconnect. The device will act as if it has
930*4882a593Smuzhiyun	been disconnected. Only after all open filehandles to the device
931*4882a593Smuzhiyun	node have been closed will the device become 'connected' again.
932*4882a593Smuzhiyun
933*4882a593Smuzhiyun- Inject V4L2_BUF_FLAG_ERROR:
934*4882a593Smuzhiyun
935*4882a593Smuzhiyun	when pressed, the next frame returned by
936*4882a593Smuzhiyun	the driver will have the error flag set (i.e. the frame is marked
937*4882a593Smuzhiyun	corrupt).
938*4882a593Smuzhiyun
939*4882a593Smuzhiyun- Inject VIDIOC_REQBUFS Error:
940*4882a593Smuzhiyun
941*4882a593Smuzhiyun	when pressed, the next REQBUFS or CREATE_BUFS
942*4882a593Smuzhiyun	ioctl call will fail with an error. To be precise: the videobuf2
943*4882a593Smuzhiyun	queue_setup() op will return -EINVAL.
944*4882a593Smuzhiyun
945*4882a593Smuzhiyun- Inject VIDIOC_QBUF Error:
946*4882a593Smuzhiyun
947*4882a593Smuzhiyun	when pressed, the next VIDIOC_QBUF or
948*4882a593Smuzhiyun	VIDIOC_PREPARE_BUFFER ioctl call will fail with an error. To be
949*4882a593Smuzhiyun	precise: the videobuf2 buf_prepare() op will return -EINVAL.
950*4882a593Smuzhiyun
951*4882a593Smuzhiyun- Inject VIDIOC_STREAMON Error:
952*4882a593Smuzhiyun
953*4882a593Smuzhiyun	when pressed, the next VIDIOC_STREAMON ioctl
954*4882a593Smuzhiyun	call will fail with an error. To be precise: the videobuf2
955*4882a593Smuzhiyun	start_streaming() op will return -EINVAL.
956*4882a593Smuzhiyun
957*4882a593Smuzhiyun- Inject Fatal Streaming Error:
958*4882a593Smuzhiyun
959*4882a593Smuzhiyun	when pressed, the streaming core will be
960*4882a593Smuzhiyun	marked as having suffered a fatal error, the only way to recover
961*4882a593Smuzhiyun	from that is to stop streaming. To be precise: the videobuf2
962*4882a593Smuzhiyun	vb2_queue_error() function is called.
963*4882a593Smuzhiyun
964*4882a593Smuzhiyun
965*4882a593SmuzhiyunVBI Raw Capture Controls
966*4882a593Smuzhiyun^^^^^^^^^^^^^^^^^^^^^^^^
967*4882a593Smuzhiyun
968*4882a593Smuzhiyun- Interlaced VBI Format:
969*4882a593Smuzhiyun
970*4882a593Smuzhiyun	if set, then the raw VBI data will be interlaced instead
971*4882a593Smuzhiyun	of providing it grouped by field.
972*4882a593Smuzhiyun
973*4882a593Smuzhiyun
974*4882a593SmuzhiyunDigital Video Controls
975*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~
976*4882a593Smuzhiyun
977*4882a593Smuzhiyun- Rx RGB Quantization Range:
978*4882a593Smuzhiyun
979*4882a593Smuzhiyun	sets the RGB quantization detection of the HDMI
980*4882a593Smuzhiyun	input. This combines with the Vivid 'Limited RGB Range (16-235)'
981*4882a593Smuzhiyun	control and can be used to test what happens if a source provides
982*4882a593Smuzhiyun	you with the wrong quantization range information. This can be tested
983*4882a593Smuzhiyun	by selecting an HDMI input, setting this control to Full or Limited
984*4882a593Smuzhiyun	range and selecting the opposite in the 'Limited RGB Range (16-235)'
985*4882a593Smuzhiyun	control. The effect is easy to see if the 'Gray Ramp' test pattern
986*4882a593Smuzhiyun	is selected.
987*4882a593Smuzhiyun
988*4882a593Smuzhiyun- Tx RGB Quantization Range:
989*4882a593Smuzhiyun
990*4882a593Smuzhiyun	sets the RGB quantization detection of the HDMI
991*4882a593Smuzhiyun	output. It is currently not used for anything in vivid, but most HDMI
992*4882a593Smuzhiyun	transmitters would typically have this control.
993*4882a593Smuzhiyun
994*4882a593Smuzhiyun- Transmit Mode:
995*4882a593Smuzhiyun
996*4882a593Smuzhiyun	sets the transmit mode of the HDMI output to HDMI or DVI-D. This
997*4882a593Smuzhiyun	affects the reported colorspace since DVI_D outputs will always use
998*4882a593Smuzhiyun	sRGB.
999*4882a593Smuzhiyun
1000*4882a593Smuzhiyun- Display Present:
1001*4882a593Smuzhiyun
1002*4882a593Smuzhiyun	sets the presence of a "display" on the HDMI output. This affects
1003*4882a593Smuzhiyun	the tx_edid_present, tx_hotplug and tx_rxsense controls.
1004*4882a593Smuzhiyun
1005*4882a593Smuzhiyun
1006*4882a593SmuzhiyunFM Radio Receiver Controls
1007*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~
1008*4882a593Smuzhiyun
1009*4882a593Smuzhiyun- RDS Reception:
1010*4882a593Smuzhiyun
1011*4882a593Smuzhiyun	set if the RDS receiver should be enabled.
1012*4882a593Smuzhiyun
1013*4882a593Smuzhiyun- RDS Program Type:
1014*4882a593Smuzhiyun
1015*4882a593Smuzhiyun
1016*4882a593Smuzhiyun- RDS PS Name:
1017*4882a593Smuzhiyun
1018*4882a593Smuzhiyun
1019*4882a593Smuzhiyun- RDS Radio Text:
1020*4882a593Smuzhiyun
1021*4882a593Smuzhiyun
1022*4882a593Smuzhiyun- RDS Traffic Announcement:
1023*4882a593Smuzhiyun
1024*4882a593Smuzhiyun
1025*4882a593Smuzhiyun- RDS Traffic Program:
1026*4882a593Smuzhiyun
1027*4882a593Smuzhiyun
1028*4882a593Smuzhiyun- RDS Music:
1029*4882a593Smuzhiyun
1030*4882a593Smuzhiyun	these are all read-only controls. If RDS Rx I/O Mode is set to
1031*4882a593Smuzhiyun	"Block I/O", then they are inactive as well. If RDS Rx I/O Mode is set
1032*4882a593Smuzhiyun	to "Controls", then these controls report the received RDS data.
1033*4882a593Smuzhiyun
1034*4882a593Smuzhiyun.. note::
1035*4882a593Smuzhiyun	The vivid implementation of this is pretty basic: they are only
1036*4882a593Smuzhiyun	updated when you set a new frequency or when you get the tuner status
1037*4882a593Smuzhiyun	(VIDIOC_G_TUNER).
1038*4882a593Smuzhiyun
1039*4882a593Smuzhiyun- Radio HW Seek Mode:
1040*4882a593Smuzhiyun
1041*4882a593Smuzhiyun	can be one of "Bounded", "Wrap Around" or "Both". This
1042*4882a593Smuzhiyun	determines if VIDIOC_S_HW_FREQ_SEEK will be bounded by the frequency
1043*4882a593Smuzhiyun	range or wrap-around or if it is selectable by the user.
1044*4882a593Smuzhiyun
1045*4882a593Smuzhiyun- Radio Programmable HW Seek:
1046*4882a593Smuzhiyun
1047*4882a593Smuzhiyun	if set, then the user can provide the lower and
1048*4882a593Smuzhiyun	upper bound of the HW Seek. Otherwise the frequency range boundaries
1049*4882a593Smuzhiyun	will be used.
1050*4882a593Smuzhiyun
1051*4882a593Smuzhiyun- Generate RBDS Instead of RDS:
1052*4882a593Smuzhiyun
1053*4882a593Smuzhiyun	if set, then generate RBDS (the US variant of
1054*4882a593Smuzhiyun	RDS) data instead of RDS (European-style RDS). This affects only the
1055*4882a593Smuzhiyun	PICODE and PTY codes.
1056*4882a593Smuzhiyun
1057*4882a593Smuzhiyun- RDS Rx I/O Mode:
1058*4882a593Smuzhiyun
1059*4882a593Smuzhiyun	this can be "Block I/O" where the RDS blocks have to be read()
1060*4882a593Smuzhiyun	by the application, or "Controls" where the RDS data is provided by
1061*4882a593Smuzhiyun	the RDS controls mentioned above.
1062*4882a593Smuzhiyun
1063*4882a593Smuzhiyun
1064*4882a593SmuzhiyunFM Radio Modulator Controls
1065*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~
1066*4882a593Smuzhiyun
1067*4882a593Smuzhiyun- RDS Program ID:
1068*4882a593Smuzhiyun
1069*4882a593Smuzhiyun
1070*4882a593Smuzhiyun- RDS Program Type:
1071*4882a593Smuzhiyun
1072*4882a593Smuzhiyun
1073*4882a593Smuzhiyun- RDS PS Name:
1074*4882a593Smuzhiyun
1075*4882a593Smuzhiyun
1076*4882a593Smuzhiyun- RDS Radio Text:
1077*4882a593Smuzhiyun
1078*4882a593Smuzhiyun
1079*4882a593Smuzhiyun- RDS Stereo:
1080*4882a593Smuzhiyun
1081*4882a593Smuzhiyun
1082*4882a593Smuzhiyun- RDS Artificial Head:
1083*4882a593Smuzhiyun
1084*4882a593Smuzhiyun
1085*4882a593Smuzhiyun- RDS Compressed:
1086*4882a593Smuzhiyun
1087*4882a593Smuzhiyun
1088*4882a593Smuzhiyun- RDS Dynamic PTY:
1089*4882a593Smuzhiyun
1090*4882a593Smuzhiyun
1091*4882a593Smuzhiyun- RDS Traffic Announcement:
1092*4882a593Smuzhiyun
1093*4882a593Smuzhiyun
1094*4882a593Smuzhiyun- RDS Traffic Program:
1095*4882a593Smuzhiyun
1096*4882a593Smuzhiyun
1097*4882a593Smuzhiyun- RDS Music:
1098*4882a593Smuzhiyun
1099*4882a593Smuzhiyun	these are all controls that set the RDS data that is transmitted by
1100*4882a593Smuzhiyun	the FM modulator.
1101*4882a593Smuzhiyun
1102*4882a593Smuzhiyun- RDS Tx I/O Mode:
1103*4882a593Smuzhiyun
1104*4882a593Smuzhiyun	this can be "Block I/O" where the application has to use write()
1105*4882a593Smuzhiyun	to pass the RDS blocks to the driver, or "Controls" where the RDS data
1106*4882a593Smuzhiyun	is Provided by the RDS controls mentioned above.
1107*4882a593Smuzhiyun
1108*4882a593SmuzhiyunMetadata Capture Controls
1109*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~
1110*4882a593Smuzhiyun
1111*4882a593Smuzhiyun- Generate PTS
1112*4882a593Smuzhiyun
1113*4882a593Smuzhiyun        if set, then the generated metadata stream contains Presentation timestamp.
1114*4882a593Smuzhiyun
1115*4882a593Smuzhiyun- Generate SCR
1116*4882a593Smuzhiyun
1117*4882a593Smuzhiyun        if set, then the generated metadata stream contains Source Clock information.
1118*4882a593Smuzhiyun
1119*4882a593SmuzhiyunVideo, VBI and RDS Looping
1120*4882a593Smuzhiyun--------------------------
1121*4882a593Smuzhiyun
1122*4882a593SmuzhiyunThe vivid driver supports looping of video output to video input, VBI output
1123*4882a593Smuzhiyunto VBI input and RDS output to RDS input. For video/VBI looping this emulates
1124*4882a593Smuzhiyunas if a cable was hooked up between the output and input connector. So video
1125*4882a593Smuzhiyunand VBI looping is only supported between S-Video and HDMI inputs and outputs.
1126*4882a593SmuzhiyunVBI is only valid for S-Video as it makes no sense for HDMI.
1127*4882a593Smuzhiyun
1128*4882a593SmuzhiyunSince radio is wireless this looping always happens if the radio receiver
1129*4882a593Smuzhiyunfrequency is close to the radio transmitter frequency. In that case the radio
1130*4882a593Smuzhiyuntransmitter will 'override' the emulated radio stations.
1131*4882a593Smuzhiyun
1132*4882a593SmuzhiyunLooping is currently supported only between devices created by the same
1133*4882a593Smuzhiyunvivid driver instance.
1134*4882a593Smuzhiyun
1135*4882a593Smuzhiyun
1136*4882a593SmuzhiyunVideo and Sliced VBI looping
1137*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1138*4882a593Smuzhiyun
1139*4882a593SmuzhiyunThe way to enable video/VBI looping is currently fairly crude. A 'Loop Video'
1140*4882a593Smuzhiyuncontrol is available in the "Vivid" control class of the video
1141*4882a593Smuzhiyuncapture and VBI capture devices. When checked the video looping will be enabled.
1142*4882a593SmuzhiyunOnce enabled any video S-Video or HDMI input will show a static test pattern
1143*4882a593Smuzhiyununtil the video output has started. At that time the video output will be
1144*4882a593Smuzhiyunlooped to the video input provided that:
1145*4882a593Smuzhiyun
1146*4882a593Smuzhiyun- the input type matches the output type. So the HDMI input cannot receive
1147*4882a593Smuzhiyun  video from the S-Video output.
1148*4882a593Smuzhiyun
1149*4882a593Smuzhiyun- the video resolution of the video input must match that of the video output.
1150*4882a593Smuzhiyun  So it is not possible to loop a 50 Hz (720x576) S-Video output to a 60 Hz
1151*4882a593Smuzhiyun  (720x480) S-Video input, or a 720p60 HDMI output to a 1080p30 input.
1152*4882a593Smuzhiyun
1153*4882a593Smuzhiyun- the pixel formats must be identical on both sides. Otherwise the driver would
1154*4882a593Smuzhiyun  have to do pixel format conversion as well, and that's taking things too far.
1155*4882a593Smuzhiyun
1156*4882a593Smuzhiyun- the field settings must be identical on both sides. Same reason as above:
1157*4882a593Smuzhiyun  requiring the driver to convert from one field format to another complicated
1158*4882a593Smuzhiyun  matters too much. This also prohibits capturing with 'Field Top' or 'Field
1159*4882a593Smuzhiyun  Bottom' when the output video is set to 'Field Alternate'. This combination,
1160*4882a593Smuzhiyun  while legal, became too complicated to support. Both sides have to be 'Field
1161*4882a593Smuzhiyun  Alternate' for this to work. Also note that for this specific case the
1162*4882a593Smuzhiyun  sequence and field counting in struct v4l2_buffer on the capture side may not
1163*4882a593Smuzhiyun  be 100% accurate.
1164*4882a593Smuzhiyun
1165*4882a593Smuzhiyun- field settings V4L2_FIELD_SEQ_TB/BT are not supported. While it is possible to
1166*4882a593Smuzhiyun  implement this, it would mean a lot of work to get this right. Since these
1167*4882a593Smuzhiyun  field values are rarely used the decision was made not to implement this for
1168*4882a593Smuzhiyun  now.
1169*4882a593Smuzhiyun
1170*4882a593Smuzhiyun- on the input side the "Standard Signal Mode" for the S-Video input or the
1171*4882a593Smuzhiyun  "DV Timings Signal Mode" for the HDMI input should be configured so that a
1172*4882a593Smuzhiyun  valid signal is passed to the video input.
1173*4882a593Smuzhiyun
1174*4882a593SmuzhiyunThe framerates do not have to match, although this might change in the future.
1175*4882a593Smuzhiyun
1176*4882a593SmuzhiyunBy default you will see the OSD text superimposed on top of the looped video.
1177*4882a593SmuzhiyunThis can be turned off by changing the "OSD Text Mode" control of the video
1178*4882a593Smuzhiyuncapture device.
1179*4882a593Smuzhiyun
1180*4882a593SmuzhiyunFor VBI looping to work all of the above must be valid and in addition the vbi
1181*4882a593Smuzhiyunoutput must be configured for sliced VBI. The VBI capture side can be configured
1182*4882a593Smuzhiyunfor either raw or sliced VBI. Note that at the moment only CC/XDS (60 Hz formats)
1183*4882a593Smuzhiyunand WSS (50 Hz formats) VBI data is looped. Teletext VBI data is not looped.
1184*4882a593Smuzhiyun
1185*4882a593Smuzhiyun
1186*4882a593SmuzhiyunRadio & RDS Looping
1187*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~
1188*4882a593Smuzhiyun
1189*4882a593SmuzhiyunAs mentioned in section 6 the radio receiver emulates stations are regular
1190*4882a593Smuzhiyunfrequency intervals. Depending on the frequency of the radio receiver a
1191*4882a593Smuzhiyunsignal strength value is calculated (this is returned by VIDIOC_G_TUNER).
1192*4882a593SmuzhiyunHowever, it will also look at the frequency set by the radio transmitter and
1193*4882a593Smuzhiyunif that results in a higher signal strength than the settings of the radio
1194*4882a593Smuzhiyuntransmitter will be used as if it was a valid station. This also includes
1195*4882a593Smuzhiyunthe RDS data (if any) that the transmitter 'transmits'. This is received
1196*4882a593Smuzhiyunfaithfully on the receiver side. Note that when the driver is loaded the
1197*4882a593Smuzhiyunfrequencies of the radio receiver and transmitter are not identical, so
1198*4882a593Smuzhiyuninitially no looping takes place.
1199*4882a593Smuzhiyun
1200*4882a593Smuzhiyun
1201*4882a593SmuzhiyunCropping, Composing, Scaling
1202*4882a593Smuzhiyun----------------------------
1203*4882a593Smuzhiyun
1204*4882a593SmuzhiyunThis driver supports cropping, composing and scaling in any combination. Normally
1205*4882a593Smuzhiyunwhich features are supported can be selected through the Vivid controls,
1206*4882a593Smuzhiyunbut it is also possible to hardcode it when the module is loaded through the
1207*4882a593Smuzhiyunccs_cap_mode and ccs_out_mode module options. See section 1 on the details of
1208*4882a593Smuzhiyunthese module options.
1209*4882a593Smuzhiyun
1210*4882a593SmuzhiyunThis allows you to test your application for all these variations.
1211*4882a593Smuzhiyun
1212*4882a593SmuzhiyunNote that the webcam input never supports cropping, composing or scaling. That
1213*4882a593Smuzhiyunonly applies to the TV/S-Video/HDMI inputs and outputs. The reason is that
1214*4882a593Smuzhiyunwebcams, including this virtual implementation, normally use
1215*4882a593SmuzhiyunVIDIOC_ENUM_FRAMESIZES to list a set of discrete framesizes that it supports.
1216*4882a593SmuzhiyunAnd that does not combine with cropping, composing or scaling. This is
1217*4882a593Smuzhiyunprimarily a limitation of the V4L2 API which is carefully reproduced here.
1218*4882a593Smuzhiyun
1219*4882a593SmuzhiyunThe minimum and maximum resolutions that the scaler can achieve are 16x16 and
1220*4882a593Smuzhiyun(4096 * 4) x (2160 x 4), but it can only scale up or down by a factor of 4 or
1221*4882a593Smuzhiyunless. So for a source resolution of 1280x720 the minimum the scaler can do is
1222*4882a593Smuzhiyun320x180 and the maximum is 5120x2880. You can play around with this using the
1223*4882a593Smuzhiyunqv4l2 test tool and you will see these dependencies.
1224*4882a593Smuzhiyun
1225*4882a593SmuzhiyunThis driver also supports larger 'bytesperline' settings, something that
1226*4882a593SmuzhiyunVIDIOC_S_FMT allows but that few drivers implement.
1227*4882a593Smuzhiyun
1228*4882a593SmuzhiyunThe scaler is a simple scaler that uses the Coarse Bresenham algorithm. It's
1229*4882a593Smuzhiyundesigned for speed and simplicity, not quality.
1230*4882a593Smuzhiyun
1231*4882a593SmuzhiyunIf the combination of crop, compose and scaling allows it, then it is possible
1232*4882a593Smuzhiyunto change crop and compose rectangles on the fly.
1233*4882a593Smuzhiyun
1234*4882a593Smuzhiyun
1235*4882a593SmuzhiyunFormats
1236*4882a593Smuzhiyun-------
1237*4882a593Smuzhiyun
1238*4882a593SmuzhiyunThe driver supports all the regular packed and planar 4:4:4, 4:2:2 and 4:2:0
1239*4882a593SmuzhiyunYUYV formats, 8, 16, 24 and 32 RGB packed formats and various multiplanar
1240*4882a593Smuzhiyunformats.
1241*4882a593Smuzhiyun
1242*4882a593SmuzhiyunThe alpha component can be set through the 'Alpha Component' User control
1243*4882a593Smuzhiyunfor those formats that support it. If the 'Apply Alpha To Red Only' control
1244*4882a593Smuzhiyunis set, then the alpha component is only used for the color red and set to
1245*4882a593Smuzhiyun0 otherwise.
1246*4882a593Smuzhiyun
1247*4882a593SmuzhiyunThe driver has to be configured to support the multiplanar formats. By default
1248*4882a593Smuzhiyunthe driver instances are single-planar. This can be changed by setting the
1249*4882a593Smuzhiyunmultiplanar module option, see section 1 for more details on that option.
1250*4882a593Smuzhiyun
1251*4882a593SmuzhiyunIf the driver instance is using the multiplanar formats/API, then the first
1252*4882a593Smuzhiyunsingle planar format (YUYV) and the multiplanar NV16M and NV61M formats the
1253*4882a593Smuzhiyunwill have a plane that has a non-zero data_offset of 128 bytes. It is rare for
1254*4882a593Smuzhiyundata_offset to be non-zero, so this is a useful feature for testing applications.
1255*4882a593Smuzhiyun
1256*4882a593SmuzhiyunVideo output will also honor any data_offset that the application set.
1257*4882a593Smuzhiyun
1258*4882a593Smuzhiyun
1259*4882a593SmuzhiyunCapture Overlay
1260*4882a593Smuzhiyun---------------
1261*4882a593Smuzhiyun
1262*4882a593SmuzhiyunNote: capture overlay support is implemented primarily to test the existing
1263*4882a593SmuzhiyunV4L2 capture overlay API. In practice few if any GPUs support such overlays
1264*4882a593Smuzhiyunanymore, and neither are they generally needed anymore since modern hardware
1265*4882a593Smuzhiyunis so much more capable. By setting flag 0x10000 in the node_types module
1266*4882a593Smuzhiyunoption the vivid driver will create a simple framebuffer device that can be
1267*4882a593Smuzhiyunused for testing this API. Whether this API should be used for new drivers is
1268*4882a593Smuzhiyunquestionable.
1269*4882a593Smuzhiyun
1270*4882a593SmuzhiyunThis driver has support for a destructive capture overlay with bitmap clipping
1271*4882a593Smuzhiyunand list clipping (up to 16 rectangles) capabilities. Overlays are not
1272*4882a593Smuzhiyunsupported for multiplanar formats. It also honors the struct v4l2_window field
1273*4882a593Smuzhiyunsetting: if it is set to FIELD_TOP or FIELD_BOTTOM and the capture setting is
1274*4882a593SmuzhiyunFIELD_ALTERNATE, then only the top or bottom fields will be copied to the overlay.
1275*4882a593Smuzhiyun
1276*4882a593SmuzhiyunThe overlay only works if you are also capturing at that same time. This is a
1277*4882a593Smuzhiyunvivid limitation since it copies from a buffer to the overlay instead of
1278*4882a593Smuzhiyunfilling the overlay directly. And if you are not capturing, then no buffers
1279*4882a593Smuzhiyunare available to fill.
1280*4882a593Smuzhiyun
1281*4882a593SmuzhiyunIn addition, the pixelformat of the capture format and that of the framebuffer
1282*4882a593Smuzhiyunmust be the same for the overlay to work. Otherwise VIDIOC_OVERLAY will return
1283*4882a593Smuzhiyunan error.
1284*4882a593Smuzhiyun
1285*4882a593SmuzhiyunIn order to really see what it going on you will need to create two vivid
1286*4882a593Smuzhiyuninstances: the first with a framebuffer enabled. You configure the capture
1287*4882a593Smuzhiyunoverlay of the second instance to use the framebuffer of the first, then
1288*4882a593Smuzhiyunyou start capturing in the second instance. For the first instance you setup
1289*4882a593Smuzhiyunthe output overlay for the video output, turn on video looping and capture
1290*4882a593Smuzhiyunto see the blended framebuffer overlay that's being written to by the second
1291*4882a593Smuzhiyuninstance. This setup would require the following commands:
1292*4882a593Smuzhiyun
1293*4882a593Smuzhiyun.. code-block:: none
1294*4882a593Smuzhiyun
1295*4882a593Smuzhiyun	$ sudo modprobe vivid n_devs=2 node_types=0x10101,0x1
1296*4882a593Smuzhiyun	$ v4l2-ctl -d1 --find-fb
1297*4882a593Smuzhiyun	/dev/fb1 is the framebuffer associated with base address 0x12800000
1298*4882a593Smuzhiyun	$ sudo v4l2-ctl -d2 --set-fbuf fb=1
1299*4882a593Smuzhiyun	$ v4l2-ctl -d1 --set-fbuf fb=1
1300*4882a593Smuzhiyun	$ v4l2-ctl -d0 --set-fmt-video=pixelformat='AR15'
1301*4882a593Smuzhiyun	$ v4l2-ctl -d1 --set-fmt-video-out=pixelformat='AR15'
1302*4882a593Smuzhiyun	$ v4l2-ctl -d2 --set-fmt-video=pixelformat='AR15'
1303*4882a593Smuzhiyun	$ v4l2-ctl -d0 -i2
1304*4882a593Smuzhiyun	$ v4l2-ctl -d2 -i2
1305*4882a593Smuzhiyun	$ v4l2-ctl -d2 -c horizontal_movement=4
1306*4882a593Smuzhiyun	$ v4l2-ctl -d1 --overlay=1
1307*4882a593Smuzhiyun	$ v4l2-ctl -d1 -c loop_video=1
1308*4882a593Smuzhiyun	$ v4l2-ctl -d2 --stream-mmap --overlay=1
1309*4882a593Smuzhiyun
1310*4882a593SmuzhiyunAnd from another console:
1311*4882a593Smuzhiyun
1312*4882a593Smuzhiyun.. code-block:: none
1313*4882a593Smuzhiyun
1314*4882a593Smuzhiyun	$ v4l2-ctl -d1 --stream-out-mmap
1315*4882a593Smuzhiyun
1316*4882a593SmuzhiyunAnd yet another console:
1317*4882a593Smuzhiyun
1318*4882a593Smuzhiyun.. code-block:: none
1319*4882a593Smuzhiyun
1320*4882a593Smuzhiyun	$ qv4l2
1321*4882a593Smuzhiyun
1322*4882a593Smuzhiyunand start streaming.
1323*4882a593Smuzhiyun
1324*4882a593SmuzhiyunAs you can see, this is not for the faint of heart...
1325*4882a593Smuzhiyun
1326*4882a593Smuzhiyun
1327*4882a593SmuzhiyunOutput Overlay
1328*4882a593Smuzhiyun--------------
1329*4882a593Smuzhiyun
1330*4882a593SmuzhiyunNote: output overlays are primarily implemented in order to test the existing
1331*4882a593SmuzhiyunV4L2 output overlay API. Whether this API should be used for new drivers is
1332*4882a593Smuzhiyunquestionable.
1333*4882a593Smuzhiyun
1334*4882a593SmuzhiyunThis driver has support for an output overlay and is capable of:
1335*4882a593Smuzhiyun
1336*4882a593Smuzhiyun	- bitmap clipping,
1337*4882a593Smuzhiyun	- list clipping (up to 16 rectangles)
1338*4882a593Smuzhiyun	- chromakey
1339*4882a593Smuzhiyun	- source chromakey
1340*4882a593Smuzhiyun	- global alpha
1341*4882a593Smuzhiyun	- local alpha
1342*4882a593Smuzhiyun	- local inverse alpha
1343*4882a593Smuzhiyun
1344*4882a593SmuzhiyunOutput overlays are not supported for multiplanar formats. In addition, the
1345*4882a593Smuzhiyunpixelformat of the capture format and that of the framebuffer must be the
1346*4882a593Smuzhiyunsame for the overlay to work. Otherwise VIDIOC_OVERLAY will return an error.
1347*4882a593Smuzhiyun
1348*4882a593SmuzhiyunOutput overlays only work if the driver has been configured to create a
1349*4882a593Smuzhiyunframebuffer by setting flag 0x10000 in the node_types module option. The
1350*4882a593Smuzhiyuncreated framebuffer has a size of 720x576 and supports ARGB 1:5:5:5 and
1351*4882a593SmuzhiyunRGB 5:6:5.
1352*4882a593Smuzhiyun
1353*4882a593SmuzhiyunIn order to see the effects of the various clipping, chromakeying or alpha
1354*4882a593Smuzhiyunprocessing capabilities you need to turn on video looping and see the results
1355*4882a593Smuzhiyunon the capture side. The use of the clipping, chromakeying or alpha processing
1356*4882a593Smuzhiyuncapabilities will slow down the video loop considerably as a lot of checks have
1357*4882a593Smuzhiyunto be done per pixel.
1358*4882a593Smuzhiyun
1359*4882a593Smuzhiyun
1360*4882a593SmuzhiyunCEC (Consumer Electronics Control)
1361*4882a593Smuzhiyun----------------------------------
1362*4882a593Smuzhiyun
1363*4882a593SmuzhiyunIf there are HDMI inputs then a CEC adapter will be created that has
1364*4882a593Smuzhiyunthe same number of input ports. This is the equivalent of e.g. a TV that
1365*4882a593Smuzhiyunhas that number of inputs. Each HDMI output will also create a
1366*4882a593SmuzhiyunCEC adapter that is hooked up to the corresponding input port, or (if there
1367*4882a593Smuzhiyunare more outputs than inputs) is not hooked up at all. In other words,
1368*4882a593Smuzhiyunthis is the equivalent of hooking up each output device to an input port of
1369*4882a593Smuzhiyunthe TV. Any remaining output devices remain unconnected.
1370*4882a593Smuzhiyun
1371*4882a593SmuzhiyunThe EDID that each output reads reports a unique CEC physical address that is
1372*4882a593Smuzhiyunbased on the physical address of the EDID of the input. So if the EDID of the
1373*4882a593Smuzhiyunreceiver has physical address A.B.0.0, then each output will see an EDID
1374*4882a593Smuzhiyuncontaining physical address A.B.C.0 where C is 1 to the number of inputs. If
1375*4882a593Smuzhiyunthere are more outputs than inputs then the remaining outputs have a CEC adapter
1376*4882a593Smuzhiyunthat is disabled and reports an invalid physical address.
1377*4882a593Smuzhiyun
1378*4882a593Smuzhiyun
1379*4882a593SmuzhiyunSome Future Improvements
1380*4882a593Smuzhiyun------------------------
1381*4882a593Smuzhiyun
1382*4882a593SmuzhiyunJust as a reminder and in no particular order:
1383*4882a593Smuzhiyun
1384*4882a593Smuzhiyun- Add a virtual alsa driver to test audio
1385*4882a593Smuzhiyun- Add virtual sub-devices and media controller support
1386*4882a593Smuzhiyun- Some support for testing compressed video
1387*4882a593Smuzhiyun- Add support to loop raw VBI output to raw VBI input
1388*4882a593Smuzhiyun- Add support to loop teletext sliced VBI output to VBI input
1389*4882a593Smuzhiyun- Fix sequence/field numbering when looping of video with alternate fields
1390*4882a593Smuzhiyun- Add support for V4L2_CID_BG_COLOR for video outputs
1391*4882a593Smuzhiyun- Add ARGB888 overlay support: better testing of the alpha channel
1392*4882a593Smuzhiyun- Improve pixel aspect support in the tpg code by passing a real v4l2_fract
1393*4882a593Smuzhiyun- Use per-queue locks and/or per-device locks to improve throughput
1394*4882a593Smuzhiyun- Add support to loop from a specific output to a specific input across
1395*4882a593Smuzhiyun  vivid instances
1396*4882a593Smuzhiyun- The SDR radio should use the same 'frequencies' for stations as the normal
1397*4882a593Smuzhiyun  radio receiver, and give back noise if the frequency doesn't match up with
1398*4882a593Smuzhiyun  a station frequency
1399*4882a593Smuzhiyun- Make a thread for the RDS generation, that would help in particular for the
1400*4882a593Smuzhiyun  "Controls" RDS Rx I/O Mode as the read-only RDS controls could be updated
1401*4882a593Smuzhiyun  in real-time.
1402*4882a593Smuzhiyun- Changing the EDID should cause hotplug detect emulation to happen.
1403