public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Daniel Scally <dan.scally@ideasonboard.com>
Cc: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com,
	tomi.valkeinen@ideasonboard.com
Subject: Re: [PATCH 1/2] v4l2-ctl: Add --try-routing option
Date: Wed, 17 Jan 2024 15:21:50 +0200	[thread overview]
Message-ID: <20240117132150.GF4860@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20240117130805.939312-1-dan.scally@ideasonboard.com>

Hi Dan,

Thank you for the patch.

On Wed, Jan 17, 2024 at 01:08:04PM +0000, Daniel Scally wrote:
> v4l2-ctl's --list-subdev-mbus-codes option sets the which flag to
> V4L2_SUBDEV_FORMAT_TRY, which is an entirely reasonable choice, but
> means it's currently impossible to list mbus codes for pads that are
> only part of inactive routes as the --set-routing option sets ACTIVE
> routing rather than TRY.
> 
> Add a --try-routing option that has identical functionality to the
> existing --set-routing but which uses the TRY format instead.

I don't think this will help fixing your problem. They TRY context is
local to the file handle, v4l2-ctl will never seen the TRY routes you
set here.

> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
> ---
>  utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 11 +++++++----
>  utils/v4l2-ctl/v4l2-ctl.cpp        |  1 +
>  utils/v4l2-ctl/v4l2-ctl.h          |  1 +
>  3 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
> index 86e6c689..48b79288 100644
> --- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
> +++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
> @@ -96,7 +96,8 @@ void subdev_usage()
>  	       "  --set-subdev-fps pad=<pad>,stream=<stream>,fps=<fps> (for testing only, otherwise use media-ctl)\n"
>  	       "                     set the frame rate [VIDIOC_SUBDEV_S_FRAME_INTERVAL]\n"
>  	       "  --get-routing      Print the route topology\n"
> -	       "  --set-routing <routes>\n"
> +	       "  --set-routing      (for testing only, otherwise use media-ctl)\n"
> +	       "  --try-routing <routes>\n"
>  	       "                     Comma-separated list of route descriptors to setup\n"
>  	       "\n"
>  	       "Routes are defined as\n"
> @@ -458,14 +459,16 @@ void subdev_cmd(int ch, char *optarg)
>  			}
>  		}
>  		break;
> -	case OptSetRouting: {
> +	case OptSetRouting:
> +	case OptTryRouting: {
>  		struct v4l2_subdev_route *r;
>  		char *end, *ref, *tok;
>  		unsigned int flags;
>  
>  		memset(&routing, 0, sizeof(routing));
>  		memset(routes, 0, sizeof(routes[0]) * NUM_ROUTES_MAX);
> -		routing.which = V4L2_SUBDEV_FORMAT_ACTIVE;
> +		routing.which = ch == OptSetRouting ? V4L2_SUBDEV_FORMAT_ACTIVE :
> +				      V4L2_SUBDEV_FORMAT_TRY;
>  		routing.num_routes = 0;
>  		routing.routes = (__u64)routes;
>  
> @@ -683,7 +686,7 @@ void subdev_set(cv4l_fd &_fd)
>  					fival.interval.denominator, fival.interval.numerator);
>  		}
>  	}
> -	if (options[OptSetRouting]) {
> +	if (options[OptSetRouting] || options[OptTryRouting]) {
>  		if (!_fd.has_streams()) {
>  			printf("Streams API not supported.\n");
>  			return;
> diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
> index e195ad8e..f9121284 100644
> --- a/utils/v4l2-ctl/v4l2-ctl.cpp
> +++ b/utils/v4l2-ctl/v4l2-ctl.cpp
> @@ -65,6 +65,7 @@ static struct option long_options[] = {
>  	{"set-fmt-video-out", required_argument, nullptr, OptSetVideoOutFormat},
>  	{"try-fmt-video-out", required_argument, nullptr, OptTryVideoOutFormat},
>  	{"get-routing", no_argument, 0, OptGetRouting},
> +	{"try-routing", required_argument, 0, OptTryRouting},
>  	{"set-routing", required_argument, 0, OptSetRouting},
>  	{"help", no_argument, nullptr, OptHelp},
>  	{"help-tuner", no_argument, nullptr, OptHelpTuner},
> diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h
> index cc7f1184..6382619c 100644
> --- a/utils/v4l2-ctl/v4l2-ctl.h
> +++ b/utils/v4l2-ctl/v4l2-ctl.h
> @@ -193,6 +193,7 @@ enum Option {
>  	OptShowEdid,
>  	OptFixEdidChecksums,
>  	OptGetRouting,
> +	OptTryRouting,
>  	OptSetRouting,
>  	OptFreqSeek,
>  	OptEncoderCmd,

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2024-01-17 13:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 13:08 [PATCH 1/2] v4l2-ctl: Add --try-routing option Daniel Scally
2024-01-17 13:08 ` [PATCH 2/2] media-ctl: Re-order setting format and routes Daniel Scally
2024-01-17 13:22   ` Laurent Pinchart
2024-01-18 10:53   ` Sakari Ailus
2024-01-17 13:18 ` [PATCH 1/2] v4l2-ctl: Add --try-routing option Dan Scally
2024-01-17 13:21 ` Laurent Pinchart [this message]
2024-01-18 10:27   ` Dan Scally
2024-01-18 10:48     ` Laurent Pinchart
2024-01-18 10:58       ` Dan Scally
2024-01-18 11:37 ` Sakari Ailus

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=20240117132150.GF4860@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.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