Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6119788yba; Tue, 14 May 2019 01:56:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvkB842V9NVQji5KO4vaoIlXSa0WLSvFF6pZXk2ywBc01LcrmDlRP+4/9DCcQx7W/hyNjb X-Received: by 2002:a17:902:bb96:: with SMTP id m22mr36306793pls.5.1557824184761; Tue, 14 May 2019 01:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557824184; cv=none; d=google.com; s=arc-20160816; b=Fw5qTk601JBi9Tk7GQQMcM5tmIbL+lVV+xThGkX69sU00D6/CxzKYkelorQvqCkv05 vYBfcghwelkPqHlcOcLA8DMn+IZU3j1S0iLLDjAPqWJL9PsuaJgKo2o85yjdqtLYwIEA U3kg2+7lSzkS/YZBl8Qlf6fkjTP5QPjAsheLTiIuwMH2TEvuMKuK6AVA2jrea8ZcDwyO uu6A+Xbq/OhZYp/ekghQcGGFc97IgfJ1okPPduDexNgfl89vOhBJVDM7UmL1RtbwSI/m iOARMpBriXxOHSo/3N/mbtedgZreQzsVwse+cP6rFcgveyi/XTkH6m/9ohrm/nwI3SaO 6Y9A== 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=GDamURbtpGgVHM2G7y2obUV+vd+bhtlh/DCMrUBfy7U=; b=gJlG40rbRbf520f5Z5w+uv5HaDL9tbpcyNkwq7Kx1T3jBvhcCxFy1cbYMmW22GRtw7 3GmRIl5ZkaTn+S7Ob9qti11LggGj1VrpUIutdQVbFU40GDpNi5c45hXzi4H8Km6hw5qr uESiV/YELmuJdIGvoXqui0A5YQbD4NmSi+zz610QTox02QgApT80AAyRH7q/Zq/KBJHz JqPYcYxnVSsCfNM7LUxz1rQUkwnPIQG33GL3wTdYzgrPYvJFV/xjhYMp1qkjYDJwbVc1 vXkZ8p1E35xQyFlVLp0YF2ZRoLcPAaz2fPe326eCvdb857BDi8LiAicBoV+P4Ny1KQ4C 8P5g== 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 x64si3572446pgd.20.2019.05.14.01.56.09; Tue, 14 May 2019 01:56:24 -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 S1726563AbfENIyZ (ORCPT + 99 others); Tue, 14 May 2019 04:54:25 -0400 Received: from lb1-smtp-cloud9.xs4all.net ([194.109.24.22]:47971 "EHLO lb1-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfENIyY (ORCPT ); Tue, 14 May 2019 04:54:24 -0400 Received: from [IPv6:2001:420:44c1:2579:859d:cefd:f7a7:d8be] ([IPv6:2001:420:44c1:2579:859d:cefd:f7a7:d8be]) by smtp-cloud9.xs4all.net with ESMTPA id QTCThNgNTsDWyQTCXhnyVt; Tue, 14 May 2019 10:54:22 +0200 Subject: Re: [PATCH v2] media/doc: Allow sizeimage to be set by v4l clients To: Stanimir Varbanov , linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190412155915.16849-1-stanimir.varbanov@linaro.org> From: Hans Verkuil Message-ID: Date: Tue, 14 May 2019 10:54:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190412155915.16849-1-stanimir.varbanov@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfAgHoK2WGMk8wobjzwGKH8h2qhPqPdWqnic4oyaXyYXoeyoRnnLK/2ARQjpyQ0xK95h8xK8IxF4BxwZrXbykNh+Z/HyS6oJ80GXvwBJ8LvBnV8Fw8XHF ACq78qH8Y0dRpNHTfaxSdsYrf6/81duxZvrBRrvKbGitnonfy0N/vQt0CZr1UzBlaL1OI07Tnd+BqHQkJ9KdxqLU7tRShMsibjdCk1rOi0AW69oODpX2f0wp FHs8oSQrapUvigEDFBBLgmjBygAqXSvgWcnhkC/mbFC2q02Ox7Vk/URo+wAfHzLMKIqD8K+H/sdBjtWaev97wVyp9KmMvYWDHsSTCpMU6mYxbpqvYIrV4zEj ZodYpnwiM6h0uohbDMAtI/lqKBwtLDE0nP2Yo4oWMiLtwI6UU2TqqCWDlTmlP49TPFRbYYgX64ShzBEQBXYnBjbkqD2PVQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stanimir, On 4/12/19 5:59 PM, Stanimir Varbanov wrote: > 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. I've been reconsidering this change. The sizeimage value in the format is the minimum size a buffer should have in order to store the data of an image of the width and height as described in the format. But there is nothing that prevents userspace from calling VIDIOC_CREATEBUFS instead of VIDIOC_REQBUFS to allocate larger buffers. So do we really need this change? The more I think about this, the more uncomfortable I become with this change. Regards, Hans > > 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. > * - __u32 > - ``colorspace`` > - Image colorspace, from enum :c:type:`v4l2_colorspace`. >