Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7229079yba; Thu, 2 May 2019 06:32:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyI6UPGO2a0kPRY2sdRYyfL3uE4wv789cI2SPoCzDM7j/VyqzH5HeQNY7HF+j4LmLb1flBh X-Received: by 2002:a65:4185:: with SMTP id a5mr4024618pgq.82.1556803960895; Thu, 02 May 2019 06:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556803960; cv=none; d=google.com; s=arc-20160816; b=YrdmSu4suf40rdhkfTs/KWzwlYVKL02iQOTckxIsTgHdVXbMn+RLG9e4AfDywRnQqb LRv7OhAHPKwLto9Xz8rUwyHKwaPCRXLNIW2ApNRXsYV9XVMunbL7khFaeJQNUgSH0cUZ ZjwMX52WQZT44tlVn71VJu0kqCZXmh6k69hwxAe8VTQvyMUDJDGq+aPkhx0708SJpZKV q8ynYfv1uShKYNnjQ3jpQsW7kSWQBKFngNfkJpMg9hjdv7psdYQM6iTtIgPc31Sp/l/l bh5rYi7Av4ycmzjl7r46f8l7SJArjzp5X5yXcGRIf6nw7QGOptgsDDkvu/MHBSdAFyMd bSPQ== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=xwymtSVqN1lovVQt6NGsb0j+Ksp6Gq6pqoqeUUx9qlY=; b=nolGq4B+O30PhCPk7H23DbY/BZtmLR2bXPZBPbGjdzoDjagnQbWAZqjAnZ3FxK9GxJ gggmiFOlLdTEX0x9q2whddareKgdZMloVi/lLrG1Ah2KGCrcV+qg4qLeXeIumSLSstsA 96Wv0arMIn5scJEcpMW+3RO1P5ZpUDWqCtda5M/dM//4tCHPRaWC7NvPiIMtBKwXAGiH KKUgG77UwiB27zxGtRK0/GAS/Od6KWisUfQaCUdtzeCwUFH59oIcp8AW6K6NgoJ1/yUD jTlUCioDpnNswZuKFTxEIveqTdJt7yKWchP5WnfXkpXAy1dqS2nFaRAH7bT3ddb2zXb0 OFYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=JvQlEI5R; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m86si44810743pfi.235.2019.05.02.06.32.24; Thu, 02 May 2019 06:32:40 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=JvQlEI5R; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726369AbfEBNaE (ORCPT + 99 others); Thu, 2 May 2019 09:30:04 -0400 Received: from casper.infradead.org ([85.118.1.10]:36284 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbfEBNaD (ORCPT ); Thu, 2 May 2019 09:30:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xwymtSVqN1lovVQt6NGsb0j+Ksp6Gq6pqoqeUUx9qlY=; b=JvQlEI5RM4kReI5CmEtGZ0pJ0T ap26TUWdn4Ue6aZ4FpNTcV8aWippQYhCijsNBIH/ugiGhS/ZOkSKh18rJopKMz2TW2ms5ec7B5BvB 0w+CtMfWC1k/SIkZ8ahK23dkU/n1fPlw8cS4u4YkI38vTCCl7mr0byND/MHB4h596+Hl8ZGmWf9ev 06fbGizsKPmaAvdipxJeqy1sYNx6vIXA5xZT8nmmRwHYW7yGWJTDRMWtW7DcaZs0CpWAyjxqkivIA KDThFvg9a/5brrvL/mtoaQDv/tb0Iulqs2VsRZcHu7sBhdl6W98uw/jbZyr7Ac5Je2VcFcceiTG+G T3GCIZlw==; Received: from [177.159.247.19] (helo=coco.lan) by casper.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMBmi-0004FZ-L8; Thu, 02 May 2019 13:30:01 +0000 Date: Thu, 2 May 2019 10:29:56 -0300 From: Mauro Carvalho Chehab To: Hans Verkuil Cc: Stanimir Varbanov , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] media/doc: Allow sizeimage to be set by v4l clients Message-ID: <20190502102956.70aed1c3@coco.lan> In-Reply-To: References: <20190412155915.16849-1-stanimir.varbanov@linaro.org> <20190502095550.31282c0d@coco.lan> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, 2 May 2019 15:16:54 +0200 Hans Verkuil escreveu: > On 5/2/19 2:55 PM, Mauro Carvalho Chehab wrote: > > Em Fri, 12 Apr 2019 18:59:15 +0300 > > Stanimir Varbanov escreveu: > > > >> This changes v4l2_pix_format and v4l2_plane_pix_format sizeimage > >> field description to allow v4l clients to set bigger image size > >> in case of variable length compressed data. > >> > >> Signed-off-by: Stanimir Varbanov > >> --- > >> Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst | 13 ++++++++++++- > >> Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 11 ++++++++++- > >> 2 files changed, 22 insertions(+), 2 deletions(-) > >> > >> diff --git a/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst b/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst > >> index 5688c816e334..005428a8121e 100644 > >> --- a/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst > >> +++ b/Documentation/media/uapi/v4l/pixfmt-v4l2-mplane.rst > >> @@ -31,7 +31,18 @@ describing all planes of that format. > >> > >> * - __u32 > >> - ``sizeimage`` > >> - - Maximum size in bytes required for image data in this plane. > >> + - Maximum size in bytes required for image data in this plane, > >> + set by the driver. When the image consists of variable length > >> + compressed data this is the number of bytes required by the > >> + codec to support the worst-case compression scenario. > >> + > >> + For uncompressed images the driver will set the value. For > >> + variable length compressed data clients are allowed to set > >> + the sizeimage field, but the driver may ignore it and set the > >> + value itself, or it may modify the provided value based on > >> + alignment requirements or minimum/maximum size requirements. > >> + If the client wants to leave this to the driver, then it should > >> + set sizeimage to 0. > >> * - __u32 > >> - ``bytesperline`` > >> - Distance in bytes between the leftmost pixels in two adjacent > >> diff --git a/Documentation/media/uapi/v4l/pixfmt-v4l2.rst b/Documentation/media/uapi/v4l/pixfmt-v4l2.rst > >> index 71eebfc6d853..0f7771151db9 100644 > >> --- a/Documentation/media/uapi/v4l/pixfmt-v4l2.rst > >> +++ b/Documentation/media/uapi/v4l/pixfmt-v4l2.rst > >> @@ -89,7 +89,16 @@ Single-planar format structure > >> - Size in bytes of the buffer to hold a complete image, set by the > >> driver. Usually this is ``bytesperline`` times ``height``. When > >> the image consists of variable length compressed data this is the > >> - maximum number of bytes required to hold an image. > >> + number of bytes required by the codec to support the worst-case > >> + compression scenario. > >> + > >> + For uncompressed images the driver will set the value. For > >> + variable length compressed data clients are allowed to set > >> + the sizeimage field, but the driver may ignore it and set the > >> + value itself, or it may modify the provided value based on > >> + alignment requirements or minimum/maximum size requirements. > >> + If the client wants to leave this to the driver, then it should > >> + set sizeimage to 0. > > > > It is very confusing to understand what you meant by the above paragraph, > > as you inverted the sentence order and forgot a comma. > > > > I would, instead, write the phrases using the direct order, and break > > into two paragraphs, e. g., changing the above to: > > > > "The driver will set the value for uncompressed images. > > > > Clients are allowed to set the sizeimage field for variable length > > compressed data, but the driver may ignore it and set the > > value itself, or it may modify the provided value based on > > alignment requirements or minimum/maximum size requirements. > > If the client wants to leave this to the driver, then it should > > set sizeimage to 0." > > > > That makes it a lot easier to read, hopefully preventing mistakes from > > app and driver developers when reading about sizeimage. > > > > Yet, I'm not too comfortable on letting this too generic. I mean, > > how an app writer would know what formats are "variable length > > compressed data", specially since libv4l may actually change that. > > It's actually quite clearly defined: compressed formats set the > V4L2_FMT_FLAG_COMPRESSED flag in VIDIOC_ENUMFMT. Ok, so let's be explicit here, e. g. something like: "Clients are allowed to set the sizeimage field for variable length compressed data flagged with V4L2_FMT_FLAG_COMPRESSED at VIDIOC_ENUMFMT, but the driver may ignore it and set the value itself, or it may modify the provided value based on alignment requirements or minimum/maximum size requirements. If the client wants to leave this to the driver, then it should set sizeimage to 0." That makes clear for app developers when they can use this new feature. That still leads us to what happens at libv4l with sizeimage for a compressed format that got uncompressed by the library, in order to ensure that a change like this won't cause breakages at existing userspace apps. > > Also bytesperline will be 0 for compressed formats. > > Regards, > > Hans > > > > > Thanks, > > Mauro > > > Thanks, Mauro