Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: vivid: Add a rectangle control

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

Signed-off-by: Yunke Cao <yunkec@google.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://lore.kernel.org/r/20250203-uvc-roi-v17-3-5900a9fed613@chromium.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>

authored by

Yunke Cao and committed by
Hans Verkuil
ad2ebde8 a5bd42aa

+34
+34
drivers/media/test-drivers/vivid/vivid-ctrls.c
··· 37 37 #define VIVID_CID_U8_PIXEL_ARRAY (VIVID_CID_CUSTOM_BASE + 14) 38 38 #define VIVID_CID_S32_ARRAY (VIVID_CID_CUSTOM_BASE + 15) 39 39 #define VIVID_CID_S64_ARRAY (VIVID_CID_CUSTOM_BASE + 16) 40 + #define VIVID_CID_RECT (VIVID_CID_CUSTOM_BASE + 17) 40 41 41 42 #define VIVID_CID_VIVID_BASE (0x00f00000 | 0xf000) 42 43 #define VIVID_CID_VIVID_CLASS (0x00f00000 | 1) ··· 359 358 .min = 0, 360 359 .max = 255, 361 360 .step = 1, 361 + }; 362 + 363 + static const struct v4l2_rect rect_def = { 364 + .top = 100, 365 + .left = 200, 366 + .width = 300, 367 + .height = 400, 368 + }; 369 + 370 + static const struct v4l2_rect rect_min = { 371 + .top = 0, 372 + .left = 0, 373 + .width = 1, 374 + .height = 1, 375 + }; 376 + 377 + static const struct v4l2_rect rect_max = { 378 + .top = 0, 379 + .left = 0, 380 + .width = 1000, 381 + .height = 2000, 382 + }; 383 + 384 + static const struct v4l2_ctrl_config vivid_ctrl_rect = { 385 + .ops = &vivid_user_gen_ctrl_ops, 386 + .id = VIVID_CID_RECT, 387 + .name = "Rect", 388 + .type = V4L2_CTRL_TYPE_RECT, 389 + .flags = V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX, 390 + .p_def.p_const = &rect_def, 391 + .p_min.p_const = &rect_min, 392 + .p_max.p_const = &rect_max, 362 393 }; 363 394 364 395 /* Framebuffer Controls */ ··· 1718 1685 dev->int_menu = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_int_menu, NULL); 1719 1686 dev->ro_int32 = v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_ro_int32, NULL); 1720 1687 v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_area, NULL); 1688 + v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_rect, NULL); 1721 1689 v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u32_array, NULL); 1722 1690 v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u32_dyn_array, NULL); 1723 1691 v4l2_ctrl_new_custom(hdl_user_gen, &vivid_ctrl_u16_matrix, NULL);