All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Paul Kocialkowski <contact@paulk.fr>,
	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>,
	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>,
	linux-sunxi@googlegroups.com
Subject: Re: [PATCH v8 4/8] media: platform: Add Cedrus VPU decoder driver
Date: Thu, 6 Sep 2018 09:22:28 +0200	[thread overview]
Message-ID: <890469f8-434f-4ca1-ec95-20542610fd78@xs4all.nl> (raw)
In-Reply-To: <461c6a0d-a346-b9da-b75e-4aab907054df@xs4all.nl>

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?

Thanks!

	Hans

WARNING: multiple messages have this Message-ID (diff)
From: Hans Verkuil <hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
To: Paul Kocialkowski <contact-W9ppeneeCTY@public.gmane.org>,
	linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org
Cc: Mauro Carvalho Chehab
	<mchehab-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Maxime Ripard
	<maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
	Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	Thomas Petazzoni
	<thomas.petazzoni-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
	Randy Li <ayaka-xPW3/0Ywev/iB9QmIjCX8w@public.gmane.org>,
	Ezequiel Garcia
	<ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>,
	Tomasz Figa <tfiga-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Alexandre Courbot
	<acourbot-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Philipp Zabel <p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	Laurent Pinchart
	<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>,
	Sakari Ailus
	<sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: [PATCH v8 4/8] media: platform: Add Cedrus VPU decoder driver
Date: Thu, 6 Sep 2018 09:22:28 +0200	[thread overview]
Message-ID: <890469f8-434f-4ca1-ec95-20542610fd78@xs4all.nl> (raw)
In-Reply-To: <461c6a0d-a346-b9da-b75e-4aab907054df-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>

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?

Thanks!

	Hans

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: hverkuil@xs4all.nl (Hans Verkuil)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 4/8] media: platform: Add Cedrus VPU decoder driver
Date: Thu, 6 Sep 2018 09:22:28 +0200	[thread overview]
Message-ID: <890469f8-434f-4ca1-ec95-20542610fd78@xs4all.nl> (raw)
In-Reply-To: <461c6a0d-a346-b9da-b75e-4aab907054df@xs4all.nl>

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?

Thanks!

	Hans

  reply	other threads:[~2018-09-06  7:22 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28  7:34 [PATCH v8 0/8] Cedrus driver for the Allwinner Video Engine, using media requests Paul Kocialkowski
2018-08-28  7:34 ` Paul Kocialkowski
2018-08-28  7:34 ` Paul Kocialkowski
2018-08-28  7:34 ` [PATCH v8 1/8] media: v4l: Add definitions for MPEG2 slice format and metadata Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-09-03  8:32   ` Hans Verkuil
2018-09-03  8:32     ` Hans Verkuil
2018-09-03  8:32     ` Hans Verkuil
2018-09-05 15:42     ` Paul Kocialkowski
2018-09-05 15:42       ` Paul Kocialkowski
2018-09-05 15:42       ` Paul Kocialkowski
2018-08-28  7:34 ` [PATCH v8 2/8] media: v4l: Add definition for the Sunxi tiled NV12 format Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28  7:34 ` [PATCH v8 3/8] dt-bindings: media: Document bindings for the Cedrus VPU driver Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28 14:44   ` Maxime Ripard
2018-08-28 14:44     ` Maxime Ripard
2018-08-28 14:47   ` [linux-sunxi] " Corentin Labbe
2018-08-28 14:47     ` Corentin Labbe
2018-08-28 14:47     ` Corentin Labbe
2018-09-05 15:43     ` [linux-sunxi] " Paul Kocialkowski
2018-09-05 15:43       ` Paul Kocialkowski
2018-09-05 15:43       ` Paul Kocialkowski
2018-08-28  7:34 ` [PATCH v8 4/8] media: platform: Add Cedrus VPU decoder driver Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28 14:56   ` Maxime Ripard
2018-08-28 14:56     ` Maxime Ripard
2018-08-28 14:56     ` Maxime Ripard
2018-08-29  1:08   ` Ezequiel Garcia
2018-08-29  1:08     ` Ezequiel Garcia
2018-09-05 15:49     ` Paul Kocialkowski
2018-09-05 15:49       ` Paul Kocialkowski
2018-09-05 15:49       ` Paul Kocialkowski
2018-09-03  9:11   ` Hans Verkuil
2018-09-03  9:11     ` Hans Verkuil
2018-09-03  9:11     ` Hans Verkuil
2018-09-05 16:29     ` Paul Kocialkowski
2018-09-05 16:29       ` Paul Kocialkowski
2018-09-05 16:29       ` Paul Kocialkowski
2018-09-06  7:01       ` Hans Verkuil
2018-09-06  7:01         ` Hans Verkuil
2018-09-06  7:01         ` Hans Verkuil
2018-09-06  7:22         ` Hans Verkuil [this message]
2018-09-06  7:22           ` Hans Verkuil
2018-09-06  7:22           ` Hans Verkuil
2018-09-07 15:04           ` Paul Kocialkowski
2018-09-07 15:04             ` Paul Kocialkowski
2018-09-07 15:04             ` Paul Kocialkowski
2018-09-06  7:25         ` Tomasz Figa
2018-09-06  7:25           ` Tomasz Figa
2018-09-06  7:25           ` Tomasz Figa
2018-09-06  7:39           ` Hans Verkuil
2018-09-06  7:39             ` Hans Verkuil
2018-09-06  7:39             ` Hans Verkuil
2018-09-07  8:05             ` Tomasz Figa
2018-09-07  8:05               ` Tomasz Figa
2018-09-07  8:05               ` Tomasz Figa
2018-08-28  7:34 ` [PATCH v8 5/8] ARM: dts: sun5i: Add Video Engine and reserved memory nodes Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28 14:55   ` Maxime Ripard
2018-08-28 14:55     ` Maxime Ripard
2018-08-28 14:55     ` Maxime Ripard
2018-08-28  7:34 ` [PATCH v8 6/8] ARM: dts: sun7i-a20: " Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28 14:55   ` Maxime Ripard
2018-08-28 14:55     ` Maxime Ripard
2018-08-28 14:55     ` Maxime Ripard
2018-08-28  7:34 ` [PATCH v8 7/8] ARM: dts: sun8i-a33: " Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28 14:55   ` Maxime Ripard
2018-08-28 14:55     ` Maxime Ripard
2018-08-28  7:34 ` [PATCH v8 8/8] ARM: dts: sun8i-h3: " Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28  7:34   ` Paul Kocialkowski
2018-08-28 14:55   ` Maxime Ripard
2018-08-28 14:55     ` Maxime Ripard
2018-08-28 14:55     ` 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=890469f8-434f-4ca1-ec95-20542610fd78@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=acourbot@chromium.org \
    --cc=ayaka@soulik.info \
    --cc=contact@paulk.fr \
    --cc=devel@driverdev.osuosl.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ezequiel@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --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 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.