aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hansverk@cisco.com>2018-11-30 16:10:02 +0100
committerHans Verkuil <hansverk@cisco.com>2018-11-30 16:10:02 +0100
commitcff58fcfbdf75381d5351f5ea8e7846f59cb7905 (patch)
treef2acc6ccfb06bd7ca9629af22602f2d33cc487ee
parent3097253a1493d84f8466b3f66550e22efdfcd712 (diff)
v4l2-compliance: verify QBUF restores length and bytesused
Check that QBUF fills in the correct length and bytesused values. Especially important if they have to come from a previous PREPARE_BUF call. Signed-off-by: Hans Verkuil <hansverk@cisco.com>
-rw-r--r--utils/v4l2-compliance/v4l2-test-buffers.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index 568d59c8..24b74bda 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -1226,8 +1226,11 @@ static int setupUserPtr(struct node *node, cv4l_queue &q)
fail_on_test(buf.querybuf(node, i));
fail_on_test(buf.check(q, Prepared, i));
}
- for (unsigned p = 0; p < buf.g_num_planes(); p++)
+ for (unsigned p = 0; p < buf.g_num_planes(); p++) {
buf.s_userptr(0UL, p);
+ buf.s_bytesused(0, p);
+ buf.s_length(0, p);
+ }
}
if (ret == ENOTTY) {
for (unsigned p = 0; p < buf.g_num_planes(); p++)
@@ -1245,8 +1248,11 @@ static int setupUserPtr(struct node *node, cv4l_queue &q)
}
fail_on_test(buf.qbuf(node, q));
- for (unsigned p = 0; p < buf.g_num_planes(); p++)
+ for (unsigned p = 0; p < buf.g_num_planes(); p++) {
fail_on_test(buf.g_userptr(p) != q.g_userptr(i, p));
+ fail_on_test(buf.g_length(p) != q.g_length(p));
+ fail_on_test(!buf.g_bytesused(p));
+ }
fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE);
fail_on_test(buf.querybuf(node, i));
fail_on_test(buf.check(q, Queued, i));
@@ -1363,13 +1369,19 @@ static int setupDmaBuf(struct node *expbuf_node, struct node *node,
fail_on_test(ret);
fail_on_test(buf.querybuf(node, i));
fail_on_test(buf.check(q, Prepared, i));
- for (unsigned p = 0; p < buf.g_num_planes(); p++)
+ for (unsigned p = 0; p < buf.g_num_planes(); p++) {
buf.s_fd(-1, p);
+ buf.s_bytesused(0, p);
+ buf.s_length(0, p);
+ }
}
fail_on_test(buf.qbuf(node, false));
- for (unsigned p = 0; p < buf.g_num_planes(); p++)
+ for (unsigned p = 0; p < buf.g_num_planes(); p++) {
fail_on_test(buf.g_fd(p) != q.g_fd(i, p));;
+ fail_on_test(buf.g_length(p) != q.g_length(p));
+ fail_on_test(!buf.g_bytesused(p));
+ }
fail_on_test(buf.g_flags() & V4L2_BUF_FLAG_DONE);
fail_on_test(buf.querybuf(node, i));
fail_on_test(buf.check(q, Queued, i));

Privacy Policy