Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4377107imm; Mon, 8 Oct 2018 21:25:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV63SddRCHGMboFkU0FJ7OOSmJgwIQWNsHOdvKnp76eyptDGzkwv9byVvkKzyRHVA4cfyx/Nc X-Received: by 2002:a65:6409:: with SMTP id a9-v6mr24092228pgv.204.1539059109850; Mon, 08 Oct 2018 21:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539059109; cv=none; d=google.com; s=arc-20160816; b=XaHfO3RdSu5QRU9WqLjPxNgh94Ni7hJQU5LJR0TmNLDv+HQFxPTo/JuCO4yk1OJHCc +BqsflLIBj1ZPmokTSCeeZqtJHqB7T8h3qd2MM6bc3j0pthoBGRcm93EBIVkBvBHztDf LHI999y+XIjWpqIkQRTLbU2yadNYLRUrjvQJ/np1eCpJYI4zHvKtkAzhwOqvcDHH96LY ag7UeiMx6aqTcfpIBxO96JzsU/jSqFIsGHANVecTtF21ky8KtjXo49Ean8+/pk+l7rFQ EKhk/RDw5jo+h/1t3pSR84LUteEuYApNw/oFmf6G2z3Gct97YnpDY1GwYuVby6UU+85d RqlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VsAM/EWKQJr5+ankh0xeabBlUfA8qsnXvJzTXaBqZxY=; b=ID50VphxM1GvoAPM2+1nydB7MiaeRH8uCoJ+xg85fUG3Q5x8StIc2nuhYaEY8vCsWG V+7MH7RKcfVR1iX80lV9mrFp7n64HGRMfBWEu0uE5MQDwQL0WAjO4+/T1LZ2M56npWZv akF0xFjSn2kaRpPuiY69PmV37xbuVGWCYlwy8/7zebc1OlN+Uq1UWyJzoB5OvpzSIsie W+rv/nsH8OBWsLYDnwDniTAlY/PGG4nX6VxKL3/QN//npuMzjOG/sFAu/S8dL+BIW42Y vARiE+h+kzM7IiE92Hb5iX1pNImH6lyYyxY7P7ntwrcsa4OkudTUYvvHzh0JrrDsMCE1 Lqyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=E2gzTGal; 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 j10-v6si19917115pgi.223.2018.10.08.21.24.42; Mon, 08 Oct 2018 21:25:09 -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=E2gzTGal; 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 S1726573AbeJILjB (ORCPT + 99 others); Tue, 9 Oct 2018 07:39:01 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:43127 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725803AbeJILjB (ORCPT ); Tue, 9 Oct 2018 07:39:01 -0400 Received: by mail-yw1-f67.google.com with SMTP id j75-v6so95178ywj.10 for ; Mon, 08 Oct 2018 21:24:03 -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; bh=VsAM/EWKQJr5+ankh0xeabBlUfA8qsnXvJzTXaBqZxY=; b=E2gzTGalOHUUF3wxOz4HFtL4vS3MoXCYvyfOuf/LyYqLF2+2sk0Fq5JKO+iFd7fnK8 kBaganRDy8If9ky6X0ptRjGM1QaZOOghtWXvXbrLR5X1crWHQZZoFeU39+yAKtjpM8bL itztvHtBeP/3Aim3hfxdOnJyAX9U28uEYtdQU= 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; bh=VsAM/EWKQJr5+ankh0xeabBlUfA8qsnXvJzTXaBqZxY=; b=QA2u/o25bzdvc87yldNRaVSgWzpmObwQ+q0EtomoqrBsHVXoQ5NGq+ZJubfxQBJteY 5dBlTvfI2780Ixgy+BVnA6/VogM29E6Kx0Aqb2LAbDN3jFYEsiFsG2/6HI+SocYC7hd0 9SZ2EPojEcaLQ2BV5j4ueaK8A/InlSk6Thw2f8uzKwfa2GJzt8/TlHa4xAkJWoHOj3bR E/KR07jA13pvyxL/hkZQj4KDqBi2vXGdqce/6ocJvlT2IlnbBAa7GUgeqBbDuWvT1uDJ ztQ0hZsrDfCYxlc8o6hojgKIGRT6EQNSYiw6/Q20KMPQKb3grgA3yZcfR/raNLFhE0jf qcxg== X-Gm-Message-State: ABuFfoiFIQwuCvCT+4kbTHTmWYVOVNMoZ8Pt+G9HdMfykDD9DcE1ObDq DTAXvtKqdYyUGQtTuvQmfChdtkRfoUo= X-Received: by 2002:a81:17d4:: with SMTP id 203-v6mr14465838ywx.423.1539059042621; Mon, 08 Oct 2018 21:24:02 -0700 (PDT) Received: from mail-yw1-f49.google.com (mail-yw1-f49.google.com. [209.85.161.49]) by smtp.gmail.com with ESMTPSA id u14-v6sm3824806ywg.46.2018.10.08.21.23.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Oct 2018 21:23:59 -0700 (PDT) Received: by mail-yw1-f49.google.com with SMTP id m127-v6so112277ywb.0 for ; Mon, 08 Oct 2018 21:23:59 -0700 (PDT) X-Received: by 2002:a81:8144:: with SMTP id r65-v6mr11653652ywf.403.1539059038815; Mon, 08 Oct 2018 21:23:58 -0700 (PDT) MIME-Version: 1.0 References: <20180724140621.59624-1-tfiga@chromium.org> <20180724140621.59624-2-tfiga@chromium.org> <37a8faea-a226-2d52-36d4-f9df194623cc@xs4all.nl> <1dc5fd0b-61f0-545a-fea6-bd90721e144b@xs4all.nl> In-Reply-To: <1dc5fd0b-61f0-545a-fea6-bd90721e144b@xs4all.nl> From: Tomasz Figa Date: Tue, 9 Oct 2018 13:23:47 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] media: docs-rst: Document memory-to-memory video decoder interface To: Hans Verkuil 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 , Maxime Jourdan Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 8, 2018 at 9:22 PM Hans Verkuil wrote: > > On 09/19/2018 12:17 PM, Tomasz Figa wrote: > > Hi Hans, > > > > On Thu, Jul 26, 2018 at 7:20 PM 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] > >>>> +13. Allocate destination (raw format) buffers via :c:func:`VIDIOC_REQBUFS` > >>>> + on the ``CAPTURE`` queue. > >>>> + > >>>> + * **Required fields:** > >>>> + > >>>> + ``count`` > >>>> + requested number of buffers to allocate; greater than zero > >>>> + > >>>> + ``type`` > >>>> + a ``V4L2_BUF_TYPE_*`` enum appropriate for ``CAPTURE`` > >>>> + > >>>> + ``memory`` > >>>> + follows standard semantics > >>>> + > >>>> + * **Return fields:** > >>>> + > >>>> + ``count`` > >>>> + adjusted to allocated number of buffers > >>>> + > >>>> + * The driver must adjust count to minimum of required number of > >>>> + destination buffers for given format and stream configuration and the > >>>> + count passed. The client must check this value after the ioctl > >>>> + returns to get the number of buffers allocated. > >>>> + > >>>> + .. note:: > >>>> + > >>>> + To allocate more than minimum number of buffers (for pipeline > >>>> + depth), use G_CTRL(``V4L2_CID_MIN_BUFFERS_FOR_CAPTURE``) to > >>>> + get minimum number of buffers required, and pass the obtained value > >>>> + plus the number of additional buffers needed in count to > >>>> + :c:func:`VIDIOC_REQBUFS`. > >>> > >>> > >>> I think we should mention here the option of using VIDIOC_CREATE_BUFS in order > >>> to allocate buffers larger than the current CAPTURE format in order to accommodate > >>> future resolution changes. > >> > >> Ack. > >> > > > > I'm about to add a paragraph to describe this, but there is one detail > > to iron out. > > > > The VIDIOC_CREATE_BUFS ioctl accepts a v4l2_format struct. Userspace > > needs to fill in this struct and the specs says that > > > > "Usually this will be done using the VIDIOC_TRY_FMT or VIDIOC_G_FMT > > ioctls to ensure that the requested format is supported by the > > driver." > > > > However, in case of a decoder, those calls would fixup the format to > > match the currently parsed stream, which would likely resolve to the > > current coded resolution (~hardware alignment). How do we get a format > > for the desired maximum resolution? > > You would call G_FMT to get the current format/resolution, then update > width and height and call TRY_FMT. > > Although to be honest you can also just set pixelformat and width/height > and zero everything else and call TRY_FMT directly, skipping the G_FMT > ioctl. > Wouldn't TRY_FMT adjust the width and height back to match current stream? Best regards, Tomasz