Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1818592imm; Thu, 7 Jun 2018 00:31:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIt7bPrDLk7NfOWU5/46anQWnqqj6Nf1ehxxXDdmpQOv1X9l8zgYrxktai+miy65BMAVWqF X-Received: by 2002:a17:902:7089:: with SMTP id z9-v6mr814521plk.231.1528356682989; Thu, 07 Jun 2018 00:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528356682; cv=none; d=google.com; s=arc-20160816; b=UwUwJOUplGvhp2i7q7LAzmNURneV6o9TKKFYU5T/+zKYWgHT/Vl5nntbunoQpJF21F ADJYC5/mkh+uQi5Jk0y0oHhMawO+gfz58jfEAiNSYTClTCtcSryVOjMsHy695AUckfmh +rON7G1gbiMWbW7JAwRzTPKLzxA7sQCjHf1zvpWRfTk+qeBonVgCKgZe+BulqePZjPyQ NsUXexRMLH1MG7W58yRX6BDyaJdvSbCx/vWeqdHpUaBagK8eVpVgj38aHRr+WS1zlVpM U5p841wCegTxZ8BMb/gCT+0iS9+DCFivnPdLYkOPpyPhn22BFAfTaK6j7AdKUbYVmOo2 DY/g== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:arc-authentication-results; bh=vPL9vQW3X0tl5VfmRFVdk+rwFnk6aclThxxoX9HW76o=; b=GtKyAykL/QgTA6/6JThPnPdWREELr61rtMMdUJyA9EgImEyRoWuxRwRbLorEowVS92 LqIwG4hu67P6AmDenJgch0HTPEc7TBKd1AH12t64K0XptFp+M2r1ASEsPGr8e6NZWu7p oi03lhXqtvv+lXOdNu/Qs/8IHl6LQgjXViNkQzZdkLLFzat96ddFIXoN696/CxQ6lwFI pOzVV4LZZ31V+GJFzduhN9TqLekIuWMBrIy8tFOyOwrJoO6+bcwuyQrki2S0jaCKNSYs MNMEoYLZx78GBsRq7qieaTXkrrex8oNbFriiLufUUgLjtopaUDu9sG5U6CHBGvoFB5g/ IsQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=X/m3Gh5i; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b17-v6si12363564pls.467.2018.06.07.00.31.08; Thu, 07 Jun 2018 00:31:22 -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; dkim=pass header.i=@chromium.org header.s=google header.b=X/m3Gh5i; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932068AbeFGHad (ORCPT + 99 others); Thu, 7 Jun 2018 03:30:33 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:35048 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750897AbeFGHab (ORCPT ); Thu, 7 Jun 2018 03:30:31 -0400 Received: by mail-vk0-f67.google.com with SMTP id o17-v6so5433950vka.2 for ; Thu, 07 Jun 2018 00:30:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vPL9vQW3X0tl5VfmRFVdk+rwFnk6aclThxxoX9HW76o=; b=X/m3Gh5ipOHsw8ClCyUFWMMDMb+NYqJTgN13sQj+9JxFLTvNNZgpbDknP9PjosrsEH yc9s0icnK01eHjVV3wc3XjMw/hzXj1u27XKnSiB6JPWNfNDAAGOA6A6hHSGYUv/MCMEg WhEHG2/yDIuypJui9u1oCKYkn+uLKFPnQA3bs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=vPL9vQW3X0tl5VfmRFVdk+rwFnk6aclThxxoX9HW76o=; b=QZm05NX2cEGmGDbPLbUVF1jJGl5sphYiJY/kGlVFAUHI5YU89Vx9wmNAgRJYg5efz3 A71ysJVZgAIMaYQAHm2WCIu9SFu7KG3+7ev9lcRb5h7v+0kt28sqwzIWq3TzxgkvpKjt 0TLQ9EDg8VRNuseCTvaSF6S6r1tZK2/FBSGHMoQj/uIDnFG+FHG9znEob1Ij/ots3Z0z GGB26uVlKPKpC/cCoz3uZYf+SkSSAaJc5TzG/v6x4AcoD46W/xj9+Ofm2BK1q6p828DG 0npsdrUPmESYuDfsatmC31WCp36qT5x7+xn4mpH/jDZd2IHOpp+863FY6zA18RjhK/gH HSDg== X-Gm-Message-State: APt69E2ajxYn2ES1xWwKLBLqW8IDAUivwTYGjcLW3RTDzN/7tECLLNxJ 9SvyxMIltt6XSzMHmjQkKFSj9b88Pik= X-Received: by 2002:a1f:4603:: with SMTP id t3-v6mr430014vka.56.1528356630528; Thu, 07 Jun 2018 00:30:30 -0700 (PDT) Received: from mail-vk0-f48.google.com (mail-vk0-f48.google.com. [209.85.213.48]) by smtp.gmail.com with ESMTPSA id o85-v6sm14942712vkd.45.2018.06.07.00.30.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 00:30:29 -0700 (PDT) Received: by mail-vk0-f48.google.com with SMTP id q135-v6so5435270vkh.1 for ; Thu, 07 Jun 2018 00:30:29 -0700 (PDT) X-Received: by 2002:a1f:e686:: with SMTP id d128-v6mr427105vkh.176.1528356628694; Thu, 07 Jun 2018 00:30:28 -0700 (PDT) MIME-Version: 1.0 References: <20180605103328.176255-1-tfiga@chromium.org> <20180605103328.176255-2-tfiga@chromium.org> In-Reply-To: From: Tomasz Figa Date: Thu, 7 Jun 2018 16:30:16 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 1/2] media: docs-rst: Add decoder UAPI specification to Codec Interfaces To: Hans Verkuil Cc: dave.stevenson@raspberrypi.org, Linux Media Mailing List , Linux Kernel Mailing List , 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=?= , Stanimir Varbanov , todor.tomov@linaro.org, nicolas@ndufresne.ca, Paul Kocialkowski , Laurent Pinchart Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 7, 2018 at 4:22 PM Hans Verkuil wrote: > > On 06/05/2018 03:10 PM, Dave Stevenson wrote: > > Hi Tomasz. > > > > Thanks for formalising this. > > I'm working on a stateful V4L2 codec driver on the Raspberry Pi and > > was having to deduce various implementation details from other > > drivers. I know how much we all tend to hate having to write > > documentation, but it is useful to have. > > > > On 5 June 2018 at 11:33, Tomasz Figa wrote: > >> Due to complexity of the video decoding process, the V4L2 drivers of > >> stateful decoder hardware require specific sequencies of V4L2 API call= s > >> to be followed. These include capability enumeration, initialization, > >> decoding, seek, pause, dynamic resolution change, flush 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=C3=BCsseldorf. The de facto Codec API that > >> originated at those events was later implemented by the drivers we alr= eady > >> have merged in mainline, such as s5p-mfc or mtk-vcodec. > >> > >> The only thing missing was the real specification included as a part o= f > >> 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-codec.rst | 771 ++++++++++++++++++++= + > >> Documentation/media/uapi/v4l/v4l2.rst | 14 +- > >> 2 files changed, 784 insertions(+), 1 deletion(-) > >> > >> diff --git a/Documentation/media/uapi/v4l/dev-codec.rst b/Documentatio= n/media/uapi/v4l/dev-codec.rst > >> index c61e938bd8dc..0483b10c205e 100644 > >> --- a/Documentation/media/uapi/v4l/dev-codec.rst > >> +++ b/Documentation/media/uapi/v4l/dev-codec.rst > >> @@ -34,3 +34,774 @@ the codec and reprogram it whenever another file h= andler gets access. > >> This is different from the usual video node behavior where the video > >> properties are global to the device (i.e. changing something through = one > >> file handle is visible through another file handle). > > > > I know this isn't part of the changes, but raises a question in > > v4l2-compliance (so probably one for Hans). > > testUnlimitedOpens tries opening the device 100 times. On a normal > > device this isn't a significant overhead, but when you're allocating > > resources on a per instance basis it quickly adds up. > > Internally I have state that has a limit of 64 codec instances (either > > encode or decode), so either I allocate at start_streaming and fail on > > the 65th one, or I fail on open. I generally take the view that > > failing early is a good thing. > > Opinions? Is 100 instances of an M2M device really sensible? > > Resources should not be allocated by the driver until needed (i.e. the > queue_setup op is a good place for that). > > It is perfectly legal to open a video node just to call QUERYCAP to > see what it is, and I don't expect that to allocate any hardware resource= s. > And if I want to open it 100 times, then that should just work. > > It is *always* wrong to limit the number of open arbitrarily. That's a valid point indeed. Besides the querying use case, userspace might just want to pre-open a bigger number of instances, but it doesn't mean that they would be streaming all at the same time indeed. Best regards, Tomasz