Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2251352imw; Wed, 6 Jul 2022 02:43:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sLWczJHVbD+I3qWwkTPGTt+5gJUxoh5JPnwBuzN8cCi3cOngADBdbfb/2UU1STus1xh0vD X-Received: by 2002:a17:906:3f49:b0:722:e1d2:f857 with SMTP id f9-20020a1709063f4900b00722e1d2f857mr39023215ejj.15.1657100625678; Wed, 06 Jul 2022 02:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657100625; cv=none; d=google.com; s=arc-20160816; b=r79aYJV1HF+RK5br6E95Lwh3neR7ibGRmG+PfdilzqNisdxCnvaz9FAHs2yhWrFBnG TWiV+2u1s/j1egr2dP9IZwJi/Vrulvucjzw/bzcjku+PUDCs9RvU6zoexWbficXk6YDb 5kgmgL8y2KrFYlTT0YM9fUC8hGZTk5JlV57ML9fZGJAcmzDJTZKBGXG9R/yYo7J7SnbV Z5CuKYcI/rNas4zRZYq8V5PKOgYCBn9D+y4k+u09rAUOTYxcpHHVD3k81uMvbJ/tJIkB RFMnUDtm4uYnTVnELJq41aktT1GZshWJbWeuZ9S1tojcSEcdeMNbEiCGyOcXw+nf2etj 7etw== 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=6WCVwsYehQct1rj82U6GqqVw6dvXTI/q8jZn5+TrXzI=; b=kahCuPlywNXe0L9Z07C2D0j06YDe+HtrMKdM7+fJobphYESvgoSqNtGvnfMoT3f/yK g4LC/wOyuXOCQFq1TJ0D1MdCh3FOoDFHvwNM8QRDP3oWaZU73uhKQKCJ5YXzrn879CfC MmMDgZ4Iv3Ml1NxZQjpkeGCRpOAG4mHoie71+LJNJzLQSR3EgYtQioOmmUFDDfc6J/i7 NgUujX0xkVXHV3b3ggsqlNaVEHp5r2L/oZ/U1I6FfAhZieSCAcCcH6dJ0Q1DuVroXz8V XsaVMpSSQPrAlTx5GGzJsvCnMbaAJbFqTCvgFsQXR8tCWhP9wj8R77hygg/oS8tP9YHc kkFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WPPOYXCK; 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 b11-20020a056402278b00b004379565c6b2si21815216ede.293.2022.07.06.02.43.20; Wed, 06 Jul 2022 02:43:45 -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=WPPOYXCK; 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 S232677AbiGFJiP (ORCPT + 99 others); Wed, 6 Jul 2022 05:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230153AbiGFJiO (ORCPT ); Wed, 6 Jul 2022 05:38:14 -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 112F1237CB; Wed, 6 Jul 2022 02:38:13 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:3a70:988d:42ce:f5cc]) (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 370E4660199B; Wed, 6 Jul 2022 10:38:11 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1657100291; bh=qvrAAJ3OHduNlP8QzQDPXe7I7VGmUp+F+c61GN7S4ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WPPOYXCKX7lefUU5ZGig0wTY+J8kPIFA9OqpkBvhQPuIqdvR1h8jKAbnc94as3oJ5 3StWeUY3Py51RtRwHvEzgUzvxxiqjMT7NXCBEs1x6UiF4qMyOpQBHwTZkwjQT2EUty 6qEotMOR1LfgOyBdYxglm3ee5ecn2KdSmNYYbUVxLSx1Tx4xh1iLFfySNCfI0s4wIl D5NHS6ECfYmh1zSO/1h0uHpus1AP/HYtklBeDXkjp1oli4Dm0uU98tvjnPs0g2Dnfx rWlkcmsfsjtsZVUvI6NlTgTX7hTG7JmbYNrBDZyzgICL1hWXBgbC3vzNSn/+KY1jar g9LGNQsrIHSAw== 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 v11 01/17] videodev2.h: add V4L2_CTRL_FLAG_DYNAMIC_ARRAY Date: Wed, 6 Jul 2022 11:37:47 +0200 Message-Id: <20220706093803.158810-2-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220706093803.158810-1-benjamin.gaignard@collabora.com> References: <20220706093803.158810-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 Acked-by: Benjamin Gaignard Acked-by: Nicolas Dufresne Tested-by: Benjamin Gaignard Tested-by: Jernej Skrabec --- .../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 -- 2.32.0