From patchwork Fri Oct 18 05:44:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13841168 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 EED42D3C54F for ; Fri, 18 Oct 2024 05:56:24 +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=vDJTXYV5uU5wcz57Xt6Gi11QLb uWb8gHHXtQydJpSHY+wR57PPAwHhaaBYRspodwGCXm3jsFP/fqJt5i4TxDwwToERgTxoyvtvnKVE8 /34x2TpzaI9gGOFRWrTOSpc3w4aoRNrvlMOp6cch17AQ/LgN2CoYL6SaSGEUb3Fq4GZaskJT4Y5rB UNCfSp6vZXZvSt62cqa4PPm3hY0a0kodFwT5XGcf2bqtQxc1blWH/dIbHaST/m9W6sPWaEcPF672I U5fZD0v6CnRpW9c/JbQ+cTM7XEBVWiR4ZmTEBcKrh45hsZ4w3Ml73GufZy/boaM1lZttltt3LBvtZ vnrCfkIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1fyB-0000000H2Za-2vIO; Fri, 18 Oct 2024 05:56:15 +0000 Received: from mail-db8eur05on20611.outbound.protection.outlook.com ([2a01:111:f403:2614::611] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1foA-0000000Gzvp-2erM for linux-arm-kernel@lists.infradead.org; Fri, 18 Oct 2024 05:45:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=h/YSOx+9mjeabYNuluM64oohnVQF7SJxUfwV2O07Q80/WEeD60QbdTuOdWdZIojf6Q6D22I+I0YER/mSlcP0tdSM1woM2CKjRKkyJ2gS0YZxb49ByZ8mhtskHM61o+9u0+XuIIhJkDIpJ2OVVg0ynoJ2Mo9uFkGwvCYXhWNuj8ORlpEC5LTt6Ld9wbpUeWpHoUmfGPZRtASji4TURBk7wXfdPATlgQ/1PgMUepuQWpueZeEco8bdEznQ6vOqCNWOUush+CzJc8E8i7V5hqgqIK/mer6qCQQ6SxRiRKWXyo6tJ7iMUBLGcUD5KbCURJa+xZ9zv4eLvPjTUl3x9rGVNw== 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=K3+zhNI5VS6IKWb6QOdCtjpVCycJVK3rFo5kROJWK80HB9VKaxcf1k0HYRQGDcxQMJNjPWHGZZhCriS8q/tXZ8qKKouDzEYW6l53mPc2BGdRGZr2QJnvlUCh28Nq+QPk0lCD34hhtePobCfjNuUqMF+kPOxn1YnhI1/EHhJ58X0T5J0hXRtyfaiVCVk/kkYRr0wxnCcwjVAZUuxbLEFfUsUNUZPF0koIW4np0lhKcGgNWo8CGz/+L14eSA/iZJ6GoEqGbe/E+G0854mCUIQlEDRrZRDjHpfTGCpq/e40fTx0/Q0l8uDyRLVoZRtgKcdn/KalbuiJ+G8M/UH124phRA== 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=l6MgY4KHgdS8yON9Q8CXD2YDYJVHhOk3hcQuz9yHXDpl4s2a7YMrdRrZVqkQViVUrvkuok53pM4CZR2eEWns9PSq762BYA6O/JfF36tl/DPGKR0RyFxM2croMlfed5JbvqkwuxWGs0tN49Ge++JOcmSXZI8EyFRC9pHZHqBD1ZmWbELbBeHcC0rKpoMQLwbC47Wg0xcvKLqVqDTVEE0Xb758GXUI2fXgord8zAq2Bls6gtXgR3Ba6bMGIEcGRNy1dvAslOR2/NTGFM6gKZ6/lLUsikrTtxvfO+93uj2aTwIUILIhVhRJAj4ERglNirJqXcZTSyOXcsMPxHQHtVZ/sA== 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 AM9PR04MB8537.eurprd04.prod.outlook.com (2603:10a6:20b:434::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.22; Fri, 18 Oct 2024 05:45:51 +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:51 +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 6/6] media: vivid: Add a video region ctrl Date: Fri, 18 Oct 2024 14:44:48 +0900 Message-ID: <20241018054448.3190423-7-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_|AM9PR04MB8537:EE_ X-MS-Office365-Filtering-Correlation-Id: 04d5cf1c-7e08-4454-e7f0-08dcef381fc1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|7416014|376014|38350700014; X-Microsoft-Antispam-Message-Info: WvfrIRCagXW6lgJodzE7r8+87vi5sXwmT8XO/FYX2Cf2Di7UTyd7Dgx/pF1XI4nlnL3WsODVAG8E7VU4lSHlkyNE4XE77X3Mqck35WVjJFyh9zRzJLOKNzcKiRSS/wP0lTpu9p8O0PC3sQDn8tE0p9azg1Q/UHWUmfebYLvmKB/x3dPxa+G3AvhJSGgFpzJa3OqHzzb/28ZOlCKLaPR2ppxLEkWdjMbpNkrvBfqs2PbuGStjLyg+7WQ/bJbKBlYYHEKn4k79+koRsOCkjEL2Q0jL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TniJt9s+kIFGDuI= 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)(1800799024)(366016)(52116014)(7416014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kh3FGxBie9ilP2sqY89/KKJF03yfbnGjatde1c98iw7FRsDOQZLhrfxPOrIkwLapakohB1rBlmiLVM77T+cFJugtc50JT5M68jhQbch57g4PxDiqyK2gokXrru5nBbWk9Fg9G5QP/M+kGbUAB0/DwI61FQdYrNfxazbbFtjZ6kelVhkkhL8lmyajekf7A5+DAipSccSA8G+lCCN0FWPian97znnrQ0S4J/QIHUxByA/Wu0O0LAHCD4OEqx0NFbA8RXoZc61N0JaW+Z0Htd0Fzx4ijqmObbpVXv1XbjL3wqnHjo5FrORIJpq3wHbyg/jn6SCMnBIe3moJvTM0TIH5buECPp/T62geIXt5TuJ5GBdZp7fz5usFFSOrB+kTL9z8RJVCZaMXzCotjx60T9GVOCZujeoFWFJZi8IMHxOf8wEtr/EqoSm11czDqAuUB0ec5QhCZxuGCt9LHxb9pjyyaKFTBYY/69Upp8GHZekPrlcVWro4uYolcfrzCNgc45UBsLOG3W2o/1tMdvA7IgjPqOdFfvcIjFooyRVvaMSjDXCx6hsb9ML1waKDHhZi/ca4d2WEkgXbuEvxNK2IVpt2paA0o6vObA8VGID2tubCpW6KjKnHv/RpHvP4HYrfSdFFeE1Re/ifwwhCFMd8H8HazVWYyUbmnaR575Gcs2iTto1pO/43fruWtE0C42cGHNYQIkYVTdvTqvrXqJUNzKK9Fg4KU93Q15yJpnfeek4RzFyCKUv67ZQOx4a7AxdHOmJ+Kk1t1fuX2a0O/q1IARGTqK/flyTrDgNZ8G+koOety/5sEOdH4YZYfqC3Rnv+we6jRBVuoOWUWbnP1nQiu5ltMHi6yNnb/4WgE6uKSPncGCdF26jKMTXYEg+dmqA3FQ1Fl64uGDSVj4IYGL1HqMBoksZ/JSBwGhwUdOi2dgtOIIR+PEt1mPPRmebvItXzgc0NHM3Lt33uCk3lMKH1qlxzo+70fH3poYK7DlRV9D9yeOtuYzpFhcTswBLX75Laj9RUW0DWmMmaGIyepgkom7WftSd3JXo0qQs86+e63KY0LXHI3wLtHqpEOYuArMP5mrt32YSkbmj0cwWuksCvMRDRzJ+z29j8qDMXxNBPvh8Vh5VpgvlnJHinbXFw1MidF3jifiSP4YHhXfU7ZRLXoP6PERPSvdneCfKyiAjTHZCIrrwXvAFCJvso8ISrONexfaYEqQlTKxg+4D0hIocs/p6hW+QpaQdcADWCNR596H2HCArZSsgSBmW86iUBEUMpYKYfNtfgGs1LhwUA2a8NPNsfy5oqmSwkBMZL80lFJwsxKrYWCjbiZ0BAz9kkY5xVk6lI4hh8JG4J+l/8agdoOa/V2PuMXUm6rSNEPIxQu7sfvmQjsZ2i9689awxUi4t7p6Mtv1jpbVIdvx3FjDoaO26iQUPydtePHkhHyzGyisp7YA9h5NwBwFX/Nnp6I5DNt0VUJ3TXw5VXoi3TR0W63qYNPfFNRVbj0sqRX68wF0ft59e0HUodmcHV2o38dMinb+w3Hw1fcdfXZlPCebu8HCr9+kQD7she2CW1ARA14+FvPqvrpS3EDxnf0hda8WLaHf6T X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04d5cf1c-7e08-4454-e7f0-08dcef381fc1 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:51.1571 (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: wO+OUdwEYc8HR+W5VTIl/VMc4mwdEyXPlsRWJvsNr2Ekkz0xEy480E2Zerx+eCqtdbOBUtiqc2hMPqaea/2N3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8537 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_224554_688373_8B780883 X-CRM114-Status: GOOD ( 11.15 ) 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);