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: v4l2_ctrl: Add V4L2_CTRL_TYPE_RECT

Add p_rect to struct v4l2_ext_control with basic support in
v4l2-ctrls.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
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-1-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
3b9d7340 f4b21171

+31 -1
+4
Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
··· 199 199 - ``p_area`` 200 200 - A pointer to a struct :c:type:`v4l2_area`. Valid if this control is 201 201 of type ``V4L2_CTRL_TYPE_AREA``. 202 + * - struct :c:type:`v4l2_rect` * 203 + - ``p_rect`` 204 + - A pointer to a struct :c:type:`v4l2_rect`. Valid if this control is 205 + of type ``V4L2_CTRL_TYPE_RECT``. 202 206 * - struct :c:type:`v4l2_ctrl_h264_sps` * 203 207 - ``p_h264_sps`` 204 208 - A pointer to a struct :c:type:`v4l2_ctrl_h264_sps`. Valid if this control is
+7
Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
··· 441 441 - n/a 442 442 - A struct :c:type:`v4l2_area`, containing the width and the height 443 443 of a rectangular area. Units depend on the use case. 444 + * - ``V4L2_CTRL_TYPE_RECT`` 445 + - n/a 446 + - n/a 447 + - n/a 448 + - A struct :c:type:`v4l2_rect`, containing a rectangle described by 449 + the position of its top-left corner, the width and the height. Units 450 + depend on the use case. 444 451 * - ``V4L2_CTRL_TYPE_H264_SPS`` 445 452 - n/a 446 453 - n/a
+1
Documentation/userspace-api/media/videodev2.h.rst.exceptions
··· 150 150 replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`v4l2_ctrl_type` 151 151 replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`v4l2_ctrl_type` 152 152 replace symbol V4L2_CTRL_TYPE_AREA :c:type:`v4l2_ctrl_type` 153 + replace symbol V4L2_CTRL_TYPE_RECT :c:type:`v4l2_ctrl_type` 153 154 replace symbol V4L2_CTRL_TYPE_FWHT_PARAMS :c:type:`v4l2_ctrl_type` 154 155 replace symbol V4L2_CTRL_TYPE_VP8_FRAME :c:type:`v4l2_ctrl_type` 155 156 replace symbol V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR :c:type:`v4l2_ctrl_type`
+15 -1
drivers/media/v4l2-core/v4l2-ctrls-core.c
··· 370 370 case V4L2_CTRL_TYPE_AV1_FILM_GRAIN: 371 371 pr_cont("AV1_FILM_GRAIN"); 372 372 break; 373 - 373 + case V4L2_CTRL_TYPE_RECT: 374 + pr_cont("%ux%u@%dx%d", 375 + ptr.p_rect->width, ptr.p_rect->height, 376 + ptr.p_rect->left, ptr.p_rect->top); 377 + break; 374 378 default: 375 379 pr_cont("unknown type %d", ctrl->type); 376 380 break; ··· 819 815 struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering; 820 816 struct v4l2_ctrl_hevc_decode_params *p_hevc_decode_params; 821 817 struct v4l2_area *area; 818 + struct v4l2_rect *rect; 822 819 void *p = ptr.p + idx * ctrl->elem_size; 823 820 unsigned int i; 824 821 ··· 1174 1169 case V4L2_CTRL_TYPE_AREA: 1175 1170 area = p; 1176 1171 if (!area->width || !area->height) 1172 + return -EINVAL; 1173 + break; 1174 + 1175 + case V4L2_CTRL_TYPE_RECT: 1176 + rect = p; 1177 + if (!rect->width || !rect->height) 1177 1178 return -EINVAL; 1178 1179 break; 1179 1180 ··· 1882 1871 break; 1883 1872 case V4L2_CTRL_TYPE_AREA: 1884 1873 elem_size = sizeof(struct v4l2_area); 1874 + break; 1875 + case V4L2_CTRL_TYPE_RECT: 1876 + elem_size = sizeof(struct v4l2_rect); 1885 1877 break; 1886 1878 default: 1887 1879 if (type < V4L2_CTRL_COMPOUND_TYPES)
+2
include/media/v4l2-ctrls.h
··· 56 56 * @p_av1_tile_group_entry: Pointer to an AV1 tile group entry structure. 57 57 * @p_av1_frame: Pointer to an AV1 frame structure. 58 58 * @p_av1_film_grain: Pointer to an AV1 film grain structure. 59 + * @p_rect: Pointer to a rectangle. 59 60 * @p: Pointer to a compound value. 60 61 * @p_const: Pointer to a constant compound value. 61 62 */ ··· 90 89 struct v4l2_ctrl_av1_tile_group_entry *p_av1_tile_group_entry; 91 90 struct v4l2_ctrl_av1_frame *p_av1_frame; 92 91 struct v4l2_ctrl_av1_film_grain *p_av1_film_grain; 92 + struct v4l2_rect *p_rect; 93 93 void *p; 94 94 const void *p_const; 95 95 };
+2
include/uapi/linux/videodev2.h
··· 1859 1859 __s32 __user *p_s32; 1860 1860 __s64 __user *p_s64; 1861 1861 struct v4l2_area __user *p_area; 1862 + struct v4l2_rect __user *p_rect; 1862 1863 struct v4l2_ctrl_h264_sps __user *p_h264_sps; 1863 1864 struct v4l2_ctrl_h264_pps __user *p_h264_pps; 1864 1865 struct v4l2_ctrl_h264_scaling_matrix __user *p_h264_scaling_matrix; ··· 1930 1929 V4L2_CTRL_TYPE_U16 = 0x0101, 1931 1930 V4L2_CTRL_TYPE_U32 = 0x0102, 1932 1931 V4L2_CTRL_TYPE_AREA = 0x0106, 1932 + V4L2_CTRL_TYPE_RECT = 0x0107, 1933 1933 1934 1934 V4L2_CTRL_TYPE_HDR10_CLL_INFO = 0x0110, 1935 1935 V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY = 0x0111,