From: Paul Kocialkowski <contact@paulk.fr>
To: Hans Verkuil <hverkuil@xs4all.nl>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Chen-Yu Tsai <wens@csie.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
linux-sunxi@googlegroups.com, Randy Li <ayaka@soulik.info>,
Ezequiel Garcia <ezequiel@collabora.com>,
Tomasz Figa <tfiga@chromium.org>,
Alexandre Courbot <acourbot@chromium.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH v9 5/9] media: platform: Add Cedrus VPU decoder driver
Date: Fri, 07 Sep 2018 17:24:40 +0200 [thread overview]
Message-ID: <84cd11cd7efd2301ee70e92a71bd915d2f38c41e.camel@paulk.fr> (raw)
In-Reply-To: <4b30c0bf-e525-1868-f625-569d4a104aa0@xs4all.nl>
[-- Attachment #1: Type: text/plain, Size: 6503 bytes --]
Hi,
Le vendredi 07 septembre 2018 à 15:13 +0200, Hans Verkuil a écrit :
> On 09/07/2018 12:24 AM, Paul Kocialkowski wrote:
> > From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> >
> > This introduces the Cedrus VPU driver that supports the VPU found in
> > Allwinner SoCs, also known as Video Engine. It is implemented through
> > a V4L2 M2M decoder device and a media device (used for media requests).
> > So far, it only supports MPEG-2 decoding.
> >
> > Since this VPU is stateless, synchronization with media requests is
> > required in order to ensure consistency between frame headers that
> > contain metadata about the frame to process and the raw slice data that
> > is used to generate the frame.
> >
> > This driver was made possible thanks to the long-standing effort
> > carried out by the linux-sunxi community in the interest of reverse
> > engineering, documenting and implementing support for the Allwinner VPU.
> >
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> > Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
>
> One high-level comment:
>
> Can you add a TODO file for this staging driver? This can be done in
> a follow-up patch.
Definitely, I'll do that soon!
> It should contain what needs to be done to get this out of staging:
>
> - Request API needs to stabilize
> - Userspace support for stateless codecs must be created
> - Ideally one other stateless decoder driver and at least one
> stateless encoder driver should be implemented to ensure that nothing
> was forgotten in the Request API.
> - Anything else?
I still fell rather unsure about the codec metadata controls, so it
would be good to wait for more feedback on that specific point too.
They definitely fit our driver's needs and I also checked them against
the spec to spot missing elements, but I'm still worried I might have
missed something relevant there. Are there use cases currently not
covered by their current verison?
> And a few last code comments:
>
> > ---
> > MAINTAINERS | 7 +
> > drivers/staging/media/Kconfig | 2 +
> > drivers/staging/media/Makefile | 1 +
> > drivers/staging/media/sunxi/Kconfig | 15 +
> > drivers/staging/media/sunxi/Makefile | 1 +
> > drivers/staging/media/sunxi/cedrus/Kconfig | 14 +
> > drivers/staging/media/sunxi/cedrus/Makefile | 3 +
> > drivers/staging/media/sunxi/cedrus/cedrus.c | 422 ++++++++++++++
> > drivers/staging/media/sunxi/cedrus/cedrus.h | 165 ++++++
> > .../staging/media/sunxi/cedrus/cedrus_dec.c | 70 +++
> > .../staging/media/sunxi/cedrus/cedrus_dec.h | 27 +
> > .../staging/media/sunxi/cedrus/cedrus_hw.c | 322 +++++++++++
> > .../staging/media/sunxi/cedrus/cedrus_hw.h | 30 +
> > .../staging/media/sunxi/cedrus/cedrus_mpeg2.c | 237 ++++++++
> > .../staging/media/sunxi/cedrus/cedrus_regs.h | 233 ++++++++
> > .../staging/media/sunxi/cedrus/cedrus_video.c | 544 ++++++++++++++++++
> > .../staging/media/sunxi/cedrus/cedrus_video.h | 30 +
> > 17 files changed, 2123 insertions(+)
> > create mode 100644 drivers/staging/media/sunxi/Kconfig
> > create mode 100644 drivers/staging/media/sunxi/Makefile
> > create mode 100644 drivers/staging/media/sunxi/cedrus/Kconfig
> > create mode 100644 drivers/staging/media/sunxi/cedrus/Makefile
> > create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus.c
> > create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus.h
> > create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_dec.c
> > create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_dec.h
> > create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> > create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_hw.h
> > create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c
> > create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_regs.h
> > create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_video.c
> > create mode 100644 drivers/staging/media/sunxi/cedrus/cedrus_video.h
> >
>
> <snip>
>
> > +static int cedrus_request_validate(struct media_request *req)
> > +{
> > + struct media_request_object *obj;
> > + struct v4l2_ctrl_handler *parent_hdl, *hdl;
> > + struct cedrus_ctx *ctx = NULL;
> > + struct v4l2_ctrl *ctrl_test;
> > + unsigned int i;
> > +
> > + if (vb2_request_buffer_cnt(req) != 1)
> > + return -ENOENT;
>
> I would return ENOENT if there are no buffers, and EINVAL if there are too
> many. Returning ENOENT in the latter case would be very confusing.
>
> I also highly recommend that you add v4l2_info lines for these errors.
Yes that seems much clearer. I'll send that as a follow-up patch.
> > +
> > + list_for_each_entry(obj, &req->objects, list) {
> > + struct vb2_buffer *vb;
> > +
> > + if (vb2_request_object_is_buffer(obj)) {
> > + vb = container_of(obj, struct vb2_buffer, req_obj);
> > + ctx = vb2_get_drv_priv(vb->vb2_queue);
> > +
> > + break;
> > + }
> > + }
> > +
> > + if (!ctx)
> > + return -ENOENT;
> > +
> > + parent_hdl = &ctx->hdl;
> > +
> > + hdl = v4l2_ctrl_request_hdl_find(req, parent_hdl);
> > + if (!hdl) {
> > + v4l2_err(&ctx->dev->v4l2_dev, "Missing codec control(s)\n");
>
> Should be v4l2_info: it is not a driver error, it is just an info message.
Oh, my mistake.
> > + return -ENOENT;
> > + }
> > +
> > + for (i = 0; i < CEDRUS_CONTROLS_COUNT; i++) {
> > + if (cedrus_controls[i].codec != ctx->current_codec ||
> > + !cedrus_controls[i].required)
> > + continue;
> > +
> > + ctrl_test = v4l2_ctrl_request_hdl_ctrl_find(hdl,
> > + cedrus_controls[i].id);
> > + if (!ctrl_test) {
> > + v4l2_err(&ctx->dev->v4l2_dev,
> > + "Missing required codec control\n");
>
> Ditto.
>
> > + return -ENOENT;
> > + }
> > + }
> > +
> > + v4l2_ctrl_request_hdl_put(hdl);
> > +
> > + return vb2_request_validate(req);
> > +}
>
> Not worth making a v10, but you can do this in a follow-up patch.
>
> Once I have the two follow-up patches I'll make a pull request.
Excellent! I'm really glad we're approaching the end of it.
Cheers,
Paul
--
Developer of free digital technology and hardware support.
Website: https://www.paulk.fr/
Coding blog: https://code.paulk.fr/
Git repositories: https://git.paulk.fr/ https://git.code.paulk.fr/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-09-07 15:25 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-06 22:24 [PATCH v9 0/9] Cedrus driver for the Allwinner Video Engine, using media requests Paul Kocialkowski
2018-09-06 22:24 ` [PATCH v9 1/9] media: videobuf2-core: Rework and rename helper for request buffer count Paul Kocialkowski
2018-09-06 22:24 ` [PATCH v9 2/9] media: v4l: Add definitions for MPEG-2 slice format and metadata Paul Kocialkowski
2018-09-10 9:41 ` Hans Verkuil
2018-09-10 9:47 ` Paul Kocialkowski
2018-09-10 10:33 ` Hans Verkuil
2018-09-10 9:45 ` Hans Verkuil
2018-09-06 22:24 ` [PATCH v9 3/9] media: v4l: Add definition for the Sunxi tiled NV12 format Paul Kocialkowski
2018-09-06 22:24 ` [PATCH v9 4/9] dt-bindings: media: Document bindings for the Cedrus VPU driver Paul Kocialkowski
2018-09-06 22:24 ` [PATCH v9 5/9] media: platform: Add Cedrus VPU decoder driver Paul Kocialkowski
2018-09-07 7:33 ` [linux-sunxi] " Priit Laes
2018-09-07 9:14 ` Paul Kocialkowski
2018-09-07 13:13 ` Hans Verkuil
2018-09-07 13:26 ` Maxime Ripard
2018-09-07 13:52 ` Hans Verkuil
2018-09-07 14:25 ` Maxime Ripard
2018-09-07 15:15 ` Paul Kocialkowski
2018-09-07 15:24 ` Paul Kocialkowski [this message]
2018-09-11 15:24 ` Mauro Carvalho Chehab
2018-09-11 15:46 ` Mauro Carvalho Chehab
2018-09-11 15:50 ` Mauro Carvalho Chehab
2018-09-12 7:23 ` Maxime Ripard
2018-09-12 7:56 ` Hans Verkuil
2018-09-06 22:24 ` [PATCH v9 6/9] ARM: dts: sun5i: Add Video Engine and reserved memory nodes Paul Kocialkowski
2018-09-06 22:24 ` [PATCH v9 7/9] ARM: dts: sun7i-a20: " Paul Kocialkowski
2018-09-06 22:24 ` [PATCH v9 8/9] ARM: dts: sun8i-a33: " Paul Kocialkowski
2018-09-06 22:24 ` [PATCH v9 9/9] ARM: dts: sun8i-h3: " Paul Kocialkowski
2018-09-11 8:53 ` [PATCH v9 0/9] Cedrus driver for the Allwinner Video Engine, using media requests Maxime Ripard
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=84cd11cd7efd2301ee70e92a71bd915d2f38c41e.camel@paulk.fr \
--to=contact@paulk.fr \
--cc=acourbot@chromium.org \
--cc=ayaka@soulik.info \
--cc=devel@driverdev.osuosl.org \
--cc=devicetree@vger.kernel.org \
--cc=ezequiel@collabora.com \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=mark.rutland@arm.com \
--cc=maxime.ripard@bootlin.com \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh+dt@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tfiga@chromium.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=wens@csie.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
all inboxes | Powered by JetHome®