aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2018-09-06 09:19:32 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2018-09-06 09:19:32 +0200
commita8c766b75f82d0facbeed5a392d91f4469ffd716 (patch)
treecd5acc2b89b73c7b42ef28d7ccad409ca708c792 /utils
parentf44f00e8b4ac6e9aa05bac8953e3fcc89e1fe198 (diff)
v4l2-compliance: improve VIDIOC_CREATE_BUFS checks
Add tests for the multiplanar case: - check that a mismatch in num_planes will return -EINVAL - check handling of too small plane sizes The second test was only done when streaming, now it is also done when v4l2-compliance is called without the -s option. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/v4l2-compliance/v4l2-test-buffers.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index d654a7cd..6864f924 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -506,6 +506,26 @@ int testReqBufs(struct node *node)
fail_on_test(doioctl(node, VIDIOC_CREATE_BUFS, &crbufs));
fail_on_test(check_0(crbufs.reserved, sizeof(crbufs.reserved)));
fail_on_test(crbufs.index != q.g_buffers());
+
+ if (node->is_video) {
+ cv4l_fmt fmt;
+
+ node->g_fmt(fmt, q.g_type());
+ if (V4L2_TYPE_IS_MULTIPLANAR(q.g_type())) {
+ fmt.s_num_planes(fmt.g_num_planes() + 1);
+ fail_on_test(q.create_bufs(node, 1, &fmt) != EINVAL);
+ node->g_fmt(fmt, q.g_type());
+ }
+ fmt.s_height(fmt.g_height() / 2);
+ for (unsigned p = 0; p < fmt.g_num_planes(); p++)
+ fmt.s_sizeimage(fmt.g_sizeimage(p) / 2, p);
+ fail_on_test(q.create_bufs(node, 1, &fmt) != EINVAL);
+ fail_on_test(testQueryBuf(node, fmt.type, q.g_buffers()));
+ node->g_fmt(fmt, q.g_type());
+ for (unsigned p = 0; p < fmt.g_num_planes(); p++)
+ fmt.s_sizeimage(fmt.g_sizeimage(p) * 2, p);
+ fail_on_test(q.create_bufs(node, 1, &fmt));
+ }
}
fail_on_test(q.reqbufs(node));
}

Privacy Policy