From: Hans Verkuil Date: Fri, 28 Feb 2014 17:15:26 +0000 (+0100) Subject: v4l2-compliance: more nasty evil stream I/O checks X-Git-Tag: v4l-utils-1.2.0~163 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b56604f4323a06e3e2d8f0833e24cad306cf81ab;p=platform%2Fupstream%2Fv4l-utils.git v4l2-compliance: more nasty evil stream I/O checks After queuing buffers, then calling STREAMOFF without having called STREAMON we should be able to queue those buffers again. After queuing buffers, then calling REQBUFS without having called STREAMON all the old buffers should be freed correctly: good check for making sure all the vb2 ops stay balanced. Signed-off-by: Hans Verkuil --- diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp index 2d60a6f..50ab17e 100644 --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp @@ -949,6 +949,44 @@ int testMmap(struct node *node, unsigned frame_count) fail_on_test(doioctl(node, VIDIOC_STREAMOFF, &bufs.type)); last_seq.init(); + // Test queuing buffers... + for (unsigned i = 0; i < bufs.count; i++) { + struct v4l2_plane planes[VIDEO_MAX_PLANES]; + struct v4l2_buffer buf; + + memset(&buf, 0, sizeof(buf)); + buf.type = bufs.type; + buf.memory = bufs.memory; + buf.index = i; + if (V4L2_TYPE_IS_MULTIPLANAR(bufs.type)) { + buf.m.planes = planes; + buf.length = VIDEO_MAX_PLANES; + } + fail_on_test(doioctl(node, VIDIOC_QBUF, &buf)); + } + // calling STREAMOFF... + fail_on_test(doioctl(node, VIDIOC_STREAMOFF, &bufs.type)); + // and now we should be able to queue those buffers again since + // STREAMOFF should return them back to the dequeued state. + for (unsigned i = 0; i < bufs.count; i++) { + struct v4l2_plane planes[VIDEO_MAX_PLANES]; + struct v4l2_buffer buf; + + memset(&buf, 0, sizeof(buf)); + buf.type = bufs.type; + buf.memory = bufs.memory; + buf.index = i; + if (V4L2_TYPE_IS_MULTIPLANAR(bufs.type)) { + buf.m.planes = planes; + buf.length = VIDEO_MAX_PLANES; + } + fail_on_test(doioctl(node, VIDIOC_QBUF, &buf)); + } + // Now request buffers again, freeing the old buffers. + // Good check for whether all the internal vb2 calls are in + // balance. + fail_on_test(doioctl(node, VIDIOC_REQBUFS, &bufs)); + cbufs.format = cur_fmt; cbufs.count = 0; cbufs.memory = bufs.memory;