162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ciThe Virtual Video Test Driver (vivid) 462306a36Sopenharmony_ci===================================== 562306a36Sopenharmony_ci 662306a36Sopenharmony_ciThis driver emulates video4linux hardware of various types: video capture, video 762306a36Sopenharmony_cioutput, vbi capture and output, metadata capture and output, radio receivers and 862306a36Sopenharmony_citransmitters, touch capture and a software defined radio receiver. In addition a 962306a36Sopenharmony_cisimple framebuffer device is available for testing capture and output overlays. 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ciUp to 64 vivid instances can be created, each with up to 16 inputs and 16 outputs. 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciEach input can be a webcam, TV capture device, S-Video capture device or an HDMI 1462306a36Sopenharmony_cicapture device. Each output can be an S-Video output device or an HDMI output 1562306a36Sopenharmony_cidevice. 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ciThese inputs and outputs act exactly as a real hardware device would behave. This 1862306a36Sopenharmony_ciallows you to use this driver as a test input for application development, since 1962306a36Sopenharmony_ciyou can test the various features without requiring special hardware. 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ciThis document describes the features implemented by this driver: 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci- Support for read()/write(), MMAP, USERPTR and DMABUF streaming I/O. 2462306a36Sopenharmony_ci- A large list of test patterns and variations thereof 2562306a36Sopenharmony_ci- Working brightness, contrast, saturation and hue controls 2662306a36Sopenharmony_ci- Support for the alpha color component 2762306a36Sopenharmony_ci- Full colorspace support, including limited/full RGB range 2862306a36Sopenharmony_ci- All possible control types are present 2962306a36Sopenharmony_ci- Support for various pixel aspect ratios and video aspect ratios 3062306a36Sopenharmony_ci- Error injection to test what happens if errors occur 3162306a36Sopenharmony_ci- Supports crop/compose/scale in any combination for both input and output 3262306a36Sopenharmony_ci- Can emulate up to 4K resolutions 3362306a36Sopenharmony_ci- All Field settings are supported for testing interlaced capturing 3462306a36Sopenharmony_ci- Supports all standard YUV and RGB formats, including two multiplanar YUV formats 3562306a36Sopenharmony_ci- Raw and Sliced VBI capture and output support 3662306a36Sopenharmony_ci- Radio receiver and transmitter support, including RDS support 3762306a36Sopenharmony_ci- Software defined radio (SDR) support 3862306a36Sopenharmony_ci- Capture and output overlay support 3962306a36Sopenharmony_ci- Metadata capture and output support 4062306a36Sopenharmony_ci- Touch capture support 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ciThese features will be described in more detail below. 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ciConfiguring the driver 4562306a36Sopenharmony_ci---------------------- 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ciBy default the driver will create a single instance that has a video capture 4862306a36Sopenharmony_cidevice with webcam, TV, S-Video and HDMI inputs, a video output device with 4962306a36Sopenharmony_ciS-Video and HDMI outputs, one vbi capture device, one vbi output device, one 5062306a36Sopenharmony_ciradio receiver device, one radio transmitter device and one SDR device. 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ciThe number of instances, devices, video inputs and outputs and their types are 5362306a36Sopenharmony_ciall configurable using the following module options: 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci- n_devs: 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci number of driver instances to create. By default set to 1. Up to 64 5862306a36Sopenharmony_ci instances can be created. 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci- node_types: 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci which devices should each driver instance create. An array of 6362306a36Sopenharmony_ci hexadecimal values, one for each instance. The default is 0x1d3d. 6462306a36Sopenharmony_ci Each value is a bitmask with the following meaning: 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci - bit 0: Video Capture node 6762306a36Sopenharmony_ci - bit 2-3: VBI Capture node: 0 = none, 1 = raw vbi, 2 = sliced vbi, 3 = both 6862306a36Sopenharmony_ci - bit 4: Radio Receiver node 6962306a36Sopenharmony_ci - bit 5: Software Defined Radio Receiver node 7062306a36Sopenharmony_ci - bit 8: Video Output node 7162306a36Sopenharmony_ci - bit 10-11: VBI Output node: 0 = none, 1 = raw vbi, 2 = sliced vbi, 3 = both 7262306a36Sopenharmony_ci - bit 12: Radio Transmitter node 7362306a36Sopenharmony_ci - bit 16: Framebuffer for testing overlays 7462306a36Sopenharmony_ci - bit 17: Metadata Capture node 7562306a36Sopenharmony_ci - bit 18: Metadata Output node 7662306a36Sopenharmony_ci - bit 19: Touch Capture node 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci So to create four instances, the first two with just one video capture 7962306a36Sopenharmony_ci device, the second two with just one video output device you would pass 8062306a36Sopenharmony_ci these module options to vivid: 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci .. code-block:: none 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci n_devs=4 node_types=0x1,0x1,0x100,0x100 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci- num_inputs: 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci the number of inputs, one for each instance. By default 4 inputs 8962306a36Sopenharmony_ci are created for each video capture device. At most 16 inputs can be created, 9062306a36Sopenharmony_ci and there must be at least one. 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci- input_types: 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci the input types for each instance, the default is 0xe4. This defines 9562306a36Sopenharmony_ci what the type of each input is when the inputs are created for each driver 9662306a36Sopenharmony_ci instance. This is a hexadecimal value with up to 16 pairs of bits, each 9762306a36Sopenharmony_ci pair gives the type and bits 0-1 map to input 0, bits 2-3 map to input 1, 9862306a36Sopenharmony_ci 30-31 map to input 15. Each pair of bits has the following meaning: 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci - 00: this is a webcam input 10162306a36Sopenharmony_ci - 01: this is a TV tuner input 10262306a36Sopenharmony_ci - 10: this is an S-Video input 10362306a36Sopenharmony_ci - 11: this is an HDMI input 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci So to create a video capture device with 8 inputs where input 0 is a TV 10662306a36Sopenharmony_ci tuner, inputs 1-3 are S-Video inputs and inputs 4-7 are HDMI inputs you 10762306a36Sopenharmony_ci would use the following module options: 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci .. code-block:: none 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci num_inputs=8 input_types=0xffa9 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci- num_outputs: 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci the number of outputs, one for each instance. By default 2 outputs 11662306a36Sopenharmony_ci are created for each video output device. At most 16 outputs can be 11762306a36Sopenharmony_ci created, and there must be at least one. 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci- output_types: 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci the output types for each instance, the default is 0x02. This defines 12262306a36Sopenharmony_ci what the type of each output is when the outputs are created for each 12362306a36Sopenharmony_ci driver instance. This is a hexadecimal value with up to 16 bits, each bit 12462306a36Sopenharmony_ci gives the type and bit 0 maps to output 0, bit 1 maps to output 1, bit 12562306a36Sopenharmony_ci 15 maps to output 15. The meaning of each bit is as follows: 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci - 0: this is an S-Video output 12862306a36Sopenharmony_ci - 1: this is an HDMI output 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci So to create a video output device with 8 outputs where outputs 0-3 are 13162306a36Sopenharmony_ci S-Video outputs and outputs 4-7 are HDMI outputs you would use the 13262306a36Sopenharmony_ci following module options: 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci .. code-block:: none 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci num_outputs=8 output_types=0xf0 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci- vid_cap_nr: 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci give the desired videoX start number for each video capture device. 14162306a36Sopenharmony_ci The default is -1 which will just take the first free number. This allows 14262306a36Sopenharmony_ci you to map capture video nodes to specific videoX device nodes. Example: 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci .. code-block:: none 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci n_devs=4 vid_cap_nr=2,4,6,8 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci This will attempt to assign /dev/video2 for the video capture device of 14962306a36Sopenharmony_ci the first vivid instance, video4 for the next up to video8 for the last 15062306a36Sopenharmony_ci instance. If it can't succeed, then it will just take the next free 15162306a36Sopenharmony_ci number. 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci- vid_out_nr: 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci give the desired videoX start number for each video output device. 15662306a36Sopenharmony_ci The default is -1 which will just take the first free number. 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci- vbi_cap_nr: 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ci give the desired vbiX start number for each vbi capture device. 16162306a36Sopenharmony_ci The default is -1 which will just take the first free number. 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci- vbi_out_nr: 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci give the desired vbiX start number for each vbi output device. 16662306a36Sopenharmony_ci The default is -1 which will just take the first free number. 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci- radio_rx_nr: 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ci give the desired radioX start number for each radio receiver device. 17162306a36Sopenharmony_ci The default is -1 which will just take the first free number. 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci- radio_tx_nr: 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_ci give the desired radioX start number for each radio transmitter 17662306a36Sopenharmony_ci device. The default is -1 which will just take the first free number. 17762306a36Sopenharmony_ci 17862306a36Sopenharmony_ci- sdr_cap_nr: 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci give the desired swradioX start number for each SDR capture device. 18162306a36Sopenharmony_ci The default is -1 which will just take the first free number. 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_ci- meta_cap_nr: 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_ci give the desired videoX start number for each metadata capture device. 18662306a36Sopenharmony_ci The default is -1 which will just take the first free number. 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci- meta_out_nr: 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci give the desired videoX start number for each metadata output device. 19162306a36Sopenharmony_ci The default is -1 which will just take the first free number. 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci- touch_cap_nr: 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_ci give the desired v4l-touchX start number for each touch capture device. 19662306a36Sopenharmony_ci The default is -1 which will just take the first free number. 19762306a36Sopenharmony_ci 19862306a36Sopenharmony_ci- ccs_cap_mode: 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci specify the allowed video capture crop/compose/scaling combination 20162306a36Sopenharmony_ci for each driver instance. Video capture devices can have any combination 20262306a36Sopenharmony_ci of cropping, composing and scaling capabilities and this will tell the 20362306a36Sopenharmony_ci vivid driver which of those is should emulate. By default the user can 20462306a36Sopenharmony_ci select this through controls. 20562306a36Sopenharmony_ci 20662306a36Sopenharmony_ci The value is either -1 (controlled by the user) or a set of three bits, 20762306a36Sopenharmony_ci each enabling (1) or disabling (0) one of the features: 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci - bit 0: 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci Enable crop support. Cropping will take only part of the 21262306a36Sopenharmony_ci incoming picture. 21362306a36Sopenharmony_ci - bit 1: 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci Enable compose support. Composing will copy the incoming 21662306a36Sopenharmony_ci picture into a larger buffer. 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ci - bit 2: 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_ci Enable scaling support. Scaling can scale the incoming 22162306a36Sopenharmony_ci picture. The scaler of the vivid driver can enlarge up 22262306a36Sopenharmony_ci or down to four times the original size. The scaler is 22362306a36Sopenharmony_ci very simple and low-quality. Simplicity and speed were 22462306a36Sopenharmony_ci key, not quality. 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci Note that this value is ignored by webcam inputs: those enumerate 22762306a36Sopenharmony_ci discrete framesizes and that is incompatible with cropping, composing 22862306a36Sopenharmony_ci or scaling. 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ci- ccs_out_mode: 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci specify the allowed video output crop/compose/scaling combination 23362306a36Sopenharmony_ci for each driver instance. Video output devices can have any combination 23462306a36Sopenharmony_ci of cropping, composing and scaling capabilities and this will tell the 23562306a36Sopenharmony_ci vivid driver which of those is should emulate. By default the user can 23662306a36Sopenharmony_ci select this through controls. 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci The value is either -1 (controlled by the user) or a set of three bits, 23962306a36Sopenharmony_ci each enabling (1) or disabling (0) one of the features: 24062306a36Sopenharmony_ci 24162306a36Sopenharmony_ci - bit 0: 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci Enable crop support. Cropping will take only part of the 24462306a36Sopenharmony_ci outgoing buffer. 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ci - bit 1: 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_ci Enable compose support. Composing will copy the incoming 24962306a36Sopenharmony_ci buffer into a larger picture frame. 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_ci - bit 2: 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_ci Enable scaling support. Scaling can scale the incoming 25462306a36Sopenharmony_ci buffer. The scaler of the vivid driver can enlarge up 25562306a36Sopenharmony_ci or down to four times the original size. The scaler is 25662306a36Sopenharmony_ci very simple and low-quality. Simplicity and speed were 25762306a36Sopenharmony_ci key, not quality. 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_ci- multiplanar: 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_ci select whether each device instance supports multi-planar formats, 26262306a36Sopenharmony_ci and thus the V4L2 multi-planar API. By default device instances are 26362306a36Sopenharmony_ci single-planar. 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_ci This module option can override that for each instance. Values are: 26662306a36Sopenharmony_ci 26762306a36Sopenharmony_ci - 1: this is a single-planar instance. 26862306a36Sopenharmony_ci - 2: this is a multi-planar instance. 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ci- vivid_debug: 27162306a36Sopenharmony_ci 27262306a36Sopenharmony_ci enable driver debugging info 27362306a36Sopenharmony_ci 27462306a36Sopenharmony_ci- no_error_inj: 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_ci if set disable the error injecting controls. This option is 27762306a36Sopenharmony_ci needed in order to run a tool like v4l2-compliance. Tools like that 27862306a36Sopenharmony_ci exercise all controls including a control like 'Disconnect' which 27962306a36Sopenharmony_ci emulates a USB disconnect, making the device inaccessible and so 28062306a36Sopenharmony_ci all tests that v4l2-compliance is doing will fail afterwards. 28162306a36Sopenharmony_ci 28262306a36Sopenharmony_ci There may be other situations as well where you want to disable the 28362306a36Sopenharmony_ci error injection support of vivid. When this option is set, then the 28462306a36Sopenharmony_ci controls that select crop, compose and scale behavior are also 28562306a36Sopenharmony_ci removed. Unless overridden by ccs_cap_mode and/or ccs_out_mode the 28662306a36Sopenharmony_ci will default to enabling crop, compose and scaling. 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci- allocators: 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_ci memory allocator selection, default is 0. It specifies the way buffers 29162306a36Sopenharmony_ci will be allocated. 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_ci - 0: vmalloc 29462306a36Sopenharmony_ci - 1: dma-contig 29562306a36Sopenharmony_ci 29662306a36Sopenharmony_ci- cache_hints: 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci specifies if the device should set queues' user-space cache and memory 29962306a36Sopenharmony_ci consistency hint capability (V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS). 30062306a36Sopenharmony_ci The hints are valid only when using MMAP streaming I/O. Default is 0. 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_ci - 0: forbid hints 30362306a36Sopenharmony_ci - 1: allow hints 30462306a36Sopenharmony_ci 30562306a36Sopenharmony_ciTaken together, all these module options allow you to precisely customize 30662306a36Sopenharmony_cithe driver behavior and test your application with all sorts of permutations. 30762306a36Sopenharmony_ciIt is also very suitable to emulate hardware that is not yet available, e.g. 30862306a36Sopenharmony_ciwhen developing software for a new upcoming device. 30962306a36Sopenharmony_ci 31062306a36Sopenharmony_ci 31162306a36Sopenharmony_ciVideo Capture 31262306a36Sopenharmony_ci------------- 31362306a36Sopenharmony_ci 31462306a36Sopenharmony_ciThis is probably the most frequently used feature. The video capture device 31562306a36Sopenharmony_cican be configured by using the module options num_inputs, input_types and 31662306a36Sopenharmony_ciccs_cap_mode (see section 1 for more detailed information), but by default 31762306a36Sopenharmony_cifour inputs are configured: a webcam, a TV tuner, an S-Video and an HDMI 31862306a36Sopenharmony_ciinput, one input for each input type. Those are described in more detail 31962306a36Sopenharmony_cibelow. 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ciSpecial attention has been given to the rate at which new frames become 32262306a36Sopenharmony_ciavailable. The jitter will be around 1 jiffie (that depends on the HZ 32362306a36Sopenharmony_ciconfiguration of your kernel, so usually 1/100, 1/250 or 1/1000 of a second), 32462306a36Sopenharmony_cibut the long-term behavior is exactly following the framerate. So a 32562306a36Sopenharmony_ciframerate of 59.94 Hz is really different from 60 Hz. If the framerate 32662306a36Sopenharmony_ciexceeds your kernel's HZ value, then you will get dropped frames, but the 32762306a36Sopenharmony_ciframe/field sequence counting will keep track of that so the sequence 32862306a36Sopenharmony_cicount will skip whenever frames are dropped. 32962306a36Sopenharmony_ci 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_ciWebcam Input 33262306a36Sopenharmony_ci~~~~~~~~~~~~ 33362306a36Sopenharmony_ci 33462306a36Sopenharmony_ciThe webcam input supports three framesizes: 320x180, 640x360 and 1280x720. It 33562306a36Sopenharmony_cisupports frames per second settings of 10, 15, 25, 30, 50 and 60 fps. Which ones 33662306a36Sopenharmony_ciare available depends on the chosen framesize: the larger the framesize, the 33762306a36Sopenharmony_cilower the maximum frames per second. 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_ciThe initially selected colorspace when you switch to the webcam input will be 34062306a36Sopenharmony_cisRGB. 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_ciTV and S-Video Inputs 34462306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~ 34562306a36Sopenharmony_ci 34662306a36Sopenharmony_ciThe only difference between the TV and S-Video input is that the TV has a 34762306a36Sopenharmony_cituner. Otherwise they behave identically. 34862306a36Sopenharmony_ci 34962306a36Sopenharmony_ciThese inputs support audio inputs as well: one TV and one Line-In. They 35062306a36Sopenharmony_ciboth support all TV standards. If the standard is queried, then the Vivid 35162306a36Sopenharmony_cicontrols 'Standard Signal Mode' and 'Standard' determine what 35262306a36Sopenharmony_cithe result will be. 35362306a36Sopenharmony_ci 35462306a36Sopenharmony_ciThese inputs support all combinations of the field setting. Special care has 35562306a36Sopenharmony_cibeen taken to faithfully reproduce how fields are handled for the different 35662306a36Sopenharmony_ciTV standards. This is particularly noticeable when generating a horizontally 35762306a36Sopenharmony_cimoving image so the temporal effect of using interlaced formats becomes clearly 35862306a36Sopenharmony_civisible. For 50 Hz standards the top field is the oldest and the bottom field 35962306a36Sopenharmony_ciis the newest in time. For 60 Hz standards that is reversed: the bottom field 36062306a36Sopenharmony_ciis the oldest and the top field is the newest in time. 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ciWhen you start capturing in V4L2_FIELD_ALTERNATE mode the first buffer will 36362306a36Sopenharmony_cicontain the top field for 50 Hz standards and the bottom field for 60 Hz 36462306a36Sopenharmony_cistandards. This is what capture hardware does as well. 36562306a36Sopenharmony_ci 36662306a36Sopenharmony_ciFinally, for PAL/SECAM standards the first half of the top line contains noise. 36762306a36Sopenharmony_ciThis simulates the Wide Screen Signal that is commonly placed there. 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ciThe initially selected colorspace when you switch to the TV or S-Video input 37062306a36Sopenharmony_ciwill be SMPTE-170M. 37162306a36Sopenharmony_ci 37262306a36Sopenharmony_ciThe pixel aspect ratio will depend on the TV standard. The video aspect ratio 37362306a36Sopenharmony_cican be selected through the 'Standard Aspect Ratio' Vivid control. 37462306a36Sopenharmony_ciChoices are '4x3', '16x9' which will give letterboxed widescreen video and 37562306a36Sopenharmony_ci'16x9 Anamorphic' which will give full screen squashed anamorphic widescreen 37662306a36Sopenharmony_civideo that will need to be scaled accordingly. 37762306a36Sopenharmony_ci 37862306a36Sopenharmony_ciThe TV 'tuner' supports a frequency range of 44-958 MHz. Channels are available 37962306a36Sopenharmony_cievery 6 MHz, starting from 49.25 MHz. For each channel the generated image 38062306a36Sopenharmony_ciwill be in color for the +/- 0.25 MHz around it, and in grayscale for 38162306a36Sopenharmony_ci+/- 1 MHz around the channel. Beyond that it is just noise. The VIDIOC_G_TUNER 38262306a36Sopenharmony_ciioctl will return 100% signal strength for +/- 0.25 MHz and 50% for +/- 1 MHz. 38362306a36Sopenharmony_ciIt will also return correct afc values to show whether the frequency is too 38462306a36Sopenharmony_cilow or too high. 38562306a36Sopenharmony_ci 38662306a36Sopenharmony_ciThe audio subchannels that are returned are MONO for the +/- 1 MHz range around 38762306a36Sopenharmony_cia valid channel frequency. When the frequency is within +/- 0.25 MHz of the 38862306a36Sopenharmony_cichannel it will return either MONO, STEREO, either MONO | SAP (for NTSC) or 38962306a36Sopenharmony_ciLANG1 | LANG2 (for others), or STEREO | SAP. 39062306a36Sopenharmony_ci 39162306a36Sopenharmony_ciWhich one is returned depends on the chosen channel, each next valid channel 39262306a36Sopenharmony_ciwill cycle through the possible audio subchannel combinations. This allows 39362306a36Sopenharmony_ciyou to test the various combinations by just switching channels.. 39462306a36Sopenharmony_ci 39562306a36Sopenharmony_ciFinally, for these inputs the v4l2_timecode struct is filled in the 39662306a36Sopenharmony_cidequeued v4l2_buffer struct. 39762306a36Sopenharmony_ci 39862306a36Sopenharmony_ci 39962306a36Sopenharmony_ciHDMI Input 40062306a36Sopenharmony_ci~~~~~~~~~~ 40162306a36Sopenharmony_ci 40262306a36Sopenharmony_ciThe HDMI inputs supports all CEA-861 and DMT timings, both progressive and 40362306a36Sopenharmony_ciinterlaced, for pixelclock frequencies between 25 and 600 MHz. The field 40462306a36Sopenharmony_cimode for interlaced formats is always V4L2_FIELD_ALTERNATE. For HDMI the 40562306a36Sopenharmony_cifield order is always top field first, and when you start capturing an 40662306a36Sopenharmony_ciinterlaced format you will receive the top field first. 40762306a36Sopenharmony_ci 40862306a36Sopenharmony_ciThe initially selected colorspace when you switch to the HDMI input or 40962306a36Sopenharmony_ciselect an HDMI timing is based on the format resolution: for resolutions 41062306a36Sopenharmony_ciless than or equal to 720x576 the colorspace is set to SMPTE-170M, for 41162306a36Sopenharmony_ciothers it is set to REC-709 (CEA-861 timings) or sRGB (VESA DMT timings). 41262306a36Sopenharmony_ci 41362306a36Sopenharmony_ciThe pixel aspect ratio will depend on the HDMI timing: for 720x480 is it 41462306a36Sopenharmony_ciset as for the NTSC TV standard, for 720x576 it is set as for the PAL TV 41562306a36Sopenharmony_cistandard, and for all others a 1:1 pixel aspect ratio is returned. 41662306a36Sopenharmony_ci 41762306a36Sopenharmony_ciThe video aspect ratio can be selected through the 'DV Timings Aspect Ratio' 41862306a36Sopenharmony_ciVivid control. Choices are 'Source Width x Height' (just use the 41962306a36Sopenharmony_cisame ratio as the chosen format), '4x3' or '16x9', either of which can 42062306a36Sopenharmony_ciresult in pillarboxed or letterboxed video. 42162306a36Sopenharmony_ci 42262306a36Sopenharmony_ciFor HDMI inputs it is possible to set the EDID. By default a simple EDID 42362306a36Sopenharmony_ciis provided. You can only set the EDID for HDMI inputs. Internally, however, 42462306a36Sopenharmony_cithe EDID is shared between all HDMI inputs. 42562306a36Sopenharmony_ci 42662306a36Sopenharmony_ciNo interpretation is done of the EDID data with the exception of the 42762306a36Sopenharmony_ciphysical address. See the CEC section for more details. 42862306a36Sopenharmony_ci 42962306a36Sopenharmony_ciThere is a maximum of 15 HDMI inputs (if there are more, then they will be 43062306a36Sopenharmony_cireduced to 15) since that's the limitation of the EDID physical address. 43162306a36Sopenharmony_ci 43262306a36Sopenharmony_ci 43362306a36Sopenharmony_ciVideo Output 43462306a36Sopenharmony_ci------------ 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_ciThe video output device can be configured by using the module options 43762306a36Sopenharmony_cinum_outputs, output_types and ccs_out_mode (see section 1 for more detailed 43862306a36Sopenharmony_ciinformation), but by default two outputs are configured: an S-Video and an 43962306a36Sopenharmony_ciHDMI input, one output for each output type. Those are described in more detail 44062306a36Sopenharmony_cibelow. 44162306a36Sopenharmony_ci 44262306a36Sopenharmony_ciLike with video capture the framerate is also exact in the long term. 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci 44562306a36Sopenharmony_ciS-Video Output 44662306a36Sopenharmony_ci~~~~~~~~~~~~~~ 44762306a36Sopenharmony_ci 44862306a36Sopenharmony_ciThis output supports audio outputs as well: "Line-Out 1" and "Line-Out 2". 44962306a36Sopenharmony_ciThe S-Video output supports all TV standards. 45062306a36Sopenharmony_ci 45162306a36Sopenharmony_ciThis output supports all combinations of the field setting. 45262306a36Sopenharmony_ci 45362306a36Sopenharmony_ciThe initially selected colorspace when you switch to the TV or S-Video input 45462306a36Sopenharmony_ciwill be SMPTE-170M. 45562306a36Sopenharmony_ci 45662306a36Sopenharmony_ci 45762306a36Sopenharmony_ciHDMI Output 45862306a36Sopenharmony_ci~~~~~~~~~~~ 45962306a36Sopenharmony_ci 46062306a36Sopenharmony_ciThe HDMI output supports all CEA-861 and DMT timings, both progressive and 46162306a36Sopenharmony_ciinterlaced, for pixelclock frequencies between 25 and 600 MHz. The field 46262306a36Sopenharmony_cimode for interlaced formats is always V4L2_FIELD_ALTERNATE. 46362306a36Sopenharmony_ci 46462306a36Sopenharmony_ciThe initially selected colorspace when you switch to the HDMI output or 46562306a36Sopenharmony_ciselect an HDMI timing is based on the format resolution: for resolutions 46662306a36Sopenharmony_ciless than or equal to 720x576 the colorspace is set to SMPTE-170M, for 46762306a36Sopenharmony_ciothers it is set to REC-709 (CEA-861 timings) or sRGB (VESA DMT timings). 46862306a36Sopenharmony_ci 46962306a36Sopenharmony_ciThe pixel aspect ratio will depend on the HDMI timing: for 720x480 is it 47062306a36Sopenharmony_ciset as for the NTSC TV standard, for 720x576 it is set as for the PAL TV 47162306a36Sopenharmony_cistandard, and for all others a 1:1 pixel aspect ratio is returned. 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_ciAn HDMI output has a valid EDID which can be obtained through VIDIOC_G_EDID. 47462306a36Sopenharmony_ci 47562306a36Sopenharmony_ciThere is a maximum of 15 HDMI outputs (if there are more, then they will be 47662306a36Sopenharmony_cireduced to 15) since that's the limitation of the EDID physical address. See 47762306a36Sopenharmony_cialso the CEC section for more details. 47862306a36Sopenharmony_ci 47962306a36Sopenharmony_ciVBI Capture 48062306a36Sopenharmony_ci----------- 48162306a36Sopenharmony_ci 48262306a36Sopenharmony_ciThere are three types of VBI capture devices: those that only support raw 48362306a36Sopenharmony_ci(undecoded) VBI, those that only support sliced (decoded) VBI and those that 48462306a36Sopenharmony_cisupport both. This is determined by the node_types module option. In all 48562306a36Sopenharmony_cicases the driver will generate valid VBI data: for 60 Hz standards it will 48662306a36Sopenharmony_cigenerate Closed Caption and XDS data. The closed caption stream will 48762306a36Sopenharmony_cialternate between "Hello world!" and "Closed captions test" every second. 48862306a36Sopenharmony_ciThe XDS stream will give the current time once a minute. For 50 Hz standards 48962306a36Sopenharmony_ciit will generate the Wide Screen Signal which is based on the actual Video 49062306a36Sopenharmony_ciAspect Ratio control setting and teletext pages 100-159, one page per frame. 49162306a36Sopenharmony_ci 49262306a36Sopenharmony_ciThe VBI device will only work for the S-Video and TV inputs, it will give 49362306a36Sopenharmony_ciback an error if the current input is a webcam or HDMI. 49462306a36Sopenharmony_ci 49562306a36Sopenharmony_ci 49662306a36Sopenharmony_ciVBI Output 49762306a36Sopenharmony_ci---------- 49862306a36Sopenharmony_ci 49962306a36Sopenharmony_ciThere are three types of VBI output devices: those that only support raw 50062306a36Sopenharmony_ci(undecoded) VBI, those that only support sliced (decoded) VBI and those that 50162306a36Sopenharmony_cisupport both. This is determined by the node_types module option. 50262306a36Sopenharmony_ci 50362306a36Sopenharmony_ciThe sliced VBI output supports the Wide Screen Signal and the teletext signal 50462306a36Sopenharmony_cifor 50 Hz standards and Closed Captioning + XDS for 60 Hz standards. 50562306a36Sopenharmony_ci 50662306a36Sopenharmony_ciThe VBI device will only work for the S-Video output, it will give 50762306a36Sopenharmony_ciback an error if the current output is HDMI. 50862306a36Sopenharmony_ci 50962306a36Sopenharmony_ci 51062306a36Sopenharmony_ciRadio Receiver 51162306a36Sopenharmony_ci-------------- 51262306a36Sopenharmony_ci 51362306a36Sopenharmony_ciThe radio receiver emulates an FM/AM/SW receiver. The FM band also supports RDS. 51462306a36Sopenharmony_ciThe frequency ranges are: 51562306a36Sopenharmony_ci 51662306a36Sopenharmony_ci - FM: 64 MHz - 108 MHz 51762306a36Sopenharmony_ci - AM: 520 kHz - 1710 kHz 51862306a36Sopenharmony_ci - SW: 2300 kHz - 26.1 MHz 51962306a36Sopenharmony_ci 52062306a36Sopenharmony_ciValid channels are emulated every 1 MHz for FM and every 100 kHz for AM and SW. 52162306a36Sopenharmony_ciThe signal strength decreases the further the frequency is from the valid 52262306a36Sopenharmony_cifrequency until it becomes 0% at +/- 50 kHz (FM) or 5 kHz (AM/SW) from the 52362306a36Sopenharmony_ciideal frequency. The initial frequency when the driver is loaded is set to 52462306a36Sopenharmony_ci95 MHz. 52562306a36Sopenharmony_ci 52662306a36Sopenharmony_ciThe FM receiver supports RDS as well, both using 'Block I/O' and 'Controls' 52762306a36Sopenharmony_cimodes. In the 'Controls' mode the RDS information is stored in read-only 52862306a36Sopenharmony_cicontrols. These controls are updated every time the frequency is changed, 52962306a36Sopenharmony_cior when the tuner status is requested. The Block I/O method uses the read() 53062306a36Sopenharmony_ciinterface to pass the RDS blocks on to the application for decoding. 53162306a36Sopenharmony_ci 53262306a36Sopenharmony_ciThe RDS signal is 'detected' for +/- 12.5 kHz around the channel frequency, 53362306a36Sopenharmony_ciand the further the frequency is away from the valid frequency the more RDS 53462306a36Sopenharmony_cierrors are randomly introduced into the block I/O stream, up to 50% of all 53562306a36Sopenharmony_ciblocks if you are +/- 12.5 kHz from the channel frequency. All four errors 53662306a36Sopenharmony_cican occur in equal proportions: blocks marked 'CORRECTED', blocks marked 53762306a36Sopenharmony_ci'ERROR', blocks marked 'INVALID' and dropped blocks. 53862306a36Sopenharmony_ci 53962306a36Sopenharmony_ciThe generated RDS stream contains all the standard fields contained in a 54062306a36Sopenharmony_ci0B group, and also radio text and the current time. 54162306a36Sopenharmony_ci 54262306a36Sopenharmony_ciThe receiver supports HW frequency seek, either in Bounded mode, Wrap Around 54362306a36Sopenharmony_cimode or both, which is configurable with the "Radio HW Seek Mode" control. 54462306a36Sopenharmony_ci 54562306a36Sopenharmony_ci 54662306a36Sopenharmony_ciRadio Transmitter 54762306a36Sopenharmony_ci----------------- 54862306a36Sopenharmony_ci 54962306a36Sopenharmony_ciThe radio transmitter emulates an FM/AM/SW transmitter. The FM band also supports RDS. 55062306a36Sopenharmony_ciThe frequency ranges are: 55162306a36Sopenharmony_ci 55262306a36Sopenharmony_ci - FM: 64 MHz - 108 MHz 55362306a36Sopenharmony_ci - AM: 520 kHz - 1710 kHz 55462306a36Sopenharmony_ci - SW: 2300 kHz - 26.1 MHz 55562306a36Sopenharmony_ci 55662306a36Sopenharmony_ciThe initial frequency when the driver is loaded is 95.5 MHz. 55762306a36Sopenharmony_ci 55862306a36Sopenharmony_ciThe FM transmitter supports RDS as well, both using 'Block I/O' and 'Controls' 55962306a36Sopenharmony_cimodes. In the 'Controls' mode the transmitted RDS information is configured 56062306a36Sopenharmony_ciusing controls, and in 'Block I/O' mode the blocks are passed to the driver 56162306a36Sopenharmony_ciusing write(). 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_ci 56462306a36Sopenharmony_ciSoftware Defined Radio Receiver 56562306a36Sopenharmony_ci------------------------------- 56662306a36Sopenharmony_ci 56762306a36Sopenharmony_ciThe SDR receiver has three frequency bands for the ADC tuner: 56862306a36Sopenharmony_ci 56962306a36Sopenharmony_ci - 300 kHz 57062306a36Sopenharmony_ci - 900 kHz - 2800 kHz 57162306a36Sopenharmony_ci - 3200 kHz 57262306a36Sopenharmony_ci 57362306a36Sopenharmony_ciThe RF tuner supports 50 MHz - 2000 MHz. 57462306a36Sopenharmony_ci 57562306a36Sopenharmony_ciThe generated data contains the In-phase and Quadrature components of a 57662306a36Sopenharmony_ci1 kHz tone that has an amplitude of sqrt(2). 57762306a36Sopenharmony_ci 57862306a36Sopenharmony_ci 57962306a36Sopenharmony_ciMetadata Capture 58062306a36Sopenharmony_ci---------------- 58162306a36Sopenharmony_ci 58262306a36Sopenharmony_ciThe Metadata capture generates UVC format metadata. The PTS and SCR are 58362306a36Sopenharmony_citransmitted based on the values set in vivid controls. 58462306a36Sopenharmony_ci 58562306a36Sopenharmony_ciThe Metadata device will only work for the Webcam input, it will give 58662306a36Sopenharmony_ciback an error for all other inputs. 58762306a36Sopenharmony_ci 58862306a36Sopenharmony_ci 58962306a36Sopenharmony_ciMetadata Output 59062306a36Sopenharmony_ci--------------- 59162306a36Sopenharmony_ci 59262306a36Sopenharmony_ciThe Metadata output can be used to set brightness, contrast, saturation and hue. 59362306a36Sopenharmony_ci 59462306a36Sopenharmony_ciThe Metadata device will only work for the Webcam output, it will give 59562306a36Sopenharmony_ciback an error for all other outputs. 59662306a36Sopenharmony_ci 59762306a36Sopenharmony_ci 59862306a36Sopenharmony_ciTouch Capture 59962306a36Sopenharmony_ci------------- 60062306a36Sopenharmony_ci 60162306a36Sopenharmony_ciThe Touch capture generates touch patterns simulating single tap, double tap, 60262306a36Sopenharmony_citriple tap, move from left to right, zoom in, zoom out, palm press (simulating 60362306a36Sopenharmony_cia large area being pressed on a touchpad), and simulating 16 simultaneous 60462306a36Sopenharmony_citouch points. 60562306a36Sopenharmony_ci 60662306a36Sopenharmony_ciControls 60762306a36Sopenharmony_ci-------- 60862306a36Sopenharmony_ci 60962306a36Sopenharmony_ciDifferent devices support different controls. The sections below will describe 61062306a36Sopenharmony_cieach control and which devices support them. 61162306a36Sopenharmony_ci 61262306a36Sopenharmony_ci 61362306a36Sopenharmony_ciUser Controls - Test Controls 61462306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 61562306a36Sopenharmony_ci 61662306a36Sopenharmony_ciThe Button, Boolean, Integer 32 Bits, Integer 64 Bits, Menu, String, Bitmask and 61762306a36Sopenharmony_ciInteger Menu are controls that represent all possible control types. The Menu 61862306a36Sopenharmony_cicontrol and the Integer Menu control both have 'holes' in their menu list, 61962306a36Sopenharmony_cimeaning that one or more menu items return EINVAL when VIDIOC_QUERYMENU is called. 62062306a36Sopenharmony_ciBoth menu controls also have a non-zero minimum control value. These features 62162306a36Sopenharmony_ciallow you to check if your application can handle such things correctly. 62262306a36Sopenharmony_ciThese controls are supported for every device type. 62362306a36Sopenharmony_ci 62462306a36Sopenharmony_ci 62562306a36Sopenharmony_ciUser Controls - Video Capture 62662306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 62762306a36Sopenharmony_ci 62862306a36Sopenharmony_ciThe following controls are specific to video capture. 62962306a36Sopenharmony_ci 63062306a36Sopenharmony_ciThe Brightness, Contrast, Saturation and Hue controls actually work and are 63162306a36Sopenharmony_cistandard. There is one special feature with the Brightness control: each 63262306a36Sopenharmony_civideo input has its own brightness value, so changing input will restore 63362306a36Sopenharmony_cithe brightness for that input. In addition, each video input uses a different 63462306a36Sopenharmony_cibrightness range (minimum and maximum control values). Switching inputs will 63562306a36Sopenharmony_cicause a control event to be sent with the V4L2_EVENT_CTRL_CH_RANGE flag set. 63662306a36Sopenharmony_ciThis allows you to test controls that can change their range. 63762306a36Sopenharmony_ci 63862306a36Sopenharmony_ciThe 'Gain, Automatic' and Gain controls can be used to test volatile controls: 63962306a36Sopenharmony_ciif 'Gain, Automatic' is set, then the Gain control is volatile and changes 64062306a36Sopenharmony_ciconstantly. If 'Gain, Automatic' is cleared, then the Gain control is a normal 64162306a36Sopenharmony_cicontrol. 64262306a36Sopenharmony_ci 64362306a36Sopenharmony_ciThe 'Horizontal Flip' and 'Vertical Flip' controls can be used to flip the 64462306a36Sopenharmony_ciimage. These combine with the 'Sensor Flipped Horizontally/Vertically' Vivid 64562306a36Sopenharmony_cicontrols. 64662306a36Sopenharmony_ci 64762306a36Sopenharmony_ciThe 'Alpha Component' control can be used to set the alpha component for 64862306a36Sopenharmony_ciformats containing an alpha channel. 64962306a36Sopenharmony_ci 65062306a36Sopenharmony_ci 65162306a36Sopenharmony_ciUser Controls - Audio 65262306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~ 65362306a36Sopenharmony_ci 65462306a36Sopenharmony_ciThe following controls are specific to video capture and output and radio 65562306a36Sopenharmony_cireceivers and transmitters. 65662306a36Sopenharmony_ci 65762306a36Sopenharmony_ciThe 'Volume' and 'Mute' audio controls are typical for such devices to 65862306a36Sopenharmony_cicontrol the volume and mute the audio. They don't actually do anything in 65962306a36Sopenharmony_cithe vivid driver. 66062306a36Sopenharmony_ci 66162306a36Sopenharmony_ci 66262306a36Sopenharmony_ciVivid Controls 66362306a36Sopenharmony_ci~~~~~~~~~~~~~~ 66462306a36Sopenharmony_ci 66562306a36Sopenharmony_ciThese vivid custom controls control the image generation, error injection, etc. 66662306a36Sopenharmony_ci 66762306a36Sopenharmony_ci 66862306a36Sopenharmony_ciTest Pattern Controls 66962306a36Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^ 67062306a36Sopenharmony_ci 67162306a36Sopenharmony_ciThe Test Pattern Controls are all specific to video capture. 67262306a36Sopenharmony_ci 67362306a36Sopenharmony_ci- Test Pattern: 67462306a36Sopenharmony_ci 67562306a36Sopenharmony_ci selects which test pattern to use. Use the CSC Colorbar for 67662306a36Sopenharmony_ci testing colorspace conversions: the colors used in that test pattern 67762306a36Sopenharmony_ci map to valid colors in all colorspaces. The colorspace conversion 67862306a36Sopenharmony_ci is disabled for the other test patterns. 67962306a36Sopenharmony_ci 68062306a36Sopenharmony_ci- OSD Text Mode: 68162306a36Sopenharmony_ci 68262306a36Sopenharmony_ci selects whether the text superimposed on the 68362306a36Sopenharmony_ci test pattern should be shown, and if so, whether only counters should 68462306a36Sopenharmony_ci be displayed or the full text. 68562306a36Sopenharmony_ci 68662306a36Sopenharmony_ci- Horizontal Movement: 68762306a36Sopenharmony_ci 68862306a36Sopenharmony_ci selects whether the test pattern should 68962306a36Sopenharmony_ci move to the left or right and at what speed. 69062306a36Sopenharmony_ci 69162306a36Sopenharmony_ci- Vertical Movement: 69262306a36Sopenharmony_ci 69362306a36Sopenharmony_ci does the same for the vertical direction. 69462306a36Sopenharmony_ci 69562306a36Sopenharmony_ci- Show Border: 69662306a36Sopenharmony_ci 69762306a36Sopenharmony_ci show a two-pixel wide border at the edge of the actual image, 69862306a36Sopenharmony_ci excluding letter or pillarboxing. 69962306a36Sopenharmony_ci 70062306a36Sopenharmony_ci- Show Square: 70162306a36Sopenharmony_ci 70262306a36Sopenharmony_ci show a square in the middle of the image. If the image is 70362306a36Sopenharmony_ci displayed with the correct pixel and image aspect ratio corrections, 70462306a36Sopenharmony_ci then the width and height of the square on the monitor should be 70562306a36Sopenharmony_ci the same. 70662306a36Sopenharmony_ci 70762306a36Sopenharmony_ci- Insert SAV Code in Image: 70862306a36Sopenharmony_ci 70962306a36Sopenharmony_ci adds a SAV (Start of Active Video) code to the image. 71062306a36Sopenharmony_ci This can be used to check if such codes in the image are inadvertently 71162306a36Sopenharmony_ci interpreted instead of being ignored. 71262306a36Sopenharmony_ci 71362306a36Sopenharmony_ci- Insert EAV Code in Image: 71462306a36Sopenharmony_ci 71562306a36Sopenharmony_ci does the same for the EAV (End of Active Video) code. 71662306a36Sopenharmony_ci 71762306a36Sopenharmony_ci- Insert Video Guard Band 71862306a36Sopenharmony_ci 71962306a36Sopenharmony_ci adds 4 columns of pixels with the HDMI Video Guard Band code at the 72062306a36Sopenharmony_ci left hand side of the image. This only works with 3 or 4 byte RGB pixel 72162306a36Sopenharmony_ci formats. The RGB pixel value 0xab/0x55/0xab turns out to be equivalent 72262306a36Sopenharmony_ci to the HDMI Video Guard Band code that precedes each active video line 72362306a36Sopenharmony_ci (see section 5.2.2.1 in the HDMI 1.3 Specification). To test if a video 72462306a36Sopenharmony_ci receiver has correct HDMI Video Guard Band processing, enable this 72562306a36Sopenharmony_ci control and then move the image to the left hand side of the screen. 72662306a36Sopenharmony_ci That will result in video lines that start with multiple pixels that 72762306a36Sopenharmony_ci have the same value as the Video Guard Band that precedes them. 72862306a36Sopenharmony_ci Receivers that will just keep skipping Video Guard Band values will 72962306a36Sopenharmony_ci now fail and either loose sync or these video lines will shift. 73062306a36Sopenharmony_ci 73162306a36Sopenharmony_ci 73262306a36Sopenharmony_ciCapture Feature Selection Controls 73362306a36Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 73462306a36Sopenharmony_ci 73562306a36Sopenharmony_ciThese controls are all specific to video capture. 73662306a36Sopenharmony_ci 73762306a36Sopenharmony_ci- Sensor Flipped Horizontally: 73862306a36Sopenharmony_ci 73962306a36Sopenharmony_ci the image is flipped horizontally and the 74062306a36Sopenharmony_ci V4L2_IN_ST_HFLIP input status flag is set. This emulates the case where 74162306a36Sopenharmony_ci a sensor is for example mounted upside down. 74262306a36Sopenharmony_ci 74362306a36Sopenharmony_ci- Sensor Flipped Vertically: 74462306a36Sopenharmony_ci 74562306a36Sopenharmony_ci the image is flipped vertically and the 74662306a36Sopenharmony_ci V4L2_IN_ST_VFLIP input status flag is set. This emulates the case where 74762306a36Sopenharmony_ci a sensor is for example mounted upside down. 74862306a36Sopenharmony_ci 74962306a36Sopenharmony_ci- Standard Aspect Ratio: 75062306a36Sopenharmony_ci 75162306a36Sopenharmony_ci selects if the image aspect ratio as used for the TV or 75262306a36Sopenharmony_ci S-Video input should be 4x3, 16x9 or anamorphic widescreen. This may 75362306a36Sopenharmony_ci introduce letterboxing. 75462306a36Sopenharmony_ci 75562306a36Sopenharmony_ci- DV Timings Aspect Ratio: 75662306a36Sopenharmony_ci 75762306a36Sopenharmony_ci selects if the image aspect ratio as used for the HDMI 75862306a36Sopenharmony_ci input should be the same as the source width and height ratio, or if 75962306a36Sopenharmony_ci it should be 4x3 or 16x9. This may introduce letter or pillarboxing. 76062306a36Sopenharmony_ci 76162306a36Sopenharmony_ci- Timestamp Source: 76262306a36Sopenharmony_ci 76362306a36Sopenharmony_ci selects when the timestamp for each buffer is taken. 76462306a36Sopenharmony_ci 76562306a36Sopenharmony_ci- Colorspace: 76662306a36Sopenharmony_ci 76762306a36Sopenharmony_ci selects which colorspace should be used when generating the image. 76862306a36Sopenharmony_ci This only applies if the CSC Colorbar test pattern is selected, 76962306a36Sopenharmony_ci otherwise the test pattern will go through unconverted. 77062306a36Sopenharmony_ci This behavior is also what you want, since a 75% Colorbar 77162306a36Sopenharmony_ci should really have 75% signal intensity and should not be affected 77262306a36Sopenharmony_ci by colorspace conversions. 77362306a36Sopenharmony_ci 77462306a36Sopenharmony_ci Changing the colorspace will result in the V4L2_EVENT_SOURCE_CHANGE 77562306a36Sopenharmony_ci to be sent since it emulates a detected colorspace change. 77662306a36Sopenharmony_ci 77762306a36Sopenharmony_ci- Transfer Function: 77862306a36Sopenharmony_ci 77962306a36Sopenharmony_ci selects which colorspace transfer function should be used when 78062306a36Sopenharmony_ci generating an image. This only applies if the CSC Colorbar test pattern is 78162306a36Sopenharmony_ci selected, otherwise the test pattern will go through unconverted. 78262306a36Sopenharmony_ci This behavior is also what you want, since a 75% Colorbar 78362306a36Sopenharmony_ci should really have 75% signal intensity and should not be affected 78462306a36Sopenharmony_ci by colorspace conversions. 78562306a36Sopenharmony_ci 78662306a36Sopenharmony_ci Changing the transfer function will result in the V4L2_EVENT_SOURCE_CHANGE 78762306a36Sopenharmony_ci to be sent since it emulates a detected colorspace change. 78862306a36Sopenharmony_ci 78962306a36Sopenharmony_ci- Y'CbCr Encoding: 79062306a36Sopenharmony_ci 79162306a36Sopenharmony_ci selects which Y'CbCr encoding should be used when generating 79262306a36Sopenharmony_ci a Y'CbCr image. This only applies if the format is set to a Y'CbCr format 79362306a36Sopenharmony_ci as opposed to an RGB format. 79462306a36Sopenharmony_ci 79562306a36Sopenharmony_ci Changing the Y'CbCr encoding will result in the V4L2_EVENT_SOURCE_CHANGE 79662306a36Sopenharmony_ci to be sent since it emulates a detected colorspace change. 79762306a36Sopenharmony_ci 79862306a36Sopenharmony_ci- Quantization: 79962306a36Sopenharmony_ci 80062306a36Sopenharmony_ci selects which quantization should be used for the RGB or Y'CbCr 80162306a36Sopenharmony_ci encoding when generating the test pattern. 80262306a36Sopenharmony_ci 80362306a36Sopenharmony_ci Changing the quantization will result in the V4L2_EVENT_SOURCE_CHANGE 80462306a36Sopenharmony_ci to be sent since it emulates a detected colorspace change. 80562306a36Sopenharmony_ci 80662306a36Sopenharmony_ci- Limited RGB Range (16-235): 80762306a36Sopenharmony_ci 80862306a36Sopenharmony_ci selects if the RGB range of the HDMI source should 80962306a36Sopenharmony_ci be limited or full range. This combines with the Digital Video 'Rx RGB 81062306a36Sopenharmony_ci Quantization Range' control and can be used to test what happens if 81162306a36Sopenharmony_ci a source provides you with the wrong quantization range information. 81262306a36Sopenharmony_ci See the description of that control for more details. 81362306a36Sopenharmony_ci 81462306a36Sopenharmony_ci- Apply Alpha To Red Only: 81562306a36Sopenharmony_ci 81662306a36Sopenharmony_ci apply the alpha channel as set by the 'Alpha Component' 81762306a36Sopenharmony_ci user control to the red color of the test pattern only. 81862306a36Sopenharmony_ci 81962306a36Sopenharmony_ci- Enable Capture Cropping: 82062306a36Sopenharmony_ci 82162306a36Sopenharmony_ci enables crop support. This control is only present if 82262306a36Sopenharmony_ci the ccs_cap_mode module option is set to the default value of -1 and if 82362306a36Sopenharmony_ci the no_error_inj module option is set to 0 (the default). 82462306a36Sopenharmony_ci 82562306a36Sopenharmony_ci- Enable Capture Composing: 82662306a36Sopenharmony_ci 82762306a36Sopenharmony_ci enables composing support. This control is only 82862306a36Sopenharmony_ci present if the ccs_cap_mode module option is set to the default value of 82962306a36Sopenharmony_ci -1 and if the no_error_inj module option is set to 0 (the default). 83062306a36Sopenharmony_ci 83162306a36Sopenharmony_ci- Enable Capture Scaler: 83262306a36Sopenharmony_ci 83362306a36Sopenharmony_ci enables support for a scaler (maximum 4 times upscaling 83462306a36Sopenharmony_ci and downscaling). This control is only present if the ccs_cap_mode 83562306a36Sopenharmony_ci module option is set to the default value of -1 and if the no_error_inj 83662306a36Sopenharmony_ci module option is set to 0 (the default). 83762306a36Sopenharmony_ci 83862306a36Sopenharmony_ci- Maximum EDID Blocks: 83962306a36Sopenharmony_ci 84062306a36Sopenharmony_ci determines how many EDID blocks the driver supports. 84162306a36Sopenharmony_ci Note that the vivid driver does not actually interpret new EDID 84262306a36Sopenharmony_ci data, it just stores it. It allows for up to 256 EDID blocks 84362306a36Sopenharmony_ci which is the maximum supported by the standard. 84462306a36Sopenharmony_ci 84562306a36Sopenharmony_ci- Fill Percentage of Frame: 84662306a36Sopenharmony_ci 84762306a36Sopenharmony_ci can be used to draw only the top X percent 84862306a36Sopenharmony_ci of the image. Since each frame has to be drawn by the driver, this 84962306a36Sopenharmony_ci demands a lot of the CPU. For large resolutions this becomes 85062306a36Sopenharmony_ci problematic. By drawing only part of the image this CPU load can 85162306a36Sopenharmony_ci be reduced. 85262306a36Sopenharmony_ci 85362306a36Sopenharmony_ci 85462306a36Sopenharmony_ciOutput Feature Selection Controls 85562306a36Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 85662306a36Sopenharmony_ci 85762306a36Sopenharmony_ciThese controls are all specific to video output. 85862306a36Sopenharmony_ci 85962306a36Sopenharmony_ci- Enable Output Cropping: 86062306a36Sopenharmony_ci 86162306a36Sopenharmony_ci enables crop support. This control is only present if 86262306a36Sopenharmony_ci the ccs_out_mode module option is set to the default value of -1 and if 86362306a36Sopenharmony_ci the no_error_inj module option is set to 0 (the default). 86462306a36Sopenharmony_ci 86562306a36Sopenharmony_ci- Enable Output Composing: 86662306a36Sopenharmony_ci 86762306a36Sopenharmony_ci enables composing support. This control is only 86862306a36Sopenharmony_ci present if the ccs_out_mode module option is set to the default value of 86962306a36Sopenharmony_ci -1 and if the no_error_inj module option is set to 0 (the default). 87062306a36Sopenharmony_ci 87162306a36Sopenharmony_ci- Enable Output Scaler: 87262306a36Sopenharmony_ci 87362306a36Sopenharmony_ci enables support for a scaler (maximum 4 times upscaling 87462306a36Sopenharmony_ci and downscaling). This control is only present if the ccs_out_mode 87562306a36Sopenharmony_ci module option is set to the default value of -1 and if the no_error_inj 87662306a36Sopenharmony_ci module option is set to 0 (the default). 87762306a36Sopenharmony_ci 87862306a36Sopenharmony_ci 87962306a36Sopenharmony_ciError Injection Controls 88062306a36Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^^^ 88162306a36Sopenharmony_ci 88262306a36Sopenharmony_ciThe following two controls are only valid for video and vbi capture. 88362306a36Sopenharmony_ci 88462306a36Sopenharmony_ci- Standard Signal Mode: 88562306a36Sopenharmony_ci 88662306a36Sopenharmony_ci selects the behavior of VIDIOC_QUERYSTD: what should it return? 88762306a36Sopenharmony_ci 88862306a36Sopenharmony_ci Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE 88962306a36Sopenharmony_ci to be sent since it emulates a changed input condition (e.g. a cable 89062306a36Sopenharmony_ci was plugged in or out). 89162306a36Sopenharmony_ci 89262306a36Sopenharmony_ci- Standard: 89362306a36Sopenharmony_ci 89462306a36Sopenharmony_ci selects the standard that VIDIOC_QUERYSTD should return if the 89562306a36Sopenharmony_ci previous control is set to "Selected Standard". 89662306a36Sopenharmony_ci 89762306a36Sopenharmony_ci Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE 89862306a36Sopenharmony_ci to be sent since it emulates a changed input standard. 89962306a36Sopenharmony_ci 90062306a36Sopenharmony_ci 90162306a36Sopenharmony_ciThe following two controls are only valid for video capture. 90262306a36Sopenharmony_ci 90362306a36Sopenharmony_ci- DV Timings Signal Mode: 90462306a36Sopenharmony_ci 90562306a36Sopenharmony_ci selects the behavior of VIDIOC_QUERY_DV_TIMINGS: what 90662306a36Sopenharmony_ci should it return? 90762306a36Sopenharmony_ci 90862306a36Sopenharmony_ci Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE 90962306a36Sopenharmony_ci to be sent since it emulates a changed input condition (e.g. a cable 91062306a36Sopenharmony_ci was plugged in or out). 91162306a36Sopenharmony_ci 91262306a36Sopenharmony_ci- DV Timings: 91362306a36Sopenharmony_ci 91462306a36Sopenharmony_ci selects the timings the VIDIOC_QUERY_DV_TIMINGS should return 91562306a36Sopenharmony_ci if the previous control is set to "Selected DV Timings". 91662306a36Sopenharmony_ci 91762306a36Sopenharmony_ci Changing this control will result in the V4L2_EVENT_SOURCE_CHANGE 91862306a36Sopenharmony_ci to be sent since it emulates changed input timings. 91962306a36Sopenharmony_ci 92062306a36Sopenharmony_ci 92162306a36Sopenharmony_ciThe following controls are only present if the no_error_inj module option 92262306a36Sopenharmony_ciis set to 0 (the default). These controls are valid for video and vbi 92362306a36Sopenharmony_cicapture and output streams and for the SDR capture device except for the 92462306a36Sopenharmony_ciDisconnect control which is valid for all devices. 92562306a36Sopenharmony_ci 92662306a36Sopenharmony_ci- Wrap Sequence Number: 92762306a36Sopenharmony_ci 92862306a36Sopenharmony_ci test what happens when you wrap the sequence number in 92962306a36Sopenharmony_ci struct v4l2_buffer around. 93062306a36Sopenharmony_ci 93162306a36Sopenharmony_ci- Wrap Timestamp: 93262306a36Sopenharmony_ci 93362306a36Sopenharmony_ci test what happens when you wrap the timestamp in struct 93462306a36Sopenharmony_ci v4l2_buffer around. 93562306a36Sopenharmony_ci 93662306a36Sopenharmony_ci- Percentage of Dropped Buffers: 93762306a36Sopenharmony_ci 93862306a36Sopenharmony_ci sets the percentage of buffers that 93962306a36Sopenharmony_ci are never returned by the driver (i.e., they are dropped). 94062306a36Sopenharmony_ci 94162306a36Sopenharmony_ci- Disconnect: 94262306a36Sopenharmony_ci 94362306a36Sopenharmony_ci emulates a USB disconnect. The device will act as if it has 94462306a36Sopenharmony_ci been disconnected. Only after all open filehandles to the device 94562306a36Sopenharmony_ci node have been closed will the device become 'connected' again. 94662306a36Sopenharmony_ci 94762306a36Sopenharmony_ci- Inject V4L2_BUF_FLAG_ERROR: 94862306a36Sopenharmony_ci 94962306a36Sopenharmony_ci when pressed, the next frame returned by 95062306a36Sopenharmony_ci the driver will have the error flag set (i.e. the frame is marked 95162306a36Sopenharmony_ci corrupt). 95262306a36Sopenharmony_ci 95362306a36Sopenharmony_ci- Inject VIDIOC_REQBUFS Error: 95462306a36Sopenharmony_ci 95562306a36Sopenharmony_ci when pressed, the next REQBUFS or CREATE_BUFS 95662306a36Sopenharmony_ci ioctl call will fail with an error. To be precise: the videobuf2 95762306a36Sopenharmony_ci queue_setup() op will return -EINVAL. 95862306a36Sopenharmony_ci 95962306a36Sopenharmony_ci- Inject VIDIOC_QBUF Error: 96062306a36Sopenharmony_ci 96162306a36Sopenharmony_ci when pressed, the next VIDIOC_QBUF or 96262306a36Sopenharmony_ci VIDIOC_PREPARE_BUFFER ioctl call will fail with an error. To be 96362306a36Sopenharmony_ci precise: the videobuf2 buf_prepare() op will return -EINVAL. 96462306a36Sopenharmony_ci 96562306a36Sopenharmony_ci- Inject VIDIOC_STREAMON Error: 96662306a36Sopenharmony_ci 96762306a36Sopenharmony_ci when pressed, the next VIDIOC_STREAMON ioctl 96862306a36Sopenharmony_ci call will fail with an error. To be precise: the videobuf2 96962306a36Sopenharmony_ci start_streaming() op will return -EINVAL. 97062306a36Sopenharmony_ci 97162306a36Sopenharmony_ci- Inject Fatal Streaming Error: 97262306a36Sopenharmony_ci 97362306a36Sopenharmony_ci when pressed, the streaming core will be 97462306a36Sopenharmony_ci marked as having suffered a fatal error, the only way to recover 97562306a36Sopenharmony_ci from that is to stop streaming. To be precise: the videobuf2 97662306a36Sopenharmony_ci vb2_queue_error() function is called. 97762306a36Sopenharmony_ci 97862306a36Sopenharmony_ci 97962306a36Sopenharmony_ciVBI Raw Capture Controls 98062306a36Sopenharmony_ci^^^^^^^^^^^^^^^^^^^^^^^^ 98162306a36Sopenharmony_ci 98262306a36Sopenharmony_ci- Interlaced VBI Format: 98362306a36Sopenharmony_ci 98462306a36Sopenharmony_ci if set, then the raw VBI data will be interlaced instead 98562306a36Sopenharmony_ci of providing it grouped by field. 98662306a36Sopenharmony_ci 98762306a36Sopenharmony_ci 98862306a36Sopenharmony_ciDigital Video Controls 98962306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~ 99062306a36Sopenharmony_ci 99162306a36Sopenharmony_ci- Rx RGB Quantization Range: 99262306a36Sopenharmony_ci 99362306a36Sopenharmony_ci sets the RGB quantization detection of the HDMI 99462306a36Sopenharmony_ci input. This combines with the Vivid 'Limited RGB Range (16-235)' 99562306a36Sopenharmony_ci control and can be used to test what happens if a source provides 99662306a36Sopenharmony_ci you with the wrong quantization range information. This can be tested 99762306a36Sopenharmony_ci by selecting an HDMI input, setting this control to Full or Limited 99862306a36Sopenharmony_ci range and selecting the opposite in the 'Limited RGB Range (16-235)' 99962306a36Sopenharmony_ci control. The effect is easy to see if the 'Gray Ramp' test pattern 100062306a36Sopenharmony_ci is selected. 100162306a36Sopenharmony_ci 100262306a36Sopenharmony_ci- Tx RGB Quantization Range: 100362306a36Sopenharmony_ci 100462306a36Sopenharmony_ci sets the RGB quantization detection of the HDMI 100562306a36Sopenharmony_ci output. It is currently not used for anything in vivid, but most HDMI 100662306a36Sopenharmony_ci transmitters would typically have this control. 100762306a36Sopenharmony_ci 100862306a36Sopenharmony_ci- Transmit Mode: 100962306a36Sopenharmony_ci 101062306a36Sopenharmony_ci sets the transmit mode of the HDMI output to HDMI or DVI-D. This 101162306a36Sopenharmony_ci affects the reported colorspace since DVI_D outputs will always use 101262306a36Sopenharmony_ci sRGB. 101362306a36Sopenharmony_ci 101462306a36Sopenharmony_ci- Display Present: 101562306a36Sopenharmony_ci 101662306a36Sopenharmony_ci sets the presence of a "display" on the HDMI output. This affects 101762306a36Sopenharmony_ci the tx_edid_present, tx_hotplug and tx_rxsense controls. 101862306a36Sopenharmony_ci 101962306a36Sopenharmony_ci 102062306a36Sopenharmony_ciFM Radio Receiver Controls 102162306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~ 102262306a36Sopenharmony_ci 102362306a36Sopenharmony_ci- RDS Reception: 102462306a36Sopenharmony_ci 102562306a36Sopenharmony_ci set if the RDS receiver should be enabled. 102662306a36Sopenharmony_ci 102762306a36Sopenharmony_ci- RDS Program Type: 102862306a36Sopenharmony_ci 102962306a36Sopenharmony_ci 103062306a36Sopenharmony_ci- RDS PS Name: 103162306a36Sopenharmony_ci 103262306a36Sopenharmony_ci 103362306a36Sopenharmony_ci- RDS Radio Text: 103462306a36Sopenharmony_ci 103562306a36Sopenharmony_ci 103662306a36Sopenharmony_ci- RDS Traffic Announcement: 103762306a36Sopenharmony_ci 103862306a36Sopenharmony_ci 103962306a36Sopenharmony_ci- RDS Traffic Program: 104062306a36Sopenharmony_ci 104162306a36Sopenharmony_ci 104262306a36Sopenharmony_ci- RDS Music: 104362306a36Sopenharmony_ci 104462306a36Sopenharmony_ci these are all read-only controls. If RDS Rx I/O Mode is set to 104562306a36Sopenharmony_ci "Block I/O", then they are inactive as well. If RDS Rx I/O Mode is set 104662306a36Sopenharmony_ci to "Controls", then these controls report the received RDS data. 104762306a36Sopenharmony_ci 104862306a36Sopenharmony_ci.. note:: 104962306a36Sopenharmony_ci The vivid implementation of this is pretty basic: they are only 105062306a36Sopenharmony_ci updated when you set a new frequency or when you get the tuner status 105162306a36Sopenharmony_ci (VIDIOC_G_TUNER). 105262306a36Sopenharmony_ci 105362306a36Sopenharmony_ci- Radio HW Seek Mode: 105462306a36Sopenharmony_ci 105562306a36Sopenharmony_ci can be one of "Bounded", "Wrap Around" or "Both". This 105662306a36Sopenharmony_ci determines if VIDIOC_S_HW_FREQ_SEEK will be bounded by the frequency 105762306a36Sopenharmony_ci range or wrap-around or if it is selectable by the user. 105862306a36Sopenharmony_ci 105962306a36Sopenharmony_ci- Radio Programmable HW Seek: 106062306a36Sopenharmony_ci 106162306a36Sopenharmony_ci if set, then the user can provide the lower and 106262306a36Sopenharmony_ci upper bound of the HW Seek. Otherwise the frequency range boundaries 106362306a36Sopenharmony_ci will be used. 106462306a36Sopenharmony_ci 106562306a36Sopenharmony_ci- Generate RBDS Instead of RDS: 106662306a36Sopenharmony_ci 106762306a36Sopenharmony_ci if set, then generate RBDS (the US variant of 106862306a36Sopenharmony_ci RDS) data instead of RDS (European-style RDS). This affects only the 106962306a36Sopenharmony_ci PICODE and PTY codes. 107062306a36Sopenharmony_ci 107162306a36Sopenharmony_ci- RDS Rx I/O Mode: 107262306a36Sopenharmony_ci 107362306a36Sopenharmony_ci this can be "Block I/O" where the RDS blocks have to be read() 107462306a36Sopenharmony_ci by the application, or "Controls" where the RDS data is provided by 107562306a36Sopenharmony_ci the RDS controls mentioned above. 107662306a36Sopenharmony_ci 107762306a36Sopenharmony_ci 107862306a36Sopenharmony_ciFM Radio Modulator Controls 107962306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~ 108062306a36Sopenharmony_ci 108162306a36Sopenharmony_ci- RDS Program ID: 108262306a36Sopenharmony_ci 108362306a36Sopenharmony_ci 108462306a36Sopenharmony_ci- RDS Program Type: 108562306a36Sopenharmony_ci 108662306a36Sopenharmony_ci 108762306a36Sopenharmony_ci- RDS PS Name: 108862306a36Sopenharmony_ci 108962306a36Sopenharmony_ci 109062306a36Sopenharmony_ci- RDS Radio Text: 109162306a36Sopenharmony_ci 109262306a36Sopenharmony_ci 109362306a36Sopenharmony_ci- RDS Stereo: 109462306a36Sopenharmony_ci 109562306a36Sopenharmony_ci 109662306a36Sopenharmony_ci- RDS Artificial Head: 109762306a36Sopenharmony_ci 109862306a36Sopenharmony_ci 109962306a36Sopenharmony_ci- RDS Compressed: 110062306a36Sopenharmony_ci 110162306a36Sopenharmony_ci 110262306a36Sopenharmony_ci- RDS Dynamic PTY: 110362306a36Sopenharmony_ci 110462306a36Sopenharmony_ci 110562306a36Sopenharmony_ci- RDS Traffic Announcement: 110662306a36Sopenharmony_ci 110762306a36Sopenharmony_ci 110862306a36Sopenharmony_ci- RDS Traffic Program: 110962306a36Sopenharmony_ci 111062306a36Sopenharmony_ci 111162306a36Sopenharmony_ci- RDS Music: 111262306a36Sopenharmony_ci 111362306a36Sopenharmony_ci these are all controls that set the RDS data that is transmitted by 111462306a36Sopenharmony_ci the FM modulator. 111562306a36Sopenharmony_ci 111662306a36Sopenharmony_ci- RDS Tx I/O Mode: 111762306a36Sopenharmony_ci 111862306a36Sopenharmony_ci this can be "Block I/O" where the application has to use write() 111962306a36Sopenharmony_ci to pass the RDS blocks to the driver, or "Controls" where the RDS data 112062306a36Sopenharmony_ci is Provided by the RDS controls mentioned above. 112162306a36Sopenharmony_ci 112262306a36Sopenharmony_ciMetadata Capture Controls 112362306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~ 112462306a36Sopenharmony_ci 112562306a36Sopenharmony_ci- Generate PTS 112662306a36Sopenharmony_ci 112762306a36Sopenharmony_ci if set, then the generated metadata stream contains Presentation timestamp. 112862306a36Sopenharmony_ci 112962306a36Sopenharmony_ci- Generate SCR 113062306a36Sopenharmony_ci 113162306a36Sopenharmony_ci if set, then the generated metadata stream contains Source Clock information. 113262306a36Sopenharmony_ci 113362306a36Sopenharmony_ciVideo, VBI and RDS Looping 113462306a36Sopenharmony_ci-------------------------- 113562306a36Sopenharmony_ci 113662306a36Sopenharmony_ciThe vivid driver supports looping of video output to video input, VBI output 113762306a36Sopenharmony_cito VBI input and RDS output to RDS input. For video/VBI looping this emulates 113862306a36Sopenharmony_cias if a cable was hooked up between the output and input connector. So video 113962306a36Sopenharmony_ciand VBI looping is only supported between S-Video and HDMI inputs and outputs. 114062306a36Sopenharmony_ciVBI is only valid for S-Video as it makes no sense for HDMI. 114162306a36Sopenharmony_ci 114262306a36Sopenharmony_ciSince radio is wireless this looping always happens if the radio receiver 114362306a36Sopenharmony_cifrequency is close to the radio transmitter frequency. In that case the radio 114462306a36Sopenharmony_citransmitter will 'override' the emulated radio stations. 114562306a36Sopenharmony_ci 114662306a36Sopenharmony_ciLooping is currently supported only between devices created by the same 114762306a36Sopenharmony_civivid driver instance. 114862306a36Sopenharmony_ci 114962306a36Sopenharmony_ci 115062306a36Sopenharmony_ciVideo and Sliced VBI looping 115162306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115262306a36Sopenharmony_ci 115362306a36Sopenharmony_ciThe way to enable video/VBI looping is currently fairly crude. A 'Loop Video' 115462306a36Sopenharmony_cicontrol is available in the "Vivid" control class of the video 115562306a36Sopenharmony_cicapture and VBI capture devices. When checked the video looping will be enabled. 115662306a36Sopenharmony_ciOnce enabled any video S-Video or HDMI input will show a static test pattern 115762306a36Sopenharmony_ciuntil the video output has started. At that time the video output will be 115862306a36Sopenharmony_cilooped to the video input provided that: 115962306a36Sopenharmony_ci 116062306a36Sopenharmony_ci- the input type matches the output type. So the HDMI input cannot receive 116162306a36Sopenharmony_ci video from the S-Video output. 116262306a36Sopenharmony_ci 116362306a36Sopenharmony_ci- the video resolution of the video input must match that of the video output. 116462306a36Sopenharmony_ci So it is not possible to loop a 50 Hz (720x576) S-Video output to a 60 Hz 116562306a36Sopenharmony_ci (720x480) S-Video input, or a 720p60 HDMI output to a 1080p30 input. 116662306a36Sopenharmony_ci 116762306a36Sopenharmony_ci- the pixel formats must be identical on both sides. Otherwise the driver would 116862306a36Sopenharmony_ci have to do pixel format conversion as well, and that's taking things too far. 116962306a36Sopenharmony_ci 117062306a36Sopenharmony_ci- the field settings must be identical on both sides. Same reason as above: 117162306a36Sopenharmony_ci requiring the driver to convert from one field format to another complicated 117262306a36Sopenharmony_ci matters too much. This also prohibits capturing with 'Field Top' or 'Field 117362306a36Sopenharmony_ci Bottom' when the output video is set to 'Field Alternate'. This combination, 117462306a36Sopenharmony_ci while legal, became too complicated to support. Both sides have to be 'Field 117562306a36Sopenharmony_ci Alternate' for this to work. Also note that for this specific case the 117662306a36Sopenharmony_ci sequence and field counting in struct v4l2_buffer on the capture side may not 117762306a36Sopenharmony_ci be 100% accurate. 117862306a36Sopenharmony_ci 117962306a36Sopenharmony_ci- field settings V4L2_FIELD_SEQ_TB/BT are not supported. While it is possible to 118062306a36Sopenharmony_ci implement this, it would mean a lot of work to get this right. Since these 118162306a36Sopenharmony_ci field values are rarely used the decision was made not to implement this for 118262306a36Sopenharmony_ci now. 118362306a36Sopenharmony_ci 118462306a36Sopenharmony_ci- on the input side the "Standard Signal Mode" for the S-Video input or the 118562306a36Sopenharmony_ci "DV Timings Signal Mode" for the HDMI input should be configured so that a 118662306a36Sopenharmony_ci valid signal is passed to the video input. 118762306a36Sopenharmony_ci 118862306a36Sopenharmony_ciThe framerates do not have to match, although this might change in the future. 118962306a36Sopenharmony_ci 119062306a36Sopenharmony_ciBy default you will see the OSD text superimposed on top of the looped video. 119162306a36Sopenharmony_ciThis can be turned off by changing the "OSD Text Mode" control of the video 119262306a36Sopenharmony_cicapture device. 119362306a36Sopenharmony_ci 119462306a36Sopenharmony_ciFor VBI looping to work all of the above must be valid and in addition the vbi 119562306a36Sopenharmony_cioutput must be configured for sliced VBI. The VBI capture side can be configured 119662306a36Sopenharmony_cifor either raw or sliced VBI. Note that at the moment only CC/XDS (60 Hz formats) 119762306a36Sopenharmony_ciand WSS (50 Hz formats) VBI data is looped. Teletext VBI data is not looped. 119862306a36Sopenharmony_ci 119962306a36Sopenharmony_ci 120062306a36Sopenharmony_ciRadio & RDS Looping 120162306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~ 120262306a36Sopenharmony_ci 120362306a36Sopenharmony_ciAs mentioned in section 6 the radio receiver emulates stations are regular 120462306a36Sopenharmony_cifrequency intervals. Depending on the frequency of the radio receiver a 120562306a36Sopenharmony_cisignal strength value is calculated (this is returned by VIDIOC_G_TUNER). 120662306a36Sopenharmony_ciHowever, it will also look at the frequency set by the radio transmitter and 120762306a36Sopenharmony_ciif that results in a higher signal strength than the settings of the radio 120862306a36Sopenharmony_citransmitter will be used as if it was a valid station. This also includes 120962306a36Sopenharmony_cithe RDS data (if any) that the transmitter 'transmits'. This is received 121062306a36Sopenharmony_cifaithfully on the receiver side. Note that when the driver is loaded the 121162306a36Sopenharmony_cifrequencies of the radio receiver and transmitter are not identical, so 121262306a36Sopenharmony_ciinitially no looping takes place. 121362306a36Sopenharmony_ci 121462306a36Sopenharmony_ci 121562306a36Sopenharmony_ciCropping, Composing, Scaling 121662306a36Sopenharmony_ci---------------------------- 121762306a36Sopenharmony_ci 121862306a36Sopenharmony_ciThis driver supports cropping, composing and scaling in any combination. Normally 121962306a36Sopenharmony_ciwhich features are supported can be selected through the Vivid controls, 122062306a36Sopenharmony_cibut it is also possible to hardcode it when the module is loaded through the 122162306a36Sopenharmony_ciccs_cap_mode and ccs_out_mode module options. See section 1 on the details of 122262306a36Sopenharmony_cithese module options. 122362306a36Sopenharmony_ci 122462306a36Sopenharmony_ciThis allows you to test your application for all these variations. 122562306a36Sopenharmony_ci 122662306a36Sopenharmony_ciNote that the webcam input never supports cropping, composing or scaling. That 122762306a36Sopenharmony_cionly applies to the TV/S-Video/HDMI inputs and outputs. The reason is that 122862306a36Sopenharmony_ciwebcams, including this virtual implementation, normally use 122962306a36Sopenharmony_ciVIDIOC_ENUM_FRAMESIZES to list a set of discrete framesizes that it supports. 123062306a36Sopenharmony_ciAnd that does not combine with cropping, composing or scaling. This is 123162306a36Sopenharmony_ciprimarily a limitation of the V4L2 API which is carefully reproduced here. 123262306a36Sopenharmony_ci 123362306a36Sopenharmony_ciThe minimum and maximum resolutions that the scaler can achieve are 16x16 and 123462306a36Sopenharmony_ci(4096 * 4) x (2160 x 4), but it can only scale up or down by a factor of 4 or 123562306a36Sopenharmony_ciless. So for a source resolution of 1280x720 the minimum the scaler can do is 123662306a36Sopenharmony_ci320x180 and the maximum is 5120x2880. You can play around with this using the 123762306a36Sopenharmony_ciqv4l2 test tool and you will see these dependencies. 123862306a36Sopenharmony_ci 123962306a36Sopenharmony_ciThis driver also supports larger 'bytesperline' settings, something that 124062306a36Sopenharmony_ciVIDIOC_S_FMT allows but that few drivers implement. 124162306a36Sopenharmony_ci 124262306a36Sopenharmony_ciThe scaler is a simple scaler that uses the Coarse Bresenham algorithm. It's 124362306a36Sopenharmony_cidesigned for speed and simplicity, not quality. 124462306a36Sopenharmony_ci 124562306a36Sopenharmony_ciIf the combination of crop, compose and scaling allows it, then it is possible 124662306a36Sopenharmony_cito change crop and compose rectangles on the fly. 124762306a36Sopenharmony_ci 124862306a36Sopenharmony_ci 124962306a36Sopenharmony_ciFormats 125062306a36Sopenharmony_ci------- 125162306a36Sopenharmony_ci 125262306a36Sopenharmony_ciThe driver supports all the regular packed and planar 4:4:4, 4:2:2 and 4:2:0 125362306a36Sopenharmony_ciYUYV formats, 8, 16, 24 and 32 RGB packed formats and various multiplanar 125462306a36Sopenharmony_ciformats. 125562306a36Sopenharmony_ci 125662306a36Sopenharmony_ciThe alpha component can be set through the 'Alpha Component' User control 125762306a36Sopenharmony_cifor those formats that support it. If the 'Apply Alpha To Red Only' control 125862306a36Sopenharmony_ciis set, then the alpha component is only used for the color red and set to 125962306a36Sopenharmony_ci0 otherwise. 126062306a36Sopenharmony_ci 126162306a36Sopenharmony_ciThe driver has to be configured to support the multiplanar formats. By default 126262306a36Sopenharmony_cithe driver instances are single-planar. This can be changed by setting the 126362306a36Sopenharmony_cimultiplanar module option, see section 1 for more details on that option. 126462306a36Sopenharmony_ci 126562306a36Sopenharmony_ciIf the driver instance is using the multiplanar formats/API, then the first 126662306a36Sopenharmony_cisingle planar format (YUYV) and the multiplanar NV16M and NV61M formats the 126762306a36Sopenharmony_ciwill have a plane that has a non-zero data_offset of 128 bytes. It is rare for 126862306a36Sopenharmony_cidata_offset to be non-zero, so this is a useful feature for testing applications. 126962306a36Sopenharmony_ci 127062306a36Sopenharmony_ciVideo output will also honor any data_offset that the application set. 127162306a36Sopenharmony_ci 127262306a36Sopenharmony_ci 127362306a36Sopenharmony_ciCapture Overlay 127462306a36Sopenharmony_ci--------------- 127562306a36Sopenharmony_ci 127662306a36Sopenharmony_ciNote: capture overlay support is implemented primarily to test the existing 127762306a36Sopenharmony_ciV4L2 capture overlay API. In practice few if any GPUs support such overlays 127862306a36Sopenharmony_cianymore, and neither are they generally needed anymore since modern hardware 127962306a36Sopenharmony_ciis so much more capable. By setting flag 0x10000 in the node_types module 128062306a36Sopenharmony_cioption the vivid driver will create a simple framebuffer device that can be 128162306a36Sopenharmony_ciused for testing this API. Whether this API should be used for new drivers is 128262306a36Sopenharmony_ciquestionable. 128362306a36Sopenharmony_ci 128462306a36Sopenharmony_ciThis driver has support for a destructive capture overlay with bitmap clipping 128562306a36Sopenharmony_ciand list clipping (up to 16 rectangles) capabilities. Overlays are not 128662306a36Sopenharmony_cisupported for multiplanar formats. It also honors the struct v4l2_window field 128762306a36Sopenharmony_cisetting: if it is set to FIELD_TOP or FIELD_BOTTOM and the capture setting is 128862306a36Sopenharmony_ciFIELD_ALTERNATE, then only the top or bottom fields will be copied to the overlay. 128962306a36Sopenharmony_ci 129062306a36Sopenharmony_ciThe overlay only works if you are also capturing at that same time. This is a 129162306a36Sopenharmony_civivid limitation since it copies from a buffer to the overlay instead of 129262306a36Sopenharmony_cifilling the overlay directly. And if you are not capturing, then no buffers 129362306a36Sopenharmony_ciare available to fill. 129462306a36Sopenharmony_ci 129562306a36Sopenharmony_ciIn addition, the pixelformat of the capture format and that of the framebuffer 129662306a36Sopenharmony_cimust be the same for the overlay to work. Otherwise VIDIOC_OVERLAY will return 129762306a36Sopenharmony_cian error. 129862306a36Sopenharmony_ci 129962306a36Sopenharmony_ciIn order to really see what it going on you will need to create two vivid 130062306a36Sopenharmony_ciinstances: the first with a framebuffer enabled. You configure the capture 130162306a36Sopenharmony_cioverlay of the second instance to use the framebuffer of the first, then 130262306a36Sopenharmony_ciyou start capturing in the second instance. For the first instance you setup 130362306a36Sopenharmony_cithe output overlay for the video output, turn on video looping and capture 130462306a36Sopenharmony_cito see the blended framebuffer overlay that's being written to by the second 130562306a36Sopenharmony_ciinstance. This setup would require the following commands: 130662306a36Sopenharmony_ci 130762306a36Sopenharmony_ci.. code-block:: none 130862306a36Sopenharmony_ci 130962306a36Sopenharmony_ci $ sudo modprobe vivid n_devs=2 node_types=0x10101,0x1 131062306a36Sopenharmony_ci $ v4l2-ctl -d1 --find-fb 131162306a36Sopenharmony_ci /dev/fb1 is the framebuffer associated with base address 0x12800000 131262306a36Sopenharmony_ci $ sudo v4l2-ctl -d2 --set-fbuf fb=1 131362306a36Sopenharmony_ci $ v4l2-ctl -d1 --set-fbuf fb=1 131462306a36Sopenharmony_ci $ v4l2-ctl -d0 --set-fmt-video=pixelformat='AR15' 131562306a36Sopenharmony_ci $ v4l2-ctl -d1 --set-fmt-video-out=pixelformat='AR15' 131662306a36Sopenharmony_ci $ v4l2-ctl -d2 --set-fmt-video=pixelformat='AR15' 131762306a36Sopenharmony_ci $ v4l2-ctl -d0 -i2 131862306a36Sopenharmony_ci $ v4l2-ctl -d2 -i2 131962306a36Sopenharmony_ci $ v4l2-ctl -d2 -c horizontal_movement=4 132062306a36Sopenharmony_ci $ v4l2-ctl -d1 --overlay=1 132162306a36Sopenharmony_ci $ v4l2-ctl -d0 -c loop_video=1 132262306a36Sopenharmony_ci $ v4l2-ctl -d2 --stream-mmap --overlay=1 132362306a36Sopenharmony_ci 132462306a36Sopenharmony_ciAnd from another console: 132562306a36Sopenharmony_ci 132662306a36Sopenharmony_ci.. code-block:: none 132762306a36Sopenharmony_ci 132862306a36Sopenharmony_ci $ v4l2-ctl -d1 --stream-out-mmap 132962306a36Sopenharmony_ci 133062306a36Sopenharmony_ciAnd yet another console: 133162306a36Sopenharmony_ci 133262306a36Sopenharmony_ci.. code-block:: none 133362306a36Sopenharmony_ci 133462306a36Sopenharmony_ci $ qv4l2 133562306a36Sopenharmony_ci 133662306a36Sopenharmony_ciand start streaming. 133762306a36Sopenharmony_ci 133862306a36Sopenharmony_ciAs you can see, this is not for the faint of heart... 133962306a36Sopenharmony_ci 134062306a36Sopenharmony_ci 134162306a36Sopenharmony_ciOutput Overlay 134262306a36Sopenharmony_ci-------------- 134362306a36Sopenharmony_ci 134462306a36Sopenharmony_ciNote: output overlays are primarily implemented in order to test the existing 134562306a36Sopenharmony_ciV4L2 output overlay API. Whether this API should be used for new drivers is 134662306a36Sopenharmony_ciquestionable. 134762306a36Sopenharmony_ci 134862306a36Sopenharmony_ciThis driver has support for an output overlay and is capable of: 134962306a36Sopenharmony_ci 135062306a36Sopenharmony_ci - bitmap clipping, 135162306a36Sopenharmony_ci - list clipping (up to 16 rectangles) 135262306a36Sopenharmony_ci - chromakey 135362306a36Sopenharmony_ci - source chromakey 135462306a36Sopenharmony_ci - global alpha 135562306a36Sopenharmony_ci - local alpha 135662306a36Sopenharmony_ci - local inverse alpha 135762306a36Sopenharmony_ci 135862306a36Sopenharmony_ciOutput overlays are not supported for multiplanar formats. In addition, the 135962306a36Sopenharmony_cipixelformat of the capture format and that of the framebuffer must be the 136062306a36Sopenharmony_cisame for the overlay to work. Otherwise VIDIOC_OVERLAY will return an error. 136162306a36Sopenharmony_ci 136262306a36Sopenharmony_ciOutput overlays only work if the driver has been configured to create a 136362306a36Sopenharmony_ciframebuffer by setting flag 0x10000 in the node_types module option. The 136462306a36Sopenharmony_cicreated framebuffer has a size of 720x576 and supports ARGB 1:5:5:5 and 136562306a36Sopenharmony_ciRGB 5:6:5. 136662306a36Sopenharmony_ci 136762306a36Sopenharmony_ciIn order to see the effects of the various clipping, chromakeying or alpha 136862306a36Sopenharmony_ciprocessing capabilities you need to turn on video looping and see the results 136962306a36Sopenharmony_cion the capture side. The use of the clipping, chromakeying or alpha processing 137062306a36Sopenharmony_cicapabilities will slow down the video loop considerably as a lot of checks have 137162306a36Sopenharmony_cito be done per pixel. 137262306a36Sopenharmony_ci 137362306a36Sopenharmony_ci 137462306a36Sopenharmony_ciCEC (Consumer Electronics Control) 137562306a36Sopenharmony_ci---------------------------------- 137662306a36Sopenharmony_ci 137762306a36Sopenharmony_ciIf there are HDMI inputs then a CEC adapter will be created that has 137862306a36Sopenharmony_cithe same number of input ports. This is the equivalent of e.g. a TV that 137962306a36Sopenharmony_cihas that number of inputs. Each HDMI output will also create a 138062306a36Sopenharmony_ciCEC adapter that is hooked up to the corresponding input port, or (if there 138162306a36Sopenharmony_ciare more outputs than inputs) is not hooked up at all. In other words, 138262306a36Sopenharmony_cithis is the equivalent of hooking up each output device to an input port of 138362306a36Sopenharmony_cithe TV. Any remaining output devices remain unconnected. 138462306a36Sopenharmony_ci 138562306a36Sopenharmony_ciThe EDID that each output reads reports a unique CEC physical address that is 138662306a36Sopenharmony_cibased on the physical address of the EDID of the input. So if the EDID of the 138762306a36Sopenharmony_cireceiver has physical address A.B.0.0, then each output will see an EDID 138862306a36Sopenharmony_cicontaining physical address A.B.C.0 where C is 1 to the number of inputs. If 138962306a36Sopenharmony_cithere are more outputs than inputs then the remaining outputs have a CEC adapter 139062306a36Sopenharmony_cithat is disabled and reports an invalid physical address. 139162306a36Sopenharmony_ci 139262306a36Sopenharmony_ci 139362306a36Sopenharmony_ciSome Future Improvements 139462306a36Sopenharmony_ci------------------------ 139562306a36Sopenharmony_ci 139662306a36Sopenharmony_ciJust as a reminder and in no particular order: 139762306a36Sopenharmony_ci 139862306a36Sopenharmony_ci- Add a virtual alsa driver to test audio 139962306a36Sopenharmony_ci- Add virtual sub-devices and media controller support 140062306a36Sopenharmony_ci- Some support for testing compressed video 140162306a36Sopenharmony_ci- Add support to loop raw VBI output to raw VBI input 140262306a36Sopenharmony_ci- Add support to loop teletext sliced VBI output to VBI input 140362306a36Sopenharmony_ci- Fix sequence/field numbering when looping of video with alternate fields 140462306a36Sopenharmony_ci- Add support for V4L2_CID_BG_COLOR for video outputs 140562306a36Sopenharmony_ci- Add ARGB888 overlay support: better testing of the alpha channel 140662306a36Sopenharmony_ci- Improve pixel aspect support in the tpg code by passing a real v4l2_fract 140762306a36Sopenharmony_ci- Use per-queue locks and/or per-device locks to improve throughput 140862306a36Sopenharmony_ci- Add support to loop from a specific output to a specific input across 140962306a36Sopenharmony_ci vivid instances 141062306a36Sopenharmony_ci- The SDR radio should use the same 'frequencies' for stations as the normal 141162306a36Sopenharmony_ci radio receiver, and give back noise if the frequency doesn't match up with 141262306a36Sopenharmony_ci a station frequency 141362306a36Sopenharmony_ci- Make a thread for the RDS generation, that would help in particular for the 141462306a36Sopenharmony_ci "Controls" RDS Rx I/O Mode as the read-only RDS controls could be updated 141562306a36Sopenharmony_ci in real-time. 141662306a36Sopenharmony_ci- Changing the EDID should cause hotplug detect emulation to happen. 1417