From patchwork Fri Oct 18 05:44:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13841139 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 EE92ED3C54C for ; Fri, 18 Oct 2024 05:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding: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=z3oKuxRFkA9yHb1hrfi99zYa7fO58IZs40h8sxAWj0U=; b=gGfqb5Fuf4rNLUVNzE0JHTCzjD nWcvNxgtJkN4SJuB/QOq+rlZj9gxAa3ZNrTTn3FPnPldz225JkT3JwCpBxR9jWryJ6EUvevtWWYvm OC7GqDOOKIUq2X7wetT9nM0hJ8myp2uz+b8TYafapa/r07zih7yc5y+kRhe5DMa8JbhVqFY+kh556 v0xYF7mw5GdLI3AkY/Q0rue6gmfRp81EgdZ0YSv3eTUyJhiXqlZLzB6B3RbvkAKxu0TO5Rnb5P4P3 gRaFnbaZieWNm7+DfzciUxhQhgvsdaWkYlPRl5C0/ZP0I9e0C21mQK5WjPeGTo24bAAdsor5bD21W AQxn7/Og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1fsP-0000000H1DB-1Nx1; Fri, 18 Oct 2024 05:50:17 +0000 Received: from mail-vi1eur05on2061e.outbound.protection.outlook.com ([2a01:111:f403:2613::61e] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1fny-0000000Gzoi-34Bz for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2024 05:45:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=l/vm5o79Hh8mIXo3SSB4Ww2ESqySFMLS4aX0iAcX4bv8Xxpe9boAPHpOTemKLjB7W/5AUm6Cwf9VB1cqRlRrjqSv87hQs9CHAMoOtQwG2qFfCCv6IzGuYWxolcSq0o2S9mbLslF2bkUrTsxg9uMKxFh4+4/gWN5EW68FLk4ZKoxTJuXgOBeo3IAFL/56mfF5/M5Phv1o3Q0wX0cjdU5prNzB3f6JEUWV+2UDhdWcJ5tAsU/57Fg0UL9XI6H+Nf/qoBLh3xQDtkCobFMdELKe4cCDLXwv6mgi/bsOdBhE6On+cqLzLdEF6MK0czo1/CR3WCi+19V7kTNgMj/0LsJ6Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=z3oKuxRFkA9yHb1hrfi99zYa7fO58IZs40h8sxAWj0U=; b=i+nVJMXuBI7w+AfZwfAehKNVqGY0t6gWXspHANczKe1M5T2SNq7x4vNvoQx6OrOY7vpTWQdQmOgxJuWZcLNn61lQfxUcrZELQJxQW9mRJFsjlq9IlsXhozIbAaUzX/RllPExU/RaY5jwRUf3HeLMxO8BRzCBi+c8misqkfU7tlHs6EWh+f/5NdFFiqWA5xdiJSbwpD0n7fUV+NIHsaROCiW2R4YylFDs/912heiEMAUHnnoJ0CVnSIs0aOQTa1gQxFfNa1ClxAcXaIYBrlU5r30cT/xz9d3lmNbmYIMaTYaNCVf9A5TaBHxv7WgKovZgjw9Yyaf3Pa6KEF+Q/AshMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z3oKuxRFkA9yHb1hrfi99zYa7fO58IZs40h8sxAWj0U=; b=Y+yYgOozV1yrRMyT9jRbrBMfpyqvLWubAOpMpB/2rEVQgFtoBbsGnev3wn9IN7tlAi4S4lUkL9oPMdslTC5Zh/wKoMmSORzjIqhkpTF7hxQ8Sh6WF3fHsapgcEyeOmoGxgkbpRdhFded8Aq91YyL9tVIkzK73R7p5uqdQlz3YtI9RCSVFZL2cs3gK5cLNTJ163ZdLtGbg6MnL9pB4xws414EpHQLPVoa5DVRQTn9wYTaGHZwrJNmlERTISuJpTpNGh1Jqv5g1V+jewr0FgdphW5ewpPzOV66JExqn2/QvX0vuCZiDmQRHwMPT0Y14ZnhsAx5p9ZRlWNCiUdEgUlojw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) by VE1PR04MB7312.eurprd04.prod.outlook.com (2603:10a6:800:1a5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.24; Fri, 18 Oct 2024 05:45:32 +0000 Received: from PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87]) by PAXPR04MB8254.eurprd04.prod.outlook.com ([fe80::2755:55ac:5d6f:4f87%6]) with mapi id 15.20.8069.020; Fri, 18 Oct 2024 05:45:32 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: yunkec@google.com, nicolas@ndufresne.ca, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, ming.zhou@nxp.com, eagle.zhou@nxp.com, tao.jiang_2@nxp.com, ming.qian@oss.nxp.com, imx@lists.linux.dev, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC v2 2/6] media: vivid: Add an rectangle control Date: Fri, 18 Oct 2024 14:44:44 +0900 Message-ID: <20241018054448.3190423-3-ming.qian@nxp.com> X-Mailer: git-send-email 2.43.0-rc1 In-Reply-To: <20241018054448.3190423-1-ming.qian@nxp.com> References: <20241018054448.3190423-1-ming.qian@nxp.com> X-ClientProxiedBy: SI2P153CA0030.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::15) To PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8254:EE_|VE1PR04MB7312:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b7f151b-c5da-4703-98d9-08dcef3814a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|7416014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: O0+7Qypc+lwmS8+k82ForojsUIcBf10cCOexPnQeeypps3tyNm3W3BYLg9Hm1f/ggHDu4qgY8xoSRYEvbl8IAkacKZ0QsZbIBusJg/GTpn0sCxSIKcmRnd215gzbp0dlo9ZNJ39IH140FZeczUu+ldMBjXRycsIqRpZIy++QPtOXRpdxn+rh9M0j79ZBfOQDfM4z77BIQFYTS/bCsoDCAxHONOuLGBe3ONgFa6LSY3NtlrijWEyVFqw5P6wHBjh9cA/PHi2AAui8j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xkWoBMuwW3B9mF4oP/8hIA5mEEDyixDDawsAZHe248WCZ0Fk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8254.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(7416014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1ORZruj46Q/jr+6qrW6nP5npdTU4poY3kbZ5wvyPSIr10oKMyyEMsvmsi1bE3L1Y1HFvntLP4wXwr5udCOQb3JG9/o2V0tp14zzsF35ZIFe5fbWR5xj0o0qXSy6mAQztmn5C0IYz4jUp/wK5hn0/jBe2plRIQsDVDZ2Da/QZ7sMuY87bEi4i223gw40XD+L0Z+LyQfghr5VNAg8+VGLrupwk4ijdDTk1gQqysvUJmg+8Mpn2q9Cp0G9bw4DTIRVN7kNTsGL6IQi63bUjYhsdFZoz39VcsowSxUkKsv7WWFBfbOLF4WmdRjQW1Lf7qHsHRuoXalw0TpytQ9kJZevdBa8jJw5xT2wvzVebP59xb3aTlF2Pd944MtIs9rYYPS59WNx92FJfNlwSpCJJPi5vGs2kaCk44TDH3krjRrn0LMlnncN62KiU0bvTeZXgfEMY4LNC+MR2Yg3WMv0iBeoNwg4StEs+oKayim+UPCrOm7rfxZf5CPGo9wWmvWonvlnuNLnSpeQhT4A7x0WeOp2ePjZMnJbF4RCkiuFVioJa8WJWwvRgFAopYiLfxVp9Q3LaVAKtvOgQIFJSITnE85AP7Yx/nHnbrKKWBJjtXI1l968pzsVv5bLCD8DF8rUaPICtcclpabtaQEukpPaui1ni+aMeL9U6pTudx4kTbUkRUWULTgL+G9Y5zGPviwFhpF8LwPzrgxDj/rnfaelJU05FAOeXX+eGb7Ieo/Zn7UzGmO/nWCp7CgzVOadLH8aWBO+IjVzmPT8spxo/7p3D1SfOF99dTAVO3qp1guawXS3YeWztveulQXpuFnhB6mYqpsqwtauQgbvM6JbR67rN3hRCAExiwQ3dMQyjfqy0dw+NLm60RTfwLd+vvND3lx5EYFBPHb++ECd45OvES63VWy/wwyeusxxnxx37COUGCJw4I21dQ2sadE37iEie+ku96+n4BM4fFEKSYUIxUop0kYZ7r7fYsi+OPnszcsh9M5+jJGU0Gk4cacRHYfG/sRZSecq5wXIyKFR6t0ksqsbSjjoQOhY/PQworci93wu0y4jvPsXQ2T2qEq5k1kQErBgdqrFgrHHrHql+R9Sh33+omjykzidCnb6W6cdCOvEeuxiJMXS+YS0pjag7wqoIWVvPIE/UKVKT88A97yJKYTXQNjHyZJIsx8MZohAXojU+DJndYPaZC1eKRK8CMAxh50s0XAEWCTr0omvJ/VOb9Gb1PFzts9PUR6gMaFSBPwmQZgUkHMP32P7nNkTaUV45tCe0T1HRuAVgDGSRXQP4D1S/eRxadkm7USi2NBPSeA7LSfuVOs8PvpC2CfkFg8/hPFCBwXv304SHkgI5Bs3Av5c+TzOlHygVtTUbRc6WzthcxZe4/dG6HU5G+ATBv/unxklg+nZ6Uq3epArWrCXNLBFHQkVhJoH+MBbiF1q+yK0UDT6gZXjviq6QDCgW61rKkjRQ7UzmzIaunuwl6wfBUg1O/Lgj+E4lXI9We0fvJQ22MHSCE/xFknbALNUB0n4zvQg5tJnYh2tdOEk1V3XnceIidkDOVoJa9zp5tmaSwRuGE9hwQCT80+4NKZqlTqdgp/pBO+fK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b7f151b-c5da-4703-98d9-08dcef3814a4 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8254.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2024 05:45:32.5503 (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: v2N2kMCkgZtixJLW8UTDrmJaDdmzH4dKU8MLSRNGEaAW4NLDRDdpXXSO39hFUnGmv3YJ+/7FEUOP8khknTZ++A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7312 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_224542_791703_695A85CD X-CRM114-Status: GOOD ( 11.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Yunke Cao This control represents a generic read/write rectangle. It supports V4L2_CTRL_WHICH_MIN/MAX_VAL. Signed-off-by: Yunke Cao Reviewed-by: Hans Verkuil --- .../media/test-drivers/vivid/vivid-ctrls.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/media/test-drivers/vivid/vivid-ctrls.c b/drivers/media/test-drivers/vivid/vivid-ctrls.c index 8bb38bc7b8cc..bed5f4fb0c69 100644 --- a/drivers/media/test-drivers/vivid/vivid-ctrls.c +++ b/drivers/media/test-drivers/vivid/vivid-ctrls.c @@ -37,6 +37,7 @@ #define VIVID_CID_U8_PIXEL_ARRAY (VIVID_CID_CUSTOM_BASE + 14) #define VIVID_CID_S32_ARRAY (VIVID_CID_CUSTOM_BASE + 15) #define VIVID_CID_S64_ARRAY (VIVID_CID_CUSTOM_BASE + 16) +#define VIVID_CID_RECT (VIVID_CID_CUSTOM_BASE + 17) #define VIVID_CID_VIVID_BASE (0x00f00000 | 0xf000) #define VIVID_CID_VIVID_CLASS (0x00f00000 | 1) @@ -360,6 +361,38 @@ static const struct v4l2_ctrl_config vivid_ctrl_ro_int32 = { .step = 1, }; +static const struct v4l2_rect rect_def = { + .top = 100, + .left = 200, + .width = 300, + .height = 400, +}; + +static const struct v4l2_rect rect_min = { + .top = 0, + .left = 0, + .width = 1, + .height = 1, +}; + +static const struct v4l2_rect rect_max = { + .top = 0, + .left = 0, + .width = 1000, + .height = 2000, +}; + +static const struct v4l2_ctrl_config vivid_ctrl_rect = { + .ops = &vivid_user_gen_ctrl_ops, + .id = VIVID_CID_RECT, + .name = "Rect", + .type = V4L2_CTRL_TYPE_RECT, + .flags = V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX, + .p_def.p_const = &rect_def, + .p_min.p_const = &rect_min, + .p_max.p_const = &rect_max, +}; + /* Framebuffer Controls */ static int vivid_fb_s_ctrl(struct v4l2_ctrl *ctrl) @@ -1685,6 +1718,7 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap, dev->int_menu = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_int_menu, NULL); dev->ro_int32 = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_ro_int32, NULL); v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_area, NULL); + v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_rect, NULL); v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u32_array, NULL); v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u32_dyn_array, NULL); v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u16_matrix, NULL);