Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp190491imm; Thu, 6 Sep 2018 00:24:41 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb2AttqmViz3MOuxbr9b9PILA4gKL/GwiyDWsi0P4asKSTnpIRVLPlTlXs5GCO35Bw1ETBB X-Received: by 2002:a63:ea49:: with SMTP id l9-v6mr1380432pgk.427.1536218681485; Thu, 06 Sep 2018 00:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536218681; cv=none; d=google.com; s=arc-20160816; b=vMJj6Kaw0fz5agRYf9nBv4cvo1ab+RaW8BX8QLQF73xFk5kgGeEsIjnMvUvGeCK73d I0CzGbPPeRcSSk986T0gEp7r1BMUNIKI4RkTIpMoxN4oqai6AiQLlThwxkJBHAzw9DeJ F5dTXFc0vxqi5OUVnCRPzSXkJF2f/mADEFGUzG/55EqgWqcz9U6CjU69tqA7OYwVkhKd RMqRccwktOw1fssv0J5svAh9jlLf018ZIm1/W9iPV/yGexm1Srik/k1tVazZZeEMFrPS UlCvbuMtGVcOLsXLhbdQU/MviBhB5Qq7F3emscJ0SCnd9F0ha8GrLTmxbZ9j3wBDtsHt 1Z7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=b2w2q4ZdzCLoPVq1paF0wdKaybeyQgCQpY+mTzF1wRs=; b=Efz12FkKYIs/oZGtlrUOD0eQeIrDgVt/ptsfvPMTGrXvejgNOpxI3IsWJilIaTSksm EttFjJzelyx4AhzikQxxeiA4ZchTdBl/TLebaaYAkTWLGDjQbhwDGSbkNsIL+OifoFHR AtuUli1WxE/nLKmkfUM4kA4+LcOrhogGWqD9ace4GorWuq/D9JUI7JB8QqRXpuY/+IIn 9zsC6OMajN+DOdttuVVaZd+Q65EQIWcf14qa0RDN94KXmMuS3YYcLKFPf/2Jz8DuhuRq 66arsJfXYoGrtiAmlJiXlNGdPfw+mAPeVZpZAZNVftxCTrmxlsrClftVHhyGiyF2L3PP lLzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m10-v6si4453312pfe.133.2018.09.06.00.24.25; Thu, 06 Sep 2018 00:24:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727675AbeIFL4h (ORCPT + 99 others); Thu, 6 Sep 2018 07:56:37 -0400 Received: from lb1-smtp-cloud8.xs4all.net ([194.109.24.21]:51135 "EHLO lb1-smtp-cloud8.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725880AbeIFL4g (ORCPT ); Thu, 6 Sep 2018 07:56:36 -0400 Received: from [192.168.2.10] ([212.251.195.8]) by smtp-cloud8.xs4all.net with ESMTPA id xocWfLcmYxO9BxocZf3zih; Thu, 06 Sep 2018 09:22:32 +0200 Subject: Re: [PATCH v8 4/8] media: platform: Add Cedrus VPU decoder driver From: Hans Verkuil To: Paul Kocialkowski , 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 , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Greg Kroah-Hartman , Thomas Petazzoni , Randy Li , Ezequiel Garcia , Tomasz Figa , Alexandre Courbot , Philipp Zabel , Laurent Pinchart , Sakari Ailus , linux-sunxi@googlegroups.com References: <20180828073424.30247-1-paul.kocialkowski@bootlin.com> <20180828073424.30247-5-paul.kocialkowski@bootlin.com> <5faf5eed-eb2c-f804-93e3-5a42f6204d99@xs4all.nl> <461c6a0d-a346-b9da-b75e-4aab907054df@xs4all.nl> Message-ID: <890469f8-434f-4ca1-ec95-20542610fd78@xs4all.nl> Date: Thu, 6 Sep 2018 09:22:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <461c6a0d-a346-b9da-b75e-4aab907054df@xs4all.nl> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfCT1FxqL86hj96ymA3J4QeQdem3Ugbk5x7JBQkFre3JmZx8fu2o99dz3IiXiFK45AvtRKp+KOFtmMRbTXBnsu1tbJtjlnIiAbiOm5EDKwKjIHuAa3C4g lo4EsKyDQKXuyMKzF6evmpuckDFiBl9J+7Mmi0lH7nI/U5z6MnNiiZ5d4lrrF0q9yX6tZhisIW0UoZmLuNOpjNrlaCvOW+x6YN/Lu3nDZ8setJqGjOXoh4u0 Mn82u+/c2XMxtGxFBVaIjk+iBvOzf2LvLdZuzUAF0vHrQWTYugahLCzyY7c7Dbj+u9Kk1oXNM8SCSLprPmOKlPti71e/fbxN5fxhu+D+wNyQXCZ62nEijAFo xecnjYj1djjvjSfCboG845ra8/LPTO3g1GmjJgqwhodPltkba9eRYQ9D8pErQV30asktAPJOtnPUuUAWyhXapmPaxxLQGzLmDfRhf9SdlPDj4GxKORXPrZi6 R5abVTZY2JEqHF2cHobtyIZZfTW9w51JjQMFeJGRQVqyVXP/PGSLHfattfDPuXen2zNmSBte68JFVtAqfH9xX85nkMeAaoJqAxHIfKLcYlFw1DV3wPcQIuzy guSX1/KgnUAEujLPADROAdvQSJ2o1opGekSK+8e3Yb6WDl9jZmEfsHzS2wa7fsfT8pH85RAze27S8TKBfm0t4ExuhgMLF6rFgOnAooTxnRLtP2qi2xe+JcKy DFXJh7YqHi7OppFm8NWE4QPD/2NDbA+t6iEt9WcbNNFqu2KClYkKriNlWMlcwz9QW/s4KDDI4e0BiwSskwJrG19JB6Lmr9cNS+g3t0k6ZHWgY+HmLsn6860k LsUnKOD7GA5alBkoulms36UAkksdqQQVLMZdxpn9nCrb8+CGRLULrpoBVwgSuq0wCJvNJsiAsa7RP5JlJ38= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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