Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3528541ybi; Tue, 18 Jun 2019 02:13:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2HuwnM0d2DOKdX+f5xWoZR80EhsyJLm+6Hq+32f39StrSObF4Nb1V3kNd8KBk0zHuvd4O X-Received: by 2002:a17:90a:9b88:: with SMTP id g8mr4047483pjp.100.1560849219580; Tue, 18 Jun 2019 02:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560849219; cv=none; d=google.com; s=arc-20160816; b=BiHMLJomseVPaXnsbt/aHFmD3uM4o6QbFoxuLal/rRb2Q70Pt+puPTFiKzl8SC/iXc Jjg1XM6DzGQQ4WIxR0Y5ttHMhGlyLVIuZQAbQmTD8bT/PM/J0AVlooYciv5cKpugNPt3 c22ZeqSL2Pj9DfF+IlG3GMHiM1xqqHab+nW+ZOLLfD37yOgWtPpITJBvsyMKR/KLleKL mqLDfx4NLeq+uZ38j0uhfOAnTPTVGlGfaMSCku9BUFAda0MrdhEHcoMsct5+ezvf5tPG MFtgimiH1NeC72fMCqrQDv4MJN98GRLhydgGgK6h8D/DlcblWbIFvLbBRYw/H7Rlun6L EwZA== 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:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=RUIFQr2229ky0retOfvrc1xzqft5n3wr767TGzjIJ3E=; b=bGwQNY6/NA/CyajL4hiKrW7g7zGUl0w2w61I3EqngueYnlfDBtfzz0kaY47012BhBI 1jndS07Nelw3eftaOSdslg0yXFa8BOAkIgB10BWTrrWuFTzyFhhRC/xELtTb0rWbBLED N9rF0zaj6yX351SX37lh3K4ccydISY26BEeCobLEjWoKpZdXsx5OOqe8szJWeveUh3Zn Jk8KcwrjRYa4rXoDAhcR062vZmKmqMJ/OLR+aJTUT9vwWMZmd5UTmZvkMDt1V9Q5G4xd FGspnqLqw6XuSIWB8UUDAkwsKpO5tT/KCdtUDBdSC+YYzXN+HhLYRf7atRLD0wwp2zYn 8ujA== 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 z7si13020083pgu.224.2019.06.18.02.13.20; Tue, 18 Jun 2019 02:13:39 -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 S1729268AbfFRJNJ (ORCPT + 99 others); Tue, 18 Jun 2019 05:13:09 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:35689 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728385AbfFRJNJ (ORCPT ); Tue, 18 Jun 2019 05:13:09 -0400 X-Originating-IP: 90.88.23.150 Received: from aptenodytes (aaubervilliers-681-1-81-150.w90-88.abo.wanadoo.fr [90.88.23.150]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 08404E001C; Tue, 18 Jun 2019 09:13:00 +0000 (UTC) Message-ID: Subject: Re: [PATCH] media: Clarify the meaning of file descriptors in VIDIOC_DQBUF From: Paul Kocialkowski To: Tomasz Figa , linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Alexandre Courbot , Hirokazu Honda Date: Tue, 18 Jun 2019 11:13:00 +0200 In-Reply-To: <20190612093648.47412-1-tfiga@chromium.org> References: <20190612093648.47412-1-tfiga@chromium.org> Organization: Bootlin Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, 2019-06-12 at 18:36 +0900, Tomasz Figa wrote: > When the application calls VIDIOC_DQBUF with the DMABUF memory type, the > v4l2_buffer structure (or v4l2_plane structures) are filled with DMA-buf > file descriptors. However, the current documentation does not explain > whether those are new file descriptors referring to the same DMA-bufs or > just the same integers as passed to VIDIOC_QBUF back in time. Clarify > the documentation that it's the latter. LGTM, Reviewed-by: Paul Kocialkowski Cheers, Paul > Signed-off-by: Tomasz Figa > --- > Documentation/media/uapi/v4l/vidioc-qbuf.rst | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/Documentation/media/uapi/v4l/vidioc-qbuf.rst b/Documentation/media/uapi/v4l/vidioc-qbuf.rst > index dbf7b445a27b..407302d80684 100644 > --- a/Documentation/media/uapi/v4l/vidioc-qbuf.rst > +++ b/Documentation/media/uapi/v4l/vidioc-qbuf.rst > @@ -139,6 +139,14 @@ may continue as normal, but should be aware that data in the dequeued > buffer might be corrupted. When using the multi-planar API, the planes > array must be passed in as well. > > +If the application sets the ``memory`` field to ``V4L2_MEMORY_DMABUF`` to > +dequeue a :ref:`DMABUF ` buffer, the driver fills the ``m.fd`` field > +with a file descriptor numerically the same as the one given to ``VIDIOC_QBUF`` > +when the buffer was enqueued. No new file descriptor is created at dequeue time > +and the value is only for the application convenience. When the multi-planar > +API is used the ``m.fd`` fields of the passed array of struct > +:c:type:`v4l2_plane` are filled instead. > + > By default ``VIDIOC_DQBUF`` blocks when no buffer is in the outgoing > queue. When the ``O_NONBLOCK`` flag was given to the > :ref:`open() ` function, ``VIDIOC_DQBUF`` returns -- Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com