All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
	"Stanimir Varbanov" <stanimir.varbanov@linaro.org>
Subject: [PATCHv2] v4l2-compliance: only check function if an MC is present
Date: Fri, 18 Feb 2022 09:09:26 +0100	[thread overview]
Message-ID: <b6bc652a-9e6e-0e82-5a86-2bd0f2df51f1@xs4all.nl> (raw)

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


             reply	other threads:[~2022-02-18  8:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18  8:09 Hans Verkuil [this message]
2022-02-18 16:05 ` [PATCHv2] v4l2-compliance: only check function if an MC is present Nícolas F. R. A. Prado
2022-02-21 12:35 ` Stanimir Varbanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6bc652a-9e6e-0e82-5a86-2bd0f2df51f1@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=nfraprado@collabora.com \
    --cc=stanimir.varbanov@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.