public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	niklas.soderlund+renesas@ragnatech.se,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	satish.nagireddy@getcruise.com
Subject: Re: [PATCH v4 2/8] media-ctl: Add support for routes and streams
Date: Mon, 29 May 2023 10:49:58 +0300	[thread overview]
Message-ID: <20230529074958.GF25984@pendragon.ideasonboard.com> (raw)
In-Reply-To: <3de25532-983d-0d13-1a3e-d818e34c01c0@ideasonboard.com>

On Mon, May 29, 2023 at 10:34:16AM +0300, Tomi Valkeinen wrote:
> On 24/04/2023 10:29, Laurent Pinchart wrote:
> 
> >> +
> >>   	if (media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV)
> >>   		return;
> >>   
> >> -	v4l2_subdev_print_format(entity, pad->index, V4L2_SUBDEV_FORMAT_ACTIVE);
> >> -	v4l2_subdev_print_pad_dv(entity, pad->index, V4L2_SUBDEV_FORMAT_ACTIVE);
> >> +	if (!routes) {
> >> +		v4l2_subdev_print_format(entity, pad->index, 0, V4L2_SUBDEV_FORMAT_ACTIVE);
> >> +		v4l2_subdev_print_pad_dv(entity, pad->index, V4L2_SUBDEV_FORMAT_ACTIVE);
> >> +
> >> +		if (pad->flags & MEDIA_PAD_FL_SOURCE)
> >> +			v4l2_subdev_print_subdev_dv(entity);
> >> +
> >> +		return;
> >> +	}
> >> +
> >> +	printed_streams_mask = 0;
> >> +
> >> +	for (i = 0; i < num_routes; ++i) {
> >> +		const struct v4l2_subdev_route *r = &routes[i];
> > 
> > Naming the variable 'route' would be more explicit.
> > 
> >> +		unsigned int stream;
> >>   
> >> -	if (pad->flags & MEDIA_PAD_FL_SOURCE)
> >> -		v4l2_subdev_print_subdev_dv(entity);
> >> +		if (!(r->flags & V4L2_SUBDEV_ROUTE_FL_ACTIVE))
> >> +			continue;
> >> +
> >> +		if (pad->flags & MEDIA_PAD_FL_SINK) {
> >> +			if (r->sink_pad != pad->index)
> >> +				continue;
> >> +
> >> +			stream = r->sink_stream;
> >> +		} else {
> >> +			if (r->source_pad != pad->index)
> >> +				continue;
> >> +
> >> +			stream = r->source_stream;
> >> +		}
> >> +
> >> +		if (printed_streams_mask & (1 << stream))
> >> +			continue;
> >> +
> >> +		v4l2_subdev_print_format(entity, pad->index, stream, V4L2_SUBDEV_FORMAT_ACTIVE);
> >> +		v4l2_subdev_print_pad_dv(entity, pad->index, V4L2_SUBDEV_FORMAT_ACTIVE);
> >> +
> >> +		if (pad->flags & MEDIA_PAD_FL_SOURCE)
> >> +			v4l2_subdev_print_subdev_dv(entity);
> > 
> > v4l2_subdev_print_pad_dv() and v4l2_subdev_print_subdev_dv() don't
> > depend on routes or streams, should they be printed outside of the loop
> > ?
> 
> There's an if-block above the for loop which handles the no-routes case.

What I meant is that the pad and entity variables are constant through
the whole loop, so why should the pad dv and subdev dv information be
printed for each route?

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2023-05-29  7:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21 12:44 [PATCH v4 0/8] v4l-utils: Support multiplexed streams Tomi Valkeinen
2023-04-21 12:44 ` [PATCH v4 1/8] v4l2-ctl: Add routing and streams support Tomi Valkeinen
2023-04-24  7:04   ` Laurent Pinchart
2023-05-29  7:02     ` Tomi Valkeinen
2023-05-29  7:47       ` Laurent Pinchart
2023-04-21 12:44 ` [PATCH v4 2/8] media-ctl: Add support for routes and streams Tomi Valkeinen
2023-04-24  7:29   ` Laurent Pinchart
2023-05-29  7:34     ` Tomi Valkeinen
2023-05-29  7:49       ` Laurent Pinchart [this message]
2023-05-29  8:14         ` Tomi Valkeinen
2023-04-21 12:44 ` [PATCH v4 3/8] v4l2-ctl/compliance: Add routing and streams multiplexed streams Tomi Valkeinen
2023-04-21 12:44 ` [PATCH v4 4/8] v4l2-ctl/compliance: Add simple routing test Tomi Valkeinen
2023-04-24  8:04   ` Laurent Pinchart
2023-04-21 12:44 ` [PATCH v4 5/8] HACK: include/linux: Add client capabilities Tomi Valkeinen
2023-04-24  7:32   ` Laurent Pinchart
2023-05-25 14:05     ` Hans Verkuil
2023-05-26  8:19       ` Tomi Valkeinen
2023-04-21 12:44 ` [PATCH v4 6/8] media-ctl: Check for Streams API support Tomi Valkeinen
2023-04-24  7:54   ` Laurent Pinchart
2023-04-21 12:44 ` [PATCH v4 7/8] utils/common: Set V4L2_SUBDEV_CLIENT_CAP_STREAMS for subdevs Tomi Valkeinen
2023-04-24  8:01   ` Laurent Pinchart
2023-04-21 12:44 ` [PATCH v4 8/8] v4l2-ctl: Check for Streams API support Tomi Valkeinen
2023-04-24  8:03   ` 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=20230529074958.GF25984@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=sakari.ailus@linux.intel.com \
    --cc=satish.nagireddy@getcruise.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox