diff mbox series

[v4l-utils] v4l2-compliance: don't test pad's dimensions if it's MEDIA_PAD_FL_METADATA

Message ID 20200325214357.30722-1-dafna.hirschfeld@collabora.com
State New
Headers show
Series [v4l-utils] v4l2-compliance: don't test pad's dimensions if it's MEDIA_PAD_FL_METADATA | expand

Commit Message

Dafna Hirschfeld March 25, 2020, 9:43 p.m. UTC
Pads with the flag MEDIA_PAD_FL_METADATA transmit metadata
which has no dimension, so don't test the width and hight
returned by S/G_FMT for that pads.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
This patch completes the patchset sent to linux-media:
"media: staging: rkisp1: Fix formats for metadata pads"
https://patchwork.kernel.org/project/linux-media/list/?series=261673
It compiles only when the media.h file is synced with
this patchset so that the flag MEDIA_PAD_FL_METADATA
is added.

 utils/v4l2-compliance/v4l2-test-subdevs.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Helen Mae Koike Fornazier Oct. 30, 2020, 4:51 a.m. UTC | #1
Hi Dafna,

On 3/25/20 6:43 PM, Dafna Hirschfeld wrote:
> Pads with the flag MEDIA_PAD_FL_METADATA transmit metadata
> which has no dimension, so don't test the width and hight
> returned by S/G_FMT for that pads.
> 
> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
> ---
> This patch completes the patchset sent to linux-media:
> "media: staging: rkisp1: Fix formats for metadata pads"
> https://patchwork.kernel.org/project/linux-media/list/?series=261673
> It compiles only when the media.h file is synced with
> this patchset so that the flag MEDIA_PAD_FL_METADATA
> is added.
> 
>  utils/v4l2-compliance/v4l2-test-subdevs.cpp | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/utils/v4l2-compliance/v4l2-test-subdevs.cpp b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
> index 489639fb..ca527529 100644
> --- a/utils/v4l2-compliance/v4l2-test-subdevs.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
> @@ -305,11 +305,13 @@ int testSubDevFrameInterval(struct node *node, unsigned pad)
>  	return 0;
>  }
>  
> -static int checkMBusFrameFmt(struct node *node, struct v4l2_mbus_framefmt &fmt)
> +static int checkMBusFrameFmt(struct node *node, struct v4l2_mbus_framefmt &fmt, unsigned pad)
>  {
>  	fail_on_test(check_0(fmt.reserved, sizeof(fmt.reserved)));
> -	fail_on_test(fmt.width == 0 || fmt.width > 65536);
> -	fail_on_test(fmt.height == 0 || fmt.height > 65536);
> +	if (!(node->pads[pad].flags & MEDIA_PAD_FL_METADATA)) {

I was wondering if instead of checking the flag type, we shouldn't be checking the
code for MEDIA_BUS_FMT_METADATA_FIXED.


Regards,
Helen

> +		fail_on_test(fmt.width == 0 || fmt.width > 65536);
> +		fail_on_test(fmt.height == 0 || fmt.height > 65536);
> +	}
>  	fail_on_test(fmt.code == 0 || fmt.code == ~0U);
>  	fail_on_test(fmt.field == ~0U);
>  	if (!node->is_passthrough_subdev) {
> @@ -353,7 +355,7 @@ int testSubDevFormat(struct node *node, unsigned which, unsigned pad)
>  	fail_on_test(check_0(fmt.reserved, sizeof(fmt.reserved)));
>  	fail_on_test(fmt.which != which);
>  	fail_on_test(fmt.pad != pad);
> -	fail_on_test(checkMBusFrameFmt(node, fmt.format));
> +	fail_on_test(checkMBusFrameFmt(node, fmt.format, pad));
>  	s_fmt = fmt;
>  	memset(s_fmt.reserved, 0xff, sizeof(s_fmt.reserved));
>  	memset(s_fmt.format.reserved, 0xff, sizeof(s_fmt.format.reserved));
> @@ -366,7 +368,7 @@ int testSubDevFormat(struct node *node, unsigned which, unsigned pad)
>  		return 0;
>  	}
>  	fail_on_test(check_0(s_fmt.reserved, sizeof(s_fmt.reserved)));
> -	fail_on_test(checkMBusFrameFmt(node, s_fmt.format));
> +	fail_on_test(checkMBusFrameFmt(node, s_fmt.format, pad));
>  	fail_on_test(s_fmt.format.width != fmt.format.width);
>  	fail_on_test(s_fmt.format.height != fmt.format.height);
>  	fail_on_test(s_fmt.format.code != fmt.format.code);
>
diff mbox series

Patch

diff --git a/utils/v4l2-compliance/v4l2-test-subdevs.cpp b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
index 489639fb..ca527529 100644
--- a/utils/v4l2-compliance/v4l2-test-subdevs.cpp
+++ b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
@@ -305,11 +305,13 @@  int testSubDevFrameInterval(struct node *node, unsigned pad)
 	return 0;
 }
 
-static int checkMBusFrameFmt(struct node *node, struct v4l2_mbus_framefmt &fmt)
+static int checkMBusFrameFmt(struct node *node, struct v4l2_mbus_framefmt &fmt, unsigned pad)
 {
 	fail_on_test(check_0(fmt.reserved, sizeof(fmt.reserved)));
-	fail_on_test(fmt.width == 0 || fmt.width > 65536);
-	fail_on_test(fmt.height == 0 || fmt.height > 65536);
+	if (!(node->pads[pad].flags & MEDIA_PAD_FL_METADATA)) {
+		fail_on_test(fmt.width == 0 || fmt.width > 65536);
+		fail_on_test(fmt.height == 0 || fmt.height > 65536);
+	}
 	fail_on_test(fmt.code == 0 || fmt.code == ~0U);
 	fail_on_test(fmt.field == ~0U);
 	if (!node->is_passthrough_subdev) {
@@ -353,7 +355,7 @@  int testSubDevFormat(struct node *node, unsigned which, unsigned pad)
 	fail_on_test(check_0(fmt.reserved, sizeof(fmt.reserved)));
 	fail_on_test(fmt.which != which);
 	fail_on_test(fmt.pad != pad);
-	fail_on_test(checkMBusFrameFmt(node, fmt.format));
+	fail_on_test(checkMBusFrameFmt(node, fmt.format, pad));
 	s_fmt = fmt;
 	memset(s_fmt.reserved, 0xff, sizeof(s_fmt.reserved));
 	memset(s_fmt.format.reserved, 0xff, sizeof(s_fmt.format.reserved));
@@ -366,7 +368,7 @@  int testSubDevFormat(struct node *node, unsigned which, unsigned pad)
 		return 0;
 	}
 	fail_on_test(check_0(s_fmt.reserved, sizeof(s_fmt.reserved)));
-	fail_on_test(checkMBusFrameFmt(node, s_fmt.format));
+	fail_on_test(checkMBusFrameFmt(node, s_fmt.format, pad));
 	fail_on_test(s_fmt.format.width != fmt.format.width);
 	fail_on_test(s_fmt.format.height != fmt.format.height);
 	fail_on_test(s_fmt.format.code != fmt.format.code);