Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4554005imm; Tue, 9 Oct 2018 01:09:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV62CxfSypvxbaNsuz+z/j0Vc1h1VkPjA7UBRoCIx/wmmcsT1BLvWUhEfI2U8pov8oZlI5+98 X-Received: by 2002:a17:902:47c2:: with SMTP id d2-v6mr27891489plh.317.1539072588537; Tue, 09 Oct 2018 01:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539072588; cv=none; d=google.com; s=arc-20160816; b=NXDjOUe6/4RzIOHS2JT+6xKiIOJ7Eyw9vgTXKYdlySZ5p5Jqc3kDNPYmTWFe2RbPgw veSxoOZM2maRr4NT55rL1Hihvj6R7FO4P1RvAgHXwPAtOoc/aBX1nIzvED2s2sl7jMZO 1tSdpng8ddLO6x44eJrFdJK6JdpJ/EeiXrHXhuCoayT0lCFJrzX+aViRCBVtvRFi40/2 yO9Fjdn6ZwPFQzlEYYhYDRBBMyvon8GlldJDHdM5EOMo/+CgwP7juiP0zs2WkRfIkE36 iFcFwhgbiozPUJvvvpnk/gZO86IllfAQdAjgSRpl53n38bEKNwjhmsQVTJ20kMrRYuAH /68Q== 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=8FFUWAQYB12LrhPG444ySxhB7P9TX6nzzZKfOKB2bW8=; b=cftA2ewLRwVXiTiakjcJgk6Wcvmv0O/C7vLbNbBLjoLhdLw2IAqvsjSVznm1ZmmjWB d3xm7yVv5ofPwMywVzOBcf1bLeRtmC6yLBHjUEDL2fwKgNdaWOG0M3iKqLcTFJJ+ZrqU ykfzKHptorMp+4Ldv/Hi3HJiXDxFSXa30F61DxJoAleFhEg5N88xwvq4ACOYoeAb3gzX hA+EL/wKfp4MCyN9sEHQ7FAu7AJDhnqAbbiidaeZftYflCSqP1vUPckl0hFW62zxm+m5 1Ioo6wgVT3C8nc/Adu+/vdJqtUowxmlAu1IvDBIE6YkPY1jtUt8Irh8cPbrbd3YdKr0B JnvQ== 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 t33-v6si20164348pgk.141.2018.10.09.01.09.32; Tue, 09 Oct 2018 01:09:48 -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 S1726393AbeJIPXl (ORCPT + 99 others); Tue, 9 Oct 2018 11:23:41 -0400 Received: from lb2-smtp-cloud9.xs4all.net ([194.109.24.26]:58613 "EHLO lb2-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725855AbeJIPXk (ORCPT ); Tue, 9 Oct 2018 11:23:40 -0400 Received: from [IPv6:2001:420:44c1:2579:9980:eade:362a:f91e] ([IPv6:2001:420:44c1:2579:9980:eade:362a:f91e]) by smtp-cloud9.xs4all.net with ESMTPA id 9n3YgXVqrSskC9n3cgmAWu; Tue, 09 Oct 2018 10:07:57 +0200 Subject: Re: [RFC PATCH v2] media: docs-rst: Document m2m stateless video decoder interface To: Tomasz Figa Cc: Alexandre Courbot , Paul Kocialkowski , Mauro Carvalho Chehab , Pawel Osciak , Linux Media Mailing List , Linux Kernel Mailing List References: <20181004081119.102575-1-acourbot@chromium.org> <676a5e92-86c2-cf5a-9409-ef490ad8e828@xs4all.nl> From: Hans Verkuil Message-ID: <4fc9af27-3086-f4bd-c77c-5515ab872d10@xs4all.nl> Date: Tue, 9 Oct 2018 10:07:52 +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: MS4wfPCownw/NNb0u4zkrycEOVxIsolpBZL7ThNbuaGmPqlpiuIHCyb7QQ0LiIrWQFDpc29UPrI6KdDWrUG8FrXL+xm/3ExKVlSM4sFVtmRcBazmxZ7RxZ/x Kmdx9HukT+wTYC/omYPvevwY/dkMWiRvwhTKSUKyDaApgE2UyccuUFLmfP1b3b+uk2zNmiZduyBPHsgb+JjI4fNatlOvv8PsIpFo7L+7o9Q1UMj65i9zmt4d iEeYN6BjHRlGI0SqBPEziUXu2G6/s5JyAjVtCuGCM9yTRhK21K04hC0icREn2T5uw7pNAK2bF93hnLBvFVO+xEfE0mcynRE1K9by/zkRSEg7qtJYMdvP9+Cu FaQwEHL7UDYGeeiVg56JURhFdRDDAOLgIohRrcIwmOaAOEIyhLSFizR9X+Fz6otZT7lY7vTmoHvda2SAA4bkRZ40BkiXOUKcXvnDTyhbx/x4wpxykYdL89uG pBwuEIlwAcvOufec6fX/7+CTi+9ytMkL5eIPMg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/09/18 09:41, Tomasz Figa wrote: > On Mon, Oct 8, 2018 at 8:02 PM Hans Verkuil wrote: >> >> On 10/04/2018 10:11 AM, Alexandre Courbot wrote: >>> This patch documents the protocol that user-space should follow when >>> communicating with stateless video decoders. It is based on the >>> following references: >>> >>> * The current protocol used by Chromium (converted from config store to >>> request API) >>> >>> * The submitted Cedrus VPU driver >>> >>> As such, some things may not be entirely consistent with the current >>> state of drivers, so it would be great if all stakeholders could point >>> out these inconsistencies. :) >>> >>> This patch is supposed to be applied on top of the Request API V18 as >>> well as the memory-to-memory video decoder interface series by Tomasz >>> Figa. >>> >>> Changes since V1: >>> >>> * Applied fixes received as feedback, >>> * Moved controls descriptions to the extended controls file, >>> * Document reference frame management and referencing (need Hans' feedback on >>> that). >>> >>> Signed-off-by: Alexandre Courbot >>> --- >>> .../media/uapi/v4l/dev-stateless-decoder.rst | 348 ++++++++++++++++++ >>> Documentation/media/uapi/v4l/devices.rst | 1 + >>> .../media/uapi/v4l/extended-controls.rst | 25 ++ >>> .../media/uapi/v4l/pixfmt-compressed.rst | 54 ++- >>> 4 files changed, 424 insertions(+), 4 deletions(-) >>> create mode 100644 Documentation/media/uapi/v4l/dev-stateless-decoder.rst >>> >>> diff --git a/Documentation/media/uapi/v4l/dev-stateless-decoder.rst b/Documentation/media/uapi/v4l/dev-stateless-decoder.rst >> >> >> >>> +Buffer management during decoding >>> +================================= >>> +Contrary to stateful decoder drivers, a stateless decoder driver does not >>> +perform any kind of buffer management. In particular, it guarantees that >>> +``CAPTURE`` buffers will be dequeued in the same order as they are queued. This >>> +allows user-space to know in advance which ``CAPTURE`` buffer will contain a >>> +given frame, and thus to use that buffer ID as the key to indicate a reference >>> +frame. >>> + >>> +This also means that user-space is fully responsible for not queuing a given >>> +``CAPTURE`` buffer for as long as it is used as a reference frame. Failure to do >>> +so will overwrite the reference frame's data while it is still in use, and >>> +result in visual corruption of future frames. >>> + >>> +Note that this applies to all types of buffers, and not only to >>> +``V4L2_MEMORY_MMAP`` ones, as drivers supporting ``V4L2_MEMORY_DMABUF`` will >>> +typically maintain a map of buffer IDs to DMABUF handles for reference frame >>> +management. Queueing a buffer will result in the map entry to be overwritten >>> +with the new DMABUF handle submitted in the :c:func:`VIDIOC_QBUF` ioctl. >> >> The more I think about this, the more I believe that relying on capture buffer >> indices is wrong. It's easy enough if there is a straightforward 1-1 relationship, >> but what if you have H264 slices as Nicolas mentioned and it becomes a N-1 relationship? >> >> Yes, you can still do this in userspace, but it becomes a lot more complicated. >> >> And what if in the future instead of having one capture buffer per decoded frame >> there will be multiple capture buffers per decoded frame, each with a single >> slice (for example)? > > Is there any particular scenario you have in mind, where such case would happen? Video conferencing to reduce the latency, i.e. no need to wait for the full frame to be available, just start processing as soon as a decoded slice arrives. > >> >> I would feel much happier if we used a 'cookie' to refer to buffers. > > Hmm, how would this cookie work in a case of N OUTPUT -> 1 CAPTURE case? The output buffers would use the same cookie. Regards, Hans > > Best regards, > Tomasz >