From patchwork Thu Oct 17 09:19:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13839678 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 7E33ED21268 for ; Thu, 17 Oct 2024 09:25:29 +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=3j9TvxJIeAu5s+rOsq1o+usr4y /awAZ0N60FFqoZwFrULZfypTopZTPXjPCJruXUx/gwsOP3NIAAm5jQXJ3AOUbJ6ckxvvvL7rgXqmQ SRwuPG1UOymKlDXbzyhZnZ/mpAoZcpf/HLLQ/OesDh7OWkgDWYruSp5p+0ptDJabTIpwaxy2S1Rcw O+PS0HfFjrSt2GPgPQNZaH5raoj4Y8ERv8VEmmtAodY/4QUlcdH7EtZ2eWAFKBtEGHPC7+IkiDE/H tt0Rh1sw2MFfKG3s7yWj1n17G9DVt7aGZOeIr2Q9w8T+UKHh3IH/XMNP2VFHz5MCO4qyQg1qWZKcW V9CyRTlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1Mkv-0000000EKb3-2x5u; Thu, 17 Oct 2024 09:25:17 +0000 Received: from mail-am6eur05on20618.outbound.protection.outlook.com ([2a01:111:f403:2612::618] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1Mga-0000000EJYk-10Ee for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 09:20:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=e64ppHKrKlyOIV+iAZ7XfDq3DSdbWay27dD4DuhLSLbluGt3rElJ2c3sgX4dTqk12u9D6+g2sPhagD0Z4SJEvfn7n8Jl24y7Bvo++IArkWQmgwn+T5A1bPD3sz5oAuSjdUIgbqIoec8jszXIrl8cl5YdD62LWiGb/fVdeFqW2EI8KbO9wzWgZvRo/0M4KXPnCbFFsa0GQu4dT8X3kKoXAFPWiAhPUKVQ244O41v/AkjjqccU0YmYKomHljIBvFm4F1g/PMJCyl11jYx6kvzFvBRN7ub5+/Co355k8BFgzUAqRWqpkBxPtDavSmn1/NpAjqDEFBOCb6Wpd8CfR8cQ+A== 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=MWhytjmWIPHDXU5LysnP6O4H6p01ViKKFMnbeQXQKJflYgn+8ZgQCfPlF+3CTWBnSuiXM6habcZO0R52Yit9XusNhv7HtCl7IHQ/CDRVVQynTONW77dMWLS9dHBmvg3J3/pRST7f+E1otCaC9EO7UvRxeXE+UjSNwIrcZx53Uj7DnL3LN87VJVrU+Hmo/GfMhK4dqZtW6JXiRqLJzXcRYucX/jRYlKbbM7+5YEIJoQaTG5fH7Cjcn7sqeDjz7Cmi+yDD2EwfwohupkwBgtucCcJaRu1lw7/kgwXBabwetClTS41xHjYmLL2eS9k5+BUtdaCLke85O82Si3hgyvYoXg== 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=M9SllDs4VJY7zqyGbKI+sghP/RvIr2UksIwBHmLTdb+/2BnklPlNfoma4drPWYM4RrRgu7l5LVfobvJz/4iXZ8+Y8k5T4UzgrnUZY+AAAcRrqTm0QEMRLqIbkrBDcMBFBwzuKu47pf3P6PvmTHKBsI2I2nkqZtw+pkaIuzCyL9nyT0cTyLR0nDU/eXGLsbsmNj6Gj9EDkTrqSafl8EA3Zuew5CDUKLOhltk1ldD76sz40d5H3o/YWm+HQIl+vncdrYRkj3afmvnHj/Ib6flj1JhW4sM/D0lgpx24t8g7SEzu2mSo0Pb21iL8AZs22rr1+VxecMtJLd2nkVUt6g/umQ== 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 AS8PR04MB9061.eurprd04.prod.outlook.com (2603:10a6:20b:444::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18; Thu, 17 Oct 2024 09:20:35 +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.016; Thu, 17 Oct 2024 09:20:35 +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, 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 2/6] media: vivid: Add an rectangle control Date: Thu, 17 Oct 2024 18:19:47 +0900 Message-ID: <20241017091951.2160314-3-ming.qian@nxp.com> X-Mailer: git-send-email 2.43.0-rc1 In-Reply-To: <20241017091951.2160314-1-ming.qian@nxp.com> References: <20241017091951.2160314-1-ming.qian@nxp.com> X-ClientProxiedBy: SG2PR02CA0129.apcprd02.prod.outlook.com (2603:1096:4:188::19) To PAXPR04MB8254.eurprd04.prod.outlook.com (2603:10a6:102:1cd::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8254:EE_|AS8PR04MB9061:EE_ X-MS-Office365-Filtering-Correlation-Id: d05e3b88-eb36-4c3a-c98f-08dcee8cf4cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: ngBTSlgCZs+hrHL0CEfxET8XV5G9iggIlzaQwNOkz1NWkUcNArFP0kbxBlsaRLvVb8GNrNRMkZSoEyjMe7Ez5109nqKPdgk2zDgueJEdguEx+iPMSmNQ6pdx2lmqfde2ps0Dp3M9muX0CSXC9wR8L/1aZEsRfvtuAifyRvnx9HTdgQtAfQzyY9KIepGh9fYvxOl4dAWk1kZuyIzvIS6nw41Rf/eM8eEOO/TzD5MymSje3l/FfjwxPgpQ4lPpf0DN77kNR6Dwfe7R0QG21RR0YW3xpKoJNWhuwPDy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YUzTWwokMSfk6aQ= 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)(7416014)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SGLzGu4G/vb/aR0QSAOjHHcJ+MGQra6kmMAZw1xzV0LWp1laphoU4XKLvfWYufCNfrUd5goMaaB8H/7VErYB9QzMAN2x3BjfheHQ59wVxQtzVY9UZn2Br2R/SSy/CD/XNggeX2LwEzSlhBzTMn4jb2V5r4/cLvrEbwjnJAPRVyYaXdAkcY8Gk+FrOYUb2B4+0RefXsjSQ2ZsySRNi2GKpBxXq6siuTKigdLsC8xsoVjJTFUIswqtJjM1GagsfEU3wnvEpeJq113GeN0QpdYfgaEHREip1tMkrirYymCbgdji8H2eJUCMR+UabvfVwoINPP+V2I3r1MIa/0Svhb39X2B4DOSLQ3pkVVQgmALPXQ4BMX0zw4481AolGx/tooukH6O5dTj9CrPj5m9B9WCkrE+ZaGqI/BxQp9ZC+RM1U92pKQG5949z6OFnhDwTeE912f46E1A+gb9TXW+Z+a0d9u2b/VsCpUvA05gQAvrK0zQyXlFmz6BaEFt4VYAKChzNV1QpSEfuiIiuYK7WlhQ5QZhCL9b+ShVUuHaJYnmVIxHb4VSLOaJq3sUL+caU4cuXnivknCusxBtaTCGUSIX/45yxjpdphQ3Tc/21IkPdu9ac9lbKBWyPvv9hZESMRkNmgVR7Qm2vjiCwYrtmNUWLRUM5n4aqQDhEVNIAbrD1BoAPNj0kkHgqrSUD/IEwWrDdjAJhTHZ34DMOONT5wB0GuVrU0b1SEr8UPFCqpI13QIF4g02uy12aSnNBT22KriZiNN9E0F4OnVLu438I49LXT5oYXQ5nwL/O0BVu3N0LIe2vol8TvR7t2lWeJVIxMQhz5nNC7tAzSMiA4xNwPKIylRQEI3KGzzi3dgzy7RX4eThxMJaGZJWFruUqpucKe0J5Ww7xbiX+nhyaKW8eV+8cw+FxwmWaqseLmsRAGlCOBjhwra+Zx6AZNfjCpmxI0taI3tj8i2pSGURd/kt1zRVWBrv0x5R5GPZgg7Rvz7K1bMlrKiuP98nj5XyzciKFXeeE4bgru8ixk2CAcRGyCnPrraV5t+knH4xtvmthsyigBb5g5ZOTfr1ALIhSB29pJqW3LsFR7zgRWc/55oL/WQeHiD0mECQL5QF3EL7LZ07qdxw25qBwq6Wo7jMn/4wl7IUwI5HleHT9A4CugfVLUquxosfyQUnG+w/9qqLFoawlV999+Tzs65Lu+8ZIXjDcYNdII716YGeXaefr+xciXDI2PUp0pZAtUoD+arjdaQFh6pLabRVGrdIFj4GyRkhcbu0IMZEmI1a9Fv8G9mfov4prLZ6WYJ4wyhUP1Q4ZLwu1JFnyOQDIEOw5+q0QSFzOA+dzKCKmM+paAr9j/zqnBSdevoimardSKVdR1CE+Cj1S/Sf1J1etEmD6uemCblfKRV98sVRoAY7NI4r+Mp6VEZH6RHBN0rRqQuzpoRqmCcsQTKRymlH3ww8CEZZc1hPQMXdMXbdcnufQ7qEomDWxLoOyNP7sSO5/F+GRsnJOsQYPo7yVcJb37DhWZVK47BKs0u3yKfrbN+9o/osPGF17JZFM0oRCEVtWrM84Kh7CqjCudxc/Y7by1JY7Odr0ep/+R/2B X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d05e3b88-eb36-4c3a-c98f-08dcee8cf4cc X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8254.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 09:20:35.1503 (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: SMzgxNs9oMpG831hNkXgqt3fT9uTViIcqwgEL5C26y1eU+yvQ9P1Fc1H/XAsCxvYns68Q12ocwlg9LnUb9MYnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9061 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_022048_301490_1ECDBEE4 X-CRM114-Status: GOOD ( 11.01 ) 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);