From patchwork Mon Mar 28 14:13:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xavier Roumegue (OSS)" X-Patchwork-Id: 12793655 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 939B9C43217 for ; Mon, 28 Mar 2022 14:14:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243693AbiC1OPq (ORCPT ); Mon, 28 Mar 2022 10:15:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241924AbiC1OPn (ORCPT ); Mon, 28 Mar 2022 10:15:43 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140051.outbound.protection.outlook.com [40.107.14.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFAD99FFB; Mon, 28 Mar 2022 07:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MJrMhXfbly3YR9PFanvloVCyPyjJADg6RZp7419HBizFWbXFPPK5uVGXyP0ir9+n6VgKTXx+LNTkql7Suxj0qBKlGRDF6SbVTjt1zCg1JvupRMASJLaXV5srQRNbRDpzptPZcN+22jhVf3mXeCeAYVzAGij5UF/8AzvzR86yO8ZMnPqJwyxqKEUXDNXDjG7Xic7v7F2RiB/NPxsWOSk23tHGgF20+MIOEyofcKxnZDHiNMXWlP3sT6iUGUADOJZ0eyfXMlTfza7DJn85RqlXQhEYy4jT8Wxlup552Ui2ijpxBu6TfHQ1Vezo0DhS8cMviC7reMo07ftKmPUoHyE7Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rcqS8ammh3m96AiUmk9HufueEEmLESmDsN+27wGdJwQ=; b=O3dN10rPaijgospV8FtWUi2ykHl9hG0GTg4QNz1VrZznE8yNl+mu8VntgJjOdwbDXYqbU4eS2Is3ZIOCa1d/3n9I/fpRSAJQFYqSuzDAbVD2musnEjbymccXnmvz8juuNEBzwqn3H2PikPE4FYQ8L///bqIB3f9b3ISxLVIvo+KaEvwCM6FRjlNxnh8e3V4kFnPo8jl4Psen3miQUz+DKTtcBwHjrvpSSVqyEtGxz1qmt0BNk+dff5a8pAL48d4odrS8Xywj08tTQb2WVoSh1I+c3Jj1xMmUs3sZ48q66D8waSfijzvAstvWSKDghF2SOohqFe0M33R3KgocGIvvAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rcqS8ammh3m96AiUmk9HufueEEmLESmDsN+27wGdJwQ=; b=B2NiFwR/xmX/8NMJWoiK2pYqaFkOr4uaUT+xeVzW6ThlHXcB4GLhxN2b6KWyDgmAyBu+0bUmkwXO4pKvM+uhIehwzebHDN1mOlQR0BvDHvPmrMIbfN6Y6zPO7TuPGEP5EKrENO+YyD5snV5lO9c7Jf3L9FVb2pw3CJaqDbQuGhw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) by AM0PR04MB4418.eurprd04.prod.outlook.com (2603:10a6:208:6d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.22; Mon, 28 Mar 2022 14:13:57 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::45a8:8093:26f8:37d2]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::45a8:8093:26f8:37d2%7]) with mapi id 15.20.5102.022; Mon, 28 Mar 2022 14:13:57 +0000 From: Xavier Roumegue To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, stanimir.varbanov@linaro.org, laurent.pinchart@ideasonboard.com, tomi.valkeinen@ideasonboard.com, robh+dt@kernel.org, nicolas@ndufresne.ca, alexander.stein@ew.tq-group.com Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 1/9] videodev2.h: add V4L2_CTRL_FLAG_DYNAMIC_ARRAY Date: Mon, 28 Mar 2022 16:13:01 +0200 Message-Id: <20220328141309.177611-2-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220328141309.177611-1-xavier.roumegue@oss.nxp.com> References: <20220328141309.177611-1-xavier.roumegue@oss.nxp.com> X-ClientProxiedBy: PR3P193CA0032.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:51::7) To PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4e8adc63-79f0-4617-f43c-08da10c532c4 X-MS-TrafficTypeDiagnostic: AM0PR04MB4418:EE_ X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ydrjzG6hBvEPZlHYlfeEaY7+kYnleHdIaDcLJ94qf3RdArwSppxQSk72vaLH2MR1KseS1ck+2Guji4+R7O62C8s48knGw2ACMxsgE4fML6201jj7uxRXQyDa0+mL/x7BvAgKB6C59f/GRGuug9SotWjaOefgo3YqBRn57KT4uHCFInRcj2l3n1im9TDH7UO3TUTjSPeTqqGkryx14tfBIVQk8BbDwo26kWu8aq4vBuJQJ3alycYnn5pNRai5eh8TsVdicKr2ieeLTNXJOvVjCe8B/vgFz0c+/GLKC7WIE10+qOu7BorDWbLeytTCAjkNvBgfwDYXARiV6mNEIi894OAvI3wHwu7NUB1nEUXHNncGkxJrTl4mWL653xhHcPUI1XkVbeJiOvZJjZJjALeEqLkzWlTJeM/0s3B4qVmlQ6u9OSnk0fefX9khTTXFAfhFcRLJBnMY6+EzgkH+RbkVpgVUABgKmO/BMrKsK8WzPOiO5F2PNFohxrmj6LXFZ/7B84WcShwy/+KZMZJQN+0Lsrn1T29D5umgLftNU5/3xgMuwjfc0Zh4sfZW2xel8oEF+leBaSzGuusMhTSQHZnDHKH946M+u9+LMSxOYIp1HIi4VvHHPxEuFP8PCWCwMnG8EHHGRKE2iX875wuerhi+7w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8703.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66946007)(66556008)(2906002)(86362001)(6512007)(44832011)(52116002)(7416002)(316002)(508600001)(8936002)(4326008)(186003)(6506007)(38100700002)(66476007)(83380400001)(8676002)(6486002)(1076003)(5660300002)(6666004)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: gHxIE3qvycPWt6HmcPqOhTEsm+G8KeMN1MFzcJ4ujeooJMERBMKes7PjP77InDBqzyXDVXJhaZy2tpPKAz54LmtCfHjGeTFtiOJ823qLCfSZuqz9yvQ1Ji89YqhiCayrv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QJ3a6O2f7i0DdWob0hDOiBWYUUm8I4BpywuUIxKxhc7aRnIWWZqfBSKMPUgV6Wh5ao+56NaDJyRK6k4WyMVMOEbpTkhourqPx/6bgRVsAnr/LQH2kKz747Dft4qQC8ahxS2kr4JZBfTqBauaXWXBK6IGHAYjQVADO90dNNN0fWgS+9EDR4JCdB6isTCN1Hhe6L2GFEmbk7bvvN4Q48FBjuLF3gU8NCaPAga5AcvddJCv+Her58HqvJeCmXWGVSWYVKiECU7i6i0/AIS/d8sAZ4vzqBWPb6aLpJ7Z2t3g71UKz/huluyO7TyEh/fEUumaf+bnG81oG4oBCrHTAOjHB0W0GPqCkO0NvFo3KtLRbZgRoTl9PxXF/d3Qbx/4GVFTutJhV5Hr3CoWYJFo7V+r2+Oio77k0pKjz7gq3poeGKN1S4fp/9CFnm+XTf0pYn7CyMo5ov6bftx7P5dgf2KH0dmDTjOBLgqUMCxV1piwJaQsH+tnilecXIqDpD4DMdYNAVuFd7RVQzqfKt+2971hqIxFWx2CjxVv2xXWB/IUgPmlg0KCci4xv3cjEBhFQ3Z X-MS-Exchange-AntiSpam-MessageData-1: smxvWDr1qY0oAaJUT1zpcAOFkHt6iFsu5rU= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e8adc63-79f0-4617-f43c-08da10c532c4 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2022 14:13:57.5059 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mr9O2IyvnJ/m/entGl3XdKeOZy1cayoYZ3Hq5ZEIckDh46I6RY4DScM/gk8dgrzn8TSF50hP0+e8WLUdMzMt/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4418 Precedence: bulk List-ID: X-Mailing-List: linux-media@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 3768a0a80830..8df13defde75 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1886,6 +1886,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