Re: [PATCH v2] v4l2-compliance: check errors returned by CREATE_BUFS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
> ---
> 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



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux