This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: v4l2-compliance: improve compound control checks
Author:  Hans Verkuil <[email protected]>
Date:    Fri Mar 12 10:24:42 2021 +0100

Verify that QUERY_EXT_CTRLS and QUERYCTRLS handle enumerating
only regular controls or only compound controls correctly.

Before v4l2-compliance only checked that enumerating all controls
was done correctly.

Signed-off-by: Hans Verkuil <[email protected]>

 utils/v4l2-compliance/v4l2-compliance.cpp    |  6 ++-
 utils/v4l2-compliance/v4l2-test-controls.cpp | 61 ++++++++++++++++++++++++++--
 2 files changed, 62 insertions(+), 5 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=e78f2c82fdcdd648aa3b8570c14202fef2628cd9
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp 
b/utils/v4l2-compliance/v4l2-compliance.cpp
index b6e0d57b1338..9f71332cec45 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -1304,7 +1304,11 @@ void testNode(struct node &node, struct node 
&node_m2m_cap, struct node &expbuf_
                printf("\ttest VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: %s\n", 
ok(testEvents(&node)));
                printf("\ttest VIDIOC_G/S_JPEGCOMP: %s\n", 
ok(testJpegComp(&node)));
                printf("\tStandard Controls: %d Private Controls: %d\n",
-                               node.std_controls, node.priv_controls);
+                      node.std_controls - node.std_compound_controls,
+                      node.priv_controls - node.priv_compound_controls);
+               if (node.std_compound_controls || node.priv_compound_controls)
+                       printf("\tStandard Compound Controls: %d Private 
Compound Controls: %d\n",
+                              node.std_compound_controls, 
node.priv_compound_controls);
                printf("\n");
 
                /* Format ioctls */
diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp 
b/utils/v4l2-compliance/v4l2-test-controls.cpp
index 9a68b7e847b0..4be2f61c0532 100644
--- a/utils/v4l2-compliance/v4l2-test-controls.cpp
+++ b/utils/v4l2-compliance/v4l2-test-controls.cpp
@@ -231,11 +231,11 @@ int testQueryExtControls(struct node *node)
                }
                if (V4L2_CTRL_DRIVER_PRIV(id)) {
                        node->priv_controls++;
-                       if (qctrl.type >= V4L2_CTRL_COMPOUND_TYPES)
+                       if (qctrl.type >= V4L2_CTRL_COMPOUND_TYPES || 
qctrl.nr_of_dims)
                                node->priv_compound_controls++;
                } else {
                        node->std_controls++;
-                       if (qctrl.type >= V4L2_CTRL_COMPOUND_TYPES)
+                       if (qctrl.type >= V4L2_CTRL_COMPOUND_TYPES || 
qctrl.nr_of_dims)
                                node->std_compound_controls++;
                }
                node->controls[qctrl.id] = qctrl;
@@ -247,6 +247,42 @@ int testQueryExtControls(struct node *node)
        if (which && !class_count)
                return fail("no controls in class %08x\n", which);
 
+       id = 0;
+       unsigned regular_ctrls = 0;
+       for (;;) {
+               memset(&qctrl, 0xff, sizeof(qctrl));
+               qctrl.id = id | V4L2_CTRL_FLAG_NEXT_CTRL;
+               ret = doioctl(node, VIDIOC_QUERY_EXT_CTRL, &qctrl);
+               if (ret)
+                       break;
+               id = qctrl.id;
+               if (qctrl.type >= V4L2_CTRL_COMPOUND_TYPES || qctrl.nr_of_dims)
+                       return fail("V4L2_CTRL_FLAG_NEXT_CTRL enumerates 
compound controls!\n");
+               regular_ctrls++;
+       }
+       unsigned num_compound_ctrls = node->std_compound_controls + 
node->priv_compound_controls;
+       unsigned num_regular_ctrls = node->std_controls + node->priv_controls - 
num_compound_ctrls;
+       if (regular_ctrls != num_regular_ctrls)
+               return fail("expected to find %d standard controls, got %d 
instead\n",
+                           num_regular_ctrls, regular_ctrls);
+
+       id = 0;
+       unsigned compound_ctrls = 0;
+       for (;;) {
+               memset(&qctrl, 0xff, sizeof(qctrl));
+               qctrl.id = id | V4L2_CTRL_FLAG_NEXT_COMPOUND;
+               ret = doioctl(node, VIDIOC_QUERY_EXT_CTRL, &qctrl);
+               if (ret)
+                       break;
+               id = qctrl.id;
+               if (qctrl.type < V4L2_CTRL_COMPOUND_TYPES && !qctrl.nr_of_dims)
+                       return fail("V4L2_CTRL_FLAG_NEXT_COMPOUND enumerates 
regular controls!\n");
+               compound_ctrls++;
+       }
+       if (compound_ctrls != num_compound_ctrls)
+               return fail("expected to find %d compound controls, got %d 
instead\n",
+                           num_compound_ctrls, compound_ctrls);
+
        for (id = V4L2_CID_BASE; id < V4L2_CID_LASTP1; id++) {
                memset(&qctrl, 0xff, sizeof(qctrl));
                qctrl.id = id;
@@ -294,9 +330,13 @@ int testQueryControls(struct node *node)
 {
        struct v4l2_queryctrl qctrl;
        unsigned controls = 0;
+       unsigned compound_controls = 0;
        __u32 id = 0;
        int ret;
 
+       unsigned num_compound_ctrls = node->std_compound_controls + 
node->priv_compound_controls;
+       unsigned num_regular_ctrls = node->std_controls + node->priv_controls - 
num_compound_ctrls;
+
        for (;;) {
                memset(&qctrl, 0xff, sizeof(qctrl));
                qctrl.id = id | V4L2_CTRL_FLAG_NEXT_CTRL;
@@ -312,8 +352,21 @@ int testQueryControls(struct node *node)
                fail_on_test(qctrl.step < 0);
                controls++;
        }
-       fail_on_test(node->controls.size() !=
-                    controls + node->std_compound_controls + 
node->priv_compound_controls);
+       fail_on_test(controls != num_regular_ctrls);
+
+       id = 0;
+       for (;;) {
+               memset(&qctrl, 0xff, sizeof(qctrl));
+               qctrl.id = id | V4L2_CTRL_FLAG_NEXT_COMPOUND;
+               ret = doioctl(node, VIDIOC_QUERYCTRL, &qctrl);
+               if (ret)
+                       break;
+               id = qctrl.id;
+               fail_on_test(node->controls.find(qctrl.id) == 
node->controls.end());
+               fail_on_test(qctrl.step || qctrl.minimum || qctrl.maximum || 
qctrl.default_value);
+               compound_controls++;
+       }
+       fail_on_test(compound_controls != num_compound_ctrls);
 
        for (id = V4L2_CID_BASE; id < V4L2_CID_LASTP1; id++) {
                memset(&qctrl, 0xff, sizeof(qctrl));

_______________________________________________
linuxtv-commits mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to