Received: by 10.223.164.221 with SMTP id h29csp588719wrb; Fri, 27 Oct 2017 03:09:11 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SAojFHL4yBv7ENfbzDSksd/1nadmpC53kJJP7y/nlU6gcCi19Gh6fk6GGcnWzBAX+dF/3N X-Received: by 10.98.194.215 with SMTP id w84mr10516pfk.255.1509098951628; Fri, 27 Oct 2017 03:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509098951; cv=none; d=google.com; s=arc-20160816; b=BjHGu7D/5iNqLfawB8/cXYeeh7MycQdUCpy+Lx9E5tQCq1iK3rlL6cVrMNLukYm6cn hBhZUZE6KFDzN6Vra79xTl9m2I2KfTay4SmeiOyu7pVdrO9f/yWvi8lrsLfxpelbCOYK QmufJQ54iV0aKeAlBKH/lP3HSvcpu4hWPhCqYgyH4OEbYTPA8bBDrxDLDMxB7lgTrL80 +yAsOa4lyT+tgyH2vq/xE0dfHn2CZELvpuKq8rifLFSYA5O5i/rpev8Croi3+uZmy8E7 f+vrGuXs10PlZLHRkgsAjPKI3muVaHF5MNxOggrzij420wugIJD/VRkTxs1bCdXsAMZn VGpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=WwhOkKjXSp/2mIrZtVpuyh58mEV4CM0LslyMKeFPZeE=; b=SF+u1n0AeiNVD701BaVypzRvkRXrGVXFzJav7HhX05vDza39xhc9Yv5QwyIM4kJsUX N1mz+MW0qgF0FvVSyXpvEJb1+pprnnzCGdyPbl7F69xWzszF/oMFPF5TOjksvFqqGA7I b6B8EUWpN6ZymdvY1CWLRnlNJZFbHI3M1+tRgJifSsSYvu8ByPtuTno7ILoBU/4VKGdR W62FgrXRve/ManyEon7GOu3QZ9dTudiE98A8TyjlYRrrT4hYBPJzo0X2xcfMXRsGQUPw DWn2+hrnRPAS3T79kqvyBkMWvEKT4b0l5QmJC9NZfSa7/VD5tRkbjxe38VdAZjxR30nQ dFeg== 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 d72si458232pfm.71.2017.10.27.03.08.57; Fri, 27 Oct 2017 03:09:11 -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 S1752440AbdJ0KIb (ORCPT + 99 others); Fri, 27 Oct 2017 06:08:31 -0400 Received: from foss.arm.com ([217.140.101.70]:56290 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752016AbdJ0KI1 (ORCPT ); Fri, 27 Oct 2017 06:08:27 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E5B5715AD; Fri, 27 Oct 2017 03:08:26 -0700 (PDT) Received: from e107564-lin.cambridge.arm.com (e107564-lin.cambridge.arm.com [10.2.130.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EBDE93F24A; Fri, 27 Oct 2017 03:08:24 -0700 (PDT) Date: Fri, 27 Oct 2017 11:08:23 +0100 From: Brian Starkey To: Gustavo Padovan Cc: linux-media@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab , Shuah Khan , Pawel Osciak , Alexandre Courbot , Sakari Ailus , linux-kernel@vger.kernel.org, Gustavo Padovan Subject: Re: [RFC v4 17/17] [media] v4l: Document explicit synchronization behaviour Message-ID: <20171027100822.GG40170@e107564-lin.cambridge.arm.com> References: <20171020215012.20646-1-gustavo@padovan.org> <20171020215012.20646-18-gustavo@padovan.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20171020215012.20646-18-gustavo@padovan.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 20, 2017 at 07:50:12PM -0200, Gustavo Padovan wrote: >From: Gustavo Padovan > >Add section to VIDIOC_QBUF about it > >v3: > - make the out_fence refer to the current buffer (Hans) > - Note what happens when the IN_FENCE is not set (Hans) > >v2: > - mention that fences are files (Hans) > - rework for the new API > >Signed-off-by: Gustavo Padovan >--- > Documentation/media/uapi/v4l/vidioc-qbuf.rst | 31 ++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > >diff --git a/Documentation/media/uapi/v4l/vidioc-qbuf.rst b/Documentation/media/uapi/v4l/vidioc-qbuf.rst >index 9e448a4aa3aa..a65a50578bad 100644 >--- a/Documentation/media/uapi/v4l/vidioc-qbuf.rst >+++ b/Documentation/media/uapi/v4l/vidioc-qbuf.rst >@@ -118,6 +118,37 @@ immediately with an ``EAGAIN`` error code when no buffer is available. > The struct :c:type:`v4l2_buffer` structure is specified in > :ref:`buffer`. > >+Explicit Synchronization >+------------------------ >+ >+Explicit Synchronization allows us to control the synchronization of >+shared buffers from userspace by passing fences to the kernel and/or >+receiving them from it. Fences passed to the kernel are named in-fences and >+the kernel should wait on them to signal before using the buffer, i.e., queueing >+it to the driver. On the other side, the kernel can create out-fences for the >+buffers it queues to the drivers. Out-fences signal when the driver is >+finished with buffer, i.e., the buffer is ready. The fences are represented >+as a file and passed as a file descriptor to userspace. >+ >+The in-fences are communicated to the kernel at the ``VIDIOC_QBUF`` ioctl >+using the ``V4L2_BUF_FLAG_IN_FENCE`` buffer >+flags and the `fence_fd` field. If an in-fence needs to be passed to the kernel, >+`fence_fd` should be set to the fence file descriptor number and the >+``V4L2_BUF_FLAG_IN_FENCE`` should be set as well Setting one but not the other >+will cause ``VIDIOC_QBUF`` to return with error. nit: full-stop before "Setting". Also, depending what is decided about passing in a -1 in-fence, the wording might want to include that behaviour. >+ >+The fence_fd field (formely the reserved2 field) will be ignored if the >+``V4L2_BUF_FLAG_IN_FENCE`` is not set. >+ >+To get an out-fence back from V4L2 the ``V4L2_BUF_FLAG_OUT_FENCE`` flag should >+be set to ask for a fence to be attached to the buffer. To become aware of >+the out-fence created one should listen for the ``V4L2_EVENT_OUT_FENCE`` event. >+An event will be triggered for every buffer queued to the V4L2 driver with the >+``V4L2_BUF_FLAG_OUT_FENCE``. Is it worth mentioning the immediate out-fence behaviour for ordered queues? And/or clarifying that otherwise the V4L2_EVENT_OUT_FENCE event will not be sent until all in-fence(s) on the buffer (or previously queued ones) have signalled. Cheers, -Brian >+ >+At streamoff the out-fences will either signal normally if the drivers waits >+for the operations on the buffers to finish or signal with error if the >+driver cancels the pending operations. > > Return Value > ============ >-- >2.13.6 > From 1581814992280652032@xxx Fri Oct 20 21:52:11 +0000 2017 X-GM-THRID: 1581814992280652032 X-Gmail-Labels: Inbox,Category Forums