From: Deborah Brouwer <deborah.brouwer@collabora.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Nicolas Dufresne <nicolas.dufresne@collabora.com>,
Sebastian Fricke <sebastian.fricke@collabora.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Nas Chung <nas.chung@chipsnmedia.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Jackson Lee <jackson.lee@chipsnmedia.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
NXP Linux Team <linux-imx@nxp.com>,
Conor Dooley <conor+dt@kernel.org>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Benjamin Gaignard <benjamin.gaignard@collabora.com>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Robert Beckett <bob.beckett@collabora.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@collabora.com
Subject: Re: [PATCH v12 5/7] media: chips-media: wave5: Add the v4l2 layer
Date: Mon, 2 Oct 2023 16:51:28 -0700 [thread overview]
Message-ID: <ZRtXgMhSS3D6H3/4@db550> (raw)
In-Reply-To: <d9af2b98-8da5-4487-8125-3c68eefcf77c@xs4all.nl>
On Wed, Sep 27, 2023 at 09:19:46AM +0200, Hans Verkuil wrote:
> On 27/09/2023 01:29, Nicolas Dufresne wrote:
> > Le vendredi 22 septembre 2023 à 09:33 +0200, Hans Verkuil a écrit :
> >> On 21/09/2023 21:11, Nicolas Dufresne wrote:
> >>> Le mercredi 20 septembre 2023 à 17:13 +0200, Hans Verkuil a écrit :
> >>>> On 15/09/2023 23:11, Sebastian Fricke wrote:
> >>>>> From: Nas Chung <nas.chung@chipsnmedia.com>
> >>>>>
> >>>>> Add the decoder and encoder implementing the v4l2
> >>>>> API. This patch also adds the Makefile and the VIDEO_WAVE_VPU config
> >>>>>
> >>>>> Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
> >>>>> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> >>>>> Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
> >>>>> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
> >>>>> Signed-off-by: Nas Chung <nas.chung@chipsnmedia.com>
> >>>>> ---
> >>>>> drivers/media/platform/chips-media/Kconfig | 1 +
> >>>>> drivers/media/platform/chips-media/Makefile | 1 +
> >>>>> drivers/media/platform/chips-media/wave5/Kconfig | 12 +
> >>>>> drivers/media/platform/chips-media/wave5/Makefile | 10 +
> >>>>> .../platform/chips-media/wave5/wave5-helper.c | 196 ++
> >>>>> .../platform/chips-media/wave5/wave5-helper.h | 30 +
> >>>>> .../platform/chips-media/wave5/wave5-vpu-dec.c | 1965 ++++++++++++++++++++
> >>>>> .../platform/chips-media/wave5/wave5-vpu-enc.c | 1825 ++++++++++++++++++
> >>>>> .../media/platform/chips-media/wave5/wave5-vpu.c | 331 ++++
> >>>>> .../media/platform/chips-media/wave5/wave5-vpu.h | 83 +
> >>>>> 10 files changed, 4454 insertions(+)
> >>>>>
> >>
> >> <snip>
> >>
> >>>>> +static int wave5_vpu_dec_set_eos_on_firmware(struct vpu_instance *inst)
> >>>>> +{
> >>>>> + int ret;
> >>>>> +
> >>>>> + ret = wave5_vpu_dec_update_bitstream_buffer(inst, 0);
> >>>>> + if (ret) {
> >>>>> + dev_err(inst->dev->dev,
> >>>>> + "Setting EOS for the bitstream, fail: %d\n", ret);
> >>>>
> >>>> Is this an error due to a driver problem, or because a bad bitstream is
> >>>> fed from userspace? In the first case, dev_err would be right, in the
> >>>> second dev_dbg would be more appropriate. Bad userspace input should not
> >>>> spam the kernel log in general.
> >>>
> >>> Its the first. To set the EOS flag, a command is sent to the firmware. That
> >>> command may never return (timeout) or may report an error. For this specific
> >>> command, if that happens we are likely facing firmware of driver problem (or
> >>> both).
> >>
> >> OK, I'd add that as a comment here as this is unexpected behavior.
> >>
> >>>
> >>>>
> >>>>> + return ret;
> >>>>> + }
> >>>>> + return 0;
> >>>>> +}
> >>
> >> <snip>
> >>
> >>>>> +static int wave5_vpu_dec_create_bufs(struct file *file, void *priv,
> >>>>> + struct v4l2_create_buffers *create)
> >>>>> +{
> >>>>> + struct v4l2_format *f = &create->format;
> >>>>> +
> >>>>> + if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
> >>>>> + return -ENOTTY;
> >>>>
> >>>> Huh? Why is this needed?
> >>>
> >>> Minimally a comment should be added. The why is that we support CREATE_BUF for
> >>> OUTPUT queue (bitstream) but not for CAPTURE queues. This is simply not
> >>> supported by Wave5 firmware. Do you have any suggestion how this asymmetry can
> >>> be implemented better ?
> >>
> >> Certainly not with ENOTTY: the ioctl exists, it is just not supported for
> >> CAPTURE queues.
> >>
> >> How about -EPERM? And document this error as well in the VIDIOC_CREATE_BUFS
> >> documentation. And you want a dev_dbg here too.
> >
> > The suggestion cannot be used since there is documentation for that one already,
> > and it does not match "unsupported".
> >
> > "Permission denied. Can be returned if the device needs write permission, or
> > some special capabilities is needed (e. g. root)"
> >
> > What about using the most logical error code, which name is actually obvious,
> > like ENOTSUP ?
> >
> > #define ENOTSUPP 524 /* Operation is not supported */
> >
>
> Let's go with EOPNOTSUPP. That seems to be the more commonly used error
> code in drivers.
Hi Hans,
Sorry to belabour this issue but when I change the return value
to EOPNOTSUPP, it now causes v4l2-compliance to fail because
v4l2-test-buffers.cpp expects ENOTTY if CREATE_BUFS is not supported.
We didn't get this warning before because there was a typo in the
buffer check and it was only checking for single-planar buffers.
How would you prefer to handle this? The options seem like
keep ENOTTY in this driver or
patch v4l2-compliance to warn if it also receives EOPNOTSUPP?
>
> >>
> >> So I would propose that EPERM is returned if CREATE_BUFS is only supported
> >> for for one of the two queues of an M2M device.
> >
> > Note that userspace does not care of the difference between an ioctl not being
> > implemented at all or not being implement for one queue. GStreamer have been
> > testing with both queue type for couple of years now. Adding this distinction is
> > just leaking an implementation details to userspace. I'm fine to just do what
> > you'd like, just stating the obvious that while it may look logical inside the
> > kernel, its a bit of a non-sense for our users.
>
> I don't agree with that. If an ioctl returns ENOTTY, then userspace can be certain
> that that ioctl is not implemented for the given file descriptor. That's not the case
> here: it is implemented, the operation is just not supported for one of the queues.
>
> Regards,
>
> Hans
next prev parent reply other threads:[~2023-10-02 23:51 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 21:11 [PATCH v12 0/7] Wave5 codec driver Sebastian Fricke
2023-09-15 21:11 ` [PATCH v12 1/7] media: v4l2: Add ignore_streaming flag Sebastian Fricke
2023-09-20 12:59 ` Hans Verkuil
2023-09-20 14:08 ` Nicolas Dufresne
2023-09-20 14:49 ` Hans Verkuil
2023-09-21 18:39 ` Nicolas Dufresne
2023-09-22 8:28 ` Hans Verkuil
2023-09-22 20:20 ` Nicolas Dufresne
2023-09-25 9:03 ` Hans Verkuil
2023-09-15 21:11 ` [PATCH v12 2/7] media: v4l2: Allow M2M job queuing w/o streaming CAP queue Sebastian Fricke
2023-09-15 21:11 ` [PATCH v12 3/7] media: platform: chips-media: Move Coda to separate folder Sebastian Fricke
2023-09-15 21:11 ` [PATCH v12 4/7] media: chips-media: wave5: Add vpuapi layer Sebastian Fricke
2023-09-25 11:35 ` Benjamin Gaignard
2023-09-15 21:11 ` [PATCH v12 5/7] media: chips-media: wave5: Add the v4l2 layer Sebastian Fricke
2023-09-15 21:22 ` Sebastian Fricke
2023-09-16 20:28 ` Ivan Bornyakov
2023-09-16 20:55 ` Ivan Bornyakov
2023-09-20 15:13 ` Hans Verkuil
2023-09-21 19:11 ` Nicolas Dufresne
2023-09-22 7:33 ` Hans Verkuil
2023-09-26 23:29 ` Nicolas Dufresne
2023-09-27 7:19 ` Hans Verkuil
2023-10-02 23:51 ` Deborah Brouwer [this message]
2023-10-03 6:54 ` Hans Verkuil
2023-09-15 21:11 ` [PATCH v12 6/7] dt-bindings: media: wave5: add yaml devicetree bindings Sebastian Fricke
2023-09-15 22:16 ` Rob Herring
2023-09-17 7:56 ` Krzysztof Kozlowski
2023-09-18 6:49 ` Sebastian Fricke
2023-09-18 12:02 ` Krzysztof Kozlowski
2023-09-18 19:16 ` Nicolas Dufresne
2023-09-18 20:14 ` Krzysztof Kozlowski
2023-09-15 21:11 ` [PATCH v12 7/7] media: chips-media: wave5: Add wave5 driver to maintainers file Sebastian Fricke
2023-09-20 13:02 ` Hans Verkuil
2023-09-20 15:32 ` Sebastian Fricke
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=ZRtXgMhSS3D6H3/4@db550 \
--to=deborah.brouwer@collabora.com \
--cc=benjamin.gaignard@collabora.com \
--cc=bob.beckett@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=jackson.lee@chipsnmedia.com \
--cc=kernel@collabora.com \
--cc=kernel@pengutronix.de \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nas.chung@chipsnmedia.com \
--cc=nicolas.dufresne@collabora.com \
--cc=p.zabel@pengutronix.de \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sebastian.fricke@collabora.com \
--cc=shawnguo@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).