Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2131624pxb; Fri, 25 Mar 2022 11:38:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7jJjvt2GyTfb6UMRbii7eUTpRwzclkdhf9fGJRdFBUNxj32elLZzKxURNBmLaYVSPTHGM X-Received: by 2002:a17:902:db03:b0:155:cb6a:7c8e with SMTP id m3-20020a170902db0300b00155cb6a7c8emr7987548plx.125.1648233512892; Fri, 25 Mar 2022 11:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648233512; cv=none; d=google.com; s=arc-20160816; b=vcww4pxPs8WIanHHeu13GJgbtc9buGMxQPk4gX3c2Lhtu6B2eHsS+iNJK12o/iliuj 2uvm9Cqx5AkxW+kxOXGSRAOTZJ6AR77b4QpOTAgtTyzLZa6ox15feYZsdC//jA5m68/w OoR09y0MMPXBd2SWqHGXOu1Pkz6oESleWyksgkPyOmaikpehex4eKx7vWWYwZsvvUPvV mcXQOyy1nw1kAuiBPjvUSO9Q1PTIseevMm/LCpLo24Zw4jJ0HOYTet/+ey8PGdkj28Za rBIpijw4/nNheTZMqhlGT5PeciteMrvOE/LQmiVFnWAqSPPGliFpZFxhZUxLFecd9G0U yIkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=39vGWICtE1D8WySZuhFVZlySZosFxjBXRPANWqdHqJI=; b=jGSjcidua3mdyEXteuR+yHucKrhieQaAN7Oi5zyirWsrrYfTv7EZpzuaE9VvoKizRh /r0HxdfxAtOr7MVqAPE+Pp07oZdWT2X4fEIT9z98cB64q/fCxmb6vq0pZmY5zBItzZ01 UPuxi/Td8WsIL1nBd9e53TBdnxQmyGc0052pjB5ZJxMMTW1LoG2lpyKGzseVHAbpx2Mu yiBcwG58qJpGUB+VtC7p/BKrJKdwbeQ9ZqtNP4jh6tvjEemmWhcnZ1D41ku1NFB15TgZ 1eMzeTrTdHudxoGsaWiPDwMwld8rZ7ClVZYGW3YAXblb3nreuLN72EpLGUD87wEEQhxQ gFBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=NTx2AJfN; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e3-20020a170902ef4300b00153b2d16541si733431plx.329.2022.03.25.11.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 11:38:32 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=NTx2AJfN; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 81EDADA0AB; Fri, 25 Mar 2022 10:56:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344704AbiCYNNJ (ORCPT + 99 others); Fri, 25 Mar 2022 09:13:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354117AbiCYNNF (ORCPT ); Fri, 25 Mar 2022 09:13:05 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07F8FCD306 for ; Fri, 25 Mar 2022 06:11:31 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id h4so1422176edr.3 for ; Fri, 25 Mar 2022 06:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=39vGWICtE1D8WySZuhFVZlySZosFxjBXRPANWqdHqJI=; b=NTx2AJfNxhtsruI+24G5OYmC4RHPpFcxU392t4ad1qdWs3PL+wH61IGlUhqrZF/kj/ Y6u7so5LGZyjeNOaBNTyKVcVtcDy/DVeIH+UyQpE6gVpe/2Xh5kY+q3AEJxudzf4uv/d SZdJHdcKlZojzwZs3vMPUoHiUOKKsoWVcj8y0UT9IhyIxtMF0KqTh+xag8oz+vRPGfdU IC/EBlaXJHbP8ia07dtrBi/LGajTT6INsCG6oOEWPyR9Ro5yRTXCBrD8Dhdpg50WerI4 M8rrBkhR3hcsn3s1Jbi6LN5KZ38YGPOdjtiX7FDUzl32H1EjVIoJpuTLnuaw1vKNbuZ1 lZJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=39vGWICtE1D8WySZuhFVZlySZosFxjBXRPANWqdHqJI=; b=pZMTTxuGF1MpwChS1qDF3zURWO/sFJ9kRHN+3216r4QUIOeqjsnifQ8s/2fXnbDPiR DFglDIpmjj5Q/IHL01t0OjjLrHlkCJGkZFG+9MPI77SXGYZIU7t/ATMFNwWtCmNRJFAX teJrD+BAARCapknHaGzZSdUUbpnDqKGDKeqRISTSzbr8fBMF9KghKKztf+iCrTPu5VLi OzIBkqAy2oD/vODYF3JJTmPVNujlmWcKA3XfnsNihj1Py41gA8tuQF4d+sthH68XW120 AgiVn25O4Xzv97G6Uc8WSw4lyTKv3oWNTQoC2uBYbhCLQu/DeRPnInlQSxrM95q0ujGx rSOw== X-Gm-Message-State: AOAM533HeRIWIKZPsc6DWybptDUqXnfkWyxxX/jfrc/URt6BJfjRZzU9 qqwDoee97rn3EkvAeCg2fHeoElgBcfoRvMqp9yVc+w== X-Received: by 2002:a05:6402:1e92:b0:419:76:21a6 with SMTP id f18-20020a0564021e9200b00419007621a6mr12936544edf.128.1648213889593; Fri, 25 Mar 2022 06:11:29 -0700 (PDT) MIME-Version: 1.0 References: <20220322132329.6527-1-dmitry.osipenko@collabora.com> <9ec970d6-ea09-802c-419b-b2ef26800990@collabora.com> <5be83f0b343c04d877a2c2d805fb5f71ca9973b1.camel@ndufresne.ca> In-Reply-To: From: Dave Stevenson Date: Fri, 25 Mar 2022 13:11:13 +0000 Message-ID: Subject: Re: [PATCH v1] media: videobuf2: Allow applications customize data offsets of capture buffers To: Nicolas Dufresne Cc: Dmitry Osipenko , Mauro Carvalho Chehab , Tomasz Figa , Marek Szyprowski , Hans Verkuil , Benjamin Gaignard , Andrzej Pietrasiewicz , Gustavo Padovan , Boris Brezillon , Daniel Almeida , Sebastian Fricke , Laura Nao , Linux Media Mailing List , LKML , Dmitry Osipenko Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Nicolas & Dmitry On Fri, 25 Mar 2022 at 12:32, Nicolas Dufresne wrote= : > > Le jeudi 24 mars 2022 =C3=A0 21:20 +0300, Dmitry Osipenko a =C3=A9crit : > > The root of the problem is that DRM UAPI is more flexible and allows to > > customize offsets for both S/MPLANEs, while V4L doesn't allow to do it > > at all. I'm exploring all the potential options, so far neither of the > > proposed variants is ideal. > > In GStreamer kmssink, the way DRM is used, is that if you have 2 planes i= n your > pixel format, but only received 1 DMABuf, we will pass this DMABuf twice = (well > GEM handles, but twice), with appropriate offset. > > With this in mind, the idea for V4L2 could be to always resort to MPLANE = for > this purpose. The tricky part for userland is that it needs to know the d= ual > pixel format and map that accordingly. That is a bit difficult and this i= s > something Helen was trying to address with the v4l2_buffer_ext (that and > allowing space to store DRM Modifiers in the future). > > The second challenge is the overhead. In DRM, as we "prime" the DMABuf in= to > handles, this gives a kernel object to store any relevant information abo= ut the > buffer. So having it duplicate can be done at no cost. In V4L2, the drive= r would > need to handle that more often. Specially that despite the recommendation > (except for primary buffer decoder, were this is mandatory), we don't for= ce a > strict DMABuf / Buffer IDX mapping. To throw another use case of data offsets into the mix, I'm keeping a watching eye on implementing stereoscopic capture into libcamera where we want to present the same buffer to the ISP twice (once for each eye) with either a vertical or horizontal offset between the two passes. Adding a data_offset of either a half line or half the frame is the easiest way around that one, although it could potentially be accommodated through the selection API setting a compose region instead. Dave