From patchwork Thu Oct 17 09:19:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13839687 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 99A13D21262 for ; Thu, 17 Oct 2024 09:31:30 +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=ZsrsilQB6hYf/CppEdLlZz46gXU+VJmSX74tnVqkasg=; b=AgODLgFm3QusgilPLO7cG0revR hdCKVqiGYT8h4/WZvFf2JdcRIXmmBcDK9MvR12SRHyxT8gMQ42qSo4wb+no5vQS9KDcCOgEb9RWUj OYVC5/swV1sEjEaU50Bz7MGwtTUdifUmapymqIjNBg4p2qjtj6J5PIQmb+CYe7nJrebSTHl/c5u40 4Wdigp1UGOIf3jSfP9LOwXRxTQhmQtPFQ6gvgsQdENgwCs19hsaupoBq9iBjacLRabgOz7oxvGksa xuH0u6B3UTHjEOV6iEpUdwGhq1HM7FzDnp9ywM6eHl9cXAZDZiqH359XgPeZQUSUSvKuP/j1LQbJL jjrTBxmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1Mqj-0000000ELve-3CXd; Thu, 17 Oct 2024 09:31: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 1t1Mgn-0000000EJYk-12NR for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 09:21:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XV2OKcx/FKhb7SgYqR+0euKbdYZIowN4W2IWY5GZVMnY21NsuzSDgwzFwyONT2yza62jPY3r0rf+e70QPbs7U9aBZcEhd5nMjk3oSXe1m8OzcgEZT0231G+ekU+o4+a6dm2/noAEWkVkxOCd+8//MwktnNF5gVMWoRTUBhemjJ2mIFt0bndaM/ByemMf15howivXodWgYIjKOHcigdqJr8vNoGhux7ct2YHF3o8Q+/WbEmFIMyv5APEP01VNe1tOOtVQeTZZf3qHYj+B4bqGpaS4EFUI7w9nOAvjoct3O8tSLDNBqWYm0f+6VUMACsPYexvx81Q7V8fgeGSRxMa6vw== 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=ZsrsilQB6hYf/CppEdLlZz46gXU+VJmSX74tnVqkasg=; b=Y2wJfwNizD3lfP3/ONRm1gRkajqVkV5uqe6QU2BnY51GTCdwTgY74u/a+lvyS9SOb4h6IqAQPbQSv0HXKqpfaA9i+KSQQIw8Wn6Khbv/HF3AzMk2h5mAkNtsL3yVNFR3l+MS1r0fWVrwa5PUibT887cu5/cVHIVhjvPvg1uPkXV5hWgTwT3c7opA+CuNyj+VakbNR/No3EjoSFN3gpKqaMmbVNZ3Zx53aXyft0gd50RySQO4HghPndTVtMGdUc1yvjEGgq01/Zw3NAXul0m5pvJFq2xeWJahv2dnyhICoFyTHKpmodsOdKrDfqAbIMSF88ORKV/6SJy8lHtat4NGTw== 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=ZsrsilQB6hYf/CppEdLlZz46gXU+VJmSX74tnVqkasg=; b=CoeDfK2T2IfQ8XbrjZN4+Sb1YVpmHabcXUShjEukKhRPirsuA5A6Mx0TGBVahYVBd4DubTxKLb8aVVAUaNkw3PMX3YkZn3lG/raJlTkShCqH7T85rjzOBF7JzZtVkPnUrfyLJBf5ur2ZJszX7G0O69NXAl2H36RlZnlR8T3lHstYQhsWS3L3uTtrhcp8MOtpQGU8bIVMuZRZwekM+BeW5Xt9d/0YsLqUjeq3TQjbyEoZ66gsuNN1tq2H92Kk8aYDdMk/XkCX7BzRRiwxufp6gK9bOWQzuCiAU/f1lrhfHktXHb0oPNJgTPiay0UCPZFgj+S9VqgAfrgOr84V2Q18uQ== 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:54 +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:54 +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 6/6] media: vivid: Add a video region ctrl Date: Thu, 17 Oct 2024 18:19:51 +0900 Message-ID: <20241017091951.2160314-7-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: 3c79d7d8-c2b2-4ca9-219d-08dcee8cffa6 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: Ds/78agqoIlNAiOhoZ5Q+HxhZuZq7ER1GHxM5EBV3Nrif7PrebEYpmZ/Gm+MX9twJLULk8S5HGcIXmr+ySLGWfQVpW0e7gwvXndL5PbHBeX6BNx1BKyvgRbNiRqL22YvtxzsXcm/hWqa2GWlk8UHMu6wobMdlOH0DGlIG3Q2REhGmykA4wB4HphViK9lIOiH0ekdqn/A1XEE3v3bYTFKVPoBlQSuOUtZk9r5vFDKWnSJ1lKd4nAtD/LKSTWTxnU/FV4rxLH8WBX0sFoSZgHw0JYmq9c7f1lYgHLLK6JDUwWtcbQDin7cV3Wj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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: wqMyBIiSEoKZDdx91ID3tw8Kuy+1OzkT2ORy7BeY9Uo2VSSL+MlXOXIBqmWwmjul3R+B7GLbXfhmTu/mLSc1C8hXiEXnfrMYE2p3aJOzb5ZfzP2wzVApu901R3pMZGV1dvHA/PV3IKlKmaffS20Z3XGzL0fRAvhDLTbo5+mltLeMkuw/uk5r1wDuPfItTv2Lx0vxYWbzywQKrXhdn7vgB9OK9WcdmEBNlYbw3jGJJF3bEuySUWu3CZKPWYVAQEdxNLHjX5/aWSGCt+ZZT/stes3CRu9IW4SaUF+S+YjhWKB2EnHyG7wUT7z7r/5oN93URhHvT1HZRxJrYKwd0VIZM4g/zngcbB1V0mg18N8Dti1iTtXtWdIJsXvIHLk5AvQ0eubn2+OMI2OZ9L0QoufJqeYYS6S9qPj0TCEFTM39kSqLmy2TOqDjEUKo9aiBWGBazMT3cTJ9IpFMLCr8yegbfpFNUrRQ/MZFbT4pegrDLc8ByUYC1znlDPBT6tNiCwzy4P7fH3NlIxUhLrXM6hbu5x7Ti7XfHzpNYq9NfDFOxmFsH44tWuHSwn1QGTTl2DWbCiR4JGvzyII+Ebg2s6zV7n+JVSV/mwVpG0cp1EHBtiN+V4FvpU2c6vdqHMoatYuCDRZ5ZQ2iDMJxiq9PTBCQ0gN3ijg1b7rRVTUI21X/db786+CUpe5Vnptdgz22TZPWPtPPrBlfflm4y+oH6nYgtP8Hs0NbNJvBm5c9fas4oBcwxNPRcdRF0yskyizOQAPXf973xzoQyDRI2rAKFfv8tn98uNpA4mQ6BRo8DYsTeQonMEuhoAWBkBllbKnfQ9cQYzt3UAmKkLlLtl7UCYhCDMsA3wUO1NQiOLLCv37dTs6SjvozbdF+yWq70WVHEdV0ZV8i55OA3ucq5H4WLV4QRJJV/yJflYELvBRJVSCFn2/9YltoUOzeLDT2x5MB8BPftLcW+JVB6fDjcuGvfS04oMkrVxoMXhG07Gs/EeLwqXdN3fgcTLgdWjZaagP+GXGq6VBK3QxEDeFLJWk+j3/UKU8NV92ktfAqW2JsSza4VjPuvt/CI7MwRflR752RouKFLHhpqMz5JSM9rZbsNx48kymAQy9+Vnj3VJ2QnrNhDyK+xPtI6X+C7+iwICA901ymcO8AS8xz3Ywa7eNQye1YAnhlpzNoH3VzupWUsAXZLV7n2Ru9APP8ol+FRvSCL8nYuMA37ppFDGiHjhgDjqv9xoyH+eapHjvLKxDlW7O7iHNj7OUZ2J0Fd06zDnDQDmO5MoFo5VdM0zlD9SR6ohbzy25TgFn8eJGGv/qf9KKEX3IPXYbxxXhw4XO65WtEXiPegigkVX4L7V2RenLPBNyvKWW2Ka4e8msBeJCjskGtmT4oTH0YvzUFKraVZ1/7UlAIyIwXT8I+Ej3wEZMrDyzIfN+6hynSVvU9AyuZ9IKFEzUFpmKjekyXv1I2LCwaKsDxRyx62yByRj3L8ZABHAdCnGQ7m2OBeL1WZZz8szh0kCfUpxGYtiffXl9F8q8dvdxncmgKq0TixaqE+RFJ/xrpSSFsyJ8pL9mSZDIldltCFeR9liozHl7Ai6ca6ffds1ck X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c79d7d8-c2b2-4ca9-219d-08dcee8cffa6 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:53.9269 (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: LHWKERgcjRNW1oVN7NE9PegOdHyfAq0IiUJjkq2vJgw156ewuerO12stkcmnUkvthyNSBIAdYLNN8y7M/GjsEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9061 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_022101_308137_7B2CA775 X-CRM114-Status: GOOD ( 10.80 ) 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 This control represents a generic read/write region. It supports V4L2_CTRL_WHICH_MIN/MAX_VAL. Signed-off-by: Ming Qian Signed-off-by: TaoJiang --- .../media/test-drivers/vivid/vivid-ctrls.c | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/media/test-drivers/vivid/vivid-ctrls.c b/drivers/media/test-drivers/vivid/vivid-ctrls.c index bed5f4fb0c69..6ea64bea13de 100644 --- a/drivers/media/test-drivers/vivid/vivid-ctrls.c +++ b/drivers/media/test-drivers/vivid/vivid-ctrls.c @@ -38,6 +38,7 @@ #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_REGION (VIVID_CID_CUSTOM_BASE + 18) #define VIVID_CID_VIVID_BASE (0x00f00000 | 0xf000) #define VIVID_CID_VIVID_CLASS (0x00f00000 | 1) @@ -393,6 +394,32 @@ static const struct v4l2_ctrl_config vivid_ctrl_rect = { .p_max.p_const = &rect_max, }; +static const struct v4l2_ctrl_video_region_param region_def = { + .rect = { 0, 0, 0, 0 }, + .parameter = 0, +}; + +static const struct v4l2_ctrl_video_region_param region_min = { + .rect = { 0, 0, 0, 0 }, + .parameter = -51, +}; + +static const struct v4l2_ctrl_video_region_param region_max = { + .rect = { 0, 0, 1920, 1080 }, + .parameter = 51, +}; + +static const struct v4l2_ctrl_config vivid_ctrl_region = { + .ops = &vivid_user_gen_ctrl_ops, + .id = VIVID_CID_REGION, + .name = "Region", + .type = V4L2_CTRL_TYPE_REGION, + .flags = V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX, + .p_def.p_const = ®ion_def, + .p_min.p_const = ®ion_min, + .p_max.p_const = ®ion_max, +}; + /* Framebuffer Controls */ static int vivid_fb_s_ctrl(struct v4l2_ctrl *ctrl) @@ -1719,6 +1746,7 @@ int vivid_create_controls(struct vivid_dev *dev, bool show_ccs_cap, 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_region, 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);