v4l2-compliance: add EOPNOTSUPP for create_bufs
PATCH 1/1 v4l2-compliance: add EOPNOTSUPP for create_bufs
If VIDIOC_CREATE_BUFS is supported on one queue but not the other, then the driver should return EOPNOTSUPP for the unsupported queue only.
---
On the wave5 driver, v4l2-compliance -d0 -v now shows:
<snip>
Buffer ioctls:
info: test buftype Video Capture Multiplanar
info: VIDIOC_CREATE_BUFS not supported for Video Capture Multiplanar
info: test buftype Video Output Multiplanar
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK
info: could not test the Request API, no suitable control found
test Requests: OK (Not Supported)
Total for wave5-dec device /dev/video0: 45, Succeeded: 45, Failed: 0, Warnings: 0
utils/v4l2-compliance/v4l2-compliance.h | 1 + utils/v4l2-compliance/v4l2-test-buffers.cpp | 8 ++++++++ 2 files changed, 9 insertions(+)
utils/v4l2-compliance/v4l2-compliance.h +1 -0
@@ -165,6 +165,7 @@ struct base_node {bool supports_orphaned_bufs;// support for this was introduced in 5.9 bool might_support_cache_hints; +bool create_bufs_on_one_queue_only; }; struct node : public base_node, public cv4l_fd {
utils/v4l2-compliance/v4l2-test-buffers.cpp +8 -0
@@ -693,6 +693,14 @@ int testReqBufs(struct node *node) warn("VIDIOC_CREATE_BUFS not supported\n"); break; } + if (ret == EOPNOTSUPP) { + /* VIDIOC_CREATE_BUFS is supported on one queue but not the other. */ + fail_on_test(node->create_bufs_on_one_queue_only); + node->create_bufs_on_one_queue_only = true; + info("VIDIOC_CREATE_BUFS not supported for %s\n", + buftype2s(q.g_type()).c_str()); + break; + } memset(&crbufs, 0xff, sizeof(crbufs)); node->g_fmt(crbufs.format, i);
Signature · 1 line
2.40.1
Hi Deb,
Quoted 27 lines · Deborah Brouwer
If
VIDIOC_CREATE_BUFSis supported on one queue but not the other, then the driver should return EOPNOTSUPP for the unsupported queue only.Signed-off-by Deborah Brouwer <[email protected]>---
On the wave5 driver, v4l2-compliance -d0 -v now shows:
<snip>
Buffer ioctls:
info: test buftype Video Capture Multiplanar
info:VIDIOC_CREATE_BUFSnot supported for Video Capture Multiplanar
info: test buftype Video Output Multiplanar
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
testVIDIOC_EXPBUF: OK
info: could not test the Request API, no suitable control found
test Requests: OK (Not Supported)Total for wave5-dec device
/dev/video0: 45, Succeeded: 45, Failed: 0, Warnings: 0utils/v4l2-compliance/v4l2-compliance.h | 1 + utils/v4l2-compliance/v4l2-test-buffers.cpp | 8 ++++++++ 2 files changed, 9 insertions(+)utils/v4l2-compliance/v4l2-compliance.h +0
-0
utils/v4l2-compliance/v4l2-compliance.h struct base_node { · line 168
Quoted 4 lines
utils/v4l2-compliance/v4l2-compliance.h +1
-0@@ -165,6 +165,7 @@ struct base_node {bool supports_orphaned_bufs;// support for this was introduced in 5.9 bool might_support_cache_hints; +bool create_bufs_on_one_queue_only;
No need to add this here.
Quoted 9 lines
utils/v4l2-compliance/v4l2-compliance.h +0
-0}; struct node : public base_node, public cv4l_fd {utils/v4l2-compliance/v4l2-test-buffers.cpp +0
-0@@ -693,6 +693,14 @@ int testReqBufs(struct node *node) warn("VIDIOC_CREATE_BUFS not supported\n");
utils/v4l2-compliance/v4l2-test-buffers.cpp int testReqBufs(struct node *node) · line 703
Quoted 10 lines
utils/v4l2-compliance/v4l2-test-buffers.cpp +8
-0break; } + if (ret == EOPNOTSUPP) { + /* VIDIOC_CREATE_BUFS is supported on one queue but not the other. */ + fail_on_test(node->create_bufs_on_one_queue_only); + node->create_bufs_on_one_queue_only = true; + info("VIDIOC_CREATE_BUFS not supported for %s\n", + buftype2s(q.g_type()).c_str()); + break; + }
It is sufficient to have it as a local variable in this function.
utils/v4l2-compliance/v4l2-test-buffers.cpp int testReqBufs(struct node *node) · line 706
Quoted 3 lines
utils/v4l2-compliance/v4l2-test-buffers.cpp +0
-0memset(&crbufs, 0xff, sizeof(crbufs)); node->g_fmt(crbufs.format, i);
In any case, the logic needs to be improved a bit:
keep track of the q.create_bufs(node, 0) return values: crbufs_enotty_cnt, crbufs_eopnotsupp_cnt and crbufs_ok_cnt (for any ohter return values).
Fail if (crbufs_enotty_cnt && (crbufs_eopnotsupp_cnt + crbufs_ok_cnt), since if ENOTTY is returned once, it has to be returned always.
Also fail if (crbufs_eopnotsupp_cnt && !crbufs_ok_cnt), since EOPNOTSUPP indicates that it is supported in some cases, but not others, so you need to see at least some successful calls.
I think that is a better test, because that checks for ENOTTY abuse as well.
Regards,
Hans