From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
"Helen Koike" <helen.koike@collabora.com>,
"Hans Verkuil" <hverkuil@xs4all.nl>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v8.1 3/6] media: v4l2: Extend VIDIOC_ENUM_FMT to support MC-centric devices
Date: Wed, 29 Apr 2020 20:01:40 +0200 [thread overview]
Message-ID: <20200429200140.22a4db22@coco.lan> (raw)
In-Reply-To: <20200429163849.GK5956@pendragon.ideasonboard.com>
Em Wed, 29 Apr 2020 19:38:49 +0300
Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:
> Hi Mauro,
>
> On Wed, Apr 29, 2020 at 06:27:39PM +0200, Mauro Carvalho Chehab wrote:
> > Em Fri, 24 Apr 2020 16:43:31 +0300 Laurent Pinchart escreveu:
> >
> > > The VIDIOC_ENUM_FMT ioctl enumerates all formats supported by a video
> > > node. For MC-centric devices, its behaviour has always been ill-defined,
> > > with drivers implementing one of the following behaviours:
> > >
> >
> > ...
> >
> > The patch itself is OK. However, there's a change you did at the
> > documentation that it is unrelated.
> >
> > See below.
> >
> > > diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst
> > > index 8ca6ab701e4a..a987debc7654 100644
> > > --- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst
> > > +++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst
> > > @@ -48,10 +48,21 @@ one until ``EINVAL`` is returned. If applicable, drivers shall return
> > > formats in preference order, where preferred formats are returned before
> > > (that is, with lower ``index`` value) less-preferred formats.
> > >
> > > -.. note::
> > > - After switching input or output the list of enumerated image
> > > - formats may be different.
> >
> > Why are you dropping this note?
> >
> > This basically reverts this changeset:
> >
> > commit 93828d6438081649e81b8681df9bf6ad5d691650
> > Author: Hans Verkuil <hans.verkuil@cisco.com>
> > Date: Mon Sep 3 09:37:18 2012 -0300
> >
> > [media] DocBook: make the G/S/TRY_FMT specification more strict
> >
> > - S/TRY_FMT should always succeed, unless an invalid type field is passed in.
> > - TRY_FMT should give the same result as S_FMT, all other things being equal.
> > - ENUMFMT may return different formats for different inputs or outputs.
> > This was decided during the 2012 Media Workshop.
> >
> > Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> > Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> > Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
> >
> > As far as I remember, from our 2012 discussions, some drivers may change
> > the enumerated image formats when some ioctls like VIDIOC_S_INPUT and
> > VIDIOC_S_OUTPUT ioctls are used. I also vaguely remember that 90 and 270
> > degrees rotation would equally affect it.
> >
> > Perhaps, the removal was just some mistake. If so, please re-submit
> > another patch without it.
> >
> > Otherwise, if are there any good reasons for such change, and it won't
> > cause any API regressions, please place it on a separate patch, clearly
> > that.
> >
> > ... Or, maybe you felt that it won't make sense for MC-centric devices.
> > On such case, please improve the note stating it on a way that it would
> > be understandable on both MC-centric and bridge-centrid drivers.
>
> I'm not dropping the requirement, I'm rewriting it :-) The patch indeed
> removes the above, but adds the following
>
> ----
> If the driver doesn't advertise the ``V4L2_CAP_IO_MC`` :ref:`capability
> <device-capabilities>`, applications shall initialize the ``mbus_code`` field
> to zero and drivers shall ignore the value of the field. Drivers shall
> enumerate all image formats. The enumerated formats may depend on the active
> input or output of the device.
>
> If the driver advertises the ``V4L2_CAP_IO_MC`` :ref:`capability
> <device-capabilities>`, applications may initialize the ``mbus_code`` field to
> a valid :ref:`media bus format code <v4l2-mbus-pixelcode>`. If the
> ``mbus_code`` field is not zero, drivers shall restrict enumeration to only the
> image formats that can produce (for video output devices) or be produced from
> (for video capture devices) that media bus code. Regardless of the value of
> the ``mbus_code`` field, the enumerated image formats shall not depend on the
> active configuration of the video device or device pipeline. Enumeration shall
> otherwise operate as previously described.
Hmm... it took me re-reading this text 4 or 5 times, in order to understand
that you're actually meaning bridge-centric devices here :-)
Also, you placed two independent and unrelated information at the same
paragraph.
IMHO, you should let it more clear, like, for example adding a numerated
list, like:
1. Bridge-centric devices
As such devices don't advertise the ``V4L2_CAP_IO_MC`` :ref:`capability
<device-capabilities>`, applications shall initialize the ``mbus_code`` field
to zero and drivers shall ignore the value of the field.
Drivers shall enumerate all image formats. The enumerated formats may depend
on the active input or output of the device.
2. MC-centric devices
As such devices advertise the ``V4L2_CAP_IO_MC`` :ref:`capability
<device-capabilities>`, applications may initialize the ``mbus_code`` field to
a valid :ref:`media bus format code <v4l2-mbus-pixelcode>`.
If the ``mbus_code`` field is not zero, drivers shall restrict enumeration to
only the image formats that can produce (for video output devices) or be produced
from (for video capture devices) that media bus code.
Regardless of the value of the ``mbus_code`` field, the enumerated image formats
shall not depend on the active configuration of the video device or device
pipeline. Enumeration shall otherwise operate as previously described.
-
On a side note: can a MC-centric device fill ``mbus_code`` field with zero?
The second paragraph seems to contradict the first one with mandates that
``mbus_code`` should be a valid format.
> ----
>
> Note the last sentence for the !V4L2_CAP_IO_MC case:
>
> "The enumerated formats may depend on the active input or output of the
> device."
>
> We can extend it with
>
> "The enumerated formats may depend on the active input or output of the
> device, switching the input or output may thus produce different lists
> of enumerated formats."
That sounds better, but "may" seems to weak for my taste. So, I would
also add:
Applications should (re)call VIDIOC_ENUM_FMT after changing the ative
input or output of the device.
>
> I think it's a bit overkill as it's saying the same thing twice, but if
> you prefer that, I'm fine with it.
>
> For the V4L2_CAP_IO_MC case there's no .s_input() or .s_output(), so the
> note isn't applicable.
Ok.
Thanks,
Mauro
next prev parent reply other threads:[~2020-04-29 18:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-21 13:57 [PATCH v8 0/6] v4l2-dev/ioctl: Add V4L2_CAP_IO_MC Niklas Söderlund
2020-04-21 13:57 ` [PATCH v8 1/6] " Niklas Söderlund
2020-04-21 13:57 ` [PATCH v8 2/6] media: pci: Fill v4l2_fmtdesc with designated initializers Niklas Söderlund
2020-04-21 13:57 ` [PATCH v8 3/6] media: v4l2: Extend VIDIOC_ENUM_FMT to support MC-centric devices Niklas Söderlund
2020-04-22 17:26 ` Sakari Ailus
2020-04-23 10:38 ` Hans Verkuil
2020-04-24 13:43 ` [PATCH v8.1 " Laurent Pinchart
2020-04-29 16:27 ` Mauro Carvalho Chehab
2020-04-29 16:38 ` Laurent Pinchart
2020-04-29 18:01 ` Mauro Carvalho Chehab [this message]
2020-04-29 18:50 ` Laurent Pinchart
2020-04-29 19:46 ` Mauro Carvalho Chehab
2020-04-29 20:08 ` Sakari Ailus
2020-05-05 14:27 ` Hans Verkuil
2020-05-06 9:53 ` Mauro Carvalho Chehab
2020-05-06 9:51 ` Mauro Carvalho Chehab
2020-04-21 13:57 ` [PATCH v8 4/6] rcar-vin: Make use of V4L2_CAP_IO_MC Niklas Söderlund
2020-04-21 13:57 ` [PATCH v8 5/6] staging/intel-ipu3: " Niklas Söderlund
2020-04-21 13:57 ` [PATCH v8 6/6] vimc: " Niklas Söderlund
2020-04-22 17:22 ` [PATCH v8 0/6] v4l2-dev/ioctl: Add V4L2_CAP_IO_MC Laurent Pinchart
2020-04-23 9:46 ` Hans Verkuil
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=20200429200140.22a4db22@coco.lan \
--to=mchehab+huawei@kernel.org \
--cc=helen.koike@collabora.com \
--cc=hverkuil@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=sakari.ailus@linux.intel.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.