Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1479609ybi; Wed, 19 Jun 2019 21:51:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBeGiOrTrxGLusxLdet5evFVKHvTiywYBdZdpfRyi8Qxg0zCXkqwEEFaFb32wCNNBMjTph X-Received: by 2002:a17:902:76c6:: with SMTP id j6mr98058225plt.263.1561006265761; Wed, 19 Jun 2019 21:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561006265; cv=none; d=google.com; s=arc-20160816; b=dFqSJSRlztaOJ0H+eLjFAvxT7bvslre2y24KtjMfi0CPJD+8hu9H8u3sf42tm/YqJt ymd0cYZvKGFps+ffKgUK+4/M9txopAa0Jkya3rQi3G5RQtia6oIIihyQiiTbjl0K7Tki KQHGqMAaPHoCjpv7ZLYVw7BQeScJYu5PTcN5Pb3KwBhsG2Ci2owbiIS0rY6bq3OOxQr4 d/jhwhHaC9J0Iq+EO2vZ/BV5cKN4BXyfhjCmgBjcghOHP9x5KK97PPjzIlrSNL/D4YR0 oHucXhibjbnMcKBHF83oO1vLGo0CVWi0guNY9yeSrVEWbDsrzbXq1543AI89SdFDq/AC 1OxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=H7KfXwWshFgYCRp/rB3EC7KJ7aO3/YBFcG4HpA2yrRc=; b=YY/TgoJP7sLLe7RMQx+qkLSi0Hq7QpW1ttzWudAHN//nN6qySD+UxXZm758vShqGhy Ev+yMtw1jE7YSxKAUuOw+IXaFXXrbALa07sKYnzWHl09VVWdmPEYOV47AmosJ2dtv0TZ XO07A9kEyFLrUl+0moVdLgQBxK7IpN0DxqoUAqcOExuUWrpAsQb/tOhCIPiDb17ATI8/ WR1oN9cOvYykXSwLB4+fdCmUIrjk+mrHGxnBQJfoP1V/DdmDHEYyBX73yObh1Fi3aqcy TYPHRB9eQfpnlG60mlNDwODkejoUvetZ1KjXrSV/vWcYhWB/yE2NcHEMPmB7Z7o4n61r 2s0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=invRPHWw; 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 y14si3721502pgg.354.2019.06.19.21.50.48; Wed, 19 Jun 2019 21:51:05 -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=invRPHWw; 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 S1726168AbfFTEuo (ORCPT + 99 others); Thu, 20 Jun 2019 00:50:44 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:40825 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725872AbfFTEun (ORCPT ); Thu, 20 Jun 2019 00:50:43 -0400 Received: by mail-ot1-f65.google.com with SMTP id e8so1433797otl.7 for ; Wed, 19 Jun 2019 21:50:43 -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; bh=H7KfXwWshFgYCRp/rB3EC7KJ7aO3/YBFcG4HpA2yrRc=; b=invRPHWwsG//4HFgg9KwSVpDmW6VW+E3xuRUlv6jjX+XcUyFbQHVG471IpclLNl2VX I3AZlwTuDX0/+rRDEabV4QRS/D9gr1ubU0bH9ZKJTFadXBg0m9J5DXEib9hp+IP5zJRn 1hMMPiE2UdXow03GY4JfUMU6W21H2egfNnhEY= 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; bh=H7KfXwWshFgYCRp/rB3EC7KJ7aO3/YBFcG4HpA2yrRc=; b=Wg4DpOlYQvlh25ZTzPwWIgUrL6ljNunUpF66WSvs67utZ795MUlGLTEBwmHYUKKjRp OH+R9tlCLLfVPkmvIVsUlcud0KCXfkn/RMFlt89v/Gi04r36BY9QFq2674kzaAqlh03D 6s6fllAw0LDKyEDPa1zsmmrG3Htdp8n9pTZENEa62zHlezopJwlK6m7cn43iHvZxU8KS f84Xa/WDOgb+0g/ct9BsLf6cKFZNNaCi2/S2U9GKbUlgr3Y8TE2+nBeRdskLTv99VVc5 XmlRyKlMkZkLyABfTGjipYmFoCFcPrHARR8iPSNp9WGos7M/3UaeFlsuENXFWACd+Q/5 vSfQ== X-Gm-Message-State: APjAAAVg496V45s0Wy3BlI2pDcaeCwK6zBW2LiKNb4Ikkmq1zoiIDZJy eTxmrtkQ9n/G/aPf7gAiimKYds4Hs9iJEA== X-Received: by 2002:a9d:6a4b:: with SMTP id h11mr11653201otn.266.1561006242644; Wed, 19 Jun 2019 21:50:42 -0700 (PDT) Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com. [209.85.210.46]) by smtp.gmail.com with ESMTPSA id m5sm7688701oif.13.2019.06.19.21.50.41 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jun 2019 21:50:42 -0700 (PDT) Received: by mail-ot1-f46.google.com with SMTP id b7so1408894otl.11 for ; Wed, 19 Jun 2019 21:50:41 -0700 (PDT) X-Received: by 2002:a9d:711e:: with SMTP id n30mr12204552otj.97.1561006241374; Wed, 19 Jun 2019 21:50:41 -0700 (PDT) MIME-Version: 1.0 References: <20190612093648.47412-1-tfiga@chromium.org> In-Reply-To: <20190612093648.47412-1-tfiga@chromium.org> From: Alexandre Courbot Date: Thu, 20 Jun 2019 13:50:30 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] media: Clarify the meaning of file descriptors in VIDIOC_DQBUF To: Tomasz Figa Cc: Linux Media Mailing List , LKML , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Paul Kocialkowski , Hirokazu Honda Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 12, 2019 at 6:36 PM 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. > > Signed-off-by: Tomasz Figa That's a welcome precision indeed. Reviewed-by: Alexandre Courbot > --- > 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 > -- > 2.22.0.rc2.383.gf4fbbf30c2-goog >