Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1207325iog; Tue, 14 Jun 2022 01:08:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1suXBt/KKrcWYvWcxw9oqiLSMLp5Rol7/CFVGicKSoe7/Jb/4ngRc07GlXUvvGlF7zNujWd X-Received: by 2002:a17:90b:4b0f:b0:1e8:53ac:ec51 with SMTP id lx15-20020a17090b4b0f00b001e853acec51mr3268001pjb.78.1655194092078; Tue, 14 Jun 2022 01:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655194092; cv=none; d=google.com; s=arc-20160816; b=tHj76Jv3N4Elc009MGPZCKGz3VObE7OmJHOSN+jxXRgAMFo3mH9P6rEZY4xVVbFrj2 fLElxKJh++sIO2ffLvNDY6/KO2Ah/ug5jB5WmtnEecMR77od5HZFVDPSBnaAk9UBcf33 9tdvf0AYzHJ1qm+mz7Kh0M947w7b7jMnhE+raoY1CY4nqWc/A1EaSdZDXHX0S+KziBDa 9U4KjT9w0UPZHDtzXX1hr2dJpE+d2nXugOcDsYepKVOgSfK9DcFyF9RMdv9VUDyvUpzR 9dmFRMOM9EggtPOBh0CVgCu8VFhW3/mvkUNGsvY7nyNSw64tH0OacY85Cba26uO2KHVQ VAZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2Zg9/vy4zqIz1pQ2kwHZuxaV3WiVhrKXVt7zQD7OWe4=; b=M04RL1OfXFFyWn8HAtwOQchPBc/7NnKkNahjbxU3YD76QlInyVWSMtqEVkeZpVU5Im X2GPE32ugZJeEEEZ8Jc3x8I2tG3IWQcLFNKr7A4/zMzuxZ7IbhJ6ZAEaxHkDAOT99ZNB ERLGFzo7k4a6j9z+EMIuH5rBo3wbBaHRmv7k8M1JO4bET4x+hoKT0qDikZzyTcoQytbp J5S3aHVr/mXCmx5og7AhpcX8KlS86eb0eKzKfkDdnNWhLj7VsBhp2xYK7Kum4sVYknYe j780jHmdUtiLKM+iTmmnL57g9eSzYh2hSeSz33MHYE5zJtMr/nJgzdQBh7b8QoRY+90k 77lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="XZ/eJ6r0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k8-20020aa788c8000000b005228146096esi7933867pff.340.2022.06.14.01.07.59; Tue, 14 Jun 2022 01:08:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="XZ/eJ6r0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354482AbiFNHuA (ORCPT + 99 others); Tue, 14 Jun 2022 03:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235132AbiFNHt6 (ORCPT ); Tue, 14 Jun 2022 03:49:58 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A303D3EB99; Tue, 14 Jun 2022 00:49:57 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:4a7b:8d3a:acaa:ec46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id CB53066016A2; Tue, 14 Jun 2022 08:49:55 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655192996; bh=v/Qj9dkCpC1sNaB07KNbLhoqv0M/1payaJLdzsZJWFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XZ/eJ6r0zNhIiBhIM9ETHLKHAuRxLmnEFy1dOETZqQikWdxPmX+YWt/CCuDFzxrc+ vqP1M84+EqdzLq8/XdQ6uxmB+XQadivjXP+SQFFTGY3pDI+gN6vVRduCNur8gy77or 3zhMXfJgwte65c1BCh3mHEUwQv31i/GrMHztNUNeDec8fg01NOptf0BLtF0Jlv3cBd E6K+ZkPuqe+L87nUa+1+A0I8XtRZU1O/dQpapUHtsIULps0sdn1LwEkUaiOuXV1Lv4 EH3ar2AZEvSsNbuv5DKRdSnxKw8CJ62eDwM7CoXzFBvA7HgGqepJidyZvG9eJ5j7gc Cyb0tbMII8tjg== From: Benjamin Gaignard To: mchehab@kernel.org, hverkuil@xs4all.nl, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, mripard@kernel.org, paul.kocialkowski@bootlin.com, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, nicolas.dufresne@collabora.com, andrzej.p@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, kernel@collabora.com, Hans Verkuil Subject: [PATCH v7 01/17] videodev2.h: add V4L2_CTRL_FLAG_DYNAMIC_ARRAY Date: Tue, 14 Jun 2022 09:49:31 +0200 Message-Id: <20220614074947.160316-2-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220614074947.160316-1-benjamin.gaignard@collabora.com> References: <20220614074947.160316-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Verkuil Add a new flag that indicates that this control is a dynamically sized array. Also document this flag. Currently dynamically sized arrays are limited to one dimensional arrays, but that might change in the future if there is a need for it. The initial use-case of dynamic arrays are stateless codecs. A frame can be divided in many slices, so you want to provide an array containing slice information for each slice. Typically the number of slices is small, but the standard allow for hundreds or thousands of slices. Dynamic arrays are a good solution since sizing the array for the worst case would waste substantial amounts of memory. Signed-off-by: Hans Verkuil --- .../userspace-api/media/v4l/vidioc-queryctrl.rst | 8 ++++++++ include/uapi/linux/videodev2.h | 1 + 2 files changed, 9 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst index 88f630252d98..a20dfa2a933b 100644 --- a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst +++ b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst @@ -625,6 +625,14 @@ See also the examples in :ref:`control`. ``V4L2_CTRL_FLAG_GRABBED`` flag when buffers are allocated or streaming is in progress since most drivers do not support changing the format in that case. + * - ``V4L2_CTRL_FLAG_DYNAMIC_ARRAY`` + - 0x0800 + - This control is a dynamically sized 1-dimensional array. It + behaves the same as a regular array, except that the number + of elements as reported by the ``elems`` field is between 1 and + ``dims[0]``. So setting the control with a differently sized + array will change the ``elems`` field when the control is + queried afterwards. Return Value ============ diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 5311ac4fde35..9018aa984db3 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1890,6 +1890,7 @@ struct v4l2_querymenu { #define V4L2_CTRL_FLAG_HAS_PAYLOAD 0x0100 #define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE 0x0200 #define V4L2_CTRL_FLAG_MODIFY_LAYOUT 0x0400 +#define V4L2_CTRL_FLAG_DYNAMIC_ARRAY 0x0800 /* Query flags, to be ORed with the control ID */ #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 -- 2.32.0