All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] v4l2-compliance: only check function if an MC is present
@ 2022-02-18  8:09 Hans Verkuil
  2022-02-18 16:05 ` Nícolas F. R. A. Prado
  2022-02-21 12:35 ` Stanimir Varbanov
  0 siblings, 2 replies; 3+ messages in thread
From: Hans Verkuil @ 2022-02-18  8:09 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Nícolas F. R. A. Prado, Stanimir Varbanov

The codec tests checked if the function of the device as reported
by the media controller is that of an de/encoder. But that test
was also done for codecs without a MC, and then it fails.

So only do this test if an MC was found.

Also test that stateless codecs always have a MC since it is
required for such codecs.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
Nicolas, Stanimir, can you test? This is an improved version of the
patch fixing the function test for codecs.
---
 utils/v4l2-compliance/v4l2-compliance.cpp  | 1 +
 utils/v4l2-compliance/v4l2-compliance.h    | 1 +
 utils/v4l2-compliance/v4l2-test-codecs.cpp | 6 ++++--
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index c53a55ba..8d0e94e9 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -998,6 +998,7 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
 			if (!node.is_v4l2())
 				driver = mdinfo.driver;
 			node.media_bus_info = mdinfo.bus_info;
+			node.has_media = true;
 		}
 	}

diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
index 7255161f..507187eb 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -120,6 +120,7 @@ struct base_node {
 	struct node *node2;	/* second open filehandle */
 	bool has_outputs;
 	bool has_inputs;
+	bool has_media;
 	unsigned tuners;
 	unsigned modulators;
 	unsigned inputs;
diff --git a/utils/v4l2-compliance/v4l2-test-codecs.cpp b/utils/v4l2-compliance/v4l2-test-codecs.cpp
index 22175eef..1d76a17c 100644
--- a/utils/v4l2-compliance/v4l2-test-codecs.cpp
+++ b/utils/v4l2-compliance/v4l2-test-codecs.cpp
@@ -31,7 +31,8 @@ int testEncoder(struct node *node)
 	bool is_encoder = node->codec_mask & (STATEFUL_ENCODER | JPEG_ENCODER);
 	int ret;

-	if (IS_ENCODER(node))
+	fail_on_test((node->codec_mask & STATELESS_ENCODER) && !node->has_media);
+	if (IS_ENCODER(node) && node->has_media)
 		fail_on_test(node->function != MEDIA_ENT_F_PROC_VIDEO_ENCODER);
 	memset(&cmd, 0xff, sizeof(cmd));
 	memset(&cmd.raw, 0, sizeof(cmd.raw));
@@ -100,7 +101,8 @@ int testDecoder(struct node *node)
 	bool is_decoder = node->codec_mask & (STATEFUL_DECODER | JPEG_DECODER);
 	int ret;

-	if (IS_DECODER(node))
+	fail_on_test((node->codec_mask & STATELESS_DECODER) && !node->has_media);
+	if (IS_DECODER(node) && node->has_media)
 		fail_on_test(node->function != MEDIA_ENT_F_PROC_VIDEO_DECODER);
 	memset(&cmd, 0xff, sizeof(cmd));
 	memset(&cmd.raw, 0, sizeof(cmd.raw));
-- 
2.34.1


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

* Re: [PATCHv2] v4l2-compliance: only check function if an MC is present
  2022-02-18  8:09 [PATCHv2] v4l2-compliance: only check function if an MC is present Hans Verkuil
@ 2022-02-18 16:05 ` Nícolas F. R. A. Prado
  2022-02-21 12:35 ` Stanimir Varbanov
  1 sibling, 0 replies; 3+ messages in thread
From: Nícolas F. R. A. Prado @ 2022-02-18 16:05 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Linux Media Mailing List, Stanimir Varbanov

Hi Hans,

On Fri, Feb 18, 2022 at 09:09:26AM +0100, Hans Verkuil wrote:
> The codec tests checked if the function of the device as reported
> by the media controller is that of an de/encoder. But that test
> was also done for codecs without a MC, and then it fails.
> 
> So only do this test if an MC was found.
> 
> Also test that stateless codecs always have a MC since it is
> required for such codecs.
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Just like v1, this patch fixes the following v4l-compliance fail I was seeing on
the mtk-vcodec-enc driver on mt8173-elm-hana:

	fail: v4l2-test-codecs.cpp(35): node->function != MEDIA_ENT_F_PROC_VIDEO_ENCODER
test VIDIOC_(TRY_)ENCODER_CMD: FAIL

So,

Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

Thanks,
Nícolas

> ---
> Nicolas, Stanimir, can you test? This is an improved version of the
> patch fixing the function test for codecs.
> ---
>  utils/v4l2-compliance/v4l2-compliance.cpp  | 1 +
>  utils/v4l2-compliance/v4l2-compliance.h    | 1 +
>  utils/v4l2-compliance/v4l2-test-codecs.cpp | 6 ++++--
>  3 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
> index c53a55ba..8d0e94e9 100644
> --- a/utils/v4l2-compliance/v4l2-compliance.cpp
> +++ b/utils/v4l2-compliance/v4l2-compliance.cpp
> @@ -998,6 +998,7 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
>  			if (!node.is_v4l2())
>  				driver = mdinfo.driver;
>  			node.media_bus_info = mdinfo.bus_info;
> +			node.has_media = true;
>  		}
>  	}
> 
> diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
> index 7255161f..507187eb 100644
> --- a/utils/v4l2-compliance/v4l2-compliance.h
> +++ b/utils/v4l2-compliance/v4l2-compliance.h
> @@ -120,6 +120,7 @@ struct base_node {
>  	struct node *node2;	/* second open filehandle */
>  	bool has_outputs;
>  	bool has_inputs;
> +	bool has_media;
>  	unsigned tuners;
>  	unsigned modulators;
>  	unsigned inputs;
> diff --git a/utils/v4l2-compliance/v4l2-test-codecs.cpp b/utils/v4l2-compliance/v4l2-test-codecs.cpp
> index 22175eef..1d76a17c 100644
> --- a/utils/v4l2-compliance/v4l2-test-codecs.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-codecs.cpp
> @@ -31,7 +31,8 @@ int testEncoder(struct node *node)
>  	bool is_encoder = node->codec_mask & (STATEFUL_ENCODER | JPEG_ENCODER);
>  	int ret;
> 
> -	if (IS_ENCODER(node))
> +	fail_on_test((node->codec_mask & STATELESS_ENCODER) && !node->has_media);
> +	if (IS_ENCODER(node) && node->has_media)
>  		fail_on_test(node->function != MEDIA_ENT_F_PROC_VIDEO_ENCODER);
>  	memset(&cmd, 0xff, sizeof(cmd));
>  	memset(&cmd.raw, 0, sizeof(cmd.raw));
> @@ -100,7 +101,8 @@ int testDecoder(struct node *node)
>  	bool is_decoder = node->codec_mask & (STATEFUL_DECODER | JPEG_DECODER);
>  	int ret;
> 
> -	if (IS_DECODER(node))
> +	fail_on_test((node->codec_mask & STATELESS_DECODER) && !node->has_media);
> +	if (IS_DECODER(node) && node->has_media)
>  		fail_on_test(node->function != MEDIA_ENT_F_PROC_VIDEO_DECODER);
>  	memset(&cmd, 0xff, sizeof(cmd));
>  	memset(&cmd.raw, 0, sizeof(cmd.raw));
> -- 
> 2.34.1
> 

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

* Re: [PATCHv2] v4l2-compliance: only check function if an MC is present
  2022-02-18  8:09 [PATCHv2] v4l2-compliance: only check function if an MC is present Hans Verkuil
  2022-02-18 16:05 ` Nícolas F. R. A. Prado
@ 2022-02-21 12:35 ` Stanimir Varbanov
  1 sibling, 0 replies; 3+ messages in thread
From: Stanimir Varbanov @ 2022-02-21 12:35 UTC (permalink / raw)
  To: Hans Verkuil, Linux Media Mailing List; +Cc: Nícolas F. R. A. Prado



On 2/18/22 10:09, Hans Verkuil wrote:
> The codec tests checked if the function of the device as reported
> by the media controller is that of an de/encoder. But that test
> was also done for codecs without a MC, and then it fails.
> 
> So only do this test if an MC was found.
> 
> Also test that stateless codecs always have a MC since it is
> required for such codecs.
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
> Nicolas, Stanimir, can you test? This is an improved version of the
> patch fixing the function test for codecs.
> ---
>  utils/v4l2-compliance/v4l2-compliance.cpp  | 1 +
>  utils/v4l2-compliance/v4l2-compliance.h    | 1 +
>  utils/v4l2-compliance/v4l2-test-codecs.cpp | 6 ++++--
>  3 files changed, 6 insertions(+), 2 deletions(-)
> 

Tested-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

> diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
> index c53a55ba..8d0e94e9 100644
> --- a/utils/v4l2-compliance/v4l2-compliance.cpp
> +++ b/utils/v4l2-compliance/v4l2-compliance.cpp
> @@ -998,6 +998,7 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
>  			if (!node.is_v4l2())
>  				driver = mdinfo.driver;
>  			node.media_bus_info = mdinfo.bus_info;
> +			node.has_media = true;
>  		}
>  	}
> 
> diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
> index 7255161f..507187eb 100644
> --- a/utils/v4l2-compliance/v4l2-compliance.h
> +++ b/utils/v4l2-compliance/v4l2-compliance.h
> @@ -120,6 +120,7 @@ struct base_node {
>  	struct node *node2;	/* second open filehandle */
>  	bool has_outputs;
>  	bool has_inputs;
> +	bool has_media;
>  	unsigned tuners;
>  	unsigned modulators;
>  	unsigned inputs;
> diff --git a/utils/v4l2-compliance/v4l2-test-codecs.cpp b/utils/v4l2-compliance/v4l2-test-codecs.cpp
> index 22175eef..1d76a17c 100644
> --- a/utils/v4l2-compliance/v4l2-test-codecs.cpp
> +++ b/utils/v4l2-compliance/v4l2-test-codecs.cpp
> @@ -31,7 +31,8 @@ int testEncoder(struct node *node)
>  	bool is_encoder = node->codec_mask & (STATEFUL_ENCODER | JPEG_ENCODER);
>  	int ret;
> 
> -	if (IS_ENCODER(node))
> +	fail_on_test((node->codec_mask & STATELESS_ENCODER) && !node->has_media);
> +	if (IS_ENCODER(node) && node->has_media)
>  		fail_on_test(node->function != MEDIA_ENT_F_PROC_VIDEO_ENCODER);
>  	memset(&cmd, 0xff, sizeof(cmd));
>  	memset(&cmd.raw, 0, sizeof(cmd.raw));
> @@ -100,7 +101,8 @@ int testDecoder(struct node *node)
>  	bool is_decoder = node->codec_mask & (STATEFUL_DECODER | JPEG_DECODER);
>  	int ret;
> 
> -	if (IS_DECODER(node))
> +	fail_on_test((node->codec_mask & STATELESS_DECODER) && !node->has_media);
> +	if (IS_DECODER(node) && node->has_media)
>  		fail_on_test(node->function != MEDIA_ENT_F_PROC_VIDEO_DECODER);
>  	memset(&cmd, 0xff, sizeof(cmd));
>  	memset(&cmd.raw, 0, sizeof(cmd.raw));

-- 
regards,
Stan

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

end of thread, other threads:[~2022-02-21 12:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18  8:09 [PATCHv2] v4l2-compliance: only check function if an MC is present Hans Verkuil
2022-02-18 16:05 ` Nícolas F. R. A. Prado
2022-02-21 12:35 ` Stanimir Varbanov

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.