Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1225485iog; Tue, 14 Jun 2022 01:39:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOskxOXnNNSE10+P9NXzki66ZaKgfE2ACfV1WHwUQT8Ymyk/vhVcI2cWUu34UaSv5Z2/5Z X-Received: by 2002:a63:84c7:0:b0:3fd:862:df17 with SMTP id k190-20020a6384c7000000b003fd0862df17mr3565667pgd.28.1655195989328; Tue, 14 Jun 2022 01:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655195989; cv=none; d=google.com; s=arc-20160816; b=zimwiC3NczcGB9CcVywLZ7FXeWjcp7jxGB4C/YQUt4TyNRvr+TRE9YogqdotnFZlqO IP4JWTa8dIQNl0dq0uKUzeh25XH44WORMm14nbUKpJIGpK/WOixIaZi57GJLY2+miOWy pY5RKKJyQX+0LcgFosqj8O9E2QaWpc2tXeVI8EM+NTAXnpoCPNGJDSFKRMdKFDjYj9gn H5MdfaImDRPs9Snc7SDhF0OhC5nzh5IbhAws/BV3TLXVJUQKhO4JVvx9DrmOtrEJGh6x qU/Xr2BIUBvKKlwXnArcEMCT95Cs1bhO+6Kb57fb2HU0jEBn7ApB6vLSLHQAfOdzx96H 9cXA== 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=Pm05OXLJmESyTN/a9xWzeU2VysJoJpOaj3/zheY0rEWJ3Wvg/cVjrK3cJFa2kA8hbR mbCjaIVBSzIXuNjcZV4goYVLpwEeFsWOHmXPyTQ3DaU0hsVc1APXq6mlAwcFnmGxE+wT ScaVVDhhd+6i3bftbMErVj93PU/uuscMaei09FDyQyxrIjyyxWeIXa+T4DnH22vw+Tdp vkk2+Bs1gWJuJOHdxb+p3eYhh6XDZdUA0zMVO+wkTXtcZG0d0V2fkeuv8JdvqEtZX3k7 SgQx+e+1LhZ2ApVda0g4fLeb3xFnU1KswUZjn1lYWpBNv1e1LKXx38U+admEBf6zI8tf ULcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=P4aRVtMB; 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 l64-20020a639143000000b00408a098d7f8si3041736pge.669.2022.06.14.01.39.36; Tue, 14 Jun 2022 01:39:49 -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=P4aRVtMB; 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 S240777AbiFNIgh (ORCPT + 99 others); Tue, 14 Jun 2022 04:36:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239270AbiFNIgf (ORCPT ); Tue, 14 Jun 2022 04:36:35 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52FE842480; Tue, 14 Jun 2022 01:36:33 -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 5C09366016A4; Tue, 14 Jun 2022 09:36:31 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655195791; bh=v/Qj9dkCpC1sNaB07KNbLhoqv0M/1payaJLdzsZJWFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P4aRVtMBme11hZZLn7Df6ia1+6gBadDyGSYN5XBvoKPIqbMHttMiPlT+tqJHOxP92 8hyQZMM3mXbgaIdnE/nzD8z0DbmlwWajxAFwfuHySDmnqwvURdDgQWqgtPAMZDvFLD +hkuI5oA6jC7x3GJ2SQcTbXUpTuSqoaGLT2eU3S4bYmHbRWPiRSGnzJkG8TzIObMAb bnELYK5+EYfkYP05qKEaxYQ55ouTJ92IRWmz4qkic8IbnIVxXPbeoxG8F+hGXcEWyD 1L/7dqkkvrqo904rDnabLgymhnbY4eQoPKQ3QlB3Sgk4bQqQCCmKOCbY3lQ9Qjqjxu 35Ca3UWuCttdw== 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 v8 01/17] videodev2.h: add V4L2_CTRL_FLAG_DYNAMIC_ARRAY Date: Tue, 14 Jun 2022 10:35:58 +0200 Message-Id: <20220614083614.240641-2-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220614083614.240641-1-benjamin.gaignard@collabora.com> References: <20220614083614.240641-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