[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d581b9cc8153d063360d8cde290329f5c1786ae9.camel@paulk.fr>
Date: Fri, 07 Sep 2018 17:04:29 +0200
From: Paul Kocialkowski <contact@...lk.fr>
To: Hans Verkuil <hverkuil@...all.nl>, linux-media@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, devel@...verdev.osuosl.org
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Maxime Ripard <maxime.ripard@...tlin.com>,
Chen-Yu Tsai <wens@...e.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Randy Li <ayaka@...lik.info>,
Ezequiel Garcia <ezequiel@...labora.com>,
Tomasz Figa <tfiga@...omium.org>,
Alexandre Courbot <acourbot@...omium.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
linux-sunxi@...glegroups.com
Subject: Re: [PATCH v8 4/8] media: platform: Add Cedrus VPU decoder driver
Hi,
Le jeudi 06 septembre 2018 à 09:22 +0200, Hans Verkuil a écrit :
> On 09/06/2018 09:01 AM, Hans Verkuil wrote:
> > On 09/05/2018 06:29 PM, Paul Kocialkowski wrote:
> > > Hi and thanks for the review!
> > >
> > > Le lundi 03 septembre 2018 à 11:11 +0200, Hans Verkuil a écrit :
> > > > On 08/28/2018 09:34 AM, Paul Kocialkowski wrote:
> > > > > +static int cedrus_queue_setup(struct vb2_queue *vq, unsigned int *nbufs,
> > > > > + unsigned int *nplanes, unsigned int sizes[],
> > > > > + struct device *alloc_devs[])
> > > > > +{
> > > > > + struct cedrus_ctx *ctx = vb2_get_drv_priv(vq);
> > > > > + struct cedrus_dev *dev = ctx->dev;
> > > > > + struct v4l2_pix_format_mplane *mplane_fmt;
> > > > > + struct cedrus_format *fmt;
> > > > > + unsigned int i;
> > > > > +
> > > > > + switch (vq->type) {
> > > > > + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
> > > > > + mplane_fmt = &ctx->src_fmt;
> > > > > + fmt = cedrus_find_format(mplane_fmt->pixelformat,
> > > > > + CEDRUS_DECODE_SRC,
> > > > > + dev->capabilities);
> > > > > + break;
> > > > > +
> > > > > + case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
> > > > > + mplane_fmt = &ctx->dst_fmt;
> > > > > + fmt = cedrus_find_format(mplane_fmt->pixelformat,
> > > > > + CEDRUS_DECODE_DST,
> > > > > + dev->capabilities);
> > > > > + break;
> > > > > +
> > > > > + default:
> > > > > + return -EINVAL;
> > > > > + }
> > > > > +
> > > > > + if (!fmt)
> > > > > + return -EINVAL;
> > > > > +
> > > > > + if (fmt->num_buffers == 1) {
> > > > > + sizes[0] = 0;
> > > > > +
> > > > > + for (i = 0; i < fmt->num_planes; i++)
> > > > > + sizes[0] += mplane_fmt->plane_fmt[i].sizeimage;
> > > > > + } else if (fmt->num_buffers == fmt->num_planes) {
> > > > > + for (i = 0; i < fmt->num_planes; i++)
> > > > > + sizes[i] = mplane_fmt->plane_fmt[i].sizeimage;
> > > > > + } else {
> > > > > + return -EINVAL;
> > > > > + }
> > > > > +
> > > > > + *nplanes = fmt->num_buffers;
> > > >
> > > > This code does not take VIDIOC_CREATE_BUFFERS into account.
> > > >
> > > > If it is called from that ioctl, then *nplanes is non-zero and you need
> > > > to check if *nplanes equals fmt->num_buffers and that sizes[n] is >=
> > > > the required size of the format. If so, then return 0, otherwise return
> > > > -EINVAL.
> > >
> > > Thanks for spotting this, I'll fix it as you suggested in the next
> > > revision.
> > >
> > > > Doesn't v4l2-compliance fail on that? Or is that test skipped because this
> > > > is a decoder for which streaming is not supported (yet)?
> > >
> > > Apparently, v4l2-compliance doesn't fail since I'm getting:
> > > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
> >
> > It is tested, but only with the -s option. I'll see if I can improve the
> > tests.
>
> I've improved the tests. v4l2-compliance should now fail when run (without the
> -s option) against this driver. Can you check that that is indeed the case?
I think this wasn't being tested with v8 of the driver as no default
format was provided (for the G_FMT test), which probably led to MMAP
not being picked up in valid_memorytype. Thus the subsequent
CREATE_BUFS test was reported as not failing, but it really didn't test
much of anything.
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/
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists