diff mbox series

[PATCHv2] v4l2-compliance: add tests for V4L2_CAP_IO_MC

Message ID a79f8f49-817a-1804-e88e-455f00d21006@xs4all.nl
State New
Headers show
Series [PATCHv2] v4l2-compliance: add tests for V4L2_CAP_IO_MC | expand

Commit Message

Hans Verkuil April 23, 2020, 10:46 a.m. UTC
Add tests to check the behavior of VIDIOC_ENUM{INPUT,OUTPUT},
VIDIOC_G_{INPUT,OUTPUT} and VIDIOC_S_{INPUT,OUTPUT} when the
V4L2_CAP_IO_MC is set.

And the old 'node->has_inputs || node->has_outputs' argument for testColorspace()
can now be replaced with !node->is_io_mc.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
Supersedes https://patchwork.linuxtv.org/patch/62312.
---
diff mbox series

Patch

diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index b3a18492..7bd2e035 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -1004,6 +1004,8 @@  void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
 		node.is_video = false;
 		node.is_meta = true;
 	}
+	if (node.g_caps() & V4L2_CAP_IO_MC)
+		node.is_io_mc = true;

 	/* Information Opts */

diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
index 07c7be29..6c3928fe 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -97,6 +97,7 @@  struct base_node {
 	bool is_meta;
 	bool is_touch;
 	bool is_m2m;
+	bool is_io_mc;
 	bool is_planar;
 	bool can_capture;
 	bool can_output;
diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp
index 824769b3..f38bc30a 100644
--- a/utils/v4l2-compliance/v4l2-test-formats.cpp
+++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
@@ -447,7 +447,7 @@  static int testFormatsType(struct node *node, int ret,  unsigned type, struct v4
 		fail_on_test(pix.bytesperline && pix.bytesperline < pix.width);
 		fail_on_test(!pix.sizeimage);
 		if (!node->is_m2m)
-			fail_on_test(testColorspace(node->has_inputs || node->has_outputs,
+			fail_on_test(testColorspace(!node->is_io_mc,
 						    pix.pixelformat, pix.colorspace,
 						    pix.ycbcr_enc, pix.quantization));
 		fail_on_test(pix.field == V4L2_FIELD_ANY);
@@ -463,7 +463,7 @@  static int testFormatsType(struct node *node, int ret,  unsigned type, struct v4
 			return fail("pixelformat %08x (%s) for buftype %d not reported by ENUM_FMT\n",
 					pix_mp.pixelformat, fcc2s(pix_mp.pixelformat).c_str(), type);
 		if (!node->is_m2m)
-			fail_on_test(testColorspace(node->has_inputs || node->has_outputs,
+			fail_on_test(testColorspace(!node->is_io_mc,
 						    pix_mp.pixelformat, pix_mp.colorspace,
 						    pix_mp.ycbcr_enc, pix_mp.quantization));
 		fail_on_test(pix_mp.field == V4L2_FIELD_ANY);
diff --git a/utils/v4l2-compliance/v4l2-test-input-output.cpp b/utils/v4l2-compliance/v4l2-test-input-output.cpp
index fb8d12b1..80ecf75d 100644
--- a/utils/v4l2-compliance/v4l2-test-input-output.cpp
+++ b/utils/v4l2-compliance/v4l2-test-input-output.cpp
@@ -466,6 +466,10 @@  int testInput(struct node *node)
 	if (!node->inputs && node->has_inputs)
 		return fail("no inputs found, but input capabilities set\n");
 	fail_on_test(node->is_m2m && node->inputs > 1);
+	if (node->is_io_mc) {
+		fail_on_test(!node->is_video && !node->is_meta);
+		fail_on_test(node->inputs != 1);
+	}
 	return 0;
 }

@@ -836,6 +840,10 @@  int testOutput(struct node *node)
 	if (!node->outputs && node->has_outputs)
 		return fail("no outputs found, but output capabilities set\n");
 	fail_on_test(node->is_m2m && node->outputs > 1);
+	if (node->is_io_mc) {
+		fail_on_test(!node->is_video && !node->is_meta);
+		fail_on_test(node->outputs != 1);
+	}
 	return 0;
 }