Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp477638imm; Tue, 7 Aug 2018 23:44:58 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz/8vIGbaX6JSzu6QUEYXMYo7J9dryAbj7ujojHGKhRIYCc/HQks3WvBDS0bho9PIwdTd8P X-Received: by 2002:a65:4c02:: with SMTP id u2-v6mr1329070pgq.364.1533710698166; Tue, 07 Aug 2018 23:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533710698; cv=none; d=google.com; s=arc-20160816; b=FW+TSrge2JUJdcgiR0ho1bwNZbxkMkqo/awIjB5FJnPqmBGNvpAtzX/Uyavq2zKBpM hse/TeoaI8cnlcR0ZBDQTIo+9pK6cgU+QWN0WJIl+JMP7AfnIdrhodtfTxoQiiMXO5Td ZLLdDmJ57gOEIpWF238nPU6u+S3jghnlGE38gurncFf++aopQIIoYVtKPmGLyJf3Et/I gVpzWrYyZG6gls3ikfsCy/oBFdcUXmXe+UEHsxnR7WUfNPDir2grN1lnh7BdzJTR7al9 UvFriqojQUKOaNyjMEXeyBRNePXukgY5Y1hcdpcjXuLWkF0nB7AwtKkfrb0ee27CPy4G uxDg== 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:arc-authentication-results; bh=Nft93mZABhH+b1H0esQGhbhrwA4yBszA+v325KWsipc=; b=HE3ldihIwnULdj0vM+MyGSmeUsFXmVXvXCPzYLvHnVO/sEIAdMg3xzasVc/kV/sWK5 VDxKVVggQWoDlgzDJPLimFNrz8/2uJLbOZWDQukaPZpdMo24WmSia2P8o3Frn1XbwW9d gZ6uq3DFBTK3rwKgbvke5dQY2qJhxgwc68RsUqBh7GTrueaOYNk8V/ae++ebU5isncsX RB6a9v47GFr94tk9cvkkOw906a7/AvjFsfJretc3N1J8LVGyTOZjvXwijFDoIVohJwI2 KQ/PBaW570ZaFTy5FCNC65rMJvxzSmQGI836jD4G8N+QN1YxmWwLu4Mnl1nJ6Ek50pqF FMKA== 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 193-v6si3510403pgh.407.2018.08.07.23.44.43; Tue, 07 Aug 2018 23:44:58 -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 S1727133AbeHHJCK (ORCPT + 99 others); Wed, 8 Aug 2018 05:02:10 -0400 Received: from lb1-smtp-cloud9.xs4all.net ([194.109.24.22]:38143 "EHLO lb1-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726957AbeHHJCJ (ORCPT ); Wed, 8 Aug 2018 05:02:09 -0400 Received: from [192.168.2.10] ([212.251.195.8]) by smtp-cloud9.xs4all.net with ESMTPA id nICDfU6wWEJtcnICHf86BH; Wed, 08 Aug 2018 08:43:53 +0200 Subject: Re: [PATCH 1/2] media: docs-rst: Document memory-to-memory video decoder interface To: Tomasz Figa Cc: Linux Media Mailing List , Linux Kernel Mailing List , Stanimir Varbanov , Mauro Carvalho Chehab , Pawel Osciak , Alexandre Courbot , kamil@wypas.org, a.hajda@samsung.com, Kyungmin Park , jtp.park@samsung.com, Philipp Zabel , =?UTF-8?B?VGlmZmFueSBMaW4gKOael+aFp+ePiik=?= , =?UTF-8?B?QW5kcmV3LUNUIENoZW4gKOmZs+aZuui/qik=?= , todor.tomov@linaro.org, nicolas@ndufresne.ca, Paul Kocialkowski , Laurent Pinchart , dave.stevenson@raspberrypi.org, Ezequiel Garcia References: <20180724140621.59624-1-tfiga@chromium.org> <20180724140621.59624-2-tfiga@chromium.org> <37a8faea-a226-2d52-36d4-f9df194623cc@xs4all.nl> From: Hans Verkuil Message-ID: Date: Wed, 8 Aug 2018 08:43:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfFOiV5Q3vlCgzOLEJ5GWzdWLEVqxmwFtBQpN2CLdyvYEkz4J6n58tdVgBrECyinrLdJ9JXGKfhaOylwMf4pNfR3sZiFep4MivHh7Az5OSJHs2+ipbt90 Yhdxs3nRCAJnkc8vvm69HOTfK8+rcft8512sV3fECX6XlYnYk7h291FGsWXrhdvzYNM6vdvugoq+x++x6hPC/xxZ+kmaCHvFRIj1tfZGv9lBrY7MOFhR+Aoc uTwbnkRJMLfwRCqMs7m3frluVaqD6qLQenOAVhzuGlHf5qQj1rLzZBmuF1+ZOvzxOepwp5YIa53UJPq1aqLvNLmUMssVNR/I6IkN7VptYocb1u3NagRuxcRf r1zzY9qAi6wc/W4BJICt7d7pUZQ7qENHSy6dGH6oMp7wBIivB4N55C74GcBT/5O9FzsUWwvJCx5xOrzWBQowPlqPrJGWL/+Yo6CDSg0cMalg6YNawSzMpEDV q+enqiW/qyxXxoE0tDUI38PPxswgllAGc2sqWtdthai6e8PDiV+ztXoEQ9+dsdpFfN7uliYHxd8g/Ic0PTleIIPrp/fI+p/V3kXehPJ05ahJwKwtceoVUhrI rC65EFUBDi+WdHoa5bbl5NOhW9Of9mZpLzCIeMFWXVBT05LUv/FgXgxCIBik8POltLpN4djo6HJOA7Fjr9+M9IhyrU/+e18TunhXABAbgAvwXUXelnxYIE44 5Yo2wFRPVmk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/08/2018 05:11 AM, Tomasz Figa wrote: > On Tue, Aug 7, 2018 at 4:13 PM Hans Verkuil wrote: >> >> On 07/26/2018 12:20 PM, Tomasz Figa wrote: >>> Hi Hans, >>> >>> On Wed, Jul 25, 2018 at 8:59 PM Hans Verkuil wrote: >>>>> + >>>>> +14. Call :c:func:`VIDIOC_STREAMON` to initiate decoding frames. >>>>> + >>>>> +Decoding >>>>> +======== >>>>> + >>>>> +This state is reached after a successful initialization sequence. In this >>>>> +state, client queues and dequeues buffers to both queues via >>>>> +:c:func:`VIDIOC_QBUF` and :c:func:`VIDIOC_DQBUF`, following standard >>>>> +semantics. >>>>> + >>>>> +Both queues operate independently, following standard behavior of V4L2 >>>>> +buffer queues and memory-to-memory devices. In addition, the order of >>>>> +decoded frames dequeued from ``CAPTURE`` queue may differ from the order of >>>>> +queuing coded frames to ``OUTPUT`` queue, due to properties of selected >>>>> +coded format, e.g. frame reordering. The client must not assume any direct >>>>> +relationship between ``CAPTURE`` and ``OUTPUT`` buffers, other than >>>>> +reported by :c:type:`v4l2_buffer` ``timestamp`` field. >>>> >>>> Is there a relationship between capture and output buffers w.r.t. the timestamp >>>> field? I am not aware that there is one. >>> >>> I believe the decoder was expected to copy the timestamp of matching >>> OUTPUT buffer to respective CAPTURE buffer. Both s5p-mfc and coda seem >>> to be implementing it this way. I guess it might be a good idea to >>> specify this more explicitly. >> >> What about an output buffer producing multiple capture buffers? Or the case >> where the encoded bitstream of a frame starts at one output buffer and ends >> at another? What happens if you have B frames and the order of the capture >> buffers is different from the output buffers? >> >> In other words, for codecs there is no clear 1-to-1 relationship between an >> output buffer and a capture buffer. And we never defined what the 'copy timestamp' >> behavior should be in that case or if it even makes sense. > > You're perfectly right. There is no 1:1 relationship, but it doesn't > prevent copying timestamps. It just makes it possible for multiple > CAPTURE buffers to have the same timestamp or some OUTPUT timestamps > not to be found in any CAPTURE buffer. We need to document the behavior. Basically there are three different corner cases that need documenting: 1) one OUTPUT buffer generates multiple CAPTURE buffers 2) multiple OUTPUT buffers generate one CAPTURE buffer 3) the decoding order differs from the presentation order (i.e. the CAPTURE buffers are out-of-order compared to the OUTPUT buffers). For 1) I assume that we just copy the same OUTPUT timestamp to multiple CAPTURE buffers. For 2) we need to specify if the CAPTURE timestamp is copied from the first or last OUTPUT buffer used in creating the capture buffer. Using the last OUTPUT buffer makes more sense to me. And 3) implies that timestamps can be out-of-order. This needs to be very carefully documented since it is very unexpected. This should probably be a separate patch, adding text to the v4l2_buffer documentation (esp. the V4L2_BUF_FLAG_TIMESTAMP_COPY documentation). Regards, Hans