Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4045214yba; Tue, 9 Apr 2019 09:58:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9Tb9+yIGyZCWjP3IBwM3dpFHhI0+p06xnoWbI5TXKfkrXJ8PcpVAl0uupmI6xebjs+BW6 X-Received: by 2002:a17:902:aa5:: with SMTP id 34mr37850130plp.302.1554829101175; Tue, 09 Apr 2019 09:58:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554829101; cv=none; d=google.com; s=arc-20160816; b=VG6WsSsJpcJ0gW1JUl8WQWFXDDmxBf+EiXQEFvkyziZuSymPxLWu31d68z+sfIfN2t xuYKMu6/JhVOvj80rfDyujcFFOKVc7hnI2qlCWu7ZbR2QeSHpSw+5gZlNtjz6vXoDiZh YHQGckgNwLop51IAUimL7tQPD0whvM/xC7F7ETbRm+D5UxIcjrHW3C8GzYg7lersKm5C QaBDEosvKLnWfgV4fgTmEaanZhoYZ2rimUqYLJNSWZCAsrXVazUCuSQoH3WBgIn9OW5O eHIar6EY1VVfUWy7vYcjw6ZPelEF/qlQZGga3AucEJfpx6x+L3IZsG0mT7u67wqLJreD xVSA== 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 :references:in-reply-to:date:cc:to:from:subject:message-id; bh=meCvcYrtaz+cTXwcktIqwlOWf9di6pxhG5GA+Myk1VA=; b=s0KdtFQ+AZp8sdyd/SAKbB1QFGOe5pzEvuGkqs3N3RJqIqtvE2RJ2HqlhdCPF0KZq3 GYqC3/FVJRz+F7J5a4BDX593W22kkNUXeYVFR5rgO3qQI/KGOxRw66jmXNVM7RRD0wSo Gu8jZUksx5i51aoKpByf0iftWz25tCetEaAqZWr6eqpV2UByHkDMMgYuQ419xHrSwj4M O1WItulyESREdQ+2OM0b6fK/6wwtNYJCDJxVv4lw+02WkXrJfzgHFkSHntnr7WWOTp3W Lm2HsfbGB2Cb0Sdn843yFPGcV/uetqHoSd1khAakzIZvfj4G71zmFiD3MsZ/d0/xWrJU 4BYg== 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 l68si18117108pfb.248.2019.04.09.09.58.05; Tue, 09 Apr 2019 09:58:21 -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 S1726547AbfDIQ5Z (ORCPT + 99 others); Tue, 9 Apr 2019 12:57:25 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:59995 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726372AbfDIQ5Y (ORCPT ); Tue, 9 Apr 2019 12:57:24 -0400 Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1hDu3k-0002Zi-Tu; Tue, 09 Apr 2019 18:57:20 +0200 Message-ID: <1554829036.5799.6.camel@pengutronix.de> Subject: Re: [PATCH v3 1/2] media: docs-rst: Document memory-to-memory video decoder interface From: Philipp Zabel To: Hans Verkuil , Tomasz Figa , linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Pawel Osciak , Alexandre Courbot , Kamil Debski , Andrzej Hajda , Kyungmin Park , Jeongtae Park , Tiffany Lin =?UTF-8?Q?=28=E6=9E=97=E6=85=A7=E7=8F=8A=29?= , Andrew-CT Chen =?UTF-8?Q?=28=E9=99=B3=E6=99=BA=E8=BF=AA=29?= , Stanimir Varbanov , Todor Tomov , Nicolas Dufresne , Paul Kocialkowski , Laurent Pinchart , dave.stevenson@raspberrypi.org, Ezequiel Garcia , Maxime Jourdan Date: Tue, 09 Apr 2019 18:57:16 +0200 In-Reply-To: <8f05866a-1244-5e85-9b37-409526970779@xs4all.nl> References: <20190124100419.26492-1-tfiga@chromium.org> <20190124100419.26492-2-tfiga@chromium.org> <1554461965.3060.5.camel@pengutronix.de> <8f05866a-1244-5e85-9b37-409526970779@xs4all.nl> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2019-04-05 at 13:21 +0200, Hans Verkuil wrote: > On 4/5/19 12:59 PM, Philipp Zabel wrote: > > On Thu, 2019-01-24 at 19:04 +0900, Tomasz Figa wrote: > > > Due to complexity of the video decoding process, the V4L2 drivers of > > > stateful decoder hardware require specific sequences of V4L2 API calls > > > to be followed. These include capability enumeration, initialization, > > > decoding, seek, pause, dynamic resolution change, drain and end of > > > stream. > > > > > > Specifics of the above have been discussed during Media Workshops at > > > LinuxCon Europe 2012 in Barcelona and then later Embedded Linux > > > Conference Europe 2014 in Düsseldorf. The de facto Codec API that > > > originated at those events was later implemented by the drivers we already > > > have merged in mainline, such as s5p-mfc or coda. > > > > > > The only thing missing was the real specification included as a part of > > > Linux Media documentation. Fix it now and document the decoder part of > > > the Codec API. > > > > > > Signed-off-by: Tomasz Figa > > > --- > > > Documentation/media/uapi/v4l/dev-decoder.rst | 1076 +++++++++++++++++ > > > Documentation/media/uapi/v4l/dev-mem2mem.rst | 5 + > > > Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 5 + > > > Documentation/media/uapi/v4l/v4l2.rst | 10 +- > > > .../media/uapi/v4l/vidioc-decoder-cmd.rst | 40 +- > > > Documentation/media/uapi/v4l/vidioc-g-fmt.rst | 14 + > > > 6 files changed, 1135 insertions(+), 15 deletions(-) > > > create mode 100644 Documentation/media/uapi/v4l/dev-decoder.rst > > > > > > diff --git a/Documentation/media/uapi/v4l/dev-decoder.rst b/Documentation/media/uapi/v4l/dev-decoder.rst > > > new file mode 100644 > > > index 000000000000..b7db2352ad41 > > > --- /dev/null > > > +++ b/Documentation/media/uapi/v4l/dev-decoder.rst > > > @@ -0,0 +1,1076 @@ > > > +.. -*- coding: utf-8; mode: rst -*- > > > + > > > +.. _decoder: > > > + > > > +************************************************* > > > +Memory-to-memory Stateful Video Decoder Interface > > > +************************************************* > > > + > > > > [...] > > > + > > > +Drain > > > +===== > > > + > > > > [...] > > > + > > > +3. Once all the ``OUTPUT`` buffers queued before the ``V4L2_DEC_CMD_STOP`` call > > > + are dequeued and the last ``CAPTURE`` buffer is dequeued, the decoder is > > > + stopped and it will accept, but not process, any newly queued ``OUTPUT`` > > > + buffers until the client issues any of the following operations: > > > + > > > > [...] > > > + > > > +.. note:: > > > + > > > + Once the drain sequence is initiated, the client needs to drive it to > > > + completion, as described by the steps above, unless it aborts the process by > > > + issuing :c:func:`VIDIOC_STREAMOFF` on any of the ``OUTPUT`` or ``CAPTURE`` > > > + queues. The client is not allowed to issue ``V4L2_DEC_CMD_START`` or > > > + ``V4L2_DEC_CMD_STOP`` again while the drain sequence is in progress and they > > > + will fail with -EBUSY error code if attempted. > > > > Should the V4L2_DEC_CMD_STOP documentation in > > Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst: > > > > * - ``V4L2_DEC_CMD_STOP`` > > - 1 > > - Stop the decoder. When the decoder is already stopped, this > >       command does nothing. > > > > be updated to mention that for mem2mem decoders this not only does > > nothing, but returns an -EBUSY error return value? > > Yes. Basically in this case the STOP is still in progress, so returning > EBUSY makes sense and should be documented. > > > > > Also, if V4L2_DEC_CMD_STOP_IMMEDIATELY is set, should the decoder drop > > all pending buffers and signal EOS immediately? Should this be mentioned > > here? > > Hmm, the decoder spec says that flags should be set to 0, and current codec > drivers explicitly disallow a non-0 flags value. > > I'm not sure if there is a practical use-case for V4L2_DEC_CMD_STOP_IMMEDIATELY > in the context of a decoder. If you want to stop immediately, then just call > streamoff on the OUTPUT queue. v4l2-compliance currently complains if V4L2_DEC_CMD_STOP_IMMEDIATELY is not supported:                 fail: v4l2-test-codecs.cpp(104): ret != 0         test VIDIOC_(TRY_)DECODER_CMD: FAIL Should testDecoder be changed to set the V4L2_DEC_CMD_STOP_IMMEDIATELY flag only if node->codec_mask does not have the STATEFUL_DECODER bit set? regards Philipp