Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1294285rwl; Fri, 24 Mar 2023 08:40:20 -0700 (PDT) X-Google-Smtp-Source: AKy350YiLea2U0ASUaW/oINrr9/qqVgusME3Z8Ed1bvoDscHg+/sZNkdCVfNZ9rAcqrWXXFLDDcW X-Received: by 2002:a17:907:1c21:b0:8dd:5710:a017 with SMTP id nc33-20020a1709071c2100b008dd5710a017mr4252703ejc.4.1679672419908; Fri, 24 Mar 2023 08:40:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679672419; cv=none; d=google.com; s=arc-20160816; b=fjCmOqGMnnPBb1B/QfzB0jAZPS5eJ1BgL+18b7Qexx5WyqTl1rIGxqbSKJH7CfP/mv xDTyN6ik762yy1Mc49BMjXFuOQ61td+02OApmQd56n8MEha8aZpYl+ivVajknan92hnL J7YnNVt8rO6O4muLbu2bPRDfXhanwfSXZz+lrKS6A+OjIbss5YR09Okud7D/UgZJhmlT TM31X8lbWSbMT6fIlouYlpXOsX3fHgjSlVJQak/+a/C8AphX6Am+WDgf9+PZWILUaKre vdEx3YSMJ06hs3KBAATJr84GR8uvAgQ6UNniEYEvDGFYuDpIgCpyPYxNc5x/khGdg4zD jd6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=7FyBbkUlSzWUDUg7FSl6pltsSXVFIHYA7e4KXdYYzK0=; b=LpeGuHqEMIX8I/t3fy419CqOwRbFaCTnA0HJ/tnPGoWxF8mZu7WCEqaO6eR4jPS9re BO7v72FM5i7C8s095sd/Pl1mo/XR/LvWd2EjezG626+2bbO/YbDTS3xAVzrAOjjC1Ydp T2esB399NNqjE3feHtvEeHhTr8zn5wgjfChnSj7Nbtz0Z63cL5gD2cwbUvxVWCNlEdhU IFkIoSANV1yO8MLV0j5YMTGvmvbaAbB1XYKONMQaZj8fydrr30oGi5ilbhrRnLH7nm0X h0MvRQruXoIZuf33HcNaC/KOON+5YQJFdmb3/OOOBnPFz9VmWxTQLeI1SrT9tQ7bKF/c tqLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ndufresne-ca.20210112.gappssmtp.com header.s=20210112 header.b=MeRC33lk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f24-20020a056402161800b004acb302a730si22872870edv.70.2023.03.24.08.39.54; Fri, 24 Mar 2023 08:40:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ndufresne-ca.20210112.gappssmtp.com header.s=20210112 header.b=MeRC33lk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232268AbjCXPfT (ORCPT + 99 others); Fri, 24 Mar 2023 11:35:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232517AbjCXPe6 (ORCPT ); Fri, 24 Mar 2023 11:34:58 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9555720544 for ; Fri, 24 Mar 2023 08:34:52 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id w25so1807392qtc.5 for ; Fri, 24 Mar 2023 08:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndufresne-ca.20210112.gappssmtp.com; s=20210112; t=1679672091; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=7FyBbkUlSzWUDUg7FSl6pltsSXVFIHYA7e4KXdYYzK0=; b=MeRC33lk6v1nX1CaLMpuOD7McLymhdBaxID6EIllMJ/odTnOgZ3Ls7Ufy+LF90tZc3 Rukbh2vhZd09yzD7IbWoKlFToE7vKOFmwn1MlDeyeK2QwZRl3EaVkSQlWGqiEQlqMsp7 +9v2PHmuFRGG9NieLrA0J6+yO3Y+KmaQ1RDeU1+L6KYByp+SPGdB4x5pwH1MnsWM0ylM u8RqbExRZdZwI4k+Yxkf1E1Ncu/Jj4EjQsyS+95WiNCaJHSGdxvcEnqY5rb+M9AJs79D Hq3hRsBDyx/SQLzfVXCtTwZyf2mN6bBbx9A8WJIWFxsqFrARC4TK+bTN+cXf/4XHlGwY bS8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679672091; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=7FyBbkUlSzWUDUg7FSl6pltsSXVFIHYA7e4KXdYYzK0=; b=p8W15FSH80ItFGQDKw94Iyz1jUNnbozcCixbcEYd/C2gxeEwMg0EuDLM1Zauh/cSbD 3rO3iMG8UmD0ibk8FSTTYx55+xr5jWzVWlXAWLtKZBA2X0jTL2UDKHVzSt7tQZUuB40a pvWKBqBhOVQ/NhuPe171C2qBA3qctLEafUT5LmWEBfkKnzGB8rsWe8h7gQgFjStVHtAr m+LgAb6wjJpgmnSmr5kJk4G7xRJsPxYeOKUQcIeNSVtd2Vq1DvN3hvvpdC3Ks+gXmOqY gnRkwsjG0X4vH36ghf4HdkHcMa9fNGN8QesEXYE1guLn4+4pRFfmuMXgMY3lJsZXbxyI fWYA== X-Gm-Message-State: AO0yUKVxOiacnCEyrUXsCiA7T79JTzxkchqpYvRM8d3mAd6a2uGeEeSz pmGSg5ZEuLaXLP2EtW1riQyRFQ== X-Received: by 2002:ac8:5f0b:0:b0:3e1:c341:f618 with SMTP id x11-20020ac85f0b000000b003e1c341f618mr5351655qta.65.1679672091486; Fri, 24 Mar 2023 08:34:51 -0700 (PDT) Received: from nicolas-tpx395.localdomain (192-222-136-102.qc.cable.ebox.net. [192.222.136.102]) by smtp.gmail.com with ESMTPSA id h26-20020ac846da000000b003bfb5fd72a7sm12745420qto.86.2023.03.24.08.34.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 08:34:51 -0700 (PDT) Message-ID: <6f2979d33526e5ccdc32cf096415d8309fc91d3d.camel@ndufresne.ca> Subject: Re: [RFC 2/4] media: videobuf2: Replace bufs array by a list From: Nicolas Dufresne To: Hans Verkuil , Laurent Pinchart Cc: David Laight , Benjamin Gaignard , "tfiga@chromium.org" , "m.szyprowski@samsung.com" , "mchehab@kernel.org" , "ming.qian@nxp.com" , "shijie.qin@nxp.com" , "eagle.zhou@nxp.com" , "bin.liu@mediatek.com" , "matthias.bgg@gmail.com" , "angelogioacchino.delregno@collabora.com" , "tiffany.lin@mediatek.com" , "andrew-ct.chen@mediatek.com" , "yunfei.dong@mediatek.com" , "stanimir.k.varbanov@gmail.com" , "quic_vgarodia@quicinc.com" , "agross@kernel.org" , "andersson@kernel.org" , "konrad.dybcio@linaro.org" , "ezequiel@vanguardiasur.com.ar" , "p.zabel@pengutronix.de" , "daniel.almeida@collabora.com" , "linux-media@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mediatek@lists.infradead.org" , "linux-arm-msm@vger.kernel.org" , "linux-rockchip@lists.infradead.org" , "kernel@collabora.com" Date: Fri, 24 Mar 2023 11:34:48 -0400 In-Reply-To: <68ba7b3f-57f5-3969-5036-2c8d08273548@xs4all.nl> References: <20230313135916.862852-1-benjamin.gaignard@collabora.com> <20230313135916.862852-3-benjamin.gaignard@collabora.com> <20230313181155.GC22646@pendragon.ideasonboard.com> <86df05244d974416903e919d387a0a0b@AcuMS.aculab.com> <20230319233358.GD20234@pendragon.ideasonboard.com> <20230322150153.GO20234@pendragon.ideasonboard.com> <2d6480e36ce061a63440d1e11d52b02e57ba746d.camel@ndufresne.ca> <68ba7b3f-57f5-3969-5036-2c8d08273548@xs4all.nl> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le vendredi 24 mars 2023 =C3=A0 16:18 +0100, Hans Verkuil a =C3=A9crit=C2= =A0: > On 24/03/2023 16:14, Nicolas Dufresne wrote: > > Le mercredi 22 mars 2023 =C3=A0 17:01 +0200, Laurent Pinchart a =C3=A9c= rit=C2=A0: > > > On Wed, Mar 22, 2023 at 10:50:52AM -0400, Nicolas Dufresne wrote: > > > > Hi Laurent, > > > >=20 > > > > Le lundi 20 mars 2023 =C3=A0 01:33 +0200, Laurent Pinchart a =C3=A9= crit=C2=A0: > > > > > > The typical usage is that applications allocate N buffers with = the > > > > > > VIDIOC_REQBUFS ioctl, and in most cases that's all they use. > > > > >=20 > > > > > Note that once we get DELETE_BUF (or DELETE_BUFS) support I'd lik= e to > > > > > encourage applications to use the new API, and deprecate REQBUFS > > > > > (dropping it isn't on my radar, as it would take forever before n= o > > > > > userspace uses it anymore). > > > >=20 > > > > I was wondering if you can extend on this. I'm worried the count se= mantic might > > > > prevent emulating it over create_bufs() ops, but if that works, did= you meant to > > > > emulate it so driver no longer have to implement reqbufs() if they = have > > > > create_bufs() ? > > >=20 > > > For drivers it should be fairly simply, as the reqbufs and create_buf= s > > > ioctl handlers should just point to the corresponding videobuf2 helpe= rs. > > >=20 > > > What I meant is that I'd like to encourage userspace to use the > > > VIDIOC_CREATE_BUFS ioctl instead of VIDIOC_REQBUFS. > > >=20 > >=20 > > I'm not sure what rationale I can give implementer to "encourage" them = to use a > > more complex API that needs to copy over the FMT (which has just been s= et), > > specially in the initial pre-allocation case. For most, CREATE_BUFS aft= er SMT > > will look like a very redundant and counter intuitive thing. Maybe you = have a > > more optimistic view on the matter ? Or you have a better idea how we c= ould give > > a meaning to having a fmt there on the initial case where the allocatio= n matches > > the queue FMT ? >=20 > I wouldn't mind if we can make a much nicer CREATE_BUFS variant with just= the > size instead of a format. That was in hindsight a really bad idea, terrib= le > over-engineering. Note that all DRM allocators also includes width/height and some format rel= ated info (or the full info). This is because the driver deals with the alignmen= t requirements. In some use cases (I have inter frame dynamic control in mind here) the fmt could be a mean to feedback the alignment (like bytesperline)= back to the application where the stream is no longer homogeneous on the FMT. That being said, If we move toward a size base allocator API, we could also= just point back to an existing HEAP (or export an new heap if none are valid). A= nd define the sizeimage(s) is now that information you need from the FMT to allocate anything + which heap needs to be used for the current setup. Nicolas >=20 > Regards, >=20 > Hans