Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp301182imm; Thu, 26 Jul 2018 03:59:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeLv5tqFl0FNWSqL/3ADd4K4ht10DCavq7J/ODDCKK8M1aL1fOW6ogs3iDLW7yowv+mhnJV X-Received: by 2002:a17:902:28a6:: with SMTP id f35-v6mr1514996plb.110.1532602748194; Thu, 26 Jul 2018 03:59:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532602748; cv=none; d=google.com; s=arc-20160816; b=jt6Mdf76Fu4T7jccnFJ57y7eegB5tI1YUhr5V2FlRPpDasZyJSzwdP9w+ZI+jzcsZu VE065RtEzX1lTAj5RCtSzO7yMicMrDJgbZylL6tmHLv+z6K/WmrsVQChnX8IcZ3n7pv+ 0FWuwEqgIt32K+NY4rnTltHZGgKy6XMk0DVjFq663fOPLosH2UHdWfmpCErEfDLfVTbB RZDP3SthyqZ3x+l8UNJshZdRdjW3Z6cP6li79EAkg+rg8ApsXGJ7cD0bHTDDLobwx5cg Hw2dslDQNpsYVICubB1gsX+1OrS4l3ufbyr8ohhlBHyj/GRlrg+sJzT7ClwgRJlXy5Q0 HKsA== 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=Vc2zchqp7d3e9wsacIUMymp44hH/XEBO6dBnJYdSoIM=; b=bbPSJnBdUi6x9zNTWdsLoqcCqtjAx885WKg0L7r1S04LsbpolwhivoM3XpVha0/iU8 x6oWHvtYUzVPVoxpNmeaiLuSrxGdZPkIfdccm+2sVPIk111h7N7p7+MJWDVzGFsyrgrj /Xb9/6ue/LbqlSrfh9D4RKjldyXJEgn25rPZOCEXriklkqR/XmFiPftvFRvWSvHy0ecJ vk4IcyKnYv8u8UWfkJenkJbv3kGFU0wwjyniiq9Betxz8PeHCvbZzyfB70VYJsGxSKXB 7ch9fXmxpiLK8/m2BLfi3IhQjQzl8BOwry5TLX9MbpLS+/tsNbkGdD4+fxjB9zKm7F6F XjPA== 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 k18-v6si1051054pff.91.2018.07.26.03.58.53; Thu, 26 Jul 2018 03:59:08 -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 S1729532AbeGZMN0 (ORCPT + 99 others); Thu, 26 Jul 2018 08:13:26 -0400 Received: from lb2-smtp-cloud8.xs4all.net ([194.109.24.25]:49509 "EHLO lb2-smtp-cloud8.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729097AbeGZMNZ (ORCPT ); Thu, 26 Jul 2018 08:13:25 -0400 Received: from [IPv6:2001:983:e9a7:1:9ca6:a377:e357:d31a] ([IPv6:2001:983:e9a7:1:9ca6:a377:e357:d31a]) by smtp-cloud8.xs4all.net with ESMTPA id idx9fTAVdoj71idxAfQ9fp; Thu, 26 Jul 2018 12:57:06 +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: Thu, 26 Jul 2018 12:57:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 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: MS4wfJhP1XMB+afqUmKC2ytLy8l6EYXn8tJw0uLr51HLLYCLRlndc1e2ErP3kTWFzAg8NcS95jN5mLA/FXpup5US2Wl6W3Bd/ukPvlU+eGc/FG3pBH3SE+Sf zPMNsLb3H6Y/4PypQ8USG9yfmC1pGbA5QLUSJT/hj0EnFDWKGHNH/42wwU/Kyzul0paRx0tdA78IyDGnFiNQyTRkO2AEZQIT8Y+80cQtS/yNFwm/TL5OyKr5 /F+oqHxCasnCk1X8/Z6rofh8V+Ifedj7BeB2rVW5Ocxw2cDKHvyxJj+0GSqNKncwJNappaq/wRV4KKtQS+Ne2EZCDGVEi6DMHzNI8mckR+vJGW09BMebS1EI +v9cABh4ZNqyEiJOSiu8il7C2wO7I02KcVvbRm6W+hdf5Q8dzbNioS3CiqGq1F2I2phsmYE4RJCorheToJ8Mt77OlJ2gpt1duOP4W6Nzh36ZpqDIHhae6HfE bZrOJtcwUG/uegLgU3ptmWO4FA2q6bPh+uVFl0i71nmoY9w1GY6iG0lWtThqPYYXp2Yn6FkfkzSepWk00vE+l5vaVeJwT93xqMtPUXizNLX6AMi9LyaZSopW PxdN+B2o1Uq5Np7sbUb6l1UUgBW6uIV9OMSv20Lae4iZ77IdatAEDAXeYou11lpUJ+szmc4ZtUQnH8RY6MIRlzRbnFlqiMMOMcko7WZcIde0nxYlKL0rOz6f D3seJnKkqZ8JbHuUXyMHzD2fD8QraN5w6oepjgEn3T1eCkUfoNFnW+zujviOhWGBq3BkA5PTIyXpltuGX629qjkGSFkRNw79jjLJVFCOtD82BQc4ubzHcA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/07/18 12:20, Tomasz Figa wrote: > Hi Hans, > > On Wed, Jul 25, 2018 at 8:59 PM Hans Verkuil wrote: >> >> Hi Tomasz, >> >> Many, many thanks for working on this! It's a great document and when done >> it will be very useful indeed. >> >> Review comments follow... > > Thanks for review! > >> >> On 24/07/18 16:06, Tomasz Figa wrote: > [snip] >> Note that the v4l2_pix_format/S_FMT documentation needs to be updated as well >> since we never allowed 0x0 before. > > Is there any text that disallows this? I couldn't spot any. Generally > there are already drivers which return 0x0 for coded formats (s5p-mfc) > and it's not even strange, because in such case, the buffer contains > just a sequence of bytes, not a 2D picture. All non-m2m devices will always have non-zero width/height values. Only with m2m devices do we see this. This was probably never documented since before m2m appeared it was 'obvious'. This definitely needs to be documented, though. > >> What if you set the format to 0x0 but the stream does not have meta data with >> the resolution? How does userspace know if 0x0 is allowed or not? If this is >> specific to the chosen coded pixel format, should be add a new flag for those >> formats indicating that the coded data contains resolution information? > > Yes, this would definitely be on a per-format basis. Not sure what you > mean by a flag, though? E.g. if the format is set to H264, then it's > bound to include resolution information. If the format doesn't include > it, then userspace is already aware of this fact, because it needs to > get this from some other source (e.g. container). > >> >> That way userspace knows if 0x0 can be used, and the driver can reject 0x0 >> for formats that do not support it. > > As above, but I might be misunderstanding your suggestion. So my question is: is this tied to the pixel format, or should we make it explicit with a flag like V4L2_FMT_FLAG_CAN_DECODE_WXH. The advantage of a flag is that you don't need a switch on the format to know whether or not 0x0 is allowed. And the flag can just be set in v4l2-ioctls.c. >>> +STREAMOFF-STREAMON sequence on it is intended solely for changing buffer >>> +sets. >> >> 'changing buffer sets': not clear what is meant by this. It's certainly not >> 'solely' since it can also be used to achieve an instantaneous seek. >> > > To be honest, I'm not sure whether there is even a need to include > this whole section. It's obvious that if you stop feeding a mem2mem > device, it will pause. Moreover, other sections imply various > behaviors triggered by STREAMOFF/STREAMON/DECODER_CMD/etc., so it > should be quite clear that they are different from a simple pause. > What do you think? Yes, I'd drop this last sentence ('Similarly...sets'). >>> +2. After all buffers containing decoded frames from before the resolution >>> + change point are ready to be dequeued on the ``CAPTURE`` queue, the >>> + driver sends a ``V4L2_EVENT_SOURCE_CHANGE`` event for source change >>> + type ``V4L2_EVENT_SRC_CH_RESOLUTION``. >>> + >>> + * The last buffer from before the change must be marked with >>> + :c:type:`v4l2_buffer` ``flags`` flag ``V4L2_BUF_FLAG_LAST`` as in the >> >> spurious 'as'? >> > > It should be: > > * The last buffer from before the change must be marked with > the ``V4L2_BUF_FLAG_LAST`` flag in :c:type:`v4l2_buffer` ``flags`` field, > similarly to the Ah, OK. Now I get it. >> I wonder if we should make these min buffer controls required. It might be easier >> that way. > > Agreed. Although userspace is still free to ignore it, because REQBUFS > would do the right thing anyway. It's never been entirely clear to me what the purpose of those min buffers controls is. REQBUFS ensures that the number of buffers is at least the minimum needed to make the HW work. So why would you need these controls? It only makes sense if they return something different from REQBUFS. > >> >>> +7. If all the following conditions are met, the client may resume the >>> + decoding instantly, by using :c:func:`VIDIOC_DECODER_CMD` with >>> + ``V4L2_DEC_CMD_START`` command, as in case of resuming after the drain >>> + sequence: >>> + >>> + * ``sizeimage`` of new format is less than or equal to the size of >>> + currently allocated buffers, >>> + >>> + * the number of buffers currently allocated is greater than or equal to >>> + the minimum number of buffers acquired in step 6. >> >> You might want to mention that if there are insufficient buffers, then >> VIDIOC_CREATE_BUFS can be used to add more buffers. >> > > This might be a bit tricky, since at least s5p-mfc and coda can only > work on a fixed buffer set and one would need to fully reinitialize > the decoding to add one more buffer, which would effectively be the > full resolution change sequence, as below, just with REQBUFS(0), > REQBUFS(N) replaced with CREATE_BUFS. What happens today in those drivers if you try to call CREATE_BUFS? Regards, Hans