cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

vivid.rst (50939B)


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