aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-02-03 15:17:22 +0100
committerHans Verkuil <hans.verkuil@cisco.com>2014-02-03 15:17:22 +0100
commit9a48277d76c511fe7ce34b864c1b9d1b8c9e50cf (patch)
treec9ce121ea37c545ecd3fea0223ef7c310046ad87
parent27c7f1ac89a8e8692420275d70c647c593c53e5f (diff)
v4l2-compliance: multiplanar streaming support fixes.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/v4l2-compliance/v4l2-test-buffers.cpp28
-rw-r--r--utils/v4l2-compliance/v4l2-test-formats.cpp4
2 files changed, 21 insertions, 11 deletions
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index feca3cd0..7bfe4909 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -125,7 +125,7 @@ static int checkQueryBuf(struct node *node, const struct v4l2_buffer &buf,
fail_on_test(buf_states > 1);
fail_on_test(buf.length == 0);
if (V4L2_TYPE_IS_MULTIPLANAR(type)) {
- fail_on_test(buf.length <= VIDEO_MAX_PLANES);
+ fail_on_test(buf.length > VIDEO_MAX_PLANES);
for (unsigned p = 0; p < buf.length; p++) {
struct v4l2_plane *vp = buf.m.planes + p;
@@ -195,13 +195,15 @@ static int testQueryBuf(struct node *node, unsigned type, unsigned count)
memset(&buf, 0, sizeof(buf));
buf.type = type;
- if (V4L2_TYPE_IS_MULTIPLANAR(type))
+ if (V4L2_TYPE_IS_MULTIPLANAR(type)) {
buf.m.planes = planes;
+ buf.length = VIDEO_MAX_PLANES;
+ }
for (i = 0; i < count; i++) {
buf.index = i;
fail_on_test(doioctl(node, VIDIOC_QUERYBUF, &buf));
if (V4L2_TYPE_IS_MULTIPLANAR(type))
- fail_on_test(buf.m.planes == planes);
+ fail_on_test(buf.m.planes != planes);
fail_on_test(checkQueryBuf(node, buf, type, buf.memory, i, Unqueued, 0));
}
buf.index = count;
@@ -277,7 +279,7 @@ int testReqBufs(struct node *node)
fail_on_test(bufs.memory != V4L2_MEMORY_MMAP);
fail_on_test(bufs.type != i);
fail_on_test(doioctl(node, VIDIOC_REQBUFS, &bufs));
- testQueryBuf(node, i, bufs.count);
+ fail_on_test(testQueryBuf(node, i, bufs.count));
}
if (userptr_valid) {
@@ -288,7 +290,7 @@ int testReqBufs(struct node *node)
fail_on_test(bufs.memory != V4L2_MEMORY_USERPTR);
fail_on_test(bufs.type != i);
fail_on_test(doioctl(node, VIDIOC_REQBUFS, &bufs));
- testQueryBuf(node, i, bufs.count);
+ fail_on_test(testQueryBuf(node, i, bufs.count));
}
if (dmabuf_valid) {
@@ -299,7 +301,7 @@ int testReqBufs(struct node *node)
fail_on_test(bufs.memory != V4L2_MEMORY_DMABUF);
fail_on_test(bufs.type != i);
fail_on_test(doioctl(node, VIDIOC_REQBUFS, &bufs));
- testQueryBuf(node, i, bufs.count);
+ fail_on_test(testQueryBuf(node, i, bufs.count));
}
if (can_rw) {
@@ -336,7 +338,7 @@ int testReqBufs(struct node *node)
fail_on_test(cbufs.count == 0);
fail_on_test(cbufs.memory != bufs.memory);
fail_on_test(cbufs.format.type != i);
- testQueryBuf(node, i, cbufs.count);
+ fail_on_test(testQueryBuf(node, i, cbufs.count));
cbufs.count = 1;
fail_on_test(doioctl(node, VIDIOC_CREATE_BUFS, &cbufs));
if (!node->is_m2m) {
@@ -394,8 +396,10 @@ static int setupMmap(struct node *node, struct v4l2_requestbuffers &bufs)
buf.type = bufs.type;
buf.memory = bufs.memory;
buf.index = i;
- if (V4L2_TYPE_IS_MULTIPLANAR(bufs.type))
+ if (V4L2_TYPE_IS_MULTIPLANAR(bufs.type)) {
buf.m.planes = planes;
+ buf.length = VIDEO_MAX_PLANES;
+ }
fail_on_test(doioctl(node, VIDIOC_QUERYBUF, &buf));
fail_on_test(checkQueryBuf(node, buf, bufs.type, bufs.memory, i, Unqueued, 0));
g_ptrs[i] = test_mmap(NULL, buf.length,
@@ -419,8 +423,10 @@ static int releaseMmap(struct node *node, struct v4l2_requestbuffers &bufs)
buf.type = bufs.type;
buf.memory = bufs.memory;
buf.index = i;
- if (V4L2_TYPE_IS_MULTIPLANAR(bufs.type))
+ if (V4L2_TYPE_IS_MULTIPLANAR(bufs.type)) {
buf.m.planes = planes;
+ buf.length = VIDEO_MAX_PLANES;
+ }
fail_on_test(doioctl(node, VIDIOC_QUERYBUF, &buf));
munmap(g_ptrs[i], buf.length);
}
@@ -546,8 +552,10 @@ static int setupUserPtr(struct node *node, struct v4l2_requestbuffers &bufs)
buf.type = bufs.type;
buf.memory = bufs.memory;
buf.index = i;
- if (V4L2_TYPE_IS_MULTIPLANAR(bufs.type))
+ if (V4L2_TYPE_IS_MULTIPLANAR(bufs.type)) {
buf.m.planes = planes;
+ buf.length = VIDEO_MAX_PLANES;
+ }
fail_on_test(doioctl(node, VIDIOC_QUERYBUF, &buf));
fail_on_test(checkQueryBuf(node, buf, bufs.type, bufs.memory, i, Unqueued, 0));
g_ptrs[i] = malloc(buf.length);
diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp
index 9ae2df33..db023f30 100644
--- a/utils/v4l2-compliance/v4l2-test-formats.cpp
+++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
@@ -379,6 +379,7 @@ static int testFormatsType(struct node *node, int ret, unsigned type, struct v4
unsigned min_sampling_rate;
v4l2_std_id std;
__u32 service_set = 0;
+ unsigned tot_bytesperline = 0;
unsigned cnt = 0;
if (ret == ENOTTY)
@@ -424,8 +425,9 @@ static int testFormatsType(struct node *node, int ret, unsigned type, struct v4
if (ret)
return fail("pix_mp.plane_fmt[%d].reserved not zeroed\n", i);
fail_on_test(!pfmt.sizeimage);
- fail_on_test(pfmt.bytesperline && pfmt.bytesperline < pix_mp.width);
+ tot_bytesperline += pfmt.bytesperline;
}
+ fail_on_test(tot_bytesperline && tot_bytesperline < pix_mp.width);
break;
case V4L2_BUF_TYPE_VBI_CAPTURE:
case V4L2_BUF_TYPE_VBI_OUTPUT:

Privacy Policy