All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] v4l2-compliance: check errors returned by CREATE_BUFS
@ 2023-10-05  2:44 Deborah Brouwer
  2023-10-11 16:41 ` Hans Verkuil
  0 siblings, 1 reply; 2+ messages in thread
From: Deborah Brouwer @ 2023-10-05  2:44 UTC (permalink / raw
  To: hverkuil-cisco
  Cc: linux-media, nicolas.dufresne, sebastian.fricke, nas.chung,
	jackson.lee, Deborah Brouwer

If VIDIOC_CREATE_BUFS is not supported by a driver, it should return
ENOTTY on all queues; so add a test to fail if ENOTTY is returned on only
one queue.

If  VIDIOC_CREATE_BUFS is supported, asymmetrically, on only one queue and
not another, then the driver should return EOPNOTSUPP for only that queue.
Fail if the driver returns EOPNOTSUPP on both queues.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
---
Changes since v1:
- add the ENOTTY test
- use a count instead of bool to keep track of error codes

On the wave5 driver, v4l2-compliance -d0 -v 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-test-buffers.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index 6d592c9b..632da7f8 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -540,6 +540,9 @@ int testReqBufs(struct node *node)
 	bool dmabuf_valid;
 	int ret;
 	unsigned i, m;
+	int crbufs_ok_cnt = 0;
+	int crbufs_enotty_cnt = 0;
+	int crbufs_eopnotsupp_cnt = 0;
 
 	node->reopen();
 
@@ -690,9 +693,21 @@ int testReqBufs(struct node *node)
 
 			ret = q.create_bufs(node, 0);
 			if (ret == ENOTTY) {
+				/* VIDIOC_CREATE_BUFS is not supported at all. */
+				crbufs_enotty_cnt++;
+				fail_on_test(crbufs_enotty_cnt && (crbufs_eopnotsupp_cnt + crbufs_ok_cnt));
 				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(crbufs_eopnotsupp_cnt && !crbufs_ok_cnt);
+				crbufs_eopnotsupp_cnt++;
+				info("VIDIOC_CREATE_BUFS not supported for %s\n",
+				     buftype2s(q.g_type()).c_str());
+				break;
+			}
+			crbufs_ok_cnt++;
 
 			memset(&crbufs, 0xff, sizeof(crbufs));
 			node->g_fmt(crbufs.format, i);
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] v4l2-compliance: check errors returned by CREATE_BUFS
  2023-10-05  2:44 [PATCH v2] v4l2-compliance: check errors returned by CREATE_BUFS Deborah Brouwer
@ 2023-10-11 16:41 ` Hans Verkuil
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Verkuil @ 2023-10-11 16:41 UTC (permalink / raw
  To: Deborah Brouwer
  Cc: linux-media, nicolas.dufresne, sebastian.fricke, nas.chung,
	jackson.lee

On 05/10/2023 04:44, Deborah Brouwer wrote:
> If VIDIOC_CREATE_BUFS is not supported by a driver, it should return
> ENOTTY on all queues; so add a test to fail if ENOTTY is returned on only
> one queue.
> 
> If  VIDIOC_CREATE_BUFS is supported, asymmetrically, on only one queue and
> not another, then the driver should return EOPNOTSUPP for only that queue.
> Fail if the driver returns EOPNOTSUPP on both queues.
> 
> Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
> ---
> Changes since v1:
> - add the ENOTTY test
> - use a count instead of bool to keep track of error codes
> 
> On the wave5 driver, v4l2-compliance -d0 -v 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-test-buffers.cpp | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
> index 6d592c9b..632da7f8 100644
> --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
> @@ -540,6 +540,9 @@ int testReqBufs(struct node *node)
>  	bool dmabuf_valid;
>  	int ret;
>  	unsigned i, m;
> +	int crbufs_ok_cnt = 0;
> +	int crbufs_enotty_cnt = 0;
> +	int crbufs_eopnotsupp_cnt = 0;
>  
>  	node->reopen();
>  
> @@ -690,9 +693,21 @@ int testReqBufs(struct node *node)
>  
>  			ret = q.create_bufs(node, 0);
>  			if (ret == ENOTTY) {
> +				/* VIDIOC_CREATE_BUFS is not supported at all. */
> +				crbufs_enotty_cnt++;

Just count here...

> +				fail_on_test(crbufs_enotty_cnt && (crbufs_eopnotsupp_cnt + crbufs_ok_cnt));

...and move the fail_on_test to after the loop, when all the
counter values are final.

>  				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(crbufs_eopnotsupp_cnt && !crbufs_ok_cnt);

Also move to after the loop is done.

> +				crbufs_eopnotsupp_cnt++;
> +				info("VIDIOC_CREATE_BUFS not supported for %s\n",
> +				     buftype2s(q.g_type()).c_str());
> +				break;
> +			}
> +			crbufs_ok_cnt++;
>  
>  			memset(&crbufs, 0xff, sizeof(crbufs));
>  			node->g_fmt(crbufs.format, i);

Regards,

	Hans

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-11 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-05  2:44 [PATCH v2] v4l2-compliance: check errors returned by CREATE_BUFS Deborah Brouwer
2023-10-11 16:41 ` Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.