diff mbox series

[v4l-utils,v2,2/2] v4l2-compliance: Fix streams use in testSubDevEnumFrameSize()

Message ID 20240403-v4l2-compliance-streams-fixes-v2-2-be9b338dc204@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series v4l2-compliance streams fixes | expand

Commit Message

Tomi Valkeinen April 3, 2024, 10:15 a.m. UTC
We don't pass the stream number to testSubDevEnumFrameSize(), which
instead always uses stream number 0. This causes failures when the
subdevice uses streams.

Fix this by adding stream parameter, and passing the correct stream ID.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 utils/v4l2-compliance/v4l2-test-subdevs.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Laurent Pinchart April 3, 2024, 11:37 p.m. UTC | #1
On Wed, Apr 03, 2024 at 01:15:45PM +0300, Tomi Valkeinen wrote:
> We don't pass the stream number to testSubDevEnumFrameSize(), which
> instead always uses stream number 0. This causes failures when the
> subdevice uses streams.
> 
> Fix this by adding stream parameter, and passing the correct stream ID.

This looks ready to merge as far as I'm concerned. Sakari, Hans, if you
disagree, please let me know.

> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> ---
>  utils/v4l2-compliance/v4l2-test-subdevs.cpp | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/utils/v4l2-compliance/v4l2-test-subdevs.cpp b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
> index 560efb70..da304a8c 100644
> --- a/utils/v4l2-compliance/v4l2-test-subdevs.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
> @@ -121,7 +121,7 @@ static int testSubDevEnumFrameInterval(struct node *node, unsigned which,
>  }
>  
>  static int testSubDevEnumFrameSize(struct node *node, unsigned which,
> -				   unsigned pad, unsigned code)
> +				   unsigned pad, unsigned stream, unsigned code)
>  {
>  	struct v4l2_subdev_frame_size_enum fse;
>  	unsigned num_sizes;
> @@ -130,7 +130,7 @@ static int testSubDevEnumFrameSize(struct node *node, unsigned which,
>  	memset(&fse, 0, sizeof(fse));
>  	fse.which = which;
>  	fse.pad = pad;
> -	fse.stream = 0;
> +	fse.stream = stream;
>  	fse.code = code;
>  	ret = doioctl(node, VIDIOC_SUBDEV_ENUM_FRAME_SIZE, &fse);
>  	node->has_subdev_enum_fsize |= (ret != ENOTTY) << which;
> @@ -140,7 +140,7 @@ static int testSubDevEnumFrameSize(struct node *node, unsigned which,
>  		memset(&fie, 0, sizeof(fie));
>  		fie.which = which;
>  		fie.pad = pad;
> -		fie.stream = 0;
> +		fie.stream = stream;
>  		fie.code = code;
>  		fail_on_test(doioctl(node, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL, &fie) != ENOTTY);
>  		return ret;
> @@ -156,7 +156,7 @@ static int testSubDevEnumFrameSize(struct node *node, unsigned which,
>  	memset(&fse, 0xff, sizeof(fse));
>  	fse.which = which;
>  	fse.pad = pad;
> -	fse.stream = 0;
> +	fse.stream = stream;
>  	fse.code = code;
>  	fse.index = 0;
>  	fail_on_test(doioctl(node, VIDIOC_SUBDEV_ENUM_FRAME_SIZE, &fse));
> @@ -266,7 +266,7 @@ int testSubDevEnum(struct node *node, unsigned which, unsigned pad, unsigned str
>  		fail_on_test(mbus_core_enum.stream != stream);
>  		fail_on_test(mbus_core_enum.index != i);
>  
> -		ret = testSubDevEnumFrameSize(node, which, pad, mbus_core_enum.code);
> +		ret = testSubDevEnumFrameSize(node, which, pad, stream, mbus_core_enum.code);
>  		fail_on_test(ret && ret != ENOTTY);
>  	}
>  	return 0;
>
diff mbox series

Patch

diff --git a/utils/v4l2-compliance/v4l2-test-subdevs.cpp b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
index 560efb70..da304a8c 100644
--- a/utils/v4l2-compliance/v4l2-test-subdevs.cpp
+++ b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
@@ -121,7 +121,7 @@  static int testSubDevEnumFrameInterval(struct node *node, unsigned which,
 }
 
 static int testSubDevEnumFrameSize(struct node *node, unsigned which,
-				   unsigned pad, unsigned code)
+				   unsigned pad, unsigned stream, unsigned code)
 {
 	struct v4l2_subdev_frame_size_enum fse;
 	unsigned num_sizes;
@@ -130,7 +130,7 @@  static int testSubDevEnumFrameSize(struct node *node, unsigned which,
 	memset(&fse, 0, sizeof(fse));
 	fse.which = which;
 	fse.pad = pad;
-	fse.stream = 0;
+	fse.stream = stream;
 	fse.code = code;
 	ret = doioctl(node, VIDIOC_SUBDEV_ENUM_FRAME_SIZE, &fse);
 	node->has_subdev_enum_fsize |= (ret != ENOTTY) << which;
@@ -140,7 +140,7 @@  static int testSubDevEnumFrameSize(struct node *node, unsigned which,
 		memset(&fie, 0, sizeof(fie));
 		fie.which = which;
 		fie.pad = pad;
-		fie.stream = 0;
+		fie.stream = stream;
 		fie.code = code;
 		fail_on_test(doioctl(node, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL, &fie) != ENOTTY);
 		return ret;
@@ -156,7 +156,7 @@  static int testSubDevEnumFrameSize(struct node *node, unsigned which,
 	memset(&fse, 0xff, sizeof(fse));
 	fse.which = which;
 	fse.pad = pad;
-	fse.stream = 0;
+	fse.stream = stream;
 	fse.code = code;
 	fse.index = 0;
 	fail_on_test(doioctl(node, VIDIOC_SUBDEV_ENUM_FRAME_SIZE, &fse));
@@ -266,7 +266,7 @@  int testSubDevEnum(struct node *node, unsigned which, unsigned pad, unsigned str
 		fail_on_test(mbus_core_enum.stream != stream);
 		fail_on_test(mbus_core_enum.index != i);
 
-		ret = testSubDevEnumFrameSize(node, which, pad, mbus_core_enum.code);
+		ret = testSubDevEnumFrameSize(node, which, pad, stream, mbus_core_enum.code);
 		fail_on_test(ret && ret != ENOTTY);
 	}
 	return 0;