All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: Sakari Ailus <sakari.ailus@iki.fi>,
	Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Gregor Jasny <gjasny@googlemail.com>
Subject: [v4l-utils] [PATCH 6/8] v4l2-compliance: Support the changed routing API
Date: Tue,  2 Apr 2024 03:00:31 +0300	[thread overview]
Message-ID: <20240402000033.4007-7-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20240402000033.4007-1-laurent.pinchart@ideasonboard.com>

Set len_routes of struct v4l2_subdev_routing. ENOSPC error code is no
longer used, i.e. having room for fewer routes than exist in the
configuration is not considered an error anymore.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 utils/v4l2-compliance/v4l2-compliance.cpp   | 12 +++++++-----
 utils/v4l2-compliance/v4l2-test-subdevs.cpp | 19 +++++++++++--------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 2cf979096bd0..72fe0bd778ab 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -1272,15 +1272,17 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
 
 			for (unsigned which = V4L2_SUBDEV_FORMAT_TRY;
 				which <= V4L2_SUBDEV_FORMAT_ACTIVE; which++) {
+				struct v4l2_subdev_routing &routing = sd_routing[which];
 
-				sd_routing[which].which = which;
-				sd_routing[which].routes = (__u64)sd_routes[which];
-				sd_routing[which].num_routes = NUM_ROUTES_MAX;
+				routing.which = which;
+				routing.routes = (__u64)sd_routes[which];
+				routing.len_routes = NUM_ROUTES_MAX;
+				routing.num_routes = 0;
 
-				ret = doioctl(&node, VIDIOC_SUBDEV_G_ROUTING, &sd_routing[which]);
+				ret = doioctl(&node, VIDIOC_SUBDEV_G_ROUTING, &routing);
 				if (ret) {
 					fail("VIDIOC_SUBDEV_G_ROUTING: failed to get routing\n");
-					sd_routing[which].num_routes = 0;
+					routing.num_routes = 0;
 				}
 			}
 		}
diff --git a/utils/v4l2-compliance/v4l2-test-subdevs.cpp b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
index ebca1b94f5c0..714857021fc6 100644
--- a/utils/v4l2-compliance/v4l2-test-subdevs.cpp
+++ b/utils/v4l2-compliance/v4l2-test-subdevs.cpp
@@ -587,17 +587,15 @@ int testSubDevRouting(struct node *node, unsigned which)
 
 	routing.which = which;
 	routing.routes = (__u64)&routes;
+	routing.len_routes = 0;
 	routing.num_routes = 0;
 	memset(routing.reserved, 0xff, sizeof(routing.reserved));
 
-	/*
-	 * First test that G_ROUTING either returns success, or ENOSPC and
-	 * updates num_routes.
-	 */
+	/* First test that G_ROUTING returns success even when len_routes is 0. */
 
 	ret = doioctl(node, VIDIOC_SUBDEV_G_ROUTING, &routing);
-	fail_on_test(ret && ret != ENOSPC);
-	fail_on_test(ret == ENOSPC && routing.num_routes == 0);
+	fail_on_test(ret);
+	fail_on_test(routing.num_routes > NUM_ROUTES_MAX);
 	fail_on_test(check_0(routing.reserved, sizeof(routing.reserved)));
 
 	if (!routing.num_routes)
@@ -609,7 +607,8 @@ int testSubDevRouting(struct node *node, unsigned which)
 	 */
 
 	uint32_t num_routes = routing.num_routes;
-	routing.num_routes = num_routes + 1;
+	routing.len_routes = NUM_ROUTES_MAX;
+	routing.num_routes = 0;
 	fail_on_test(doioctl(node, VIDIOC_SUBDEV_G_ROUTING, &routing));
 	fail_on_test(routing.num_routes != num_routes);
 
@@ -633,10 +632,14 @@ int testSubDevRouting(struct node *node, unsigned which)
 		}
 	}
 
-	/* Set the same routes back, which should always succeed. */
+	/*
+	 * Set the same routes back, which should always succeed and report the
+	 * same number of routes.
+	 */
 
 	memset(routing.reserved, 0xff, sizeof(routing.reserved));
 	fail_on_test(doioctl(node, VIDIOC_SUBDEV_S_ROUTING, &routing));
+	fail_on_test(routing.num_routes != num_routes);
 	fail_on_test(check_0(routing.reserved, sizeof(routing.reserved)));
 
 	/* Test setting invalid pads */
-- 
Regards,

Laurent Pinchart


  parent reply	other threads:[~2024-04-02  0:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02  0:00 [v4l-utils] [PATCH 0/8] Support for the generic line-based metadata support Laurent Pinchart
2024-04-02  0:00 ` [v4l-utils] [PATCH 1/8] utils: media-ctl: Print MUST_CONNECT pad flags Laurent Pinchart
2024-04-03  8:40   ` Laurent Pinchart
2024-04-03  8:43     ` Tomi Valkeinen
2024-04-03  8:56       ` Hans Verkuil
2024-04-04 20:17         ` Sakari Ailus
2024-04-04 22:04           ` Laurent Pinchart
2024-04-02  0:00 ` [v4l-utils] [PATCH 2/8] v4l2-compliance: Constify pointers and references in formats tests Laurent Pinchart
2024-04-03  8:44   ` Tomi Valkeinen
2024-04-03  8:46   ` Hans Verkuil
2024-04-02  0:00 ` [v4l-utils] [PATCH 3/8] v4l-utils: sync-with-kernel Laurent Pinchart
2024-04-02  0:00 ` [v4l-utils] [PATCH 4/8] utils: media-ctl: Support changed routing API Laurent Pinchart
2024-04-02  0:00 ` [v4l-utils] [PATCH 5/8] utils: media-ctl: Also print INTERNAL pad flag Laurent Pinchart
2024-04-02  0:00 ` Laurent Pinchart [this message]
2024-04-02 10:54   ` [v4l-utils] [PATCH 6/8] v4l2-compliance: Support the changed routing API Tomi Valkeinen
2024-04-05  6:37     ` Sakari Ailus
2024-04-02  0:00 ` [v4l-utils] [PATCH 7/8] v4l2-compliance: Add tests for V4L2_FMT_FLAG_META_LINE_BASED flag Laurent Pinchart
2024-04-02  0:00 ` [v4l-utils] [PATCH 8/8] v4l2-compliance: Test IMMUTABLE route flag Laurent Pinchart

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=20240402000033.4007-7-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=gjasny@googlemail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=tomi.valkeinen@ideasonboard.com \
    /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.