Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4743400yba; Wed, 10 Apr 2019 04:07:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqypqnZhGzkPrK6Jus6v9xRYoJgniz28SW1SUUOM3UvVElaeRV4lmAqus+F0JqlMyjRV390s X-Received: by 2002:a63:5d04:: with SMTP id r4mr39964441pgb.117.1554894421961; Wed, 10 Apr 2019 04:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554894421; cv=none; d=google.com; s=arc-20160816; b=OPI7lpH65ddWPighOnA0MyTs68syf0XsmQZrzqM8eBcWwp7Q9UI7EIjLMnh9EXY5Gj Jx+pZ0npDP3Q7yLinDXoJWFE6WpebjIHojp1A8Xh3VfBAb4EZopLIGjBfTxbDjxPAY71 E6u4EZ3YIE7PMsFTaEfP8HQUxbqcekmPEQJnmnipFxLPTMZBo0l4+h/KVKggCXXL2F0/ SX1F+z0LYSbdgsSIMw8/M/7VtuRqFaZ+Jpo5rUICcF7IeFrncQW08/bPVwjrKbozPPll rnJJoAZweiY30hk5qDKS7lQoyIQiI+/BcVMVbgPLKGJo6rAKdEctAjusPDtl+kzGZrO4 ys8Q== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=dhJeH0BXsKIDlbzo9JUFwL9kVQKHZNFnD0H+pxBA2Cc=; b=fsnjAOg8KovxxOq/n3+SIN5MJoySKy7CFYbWik2Cwgwuvn1yOlcOJqh3yZYM7cuA6A nH0YX6r3WUz3Z62hnI7TkF/zJCbMugUiQmejmajZQEkfvmsuu9rdMCyC+L/4ZDp8g4R9 otNLz3+ZnsEhaugsn++//VvWeYkdvKDWrVsXidSWF9aOclpJE6hyCHO91UjKLIdwXvHC IrZFgzz6AqCzWFb9CNen7L1d+r4+pN2AYatbxv7/PDx4sUlyagrTeDrBuHAIYZtPPXZR k9V7ALmYMqhfsv99muHufIUP2Tr8IOxcfooRwRUt/+/txSRiOuaojDxU7WkrUaifojbJ 1+/w== 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 23si14950210pfh.2.2019.04.10.04.06.45; Wed, 10 Apr 2019 04:07:01 -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 S1729080AbfDJJ3n (ORCPT + 99 others); Wed, 10 Apr 2019 05:29:43 -0400 Received: from lb2-smtp-cloud8.xs4all.net ([194.109.24.25]:55455 "EHLO lb2-smtp-cloud8.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727583AbfDJJ3m (ORCPT ); Wed, 10 Apr 2019 05:29:42 -0400 Received: from [IPv6:2001:983:e9a7:1:5c18:3544:e4bb:f52f] ([IPv6:2001:983:e9a7:1:5c18:3544:e4bb:f52f]) by smtp-cloud8.xs4all.net with ESMTPA id E9Y2hpKidUjKfE9Y3hgwJv; Wed, 10 Apr 2019 11:29:40 +0200 Subject: Re: [PATCH v3 1/2] media: docs-rst: Document memory-to-memory video decoder interface To: Philipp Zabel , 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 , =?UTF-8?B?VGlmZmFueSBMaW4gKOael+aFp+ePiik=?= , =?UTF-8?B?QW5kcmV3LUNUIENoZW4gKOmZs+aZuui/qik=?= , Stanimir Varbanov , Todor Tomov , Nicolas Dufresne , Paul Kocialkowski , Laurent Pinchart , dave.stevenson@raspberrypi.org, Ezequiel Garcia , Maxime Jourdan 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> <1554829036.5799.6.camel@pengutronix.de> From: Hans Verkuil Message-ID: <394033d7-b3ec-4c2f-8fc0-caf8ce860998@xs4all.nl> Date: Wed, 10 Apr 2019 11:29:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <1554829036.5799.6.camel@pengutronix.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfHRWfczFqNU2nhEOYUbyBU87S4ejVkoVyY914tUDXZlLaYhoVepWK9hbWbUnZDld9WgTFzgOweOqhAaHjKh8Q0VvptZxTgOMNOnNGJyptskGUy7QLrtw zan5zi/sk2/roauJjFOESb6O1TnpexXzEoyzQdnzsoGMCagM5z6eMJPGRAqGg8O4do7ck5NSLurOf6K+vFqFKcMDXScNadSnfktU+a70V7yCuBC1qJkXocIS CRdQcWRPH7V2N7Iw+v7xRAsCgBEVDAAXMb9VfzZ+cpo3AkQJLd4qZ7VgcXGrUD7PZs2IkIYRuqNCRmVKlj7nl+hmTXMlsx2L4TN2cJzmSah1CNEX/y/uLan6 VFaBSVXNHmrpohseM2d1uOhD2A3yK3xjLE0P73XAH/frt84RK4FR6HwlvAdaJXg4TvIYmC6Zy3Lyi8gKAodb/fbDTmV57vBPIeIbRntlydc3AotevsB281Gr E3sqIcPpDLTWQGbSGdl5CRR58I03pq7QGmKuLVhklqk3V3rnLJDY6uwe0grES9stLApySNy1AC87A3YnwfvPgf91Ij2Bn3dE4cLkxYkMRbL9n9pIJ/K97VR9 G4cj3A3MiTmuInVUrCnIHaFvlngh8mx5tN2n+E8ICeIK2P8hRWM/EZCk30b92+MwnkHhFJUOthy2QPkD0LxOzPxYjT4R+DVDnHN82fxqEMFm1gGTXb1xh3hN 9/yAVgWX5UJMqe+mRiJFId7E6LNIsnUUIqutipenVog/f1CKXjwM1D12WSH5bvKxYIx5L+2uRhkcdQaX4JNIMgk18aFW+R99inFkQT6vVyD/SL4qAXG7GnMF cmHHGUq4zwpreMA9M4LbLA1fIlvLhRuxkyNRKIAXrH9tDiOTnfdmxryU9FMF0OX5F+ScY8ojF3VVKReYkhcBIhCpzVB5LZ4KHJgyEqnA4Fl5CeXlmOevjzl8 TgkwRhJ5IJmCZIYdgyASoLm0SLOPy8atiPsyTJvUAfiuyISA Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/9/19 6:57 PM, Philipp Zabel wrote: > 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? Yes. I see that the vicodec driver doesn't handle the DECODER_CMD ioctl correctly, which is why I haven't noticed this v4l2-compliance issue before. Regards, Hans > > regards > Philipp >