Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp192457imm; Thu, 6 Sep 2018 00:27:41 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb2WMPP5Tt0PHwSz5wwdyJXtwdgp2eFXaznpS4boYoztDsrV+D/d3T3eHmW0+ti7BKhgi9+ X-Received: by 2002:a63:4c54:: with SMTP id m20-v6mr1434377pgl.292.1536218861546; Thu, 06 Sep 2018 00:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536218861; cv=none; d=google.com; s=arc-20160816; b=PLtgoXDg2JjQHl58MhyUWZorG7M04i+BUn2sLvWxaJvFlv+b8j5N3Kl76dAcpSHyHc oMabqTXQfz3AYom/lLOneUR8YLbhQbQFeSCll+5J7hqMiM5bPGUArmql7x7Z3JlKqg3d oeIQg0CybXMycJ2Sda6w3COW1ExO8+AIqdRXoDG/A2ZlbEGyAX/umf1LTUw/2wltgg5A P5FT/vSPrEEJ3uCbetHTmekxbPySmPcyxwW5U/sxCwUZ9ioxhYSue/90ApJioMWzS+A4 A7+KcQhFkvVF0gdCTyvNccZrlgCFMt0uab7H9jvxpbWPAuqx3a4uYtpRqicmGLu47gPx ncLw== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=nMvTPCEEPO4gDpUADidkTsjZUR9Y8z+zhHwqwM6Xxrs=; b=wSaqwLi0oY5/a+9IMu71LqXhRD6ymcLky8dJLK2SqMbm70MXiCq3nlFKtg1QHc0X5G UtiiYUPJF7nEQKBISsPsJke6yMNC4hfDuzMIdEEtZvQm4cKKve0IjKl+lDkaDhqpRbJh aVT6Xh4HS5NJajQn5AsT7i1j20yuiF1UiQwXl4t03J6D3Tm9PLJQFfWD8PJqxnjYWYjQ gaIvRKT+8NawT2FzYHofJHZMQ4C0QYsYbFJl0By96nMpEwIvILfpQ6RNiab3DWOGQl50 7+t6F4bdYL4z36VcNxxSOwNl+8JevsMcQmENQ5s7pZAHkAXR2wmUYLb7PpnCIhI/3zle H/Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=S8lJ+QIS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h126-v6si4893386pfe.72.2018.09.06.00.27.26; Thu, 06 Sep 2018 00:27: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; dkim=pass header.i=@chromium.org header.s=google header.b=S8lJ+QIS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727773AbeIFL7w (ORCPT + 99 others); Thu, 6 Sep 2018 07:59:52 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:34962 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726444AbeIFL7w (ORCPT ); Thu, 6 Sep 2018 07:59:52 -0400 Received: by mail-yb1-f196.google.com with SMTP id o17-v6so3752970yba.2 for ; Thu, 06 Sep 2018 00:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=nMvTPCEEPO4gDpUADidkTsjZUR9Y8z+zhHwqwM6Xxrs=; b=S8lJ+QISVo4tcWLlryQl15GAkSgT0+tcVayzntzxAm2aGmTsle0Qtrv3pcMmJxhhYG LxEDW6W3pI8R0Pza453c/d5VQf9quIXcGyJ5jBoJdsDxbhAkFr29TXi9bncwQZKhFa1U lSG/mipx/BWwzB0R6c0y3f8LmXI4HBbEuzoaA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=nMvTPCEEPO4gDpUADidkTsjZUR9Y8z+zhHwqwM6Xxrs=; b=KwZaFoPt1Q9lhrvwnX/uyqw9XwFb2LEnbBzHZ9riKYzoA6IO9u+Dy9frpPsQQJz3em SgeFcY/UYjU7ioOb4B50A08mCRYpgl4R8FOJHhncWDln5oO9MEdistWk1YkcBU4SK92D BT2lVYwMM4ks72ow6OfTz+XeBI2A6hN1YfGlOItXM7TYb/ox44U2qC0LzRV5IXxU7UXp nAPV7PT2/tYWTgG8cgDYAlv+6NzzYcZCAu1aRWHTdJkqd4fjPGF9P4lovOr7hTWC3E7+ E+jR2a8AO8LExKZebhAOwfm6vzHewclbtMo345xXhnTU0E9RQS8XWjDXZ+5e6PtdP3Xw qxXQ== X-Gm-Message-State: APzg51AFUpMGA+xyk+4AtzH4SltoyTiBfdULmhiZpO0cJIABaf5M4Odn itRmnt+dApQCkQ8UufY9C7GUUy3KRJc= X-Received: by 2002:a25:4e57:: with SMTP id c84-v6mr632883ybb.199.1536218747381; Thu, 06 Sep 2018 00:25:47 -0700 (PDT) Received: from mail-yw1-f47.google.com (mail-yw1-f47.google.com. [209.85.161.47]) by smtp.gmail.com with ESMTPSA id y128-v6sm1511582ywf.52.2018.09.06.00.25.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 00:25:46 -0700 (PDT) Received: by mail-yw1-f47.google.com with SMTP id l189-v6so3688706ywb.10 for ; Thu, 06 Sep 2018 00:25:45 -0700 (PDT) X-Received: by 2002:a81:2804:: with SMTP id o4-v6mr679085ywo.342.1536218745540; Thu, 06 Sep 2018 00:25:45 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <461c6a0d-a346-b9da-b75e-4aab907054df@xs4all.nl> From: Tomasz Figa Date: Thu, 6 Sep 2018 16:25:34 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v8 4/8] media: platform: Add Cedrus VPU decoder driver To: Hans Verkuil Cc: contact@paulk.fr, Linux Media Mailing List , devicetree@vger.kernel.org, Linux Kernel Mailing List , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , devel@driverdev.osuosl.org, Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Greg KH , thomas.petazzoni@bootlin.com, ayaka , Ezequiel Garcia , Alexandre Courbot , Philipp Zabel , Laurent Pinchart , Sakari Ailus , linux-sunxi@googlegroups.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 6, 2018 at 4:01 PM Hans Verkuil wrote: > > On 09/05/2018 06:29 PM, Paul Kocialkowski wrote: > > Hi and thanks for the review! > > > > Le lundi 03 septembre 2018 =C3=A0 11:11 +0200, Hans Verkuil a =C3=A9cri= t : > >> On 08/28/2018 09:34 AM, Paul Kocialkowski wrote: > >>> +static int cedrus_request_validate(struct media_request *req) > >>> +{ > >>> + struct media_request_object *obj, *obj_safe; > >>> + struct v4l2_ctrl_handler *parent_hdl, *hdl; > >>> + struct cedrus_ctx *ctx =3D NULL; > >>> + struct v4l2_ctrl *ctrl_test; > >>> + unsigned int i; > >>> + > >>> + list_for_each_entry_safe(obj, obj_safe, &req->objects, list) { > >> > >> You don't need to use the _safe variant during validation. > > > > Okay, I'll use the regular one then. > > > >>> + struct vb2_buffer *vb; > >>> + > >>> + if (vb2_request_object_is_buffer(obj)) { > >>> + vb =3D container_of(obj, struct vb2_buffer, req_o= bj); > >>> + ctx =3D vb2_get_drv_priv(vb->vb2_queue); > >>> + > >>> + break; > >>> + } > >>> + } > >> > >> Interesting question: what happens if more than one buffer is queued i= n the > >> request? This is allowed by the request API and in that case the assoc= iated > >> controls in the request apply to all queued buffers. > >> > >> Would this make sense at all for this driver? If not, then you need to > >> check here if there is more than one buffer in the request and documen= t in > >> the spec that this is not allowed. > > > > Well, our driver was written with the (unformal) assumption that we > > only deal with a pair of one output and one capture buffer. So I will > > add a check for this at request validation time and document it in the > > spec. Should that be part of the MPEG-2 PIXFMT documentation (and > > duplicated for future formats we add support for)? > > Can you make a patch for vb2_request_has_buffers() in videobuf2-core.c > renaming it to vb2_request_buffer_cnt() and returning the number of buffe= rs > in the request? > > Then you can call it here to check that you have only one buffer. > > And this has to be documented with the PIXFMT. > > Multiple buffers are certainly possible in non-codec scenarios (vim2m and > vivid happily accept that), so this is an exception that should be > documented and checked in the codec driver. Hmm, isn't it still 1 buffer per 1 queue and just multiple queues included in the request? If we indeed allow multiple buffers for the same queue in a request, we shouldn't restrict this on a per-driver basis. It's definitely not a hardware limitation, since the driver could just do the same as if 2 requests with the same controls were given. Best regards, Tomasz