NAME
v4l2-compliance - An application to test video4linux drivers
SYNOPSIS
v4l2-compliance [-h] [-d <dev>] [-r <dev>] [-V <dev>] [-S <dev>] [-e <dev>] [-s <count>] [-f] [-a] [-c color=<color>,skip=<skip>,perc=<perc>] [-n] [-T] [-v] [-w]
DESCRIPTION
The v4l2-compliance tool is used to test video4linux devices, either video, vbi, radio or swradio, both input and output. It attempts to test almost all aspects of a V4L2 device and it covers almost all V4L2 ioctls. It has very good support for video capture and output, VBI capture and output and (software) radio tuning and transmitting.
v4l2兼容性工具用于测试video4linux设备(包括视频,vbi,广播或swradio)的输入和输出。 它尝试测试V4L2设备的几乎所有方面,并且涵盖了几乎所有V4L2 ioctl。 它对视频捕获和输出,VBI捕获和输出以及(软件)无线电调谐和传输具有很好的支持。
The support for memory-to-memory devices is limited at the moment.
目前对内存到内存设备的支持是有限的。
When testing a driver always compile the utility from the latest source code from the git repository http://git.linuxtv.org/cgit.cgi/v4l-utils.git/). The version supplied by linux distributions is almost certainly too old.
测试driver时,请始终从git信息库(http://git.linuxtv.org/cgit.cgi/v4l-utils.git/)的最新源代码中编译实用程序。 linux发行版提供的版本几乎可以肯定是太旧了。
In addition, if a test fails then it will output the source and line where the failure occurred, so you often need access to the source code to see what that test is all about.
另外,如果测试失败,那么它将输出发生失败的源代码和行,因此您经常需要访问源代码以查看该测试的全部内容。
Note that v4l2-compliance not only tests for compliance against the V4L2 API, but also whether the driver is using all the correct frameworks. These frameworks often automatically provide ioctls that are strictly speaking optional, but that come for free if you use those frameworks. By requiring their presence the v4l2-compliance utility will enforce their use.
请注意,v4l2兼容性不仅会测试是否符合V4L2 API,而且还会测试driver是否使用了所有正确的框架。 这些框架通常会自动提供严格来说是可选的ioctl,但是如果您使用这些框架,它们是免费提供的。 通过要求它们的存在,符合v4l2的实用程序将强制使用它们。
If you want to submit a new V4L2 driver, then that driver must pass the v4l2-compliance tests without fails. The best method of using this tool to test your driver is to first test without any streaming options and fix any failures from the first reported failure to the last. Sometimes earlier failures can generate later failures, so just start fixing them in order and test again after each fix.
如果要提交新的V4L2驱动程序,则该driver必须通过v4l2兼容性测试,并且必须通过。 使用此工具测试driver的最佳方法是,在没有任何流式传输选项的情况下进行首次测试,并修复从报告的第一个故障到最后一个故障。 有时,较早的故障会产生较晚的故障,因此只需按顺序开始进行修复,然后在每次修复后再次进行测试。
Next test your driver with the -s option to do the basic streaming tests. This requires that there is a valid input or output.
接下来,使用-s选项测试driver以进行基本的流测试。 这要求存在有效的输入或输出。
Whenever you run v4l2-compliance it will save the current driver state and restore it after all tests are done (including when you press Ctrl-C). All the streaming tests are performed using the saved configuration. This makes it possible to prepare for the streaming tests by configuring the device before calling v4l2-compliance.
每当您运行v4l2-compliance时,它将保存当前driver状态,并在所有测试完成后(包括按Ctrl-C时)将其恢复。 所有流测试均使用保存的配置执行。 这样可以通过在调用v4l2兼容性之前配置设备来准备流测试。
Finally you should test your driver using the -f and -c options to verify that all video pixel formats are correctly supported. You need to perform all three streaming tests for all inputs and outputs. You can use the -a option to automate that if that is possible for your hardware.
最后,您应该使用-f和-c选项测试driver,以验证是否正确支持所有视频像素格式。 您需要对所有输入和输出执行所有三个流测试。 如果您的硬件有可能,可以使用-a选项自动执行该操作。
If your driver passes all tests, then your can be confident that your driver is in very good shape!
如果您的driver通过了所有测试,那么您可以确信driver状况很好!
OPTIONS
-d, --device=<dev>
Use device as the video device. If <dev> is a number, then /dev/video<dev> is used.
- 使用设备<dev>作为视频设备。 如果<dev>是数字,则使用/ dev / video <dev>。
-V, --vbi-device=<dev>
Use device <dev> as the vbi device. If <dev> is a number, then /dev/vbi<dev> is used.
- 使用设备<dev>作为vbi设备。 如果<dev>是数字,则使用/ dev / vbi <dev>。
-r, --radio-device=
Use device <dev> as the radio device. If <dev> is a number, then /dev/radio<dev> is used.
- 使用设备<dev>作为无线电设备。 如果<dev>是数字,则使用/ dev / radio <dev>。
-S, --sdr-device=<dev>
Use device <dev> as the SDR device. If <dev> is a number, then /dev/swradio is used.
- 使用设备<dev>作为SDR设备。 如果<dev>是数字,则使用/ dev / swradio <dev>。
-e, --exp-buf-device=
Use device <dev> as the video device used to export DMABUFfers for doing DMABUF streaming tests. If <dev> is a number, then /dev/video<dev> is used. If this option is not specified, then the DMABUF streaming tests will be skipped.
- 将设备<dev>用作用于导出DMABUFfer的视频设备,以进行DMABUF流测试。 如果是数字,则使用/ dev / video <dev>。 如果未指定此选项,则将跳过DMABUF流测试。
-s, --streaming=<count>
Enable the streaming tests. Set <count> to the number of frames to stream (default 60). This requires that before v4l2-compliance is called the device has been configured with a valid input (or output) and frequency (when the device has a tuner). For DMABUF testing --expbuf-device needs to be set as well.
The configuration of the driver at the time v4l2-compliance was called will be used for the streaming tests.
- 启用流测试。 将<count>设置为要传输的帧数(默认为60)。 这要求在调用v4l2-compliance之前,已为设备配置了有效的输入(或输出)和频率(当设备具有调谐器时)。 对于DMABUF测试,还需要设置–expbuf-device。
- 调用v4l2-compliance时驱动程序的配置将用于流测试。
-f, --stream-all-formats
Test whether all available formats can be streamed. This attempts to stream using MMAP mode or read/write (if V4L2_MEMORY_MMAP is not available) for one second for all formats, at all sizes, at all intervals and with all field values. In addition, if the driver supports scaling, cropping or composing it will test that as well in various combinations. If the driver supports a lot of combinations then this test can take a long time.
The configuration of the driver at the time v4l2-compliance was called will be used for the streaming tests.
- 测试是否可以传输所有可用格式。 对于所有格式,所有大小,所有间隔和所有字段值,这会尝试使用MMAP模式进行流传输或以每秒1秒的速度进行读/写(如果V4L2_MEMORY_MMAP不可用)。 此外,如果驱动程序支持缩放,裁剪或合成,它也会以各种组合进行测试。 如果驱动程序支持很多组合,则此测试可能需要很长时间。
- 调用v4l2-compliance时驱动程序的配置将用于流测试。
-c, --stream-all-color=color=red|green|blue,skip=<skip>,perc=<perc>
For all supported, non-compressed formats stream <skip + 1> frames. For the last frame go over all pixels and calculate which of the R, G and B color components of a pixel has the highest value and count that as a red, green or blue pixel. The test succeeds if at least perc percent of the frame has the given color. This requires that a valid and predominantly red, green or blue video signal is present on the input(s). If skip is not specified, then just capture the first frame. A non-zero skip value is useful if it takes a few frames for the device to calibrate.
If perc is not specified, then this defaults to 90%.
Most signal generators are able to generate pure red, blue or green video. For cameras you can print a completely red, green or blue picture and hold it before the camera.
The goal of this test is to determine if all pixel formats will interpret the red, green and blue colors correctly and that no color components are swapped.
The configuration of the driver at the time v4l2-compliance was called will be used for the streaming tests.
- 对于所有受支持的非压缩格式,流<skip + 1>帧。对于最后一帧,遍历所有像素并计算像素的R,G和B颜色分量中哪个值最高,并将其计为红色,绿色或蓝色像素。如果至少百分之百的框架具有给定的颜色,则测试成功。这就要求在输入端上存在有效的,主要是红色,绿色或蓝色的视频信号。如果未指定skip,则仅捕获第一帧。如果设备校准需要花费几帧,则非零跳过值很有用。
- 如果未指定perc,则默认为90%。
- 大多数信号发生器能够产生纯红色,蓝色或绿色的视频。对于相机,您可以打印完全红色,绿色或蓝色的图片,并将其放在相机之前。
- 该测试的目的是确定是否所有像素格式都能正确解释红色,绿色和蓝色,并且不交换任何颜色成分。
- 调用v4l2-compliance时驱动程序的配置将用于流测试。
-a, --stream-all-io
Do the -s, -c and -f streaming tests for all inputs or outputs instead of just the current input or output. This requires that a valid video signal is present on all inputs or that all outputs are hooked up.
- 对所有输入或输出(而不仅仅是当前输入或输出)执行-s,-c和-f流测试。 这就要求在所有输入上都存在有效的视频信号,或者将所有输出连接起来。
-n, --no-warnings
Turn off warning messages. They are still counted in the summary, but you won’t see them.
- 对所有输入或输出(而不仅仅是当前输入或输出)执行-s,-c和-f流测试。 这就要求在所有输入上都存在有效的视频信号,或者将所有输出连接起来。
-T, --trace
Trace all called ioctls.
- 跟踪所有被调用的ioctl。
-v, --verbose
Turn on verbose reporting.
- 打开详细报告。
-w, --wrapper
Use the libv4l2 wrapper library for all V4L2 device accesses. Note that doing this will cause some tests to fail because the libv4l2 library isn’t fully V4L2 compliant. By default v4l2-compliance will bypass libv4l2 and access the V4L2 devices directly.
- 将libv4l2包装器库用于所有V4L2设备访问。 请注意,这样做会导致某些测试失败,因为libv4l2库不完全符合V4L2。 默认情况下,v4l2-compliance将绕过libv4l2并直接访问V4L2设备。
-h, --help
Prints the help message.
- 打印帮助消息。
EXIT STATUS
On success, it returns 0. Otherwise, it will return the error code.
BUGS
This is a work in progress, and every so often it turns out that some tests done by v4l2-compliance are too strict or plain wrong. If you suspect that might be the case, then report such bugs to the linux-media@vger.kernel.org mailinglist.
参考文献:
1, v4l2-compliance - An application to test video4linux drivers
http://manpages.ubuntu.com/manpages/bionic/man1/v4l2-compliance.1.html