public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: "Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	linux-media@vger.kernel.org,
	"Akinobu Mita" <akinobu.mita@gmail.com>,
	"Andrzej Hajda" <andrzej.hajda@intel.com>,
	"Daniel Scally" <djrscally@gmail.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Jacopo Mondi" <jacopo+renesas@jmondi.org>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Kieran Bingham" <kieran.bingham+renesas@ideasonboard.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Leon Luo" <leonl@leopardimaging.com>,
	"Luca Ceresoli" <luca.ceresoli@bootlin.com>,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	"Paul Elder" <paul.elder@ideasonboard.com>,
	"Pavel Machek" <pavel@ucw.cz>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Ricardo Ribalda" <ribalda@kernel.org>,
	"Rui Miguel Silva" <rmfrfs@gmail.com>,
	"Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"Sowjanya Komatineni" <skomatineni@nvidia.com>,
	"Steve Longerbeam" <slongerbeam@gmail.com>,
	"Sylwester Nawrocki" <s.nawrocki@samsung.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>,
	linux-tegra@vger.kernel.org
Subject: Re: [PATCH v4 3/8] media: v4l2-subdev: Add which field to struct v4l2_subdev_frame_interval
Date: Mon, 11 Dec 2023 12:53:43 +0100	[thread overview]
Message-ID: <20231211125343.25e6e543@coco.lan> (raw)
In-Reply-To: <2a656afd-0ea8-4db2-a7bf-68c3a0300988@xs4all.nl>

Em Mon, 11 Dec 2023 09:59:25 +0100
Hans Verkuil <hverkuil-cisco@xs4all.nl> escreveu:

> On 09/12/2023 12:11, Laurent Pinchart wrote:
> > On Sat, Dec 09, 2023 at 06:55:01AM +0100, Mauro Carvalho Chehab wrote:  
> >> Em Fri,  8 Dec 2023 20:16:43 +0200
> >> Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:
> >>  
> >>> Due to a historical mishap, the v4l2_subdev_frame_interval structure
> >>> is the only part of the V4L2 subdev userspace API that doesn't contain a
> >>> 'which' field. This prevents trying frame intervals using the subdev
> >>> 'TRY' state mechanism.
> >>>
> >>> Adding a 'which' field is simple as the structure has 8 reserved fields.
> >>> This would however break userspace as the field is currently set to 0,
> >>> corresponding to V4L2_SUBDEV_FORMAT_TRY, while the corresponding ioctls
> >>> currently operate on the 'ACTIVE' state. We thus need to add a new
> >>> subdev client cap, V4L2_SUBDEV_CLIENT_CAP_WHICH_INTERVAL, to indicate
> >>> that userspace is aware of this new field.
> >>>
> >>> All drivers that implement the subdev .get_frame_interval() and
> >>> .set_frame_interval() operations are updated to return -EINVAL when
> >>> operating on the TRY state, preserving the current behaviour.
> >>>
> >>> While at it, fix a bad copy&paste in the documentation of the struct
> >>> v4l2_subdev_frame_interval_enum 'which' field.  
> >>
> >> The uAPI change looks ok to me. However, having to add an special
> >> logic on every client using (get/set)_time_interval seems risky,
> >> as it will require an extra check before accepting new subdev
> >> drivers.
> >>
> >> Please move such check to drivers/media/v4l2-core/v4l2-subdev.c:
> >>
> >> 	if (fi->which != V4L2_SUBDEV_FORMAT_ACTIVE)
> >> 		return -EINVAL;  
> > 
> > But then no new driver will be able to use this API. Look at patch 8/8
> > in this series, the whole point of this exercise is to support
> > V4L2_SUBDEV_FORMAT_TRY in drivers. The added checks in existing drivers
> > is because they don't support V4L2_SUBDEV_FORMAT_TRY. Moving forward,
> > the drivers that are still maintained should be converted eventually.

Then please add a FIXME note there warning that the logic there
exists just because the driver doesn't yet support V4L2_SUBDEV_FORMAT_TRY.

With that, feel free to add: 

Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>

> > All new drivers should use the V4L2 subdev active state API and support
> > V4L2_SUBDEV_FORMAT_TRY right away.  

OK.

> I agree with Laurent here. Note that the logic isn't 'special', it is standard
> handling of the 'which' field. It was never there for g/s_frame_interval
> because that was the only one that didn't have a 'which' field, but now that
> it does, the drivers need to be adapted to handle this new field.
> 
> It shouldn't be hidden in some core code, that would only confuse matters.

If the idea is to move forward without implementing support for such
features at the existing drivers, we should at least have something
annotated at the drivers that this is something that will require
further changes in the future to support the current behavior.

I also expect that the API compliance tool to produce warnings
on drivers using the old behavior.

Thanks,
Mauro

  reply	other threads:[~2023-12-11 11:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08 18:14 [PATCH v4 0/8] media: v4l2-subdev: Improve frame interval handling Laurent Pinchart
2023-12-08 18:16 ` [PATCH v4 1/8] media: v4l: subdev: Move out subdev state lock macros outside CONFIG_MEDIA_CONTROLLER Laurent Pinchart
2023-12-11  8:36   ` Hans Verkuil
2023-12-08 18:16 ` [PATCH v4 2/8] media: v4l2-subdev: Turn .[gs]_frame_interval into pad operations Laurent Pinchart
2023-12-13 10:01   ` Luca Ceresoli
2023-12-08 18:16 ` [PATCH v4 3/8] media: v4l2-subdev: Add which field to struct v4l2_subdev_frame_interval Laurent Pinchart
2023-12-09  5:55   ` Mauro Carvalho Chehab
2023-12-09 11:11     ` Laurent Pinchart
2023-12-11  8:59       ` Hans Verkuil
2023-12-11 11:53         ` Mauro Carvalho Chehab [this message]
2023-12-11 12:25           ` Hans Verkuil
2023-12-11 13:21             ` Mauro Carvalho Chehab
2023-12-11 15:07               ` Laurent Pinchart
2023-12-11 15:27                 ` Hans Verkuil
2023-12-11 15:42                   ` Laurent Pinchart
2023-12-11 15:48                     ` Laurent Pinchart
2023-12-11  8:39   ` Hans Verkuil
2023-12-13 10:14   ` Luca Ceresoli
2023-12-08 18:16 ` [PATCH v4 4/8] media: v4l2-subdev: Store frame interval in subdev state Laurent Pinchart
2023-12-08 18:16 ` [PATCH v4 5/8] media: docs: uAPI: Clarify error documentation for invalid 'which' value Laurent Pinchart
2023-12-08 18:16 ` [PATCH v4 6/8] media: docs: uAPI: Expand " Laurent Pinchart
2023-12-08 18:16 ` [PATCH v4 7/8] media: docs: uAPI: Fix documentation of 'which' field for routing ioctls Laurent Pinchart
2023-12-08 18:16 ` [PATCH v4 8/8] media: i2c: thp7312: Store frame interval in subdev state 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=20231211125343.25e6e543@coco.lan \
    --to=mchehab@kernel.org \
    --cc=akinobu.mita@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=djrscally@gmail.com \
    --cc=hansg@kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo+renesas@jmondi.org \
    --cc=jonathanh@nvidia.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=lars@metafoo.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=leonl@leopardimaging.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=p.zabel@pengutronix.de \
    --cc=paul.elder@ideasonboard.com \
    --cc=pavel@ucw.cz \
    --cc=ribalda@kernel.org \
    --cc=rmfrfs@gmail.com \
    --cc=s.nawrocki@samsung.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=skomatineni@nvidia.com \
    --cc=slongerbeam@gmail.com \
    --cc=thierry.reding@gmail.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