Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2824352rdb; Wed, 15 Nov 2023 11:31:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFlMhnOfidD0Xn39jEq+/BDflgWsIVqBUIpZ3F4fjbq84vEEiRcMLKMa8tnOZOm7yyiWFv X-Received: by 2002:a05:6a00:4388:b0:6c0:642c:274b with SMTP id bt8-20020a056a00438800b006c0642c274bmr12797790pfb.9.1700076716792; Wed, 15 Nov 2023 11:31:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700076716; cv=none; d=google.com; s=arc-20160816; b=tGmnUiKK3H6NJOyhw0o3KlAzlWva+miIkBxlKKhGVD9t9w5refaVYu+x0V3w8GZbbv wcJz9dzvm0I7vhXZUr5g0Mxr+cvdMkXeubJEUKUHQeevhW3WGnXQgoqip0m7EjwBYxut V4hrx/WFUSdky2wgsWbJlrVc3doEaNjOtw6TuAb5ZoOSmS0AL96M6JtchFyNs1F14uoo QWy8LC/J7ig43dwHnEs4vVyfe58gLZwCMJwIVghiXAz7nO77gjTDmF50Gqtqu+yyUdql 0+Mgdvm2ipRqMNq9w+CpciMtx0l/R1ShFZWv0H+uOfrvy/ga7iMIWoy3ac+2/Erj5isp K34g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vKoboRFMVwYXLzk+HBvRLyjh1TdklplSbEjMotrXD1Y=; fh=H6tzSbtDGxpR8DwkZgE2NWrnibG0636TaL6V2MHS2p4=; b=iAh5FElZUdigzC4dysgNjUBQqHsEWlfoLL6l+UO/V1YuwW46D7cw95kciMPuNhA1SY vwW8AbXcy5VHbYcgbMnOA1MpOC2exfv1Xqs6q/yqz2lKiZxO8qDwXR3B+HxGCaxSlpsa E8A/pwO11ABXCYdp+x8FO9jMr0g00EXa91jFRzhDuFVawanbcYzczIWFoTK4asy39GIp vD7Z1Y6Rg7fHdCXJyIbdBk6q6p2cOiQZAyqeDif+fzSd8Y+YjhpvaoBmAHg8ykHhQFZA /xOUMzetmldYnGxoCag154Ww3Aj509Q9UXPQCnsRdo5r1q9YNOn69MTANlAIR1wM+Ful goPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=DAOdraz7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id o12-20020a63fb0c000000b005b8fb1da631si11032497pgh.897.2023.11.15.11.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 11:31:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=DAOdraz7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D07DC809FC84; Wed, 15 Nov 2023 11:31:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234030AbjKOTbK (ORCPT + 99 others); Wed, 15 Nov 2023 14:31:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234009AbjKOTbJ (ORCPT ); Wed, 15 Nov 2023 14:31:09 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAD2CA1; Wed, 15 Nov 2023 11:31:05 -0800 (PST) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7BF1929A; Wed, 15 Nov 2023 20:30:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1700076636; bh=VG1aMvjuyEjHJfeeciYccDaZR4VmWCZdcztVpSsBQws=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DAOdraz76XQD0sbIC3knIYtUGx5E+j6Jv8+x8BDAOyZy9+/XccbKVNgc8o2fyn0kT VJwVjUEi3AQvh5UUDbCoo24qXhx/ti2gRaUpPLmyoyCPt4ozjzmX1KB2KOW1oN9FR3 FEeMVeEB1CUz75/SuM+6/BC6maXz3BqjBYXVbjoQ= Date: Wed, 15 Nov 2023 21:31:07 +0200 From: Laurent Pinchart To: Stefan Wahren Cc: Umang Jain , linux-media@vger.kernel.org, kernel-list@raspberrypi.com, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, Dave Stevenson , Kieran Bingham , "Ricardo B . Marliere" , Dan Carpenter , Dave Stevenson Subject: Re: [PATCH v2 03/15] media: videobuf2: Allow exporting of a struct dmabuf Message-ID: <20231115193107.GB29486@pendragon.ideasonboard.com> References: <20231109210309.638594-1-umang.jain@ideasonboard.com> <20231109210309.638594-4-umang.jain@ideasonboard.com> <72f83177-cd34-480a-afcc-a79f85219751@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <72f83177-cd34-480a-afcc-a79f85219751@gmx.net> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 11:31:14 -0800 (PST) On Tue, Nov 14, 2023 at 08:41:11PM +0100, Stefan Wahren wrote: > Am 09.11.23 um 22:02 schrieb Umang Jain: > > From: Dave Stevenson > > > > videobuf2 only allowed exporting a dmabuf as a file descriptor, > > but there are instances where having the struct dma_buf is > > useful within the kernel. > > > > Split the current implementation into two, one step which > > exports a struct dma_buf, and the second which converts that > > into an fd. > > > > Signed-off-by: Dave Stevenson > > Signed-off-by: Umang Jain > > --- > > ... > > > diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h > > index 4b6a9d2ea372..cba4e495f6a2 100644 > > --- a/include/media/videobuf2-core.h > > +++ b/include/media/videobuf2-core.h > > @@ -925,6 +925,21 @@ int vb2_core_streamon(struct vb2_queue *q, unsigned int type); > > */ > > int vb2_core_streamoff(struct vb2_queue *q, unsigned int type); > > > > +/** > > + * vb2_core_expbuf_dmabuf() - Export a buffer as a dma_buf structure > > + * @q: videobuf2 queue > > + * @type: buffer type > > + * @index: id number of the buffer > > + * @plane: index of the plane to be exported, 0 for single plane queues > > + * @flags: flags for newly created file, currently only O_CLOEXEC is > > + * supported, refer to manual of open syscall for more details > > i think "newly created file" could be confusing here Would "newly created dmabuf file handle" be clearer and work for everybody ? > > + * > > + * Return: Returns the dmabuf pointer > > + */ > > +struct dma_buf *vb2_core_expbuf_dmabuf(struct vb2_queue *q, unsigned int type, > > + unsigned int index, unsigned int plane, > > + unsigned int flags); > > + > > /** > > * vb2_core_expbuf() - Export a buffer as a file descriptor. > > * @q: pointer to &struct vb2_queue with videobuf2 queue. -- Regards, Laurent Pinchart