aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2018-11-27 16:18:15 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2018-11-27 16:18:15 +0100
commitff0598b67bb673a46f8b515d51b6492cbc2c4dce (patch)
tree1a9265291c5b2cddf15ae5a01b0a40016e279b0d
parent5e908984171a5f9e387fe6a2d19ee38639217c9f (diff)
v4l2-compliance: work around vivid error injection controls
v4l2-compliance refuses to work with vivid if vivid is loaded without the no_error_inj=1 module option since some of the compliance tests trigger the error injection, thus failing the test. Make v4l2-compliance smarter by ignoring all vivid class controls if it detects that the driver is in fact vivid. This allows it to successfully pass all tests. The main reason for this change is that this allows us to use the error injection controls to test how the kernel handles various error conditions that are otherwise hard to test. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.cpp18
-rw-r--r--utils/v4l2-compliance/v4l2-test-buffers.cpp6
-rw-r--r--utils/v4l2-compliance/v4l2-test-controls.cpp8
3 files changed, 15 insertions, 17 deletions
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 792525f4..4d6a6412 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -718,23 +718,7 @@ void testNode(struct node &node, struct node &expbuf_node, media_type type,
printf("Driver Info:\n");
v4l2_info_capability(vcap);
- if (!strcmp((const char *)vcap.driver, "vivid")) {
-#define VIVID_CID_VIVID_BASE (0x00f00000 | 0xf000)
-#define VIVID_CID_DISCONNECT (VIVID_CID_VIVID_BASE + 65)
-
- struct v4l2_queryctrl qc;
-
- // This control is present for all devices if error
- // injection is enabled in the vivid driver.
- qc.id = VIVID_CID_DISCONNECT;
- if (!doioctl(&node, VIDIOC_QUERYCTRL, &qc)) {
- printf("\nThe vivid driver has error injection enabled which will cause\n");
- printf("the compliance test to fail. Load the vivid module with the\n");
- printf("no_error_inj=1 module option to disable error injection.\n");
- exit(1);
- }
- is_vivid = true;
- }
+ is_vivid = !strcmp((const char *)vcap.driver, "vivid");
}
if (!node.is_media())
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index 076f0e3d..7ab555b5 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -37,6 +37,10 @@
#include <vector>
#include "v4l2-compliance.h"
+#define V4L2_CTRL_CLASS_VIVID 0x00f00000
+#define VIVID_CID_VIVID_BASE (V4L2_CTRL_CLASS_VIVID | 0xf000)
+#define VIVID_CID_START_STR_ERROR (VIVID_CID_VIVID_BASE + 69)
+
static struct cv4l_fmt cur_fmt;
static int stream_from_fd = -1;
static bool stream_use_hdr;
@@ -1449,6 +1453,8 @@ int testRequests(struct node *node, bool test_streaming)
if (qctrl.type != V4L2_CTRL_TYPE_INTEGER &&
qctrl.type != V4L2_CTRL_TYPE_BOOLEAN)
continue;
+ if (is_vivid && V4L2_CTRL_ID2WHICH(qctrl.id) == V4L2_CTRL_CLASS_VIVID)
+ continue;
if (qctrl.minimum != qctrl.maximum) {
valid_qctrl = qctrl;
ctrl.id = qctrl.id;
diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp b/utils/v4l2-compliance/v4l2-test-controls.cpp
index c21b332f..4d86035e 100644
--- a/utils/v4l2-compliance/v4l2-test-controls.cpp
+++ b/utils/v4l2-compliance/v4l2-test-controls.cpp
@@ -32,6 +32,8 @@
#include <vector>
#include "v4l2-compliance.h"
+#define V4L2_CTRL_CLASS_VIVID 0x00f00000
+
static int checkQCtrl(struct node *node, struct test_query_ext_ctrl &qctrl)
{
struct v4l2_querymenu qmenu;
@@ -390,6 +392,9 @@ int testSimpleControls(struct node *node)
if (qctrl.type >= V4L2_CTRL_COMPOUND_TYPES)
continue;
+ if (is_vivid && V4L2_CTRL_ID2WHICH(qctrl.id) == V4L2_CTRL_CLASS_VIVID)
+ continue;
+
info("checking control '%s' (0x%08x)\n", qctrl.name, qctrl.id);
ctrl.id = qctrl.id;
if (qctrl.type == V4L2_CTRL_TYPE_INTEGER64 ||
@@ -611,6 +616,9 @@ int testExtendedControls(struct node *node)
for (iter = node->controls.begin(); iter != node->controls.end(); ++iter) {
test_query_ext_ctrl &qctrl = iter->second;
+ if (is_vivid && V4L2_CTRL_ID2WHICH(qctrl.id) == V4L2_CTRL_CLASS_VIVID)
+ continue;
+
info("checking extended control '%s' (0x%08x)\n", qctrl.name, qctrl.id);
ctrl.id = qctrl.id;
ctrl.size = 0;

Privacy Policy