lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <890469f8-434f-4ca1-ec95-20542610fd78@xs4all.nl>
Date:   Thu, 6 Sep 2018 09:22:28 +0200
From:   Hans Verkuil <hverkuil@...all.nl>
To:     Paul Kocialkowski <contact@...lk.fr>, 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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ