Index | Thread | Search

From:
"Theo de Raadt" <deraadt@openbsd.org>
Subject:
Re: sys/videoio.h: sync with Linux
To:
tech@openbsd.org
Date:
Thu, 19 Feb 2026 10:34:27 -0700

Download raw body.

Thread
So -- new things only.  OK.

Kirill A. Korinsky <kirill@korins.ky> wrote:

> On Fri, 13 Feb 2026 15:28:11 +0100,
> Kirill A. Korinsky <kirill@korins.ky> wrote:
> > 
> > On Fri, 13 Feb 2026 15:19:54 +0100,
> > Kirill A. Korinsky <kirill@korins.ky> wrote:
> > > 
> > > tech@,
> > > 
> > > as usual I'd like to sync up our videoio.h with linux upstream.
> > > 
> > > 1. media: v4l2-ctrls: Add hevc_ext_sps_[ls]t_rps controls
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fa05705107a40131a8335ad37817153709261738
> > > 
> > > 2. media: uapi: videodev2: Add support for AV1 stateful decoder
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=406fc2e9ca65e0df345ebf4ce95aa87cb6416f35
> > > 
> > > 3. media: v4l: ctrls: add a control for flash/strobe duration
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d89ccbf3dde727d91a242a5a3f3b70a90579b057
> > > 
> > > 4. media: v4l: ctrls: add a control for enabling strobe output 
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5be4154f6255d92d9d2ad5da658d7d33a655386f
> > > 
> 
> Also, I'd like to point that here no ABI or API changes.
> 
> Scope limited to few new defines, two new struct and two new enum value only.
> 
> Ok?
> 
> Index: sys/sys/videoio.h
> ===================================================================
> RCS file: /cvs/src/sys/sys/videoio.h,v
> diff -u -p -r1.28 videoio.h
> --- sys/sys/videoio.h	4 Dec 2025 22:57:47 -0000	1.28
> +++ sys/sys/videoio.h	13 Feb 2026 14:26:44 -0000
> @@ -1305,6 +1305,8 @@ enum v4l2_flash_strobe_source {
>  
>  #define V4L2_CID_FLASH_CHARGE			(V4L2_CID_FLASH_CLASS_BASE + 11)
>  #define V4L2_CID_FLASH_READY			(V4L2_CID_FLASH_CLASS_BASE + 12)
> +#define V4L2_CID_FLASH_DURATION			(V4L2_CID_FLASH_CLASS_BASE + 13)
> +#define V4L2_CID_FLASH_STROBE_OE		(V4L2_CID_FLASH_CLASS_BASE + 14)
>  
>  
>  /* JPEG-class control IDs */
> @@ -2212,6 +2214,8 @@ struct v4l2_ctrl_mpeg2_quantisation {
>  #define V4L2_CID_STATELESS_HEVC_DECODE_MODE	(V4L2_CID_CODEC_STATELESS_BASE + 405)
>  #define V4L2_CID_STATELESS_HEVC_START_CODE	(V4L2_CID_CODEC_STATELESS_BASE + 406)
>  #define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_STATELESS_BASE + 407)
> +#define V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS  (V4L2_CID_CODEC_STATELESS_BASE + 408)
> +#define V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS  (V4L2_CID_CODEC_STATELESS_BASE + 409)
>  
>  enum v4l2_stateless_hevc_decode_mode {
>  	V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED,
> @@ -2667,6 +2671,65 @@ struct v4l2_ctrl_hevc_scaling_matrix {
>  	u_int8_t	scaling_list_dc_coef_32x32[2];
>  };
>  
> +#define V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_INTER_REF_PIC_SET_PRED	0x1
> +
> +/*
> + * struct v4l2_ctrl_hevc_ext_sps_st_rps - HEVC short term RPS parameters
> + *
> + * Dynamic size 1-dimension array for short term RPS. The number of elements
> + * is v4l2_ctrl_hevc_sps::num_short_term_ref_pic_sets. It can contain up to 65 elements.
> + *
> + * @delta_idx_minus1: Specifies the delta compare to the index. See details in section 7.4.8
> + *                    "Short-term reference picture set semantics" of the specification.
> + * @delta_rps_sign: Sign of the delta as specified in section 7.4.8 "Short-term reference picture
> + *                  set semantics" of the specification.
> + * @abs_delta_rps_minus1: Absolute delta RPS as specified in section 7.4.8 "Short-term reference
> + *                        picture set semantics" of the specification.
> + * @num_negative_pics: Number of short-term RPS entries that have picture order count values less
> + *                     than the picture order count value of the current picture.
> + * @num_positive_pics: Number of short-term RPS entries that have picture order count values
> + *                     greater than the picture order count value of the current picture.
> + * @used_by_curr_pic: Bit j specifies if short-term RPS j is used by the current picture.
> + * @use_delta_flag: Bit j equals to 1 specifies that the j-th entry in the source candidate
> + *                  short-term RPS is included in this candidate short-term RPS.
> + * @delta_poc_s0_minus1: Specifies the negative picture order count delta for the i-th entry in
> + *                       the short-term RPS. See details in section 7.4.8 "Short-term reference
> + *                       picture set semantics" of the specification.
> + * @delta_poc_s1_minus1: Specifies the positive picture order count delta for the i-th entry in
> + *                       the short-term RPS. See details in section 7.4.8 "Short-term reference
> + *                       picture set semantics" of the specification.
> + * @flags: See V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_{}
> + */
> +struct v4l2_ctrl_hevc_ext_sps_st_rps {
> +	u_int8_t	delta_idx_minus1;
> +	u_int8_t	delta_rps_sign;
> +	u_int8_t	num_negative_pics;
> +	u_int8_t	num_positive_pics;
> +	u_int32_t	used_by_curr_pic;
> +	u_int32_t	use_delta_flag;
> +	u_int16_t	abs_delta_rps_minus1;
> +	u_int16_t	delta_poc_s0_minus1[16];
> +	u_int16_t	delta_poc_s1_minus1[16];
> +	u_int16_t	flags;
> +};
> +
> +#define V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_USED_LT		0x1
> +
> +/*
> + * struct v4l2_ctrl_hevc_ext_sps_lt_rps - HEVC long term RPS parameters
> + *
> + * Dynamic size 1-dimension array for long term RPS. The number of elements
> + * is v4l2_ctrl_hevc_sps::num_long_term_ref_pics_sps. It can contain up to 65 elements.
> + *
> + * @lt_ref_pic_poc_lsb_sps: picture order count modulo MaxPicOrderCntLsb of the i-th candidate
> + *                          long-term reference picture.
> + * @flags: See V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_{}
> + */
> +struct v4l2_ctrl_hevc_ext_sps_lt_rps {
> +	u_int16_t	lt_ref_pic_poc_lsb_sps;
> +	u_int16_t	flags;
> +};
> +
>  /* Stateless VP9 controls */
>  
>  #define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED	0x1
> @@ -4321,6 +4384,7 @@ struct v4l2_pix_format {
>  #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */
>  #define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */
>  #define V4L2_PIX_FMT_AV1_FRAME v4l2_fourcc('A', 'V', '1', 'F') /* AV1 parsed frame */
> +#define V4L2_PIX_FMT_AV1      v4l2_fourcc('A', 'V', '0', '1') /* AV1 */
>  #define V4L2_PIX_FMT_SPK      v4l2_fourcc('S', 'P', 'K', '0') /* Sorenson Spark */
>  #define V4L2_PIX_FMT_RV30     v4l2_fourcc('R', 'V', '3', '0') /* RealVideo 8 */
>  #define V4L2_PIX_FMT_RV40     v4l2_fourcc('R', 'V', '4', '0') /* RealVideo 9 & 10 */
> @@ -5487,6 +5551,8 @@ enum v4l2_ctrl_type {
>  	V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS	= 0x0272,
>  	V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX	= 0x0273,
>  	V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS	= 0x0274,
> +	V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS	= 0x0275,
> +	V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS	= 0x0276,
>  
>  	V4L2_CTRL_TYPE_AV1_SEQUENCE	    = 0x280,
>  	V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY = 0x281,
>