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 7/8] utils/common: Set V4L2_SUBDEV_CLIENT_CAP_STREAMS for subdevs
Date: Mon, 24 Apr 2023 11:01:53 +0300	[thread overview]
Message-ID: <20230424080153.GG4926@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230421124428.393261-8-tomi.valkeinen@ideasonboard.com>

Hi Tomi,

Thank you for the patch.

On Fri, Apr 21, 2023 at 03:44:27PM +0300, Tomi Valkeinen wrote:
> Do two things:
> 
> - Inform the kernel that we support streams with a call to
>   VIDIOC_SUBDEV_S_CLIENT_CAP
> 
> - Use the returns from VIDIOC_SUBDEV_S_CLIENT_CAP and
>   VIDIOC_SUBDEV_QUERYCAP to decide if streams are supported, and
>   return that via has_streams_support() method.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> ---
>  utils/common/cv4l-helpers.h |  1 +
>  utils/common/v4l-helpers.h  | 17 +++++++++++++++++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/utils/common/cv4l-helpers.h b/utils/common/cv4l-helpers.h
> index 3cee372b..502df6ac 100644
> --- a/utils/common/cv4l-helpers.h
> +++ b/utils/common/cv4l-helpers.h
> @@ -82,6 +82,7 @@ public:
>  	bool has_rw() const { return v4l_has_rw(this); }
>  	bool has_streaming() const { return v4l_has_streaming(this); }
>  	bool has_ext_pix_format() const { return v4l_has_ext_pix_format(this); }
> +	bool has_streams_support() const { return subdev_supports_streams; }

The other functions don't have a "_support" suffix, I'd write
"has_stream()".

>  
>  	int querycap(v4l2_capability &cap, bool force = false)
>  	{
> diff --git a/utils/common/v4l-helpers.h b/utils/common/v4l-helpers.h
> index c09cd987..2dd7f061 100644
> --- a/utils/common/v4l-helpers.h
> +++ b/utils/common/v4l-helpers.h
> @@ -39,6 +39,7 @@ struct v4l_fd {
>  	bool have_selection;
>  	bool is_subdev;
>  	bool is_media;
> +	bool subdev_supports_streams;

Same here, and I would probably also drop the subdev_ prefix.

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

>  
>  	int (*open)(struct v4l_fd *f, const char *file, int oflag, ...);
>  	int (*close)(struct v4l_fd *f);
> @@ -507,6 +508,12 @@ static inline int v4l_open(struct v4l_fd *f, const char *devname, bool non_block
>  
>  static inline int v4l_subdev_s_fd(struct v4l_fd *f, int fd, const char *devname)
>  {
> +	struct v4l2_subdev_client_capability clientcap = {};
> +	struct v4l2_subdev_capability subdevcap = {};
> +	bool subdev_streams;
> +	bool client_streams;
> +	int ret;
> +
>  	if (f->fd >= 0)
>  		f->close(f);
>  
> @@ -528,6 +535,16 @@ static inline int v4l_subdev_s_fd(struct v4l_fd *f, int fd, const char *devname)
>  	f->have_next_ctrl = false;
>  	f->have_selection = false;
>  
> +	ret = ioctl(f->fd, VIDIOC_SUBDEV_QUERYCAP, &subdevcap);
> +	subdev_streams = !ret && (subdevcap.capabilities & V4L2_SUBDEV_CAP_STREAMS);
> +
> +	clientcap.capabilities = V4L2_SUBDEV_CLIENT_CAP_STREAMS;
> +
> +	ret = ioctl(f->fd, VIDIOC_SUBDEV_S_CLIENT_CAP, &clientcap);
> +	client_streams = !ret && (clientcap.capabilities & V4L2_SUBDEV_CLIENT_CAP_STREAMS);
> +
> +	f->subdev_supports_streams = subdev_streams && client_streams;
> +
>  	return f->fd;
>  }
>  

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2023-04-24  8:01 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
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 [this message]
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=20230424080153.GG4926@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