lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241018054448.3190423-7-ming.qian@nxp.com>
Date: Fri, 18 Oct 2024 14:44:48 +0900
From: Ming Qian <ming.qian@....com>
To: mchehab@...nel.org,
	hverkuil-cisco@...all.nl
Cc: yunkec@...gle.com,
	nicolas@...fresne.ca,
	s.hauer@...gutronix.de,
	kernel@...gutronix.de,
	festevam@...il.com,
	linux-imx@....com,
	xiahong.bao@....com,
	ming.zhou@....com,
	eagle.zhou@....com,
	tao.jiang_2@....com,
	ming.qian@....nxp.com,
	imx@...ts.linux.dev,
	linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org
Subject: [RFC v2 6/6] media: vivid: Add a video region ctrl

This control represents a generic read/write region.
It supports V4L2_CTRL_WHICH_MIN/MAX_VAL.

Signed-off-by: Ming Qian <ming.qian@....com>
Signed-off-by: TaoJiang <tao.jiang_2@....com>
---
 .../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 = &region_def,
+	.p_min.p_const = &region_min,
+	.p_max.p_const = &region_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);
-- 
2.43.0-rc1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ