Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6087866yba; Tue, 14 May 2019 01:13:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyW7BmgjBgoZhagHM6/bj2U4VsotE5MkrK2ZAH1DdxMtHtPtrDbSkYVHk5VM7DINOhNmmxS X-Received: by 2002:a63:3d0b:: with SMTP id k11mr36088160pga.349.1557821612148; Tue, 14 May 2019 01:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557821612; cv=none; d=google.com; s=arc-20160816; b=lCBMdhxN2eLwzBWV3BkCdbjXBMuiO9NrEZf1NtF1VWqz/Z4QZiN97XmeAtGw8CPEdB Aa+z26eX7qRznWHSTU3c+ul/TJ/RwJTsnfoQ1NE7dbmcAv4oYBBE0iNMyQ72FJCqrNyD tQRe6/q20mfXUMZmMjDPfTewLl6fSECs7qNJNtvXTVVlxQ6qm0yhYli/vIybFDH7SuNV LW4uDj+1Lo+aDHxYtZANJ7A0iswdFdD/u0k726aE93mWmbFGaIUIN6M1xoxbl3NGsCLd es6Un5YEfSO4+GfaAJd/Kr/8hBd9HZKW4o9jgJbXibZ2Eej1IN7r9ympeC+ypoBdkHHw hIfA== 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:dkim-signature; bh=ELhRuMsUIWwL7cdxk7yZxKy2OTGQGdFenKWb/rZoxgA=; b=c75lts3JHC9caAvbEp4lTIc5NLwqAw42kshRuCSc4d8yJQXva1itK0VTJgKa/TpXAs VpoehAyUbI/fRw8vYnzd9B7lAwKdYxvH/Q/gu6nXOMAnynpbVYhdniwOX7orHunhliG/ 2iQLvNOBoqxY+UB7CcATWMKz2IOiPb2Px6fuCeI45arLsvIa0Xp3IChCKQJtK5SJyPyH H1gPUi2/LbmLGBGpBrGfZog7aOGGQ/u1lYbUJER9+exenBrgsbZVOu0d5OXdyapkmWEu 5EdZs9UdRIG2vsQUIJKDfreTSaH+LAoLF2I78W+GHlIS31/txxJy3u6PrWQeGnN4+4YR 38hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SqRCNlo6; 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 p25si19674469pli.202.2019.05.14.01.13.17; Tue, 14 May 2019 01:13:32 -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=SqRCNlo6; 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 S1726238AbfENIMM (ORCPT + 99 others); Tue, 14 May 2019 04:12:12 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41169 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbfENIMM (ORCPT ); Tue, 14 May 2019 04:12:12 -0400 Received: by mail-pf1-f196.google.com with SMTP id q17so221026pfq.8 for ; Tue, 14 May 2019 01:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ELhRuMsUIWwL7cdxk7yZxKy2OTGQGdFenKWb/rZoxgA=; b=SqRCNlo6hgzL0YlpNY/t44ggLN4avw6PNEKVCowpQgDmtPe0yYAQj9zGkyyZYVInr7 tU3BoBdA/O05irkUhvlaGqhHK4oBnhKrmD7FKGxl4h/VRzJGhAafoL/L0RUuIgzFTDz9 4plTolbqfLjzBlqbOscGy6bSw0pQMx+M3HnI0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ELhRuMsUIWwL7cdxk7yZxKy2OTGQGdFenKWb/rZoxgA=; b=i+vpFm8hJ++8BASiJPzh2EazvAZls2K765b/HqfGnZb3ZAxyBqm1AGn2G793ePPhu5 np684F6N6tvaX6avO3C+vvvN9N5ZZ822F7ivqP27l5v+k76OLPv2bdCBm3k+XeBsKQip H0ewDJYVY5ATzEqdA73rfsM3+h7oLR7WS7cFyZzUVlnyDCbM8iYUjpfE8tmfGN4UIZBc h5iIZXRv2qB4965iuFBvXcS7afEFK9kwmRnFyPesid6+nRg3weMXIsOGzZYRkYCUZt46 lfuftgpExpXzAOmUukF42AJBsMfClvtX3fMNWxfKCG7t7IVYx+JDqnbxN1n5ihC2R2f6 rUpw== X-Gm-Message-State: APjAAAV3fuHIBR/7REHLJ/Ks1uf39EaEKUteRt9wmeK0HlrpyC7aGujl 2lbk3+jKkVH4CqjFvlNCTr4y5g== X-Received: by 2002:a62:6807:: with SMTP id d7mr38391742pfc.75.1557821531245; Tue, 14 May 2019 01:12:11 -0700 (PDT) Received: from chromium.org ([2401:fa00:4:4:6d27:f13:a0fa:d4b6]) by smtp.gmail.com with ESMTPSA id f87sm23387384pff.56.2019.05.14.01.12.06 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 14 May 2019 01:12:10 -0700 (PDT) Date: Tue, 14 May 2019 17:12:04 +0900 From: Tomasz Figa To: Michael Tretter Cc: Tomasz Figa , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab , Pawel Osciak , Alexandre Courbot , Kamil Debski , Andrzej Hajda , Kyungmin Park , Jeongtae Park , Philipp Zabel , Tiffany Lin =?utf-8?B?KOael+aFp+ePiik=?= , Andrew-CT Chen =?utf-8?B?KOmZs+aZuui/qik=?= , Stanimir Varbanov , Todor Tomov , Nicolas Dufresne , Paul Kocialkowski , Laurent Pinchart , dave.stevenson@raspberrypi.org, Ezequiel Garcia , Maxime Jourdan Subject: Re: [PATCH v3 2/2] media: docs-rst: Document memory-to-memory video encoder interface Message-ID: <20190514081204.GA132745@chromium.org> References: <20190124100419.26492-1-tfiga@chromium.org> <20190124100419.26492-3-tfiga@chromium.org> <20190430193412.4291fca8@litschi.hi.pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190430193412.4291fca8@litschi.hi.pengutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michael, On Tue, Apr 30, 2019 at 07:34:12PM +0200, Michael Tretter wrote: > On Thu, 24 Jan 2019 19:04:19 +0900, Tomasz Figa wrote: [snip] > > +State machine > > +============= > > + > > +.. kernel-render:: DOT > > + :alt: DOT digraph of encoder state machine > > + :caption: Encoder state machine > > + > > + digraph encoder_state_machine { > > + node [shape = doublecircle, label="Encoding"] Encoding; > > + > > + node [shape = circle, label="Initialization"] Initialization; > > + node [shape = circle, label="Stopped"] Stopped; > > + node [shape = circle, label="Drain"] Drain; > > + node [shape = circle, label="Reset"] Reset; > > + > > + node [shape = point]; qi > > + qi -> Initialization [ label = "open()" ]; > > + > > + Initialization -> Encoding [ label = "Both queues streaming" ]; > > + > > + Encoding -> Drain [ label = "V4L2_DEC_CMD_STOP" ]; > > + Encoding -> Reset [ label = "VIDIOC_STREAMOFF(CAPTURE)" ]; > > + Encoding -> Stopped [ label = "VIDIOC_STREAMOFF(OUTPUT)" ]; > > + Encoding -> Encoding; > > + > > + Drain -> Stopped [ label = "All CAPTURE\nbuffers dequeued\nor\nVIDIOC_STREAMOFF(CAPTURE)" ]; > > Shouldn't this be > > Drain -> Stopped [ label = "All OUTPUT\nbuffers dequeued\nor\nVIDIOC_STREAMOFF(OUTPUT)" ]; > > ? While draining, the encoder continues encoding until all source > buffers, i.e., buffers in the OUTPUT queue, are encoded or STREAMOFF > happens on the OUTPUT queue. At the same time, the client continues to > queue and dequeue buffers on the CAPTURE queue and there might be > buffers queued on the CAPTURE queue even if the driver returned the > buffer with the FLAG_LAST set and returns -EPIPE on further DQBUF > requests. > The STREAMOFF should be on OUTPUT indeed, because that immediately removes any OUTPUT buffers from the queue, so there is nothing to be encoded to wait for anymore. The "All OUTPUT buffers dequeued" part is correct, though. The last OUTPUT buffer in the flush sequence is considered encoded after the application dequeues the corresponding CAPTURE buffer is dequeued and that buffer is marked with the V4L2_BUF_FLAG_LAST flag. Best regards, Tomasz