From patchwork Tue Jul 5 08:54:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 12906072 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ADCF5C433EF for ; Tue, 5 Jul 2022 08:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UVC3JLr7K6cDaOjSyh4w3cMYvLSN0u1LZnEAz2qAUOo=; b=NHf8uVkNtaLAZg OsuH/wYOGmnjwje1QlSL4VgyzH7qqeNqBF68Q+lgD2ExCPD82407Gf5WOd9Cv5RWwjZe43HqxSsIZ e5m1nNfxiUkGVGRblMnQGvmWvDrTLngI4NTjnRh4AM5ghjPlGZr3eUufGC0CTLcY8zxN0OobU2PJP Ot9kQa+5+85RQT49JagOvUyEVa6cuEUW1AeXg1LRCpV7HM+RmCD1D6y4jUZ45rN/fuSWWavAhRmH+ MDRklTfpUCOz+u20dZO9M4Y3Eh9UzU4B8rJCwFMmk1Cky5xaMbS60Y9qzJygph5R7NxJCDPSVT5rZ 2s+a3q2dpSRpmrbXBsyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8eLS-00GOYl-Un; Tue, 05 Jul 2022 08:55:46 +0000 Received: from madras.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e5ab]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8eKJ-00GNis-9p; Tue, 05 Jul 2022 08:54:38 +0000 Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:6610:ee84:2ba:7917]) (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 625A566018E6; Tue, 5 Jul 2022 09:54:28 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1657011269; bh=Mix/dcrKC689R6KC/YMCQrhQenAEsIdHlkgicoWn7ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C+DAJSLJ3b5Q95+W3tmiszjM244p+ilvoGcvIgubHwQrdQBaEaMOtGACYhyXnONlE 6n1tmZTgxgkWlQaw/ZqWJ7/O+a9onSRtfI90XOqThWw1dBD79Kr2bDCzKA+6PyZ5oi mlBD47Fdf16X1AG8cHwa838eL8zJrxmrcfjpRNk3Mp0+FrMY0+I/HKE43z0MRdL4ak 1eASG4NTtpurC8zP10PTbwj15T+xfvvTQOgkqBgshxZLU83xY6vytbBhCsMbbl70d7 TpdJOLnpGfammU7XuqwXdPFwpCrYfPfdUYyzjfXn6+e1hfkDZswDvOhWBvjNT48V/Z wZrR/Z0EyMoFg== 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 , Benjamin Gaignard Subject: [PATCH v10 01/17] videodev2.h: add V4L2_CTRL_FLAG_DYNAMIC_ARRAY Date: Tue, 5 Jul 2022 10:54:04 +0200 Message-Id: <20220705085420.272912-2-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220705085420.272912-1-benjamin.gaignard@collabora.com> References: <20220705085420.272912-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220705_015435_675013_ED1C8E3F X-CRM114-Status: GOOD ( 13.94 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.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 Acked-by: Benjamin Gaignard Acked-by: Nicolas Dufresne Tested-by: Benjamin Gaignard Tested-by: Jernej Skrabec --- version 9: - Fix undefined label: v4l2-ctrl-flag-dynamic-array warning .../userspace-api/media/v4l/vidioc-queryctrl.rst | 8 ++++++++ .../userspace-api/media/videodev2.h.rst.exceptions | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 10 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/Documentation/userspace-api/media/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/videodev2.h.rst.exceptions index 9cbb7a0c354a..0b91200776f8 100644 --- a/Documentation/userspace-api/media/videodev2.h.rst.exceptions +++ b/Documentation/userspace-api/media/videodev2.h.rst.exceptions @@ -379,6 +379,7 @@ replace define V4L2_CTRL_FLAG_VOLATILE control-flags replace define V4L2_CTRL_FLAG_HAS_PAYLOAD control-flags replace define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE control-flags replace define V4L2_CTRL_FLAG_MODIFY_LAYOUT control-flags +replace define V4L2_CTRL_FLAG_DYNAMIC_ARRAY control-flags replace define V4L2_CTRL_FLAG_NEXT_CTRL control replace define V4L2_CTRL_FLAG_NEXT_COMPOUND control 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