From patchwork Tue Mar 8 20:10:30 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: 12774340 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 1840DC4332F for ; Tue, 8 Mar 2022 20:11:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243858AbiCHUMG (ORCPT ); Tue, 8 Mar 2022 15:12:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240501AbiCHUMF (ORCPT ); Tue, 8 Mar 2022 15:12:05 -0500 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00087.outbound.protection.outlook.com [40.107.0.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AC4C427D9; Tue, 8 Mar 2022 12:11:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qy5WhtlKB54oVb3NZG97Jzy+WtR5Q41dfDSXU43hFmgl7WPrh9kqlQqjocwTfPLPsDavbV8ggrPc90ww4RnAJl8U1rS2R71j2ygcP+voobus4kGxDk+HskO9R/DcOLtB/yoi/vL3GDDTBKxloELdIVkqaodUZKtB7I9jFgLvUKgy6VUCblAoe+gTSnQgv4MY2UO2vFAoUkCNlx4CG4cj7YXafwajD0vMS4lJ5DHXEO/bfInRnrB+KS9YXrRxBSccUAiV9iVxR2AI+R+VbernqtgPf+9r2lm68Nq95C/pR9Sps2+WSGzVnNoEZDV4kooYFn72Qi2lMCrVatSOxQNc3w== 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=nF3rAgb5oZX9jVox8/0xiKZuqxCg6mxl4g8JY3CmL2ctehi1NecW2XJ3Dkmv2GT3ZXR+8JaYWNANcibxPQIjvr1iCt9FgWEJQIH9vVIKw5ccQFtHDOHO6M/coFS3HnRz6GmJR+/oKuvjZ0cl4jFkiRLGYAY5cUNkdfCTZZFHLPFyNQ8GEVcXCFBRICTlqrfDkMWbJZA2p7PZBCjy8GFar7TACLEtFgKTwIjNjo4JRvmRBfU0sT98xZnSA/1JyjAimnoHstxvlv23042qEwh0pl0+T57vUxv6brAxmBUbJZbe9WFPx4yH2TAgoBl6l/t5Zo4zaVZQlGuiFzC+nFYOyw== 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=MRv94akLtQyd51yverN6ZFiDz8oeCmdzUdm4h/sTWVIYBYtsARKZRd7aWKOpKkOLgGwz/Dygqf5V8clC40OwWR7KOD2SthAGZ4gzn8f+rnNrg7nO0NQt7vJETZFlhc8envpYwOP5GcoCXzDX2XwDENR+UaQ7vEv17vz9QqRp/EU= 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 DB7PR04MB4588.eurprd04.prod.outlook.com (2603:10a6:5:35::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.16; Tue, 8 Mar 2022 20:11:04 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::a037:bc8:44b:5965]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::a037:bc8:44b:5965%3]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 20:11:04 +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 Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v3 1/9] videodev2.h: add V4L2_CTRL_FLAG_DYNAMIC_ARRAY Date: Tue, 8 Mar 2022 21:10:30 +0100 Message-Id: <20220308201038.48386-2-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220308201038.48386-1-xavier.roumegue@oss.nxp.com> References: <20220308201038.48386-1-xavier.roumegue@oss.nxp.com> X-ClientProxiedBy: PAZP264CA0140.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f8::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: 3d5b81dd-972d-477d-4ac2-08da013fc5c0 X-MS-TrafficTypeDiagnostic: DB7PR04MB4588: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: oz7dcqnp0zH/Egmnoqx4nU9dTlU82+fV7AnuCU9pkrCRDcSADzlOPcUZYtQj6DNse+21BJhPCZXd0GrKoiI5SF8WS39JHU2R0UQ5Y1USeHDKJ9udvloNXwqHI8I28/3eANfNan1bo5uo+Sn3skLZAjg/1gPU9pjyqaRmjbjvuL/XNYMJk99nfuBpAds1dJDKWkvJbExfM2abGFVTWy8ka3Tw/vRsFp8adbdrIuH18PXFO4h2pbTCFZ5YHLutCKPmaCS3i4hY8gHVgm+dNSeAdbeLcH6200hE/8X34ns45PFF5qIASGLoPwqdho71SGO5uudrb7sqnhWvG6wYqMmfKJ8XdKRNovhaFnMKWhwVzyYDBd6qOtRFXTt3I2gbphj7u7DzCwIlAcMORLn9TMEp7XDCdMNzh8/MB9qTBlizMYhUjwaHkkFcwcepSJ4NDisMWCwsgoA9CiFHROwGUZciPM2+ZTBXccLDS/Zsa8h5WLxWwFbwAO2rJh05Wi4pYSpSWJD7tRLyNKcI/zbVvN8z9IzWSBqYzfJ8XymDimVhN9KhqdENH35NEwqWZdPscOSxgFa8j8uDbibBQCQ67riVczzy7IUMtzeo7VWnL+sfgWJN+W/tGmb4Fk4M3gUvP/t7Ltq8IcW24D1v5Y9ODC4sjQ== 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)(6506007)(52116002)(6666004)(4326008)(2906002)(6512007)(5660300002)(44832011)(8936002)(1076003)(186003)(2616005)(86362001)(83380400001)(38100700002)(6486002)(8676002)(66946007)(498600001)(66476007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VirxSSwhvl17jyuRLyqhQ9nc4mFJ7QatKCtgstEOnJDS8Z9CYTmbtJbUXXq49S9P7+Rb1qJCgllQvi5ZpNovpHC6IxYJ/B9NFb5J79sCqN2zvDkNUfp/DB4IYLR2QRv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JUecH00E2fI5BM2nbBWwyRhbx+rb/Xhl3oe35Ia9/ikT6q/3khe9cb4G/Pq1SDhs6K78xrpqKHN5d75Rj5wdquwnasZd3/Gl/O50WEf+gBLJVHBhGCd+xRxR3eXgjg9Wj4QXOsZOHRoKdM7ZLO+V3bQS1DcjGpcjJDVCW2ddlPEdV/jA2tW/yGxjuldsRKB/OByYlN8eXu1gEGcSdbMqXTYG3a6u0MnRzntTWfBVaUHtMeUndHd1d9NkvHRzJlwwSL7U1UI9e4paelOmHw10pO7m98pA7QDGGKeY6GTKUrPNdS8w42jjxqJ8j7m9Ubojr/MCr+urpdHugH1/Y/N2seTLThQQhwsTHZ8P6NVCGiN0wQGqrztjQ5bDVDjTflkNcDTgs0ThhhUhgvpULuAUM58wK94M+a1adZJuJcmuAqWPxFBrm4joDiqm3IrJlQSpmri8lsslORRYYnkGXKYElGOTSeD+woJbWKy/2v5A7L7Bq5RDg= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d5b81dd-972d-477d-4ac2-08da013fc5c0 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 20:11:04.1582 (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: lxxLNpaUs9OF9BQnLeMI7TeLx02eo8VP7E2vdmwCbv6PT7cpDP88J6Y7tOwQlm7FY+e4AK2wNa9J7xVWNEPBRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4588 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