Add p_rect to struct v4l2_ext_control with basic support in v4l2-ctrls.
Unified · Split
| @@ -199,6 +199,10 @@ still cause this situation. · 198 unmodified lines | ||
| 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 |
| @@ -441,6 +441,13 @@ See also the examples in :ref:`control`. · 440 unmodified lines | ||
| 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 |
| @@ -150,6 +150,7 @@ replace symbol V4L2_CTRL_TYPE_HEVC_SPS :c:type:`v4l2_ctrl_type` · 149 unmodified lines | ||
| 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` |
| @@ -370,7 +370,11 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl) · 369 unmodified lines | ||
| 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; |
| @@ -815,6 +819,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, · 438 unmodified lines | ||
| 815 | 819 | struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering; |
| 816 | 820 | struct v4l2_ctrl_hevc_decode_params *p_hevc_decode_params; |
| 817 | 821 | struct v4l2_area *area; |
| 822 | + struct v4l2_rect *rect; | |
| 818 | 823 | void *p = ptr.p + idx * ctrl->elem_size; |
| 819 | 824 | unsigned int i; |
| 820 | 825 | |
| @@ -1172,6 +1177,12 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, · 351 unmodified lines | ||
| 1172 | 1177 | return -EINVAL; |
| 1173 | 1178 | break; |
| 1174 | 1179 | |
| 1180 | + case V4L2_CTRL_TYPE_RECT: | |
| 1181 | + rect = p; | |
| 1182 | + if (!rect->width || !rect->height) | |
| 1183 | + return -EINVAL; | |
| 1184 | + break; | |
| 1185 | + | |
| 1175 | 1186 | default: |
| 1176 | 1187 | return -EINVAL; |
| 1177 | 1188 | } |
| @@ -1872,6 +1883,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, · 694 unmodified lines | ||
| 1872 | 1883 | case V4L2_CTRL_TYPE_AREA: |
| 1873 | 1884 | elem_size = sizeof(struct v4l2_area); |
| 1874 | 1885 | break; |
| 1886 | + case V4L2_CTRL_TYPE_RECT: | |
| 1887 | + elem_size = sizeof(struct v4l2_rect); | |
| 1888 | + break; | |
| 1875 | 1889 | default: |
| 1876 | 1890 | if (type < V4L2_CTRL_COMPOUND_TYPES) |
| 1877 | 1891 | elem_size = sizeof(s32); |
| @@ -56,6 +56,7 @@ struct video_device; · 55 unmodified lines | ||
| 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 | */ |
| @@ -89,6 +90,7 @@ union v4l2_ctrl_ptr { · 27 unmodified lines | ||
| 89 | 90 | struct v4l2_ctrl_av1_tile_group_entry *p_av1_tile_group_entry; |
| 90 | 91 | struct v4l2_ctrl_av1_frame *p_av1_frame; |
| 91 | 92 | struct v4l2_ctrl_av1_film_grain *p_av1_film_grain; |
| 93 | + struct v4l2_rect *p_rect; | |
| 92 | 94 | void *p; |
| 93 | 95 | const void *p_const; |
| 94 | 96 | }; |
| @@ -1859,6 +1859,7 @@ struct v4l2_ext_control { · 1858 unmodified lines | ||
| 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; |
| @@ -1929,6 +1930,7 @@ enum v4l2_ctrl_type { · 64 unmodified lines | ||
| 1929 | 1930 | V4L2_CTRL_TYPE_U16 = 0x0101, |
| 1930 | 1931 | V4L2_CTRL_TYPE_U32 = 0x0102, |
| 1931 | 1932 | V4L2_CTRL_TYPE_AREA = 0x0106, |
| 1933 | + V4L2_CTRL_TYPE_RECT = 0x0107, | |
| 1932 | 1934 | |
| 1933 | 1935 | V4L2_CTRL_TYPE_HDR10_CLL_INFO = 0x0110, |
| 1934 | 1936 | V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY = 0x0111, |