Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5447295ybi; Wed, 12 Jun 2019 02:39:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2XuTw3kX55b1G/7vzv35htCW/hkody0wfVx8reKQL5aM2rJUHwBI+rTFEmJgQOkI6MIgw X-Received: by 2002:a17:902:294a:: with SMTP id g68mr82431941plb.169.1560332383403; Wed, 12 Jun 2019 02:39:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560332383; cv=none; d=google.com; s=arc-20160816; b=Qa8CwEWNLeEFYGKMTuFJve+daHbgNbX6dIBP1M1Lc7WHa8bKTP1XjHdzV+Gwgf/eU6 adaGxMHDLdobCUv0CgFvK+JIQ7mll+lZnC8M38TR4tuRz0OQRL74WJ6hSVO9/Cwngm+2 +KQ2/XZGD/M8giZX0brHI+h9sfD8JEsp1QQWvo1EbFyLaUKdEoesmQByvqslgjHHXGDZ t6rA5XJg5ggFYPXVhXVKcLV/6Ic8zZ41L7lloJ5sjlcQLEqUZ8Fpuo/ZhAnY2BJ7cSrC uJsce8DY7cqsl3BqKFApfCidWyW8AmtVCloGHWq9KAk+VmP/dGjMgCPYzzTeTSOx+w4L JZ7g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=0HM5SoliJDA3x8dLqRFVSpErY9ZjZiu/7dZDibCRUD8=; b=Cpr8+2B6dz7vRgRZUyXGG5vG9YsECqG21qND/3wGn5V/pgIbXAFPGQkZh6yZdcRX64 cDQjI/qyNN/LjSuM5YR3b1olG0qCL94IWJXGQyLxYOVDD826JllBFmAbsTgMOyykkeEF vngp3Nz21LtvGp/9AMqaomkITc0ngZ9s4zVkaZSS0OUMDIe1ai2rw/GyLcmMRGx9BHWr jIezA3qppcfSu4siM1qd4ZMHd1OKwzIMEn/fQi3mMLodzXJGJmmw9edF+L04ARWxZLC3 tCpoa768lR187oM97lSlUP3lFYb3yXbSAgcnBdu56RvDPnUebapUw/B7L/jSB+CokT1h qjzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b5NRZZzX; 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 b95si15663440plb.401.2019.06.12.02.39.28; Wed, 12 Jun 2019 02:39:43 -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=b5NRZZzX; 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 S2437553AbfFLJg4 (ORCPT + 99 others); Wed, 12 Jun 2019 05:36:56 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:40004 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729856AbfFLJgz (ORCPT ); Wed, 12 Jun 2019 05:36:55 -0400 Received: by mail-pl1-f194.google.com with SMTP id a93so6409285pla.7 for ; Wed, 12 Jun 2019 02:36:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0HM5SoliJDA3x8dLqRFVSpErY9ZjZiu/7dZDibCRUD8=; b=b5NRZZzXPxl6w5LwxAXkKuxZxHCocavnaojtqAEHIs6N4i7nDPLyLD58i1cyvDL8Oc RWOwGw4rr9cfAgZHPk0O5X8/wXR0Okm742qRAazPUelI3Hz9knF4mslU2kgihImuw6gr MRfXTfkKhmzsekl2p8UGUrZTXTf9aKDL4boY4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0HM5SoliJDA3x8dLqRFVSpErY9ZjZiu/7dZDibCRUD8=; b=p3+1/lTJ+j8XZ3f/0PEoauyHKc4nib7j8W1yjjyLi+n0cYiSQILSnhbFD6BSSM3zzO OXd6eTrslxwdhTvn51kboiDellxsFxV/raHyiXUT0DKmSpmddQCu+eQfMQ+SRMRQdCdb jmiO4f1Bk722XWZ9504yLVAYJZtQbI59HY5Y1ioouGybypU+74+TJ5mxP6yXkBCtiYMF EI8k/YdeckuQc64RE197XM9tJH6A2PSYbxtsMTQqz/oc/O2m2wo99tam1tkp1ALxmT7e qIryjLfAqfnRQqVBMVHzkUa6f/J4TSwJbhHD3oSd2xE9Cq+sTiSMZSx6edkBEEaFoLED kL1Q== X-Gm-Message-State: APjAAAWaCXC7+bKpSrUtjaMesnWrPAf8zmXaYQf7bWSfBbXre44cjatR 5WpRYx/zTVWLXBJRMpbwups6Pw== X-Received: by 2002:a17:902:da4:: with SMTP id 33mr21908077plv.209.1560332215116; Wed, 12 Jun 2019 02:36:55 -0700 (PDT) Received: from tfiga.tok.corp.google.com ([2401:fa00:4:4:6d27:f13:a0fa:d4b6]) by smtp.gmail.com with ESMTPSA id t4sm4521209pjq.19.2019.06.12.02.36.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 12 Jun 2019 02:36:54 -0700 (PDT) From: Tomasz Figa To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Paul Kocialkowski , Alexandre Courbot , Hirokazu Honda , Tomasz Figa Subject: [PATCH] media: Clarify the meaning of file descriptors in VIDIOC_DQBUF Date: Wed, 12 Jun 2019 18:36:48 +0900 Message-Id: <20190612093648.47412-1-tfiga@chromium.org> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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