@@ -89,6 +89,7 @@ enum poll_mode {
#define VIVID_CID_CUSTOM_BASE (V4L2_CID_USER_BASE | 0xf000)
#define VIVID_CID_RO_INTEGER (VIVID_CID_CUSTOM_BASE + 12)
#define VIVID_CID_U32_DYN_ARRAY (VIVID_CID_CUSTOM_BASE + 13)
+#define VIVID_CID_U8_PIXEL_ARRAY (VIVID_CID_CUSTOM_BASE + 14)
struct test_query_ext_ctrl: v4l2_query_ext_ctrl {
__u64 menu_mask;
@@ -448,6 +448,44 @@ static int checkInput(struct node *node, const struct v4l2_input &descr, unsigne
return 0;
}
+static int checkVividPixelArray(struct node *node)
+{
+ struct v4l2_query_ext_ctrl qextctrl = {
+ .id = VIVID_CID_U8_PIXEL_ARRAY
+ };
+ cv4l_fmt fmt;
+
+ fail_on_test(node->query_ext_ctrl(qextctrl));
+ fail_on_test(node->g_fmt(fmt));
+ fail_on_test(qextctrl.nr_of_dims != 2);
+ fail_on_test(qextctrl.dims[0] != fmt.g_width());
+ fail_on_test(qextctrl.dims[1] != fmt.g_height());
+ fail_on_test(qextctrl.minimum == qextctrl.default_value);
+
+ struct v4l2_ext_control ctrl = {
+ .id = VIVID_CID_U8_PIXEL_ARRAY
+ };
+ struct v4l2_ext_controls ctrls = {
+ .count = 1
+ };
+
+ ctrl.size = qextctrl.elems * qextctrl.elem_size;
+ ctrl.p_u8 = new unsigned char[ctrl.size];
+ ctrls.controls = &ctrl;
+ fail_on_test(node->g_ext_ctrls(ctrls));
+ for (unsigned i = 0; i < qextctrl.elems; i++) {
+ fail_on_test(ctrl.p_u8[i] != qextctrl.default_value);
+ ctrl.p_u8[i] = qextctrl.minimum;
+ }
+ fail_on_test(node->s_ext_ctrls(ctrls));
+ fail_on_test(node->g_ext_ctrls(ctrls));
+ for (unsigned i = 0; i < qextctrl.elems; i++) {
+ fail_on_test(ctrl.p_u8[i] != qextctrl.minimum);
+ }
+ delete [] ctrl.p_u8;
+ return 0;
+}
+
int testInput(struct node *node)
{
struct v4l2_input descr;
@@ -479,6 +517,14 @@ int testInput(struct node *node)
return fail("VIDIOC_G_INPUT didn't fill in the input\n");
if (node->is_radio)
return fail("radio can't have input support\n");
+ if (is_vivid && cur_input == 0) {
+ // for vivid start off with a different input than the
+ // current one. This ensures that the checkVividPixelArray()
+ // call later succeeds since switching to input 0 will reset
+ // that control to the default values.
+ input = 1;
+ doioctl(node, VIDIOC_S_INPUT, &input);
+ }
for (;;) {
memset(&descr, 0xff, sizeof(descr));
descr.index = i;
@@ -494,6 +540,8 @@ int testInput(struct node *node)
return fail("input set to %d, but becomes %d?!\n", i, input);
if (checkInput(node, descr, i))
return fail("invalid attributes for input %d\n", i);
+ if (is_vivid && node->is_video && checkVividPixelArray(node))
+ return fail("vivid pixel array control test failed\n");
node->inputs++;
i++;
}
Changing the input will change the format, which will also change the dimensions of the pixel array control, and reset the contents of that array to the default value. Check that this is in fact happening. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> --- utils/v4l2-compliance/v4l2-compliance.h | 1 + .../v4l2-test-input-output.cpp | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+)