@@ -203,6 +203,10 @@ still cause this situation.
- ``p_rect``
- A pointer to a struct :c:type:`v4l2_rect`. Valid if this control is
of type ``V4L2_CTRL_TYPE_RECT``.
+ * - struct :c:type:`v4l2_ctrl_video_region_param` *
+ - ``p_region``
+ - A pointer to a struct :c:type:`v4l2_ctrl_video_region_param`. Valid if
+ this control is of type ``V4L2_CTRL_TYPE_REGION``.
* - struct :c:type:`v4l2_ctrl_h264_sps` *
- ``p_h264_sps``
- A pointer to a struct :c:type:`v4l2_ctrl_h264_sps`. Valid if this control is
@@ -451,6 +451,18 @@ See also the examples in :ref:`control`.
``V4L2_CTRL_WHICH_MAX_VAL`` is optional and depends on the
``V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX`` flag. See the documentation of
the specific control on how to interpret the minimum and maximum values.
+ * - ``V4L2_CTRL_TYPE_REGION``
+ - n/a
+ - n/a
+ - n/a
+ - A struct :c:type:`v4l2_ctrl_video_region_param`, containing a rectangle
+ described by the position of its top-left corner, the width and the height.
+ And a parameter for detailed purpose, for example, it's QP offset for video
+ encoder ROI. Units depend on the use case. Support for
+ ``V4L2_CTRL_WHICH_MIN_VAL`` and ``V4L2_CTRL_WHICH_MAX_VAL`` is optional and
+ depends on the ``V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX`` flag. See the
+ documentation of the specific control on how to interpret the minimum and
+ maximum values.
* - ``V4L2_CTRL_TYPE_H264_SPS``
- n/a
- n/a
@@ -151,6 +151,7 @@ replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_AREA :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_RECT :c:type:`v4l2_ctrl_type`
+replace symbol V4L2_CTRL_TYPE_REGION :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_FWHT_PARAMS :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_VP8_FRAME :c:type:`v4l2_ctrl_type`
replace symbol V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR :c:type:`v4l2_ctrl_type`
@@ -441,6 +441,11 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)
ptr.p_rect->width, ptr.p_rect->height,
ptr.p_rect->left, ptr.p_rect->top);
break;
+ case V4L2_CTRL_TYPE_REGION:
+ pr_cont("%ux%u@%dx%d, %d",
+ ptr.p_rect->width, ptr.p_rect->height,
+ ptr.p_rect->left, ptr.p_rect->top, ptr.p_region->parameter);
+ break;
default:
pr_cont("unknown type %d", ctrl->type);
break;
@@ -886,6 +891,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
struct v4l2_ctrl_hevc_decode_params *p_hevc_decode_params;
struct v4l2_area *area;
struct v4l2_rect *rect;
+ struct v4l2_ctrl_video_region_param *p_region;
void *p = ptr.p + idx * ctrl->elem_size;
unsigned int i;
@@ -1248,7 +1254,10 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
if (!rect->width || !rect->height)
return -EINVAL;
break;
-
+ case V4L2_CTRL_TYPE_REGION:
+ p_region = p;
+ zero_reserved(*p_region);
+ break;
default:
return -EINVAL;
}
@@ -1957,6 +1966,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
case V4L2_CTRL_TYPE_RECT:
elem_size = sizeof(struct v4l2_rect);
break;
+ case V4L2_CTRL_TYPE_REGION:
+ elem_size = sizeof(struct v4l2_ctrl_video_region_param);
+ break;
default:
if (type < V4L2_CTRL_COMPOUND_TYPES)
elem_size = sizeof(s32);
@@ -57,6 +57,7 @@ struct video_device;
* @p_av1_frame: Pointer to an AV1 frame structure.
* @p_av1_film_grain: Pointer to an AV1 film grain structure.
* @p_rect: Pointer to a rectangle.
+ * @p_region: Pointer to a video region
* @p: Pointer to a compound value.
* @p_const: Pointer to a constant compound value.
*/
@@ -91,6 +92,7 @@ union v4l2_ctrl_ptr {
struct v4l2_ctrl_av1_frame *p_av1_frame;
struct v4l2_ctrl_av1_film_grain *p_av1_film_grain;
struct v4l2_rect *p_rect;
+ struct v4l2_ctrl_video_region_param *p_region;
void *p;
const void *p_const;
};
@@ -448,6 +448,12 @@ struct v4l2_area {
__u32 height;
};
+struct v4l2_ctrl_video_region_param {
+ struct v4l2_rect rect;
+ __s32 parameter;
+ __u32 reserved[2];
+};
+
/**
* struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP
*
@@ -1858,6 +1864,7 @@ struct v4l2_ext_control {
__s64 __user *p_s64;
struct v4l2_area __user *p_area;
struct v4l2_rect __user *p_rect;
+ struct v4l2_ctrl_video_region_param __user *p_region;
struct v4l2_ctrl_h264_sps __user *p_h264_sps;
struct v4l2_ctrl_h264_pps __user *p_h264_pps;
struct v4l2_ctrl_h264_scaling_matrix __user *p_h264_scaling_matrix;
@@ -1931,6 +1938,7 @@ enum v4l2_ctrl_type {
V4L2_CTRL_TYPE_U32 = 0x0102,
V4L2_CTRL_TYPE_AREA = 0x0106,
V4L2_CTRL_TYPE_RECT = 0x0107,
+ V4L2_CTRL_TYPE_REGION = 0x0108,
V4L2_CTRL_TYPE_HDR10_CLL_INFO = 0x0110,
V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY = 0x0111,