Index | Thread | Search

From:
Marcus Glocker <marcus@nazgul.ch>
Subject:
Re: sys/videoio.h: sync with media/v6.15-1 of linux-media
To:
"Kirill A. Korinsky" <kirill@korins.ky>
Cc:
tech@openbsd.org
Date:
Wed, 26 Mar 2025 19:26:54 +0100

Download raw body.

Thread
On Wed, Mar 26, 2025 at 10:07:23AM GMT, Kirill A. Korinsky wrote:

> tech@,
> 
> I'd like to keep our videoio.h synchronized with Linux, and
> would like to backport new definition of:
>  - V4L2_CID_USER_UVC_BASE
>  - V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX, V4L2_CTRL_WHICH_MIN_VAL and
>    V4L2_CTRL_WHICH_MAX_VAL
>  - V4L2_CTRL_TYPE_RECT
> 
> which is based on commits:
>  - https://github.com/torvalds/linux/commit/2dc768d71b45a3a40ea15805667ed662127eeefd
>  - https://github.com/torvalds/linux/commit/a5bd42aafb068427ecf4d6d34fa023944f211922
>  - https://github.com/torvalds/linux/commit/3b9d7340cfac91f8a2ac237a6787f521f1440ca3
> 
> Ok?

Diff looks good to me, and no regression spotted during testing.

ok mglocker@
 
> Index: sys/sys/videoio.h
> ===================================================================
> RCS file: /home/cvs/src/sys/sys/videoio.h,v
> diff -u -p -r1.21 videoio.h
> --- sys/sys/videoio.h	18 Jan 2025 19:50:55 -0000	1.21
> +++ sys/sys/videoio.h	26 Mar 2025 09:00:23 -0000
> @@ -330,6 +330,13 @@ enum v4l2_colorfx {
>   */
>  #define V4L2_CID_USER_THP7312_BASE		(V4L2_CID_USER_BASE + 0x11c0)
>  
> +/*
> + * The base for the uvc driver controls.
> + * See linux/uvcvideo.h for the list of controls.
> + * We reserve 64 controls for this driver.
> + */
> +#define V4L2_CID_USER_UVC_BASE			(V4L2_CID_USER_BASE + 0x11e0)
> +
>  /* MPEG-class control IDs */
>  /* The MPEG controls are applicable to all codec controls
>   * and the 'MPEG' part of the define is historical */
> @@ -5347,6 +5354,7 @@ struct v4l2_ext_control {
>  		int32_t __user *p_s32;
>  		int64_t __user *p_s64;
>  		struct v4l2_area __user *p_area;
> +		struct v4l2_rect __user *p_rect;
>  		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;
> @@ -5395,6 +5403,8 @@ struct v4l2_ext_controls {
>  #define V4L2_CTRL_WHICH_CUR_VAL   0
>  #define V4L2_CTRL_WHICH_DEF_VAL   0x0f000000
>  #define V4L2_CTRL_WHICH_REQUEST_VAL 0x0f010000
> +#define V4L2_CTRL_WHICH_MIN_VAL   0x0f020000
> +#define V4L2_CTRL_WHICH_MAX_VAL   0x0f030000
>  
>  enum v4l2_ctrl_type {
>  	V4L2_CTRL_TYPE_INTEGER	     = 1,
> @@ -5413,6 +5423,7 @@ enum v4l2_ctrl_type {
>  	V4L2_CTRL_TYPE_U16	     = 0x0101,
>  	V4L2_CTRL_TYPE_U32	     = 0x0102,
>  	V4L2_CTRL_TYPE_AREA          = 0x0106,
> +	V4L2_CTRL_TYPE_RECT	     = 0x0107,
>  
>  	V4L2_CTRL_TYPE_HDR10_CLL_INFO		= 0x0110,
>  	V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY	= 0x0111,
> @@ -5501,6 +5512,7 @@ struct v4l2_querymenu {
>  #define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE	0x0200
>  #define V4L2_CTRL_FLAG_MODIFY_LAYOUT	0x0400
>  #define V4L2_CTRL_FLAG_DYNAMIC_ARRAY	0x0800
> +#define V4L2_CTRL_FLAG_HAS_WHICH_MIN_MAX 0x1000
>  
>  /*  Query flags, to be ORed with the control ID */
>  #define V4L2_CTRL_FLAG_NEXT_CTRL	0x80000000
>