public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Detlev Casanova <detlev.casanova@collabora.com>,
	 linux-kernel@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Ezequiel Garcia	 <ezequiel@vanguardiasur.com.ar>,
	Heiko Stuebner <heiko@sntech.de>,
	Ricardo Ribalda <ribalda@chromium.org>,
	Hans Verkuil <hverkuil@kernel.org>,
	Hans de Goede <hansg@kernel.org>,  Yunke Cao <yunkec@google.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Laurent Pinchart	 <laurent.pinchart@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	 James Cowgill <james.cowgill@blaize.com>,
	linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
		linux-arm-kernel@lists.infradead.org, kernel@collabora.com,
	Jonas Karlman	 <jonas@kwiboo.se>,
	Diederik de Haas <didi.debian@cknow.org>
Subject: Re: [PATCH v8 02/17] media: v4l2-ctrls: Add hevc_ext_sps_[ls]t_rps controls
Date: Sun, 18 Jan 2026 16:52:34 -0500	[thread overview]
Message-ID: <d347016e0e908663ead7345dcfdc4ecb26bc53c2.camel@collabora.com> (raw)
In-Reply-To: <20260109161538.1294449-3-detlev.casanova@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 10158 bytes --]

Le vendredi 09 janvier 2026 à 11:15 -0500, Detlev Casanova a écrit :
> The vdpu381 decoder found on newer Rockchip SoC need the information
> from the long term and short term ref pic sets from the SPS.
> 
> So far, it wasn't included in the v4l2 API, so add it with new dynamic
> sized controls.
> 
> Each element of the hevc_ext_sps_lt_rps array contains the long term ref
> pic set at that index.
> Each element of the hevc_ext_sps_st_rps contains the short term ref pic
> set at that index, as the raw data.
> It is the role of the drivers to calculate the reference sets values.
> 
> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> ---
>  drivers/media/v4l2-core/v4l2-ctrls-core.c | 28 +++++++++++
>  drivers/media/v4l2-core/v4l2-ctrls-defs.c | 10 ++++
>  include/uapi/linux/v4l2-controls.h        | 61 +++++++++++++++++++++++
>  include/uapi/linux/videodev2.h            |  2 +
>  4 files changed, 101 insertions(+)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
> index 209bc05883bb..f11255255c74 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
> @@ -424,6 +424,12 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)
>  	case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
>  		pr_cont("HEVC_SLICE_PARAMS");
>  		break;
> +	case V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS:
> +		pr_cont("HEVC_EXT_SPS_ST_RPS");
> +		break;
> +	case V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS:
> +		pr_cont("HEVC_EXT_SPS_LT_RPS");
> +		break;
>  	case V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX:
>  		pr_cont("HEVC_SCALING_MATRIX");
>  		break;
> @@ -961,6 +967,8 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
>  	struct v4l2_ctrl_h264_pred_weights *p_h264_pred_weights;
>  	struct v4l2_ctrl_h264_slice_params *p_h264_slice_params;
>  	struct v4l2_ctrl_h264_decode_params *p_h264_dec_params;
> +	struct v4l2_ctrl_hevc_ext_sps_lt_rps *p_hevc_lt_rps;
> +	struct v4l2_ctrl_hevc_ext_sps_st_rps *p_hevc_st_rps;
>  	struct v4l2_ctrl_hevc_sps *p_hevc_sps;
>  	struct v4l2_ctrl_hevc_pps *p_hevc_pps;
>  	struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering;
> @@ -1254,6 +1262,20 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
>  	case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
>  		break;
>  
> +	case V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS:
> +		p_hevc_st_rps = p;
> +
> +		if (p_hevc_st_rps->flags & ~V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_INTER_REF_PIC_SET_PRED)
> +			return -EINVAL;
> +		break;
> +
> +	case V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS:
> +		p_hevc_lt_rps = p;
> +
> +		if (p_hevc_lt_rps->flags & ~V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_USED_LT)
> +			return -EINVAL;
> +		break;
> +
>  	case V4L2_CTRL_TYPE_HDR10_CLL_INFO:
>  		break;
>  
> @@ -2006,6 +2028,12 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
>  	case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
>  		elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params);
>  		break;
> +	case V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS:
> +		elem_size = sizeof(struct v4l2_ctrl_hevc_ext_sps_st_rps);
> +		break;
> +	case V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS:
> +		elem_size = sizeof(struct v4l2_ctrl_hevc_ext_sps_lt_rps);
> +		break;
>  	case V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX:
>  		elem_size = sizeof(struct v4l2_ctrl_hevc_scaling_matrix);
>  		break;
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> index ad41f65374e2..167286c9e424 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> @@ -1233,6 +1233,8 @@ const char *v4l2_ctrl_get_name(u32 id)
>  	case V4L2_CID_STATELESS_HEVC_DECODE_MODE:		return "HEVC Decode Mode";
>  	case V4L2_CID_STATELESS_HEVC_START_CODE:		return "HEVC Start Code";
>  	case V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS:	return "HEVC Entry Point Offsets";
> +	case V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS:		return "HEVC Short Term Ref Sets";
> +	case V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS:		return "HEVC Long Term Ref Sets";
>  	case V4L2_CID_STATELESS_AV1_SEQUENCE:			return "AV1 Sequence Parameters";
>  	case V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY:		return "AV1 Tile Group Entry";
>  	case V4L2_CID_STATELESS_AV1_FRAME:			return "AV1 Frame Parameters";
> @@ -1578,6 +1580,14 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>  		*type = V4L2_CTRL_TYPE_U32;
>  		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
>  		break;
> +	case V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS:
> +		*type = V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS;
> +		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> +		break;
> +	case V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS:
> +		*type = V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS;
> +		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> +		break;
>  	case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR:
>  		*type = V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR;
>  		break;
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
> index f84ed133a6c9..e9f1fcc4f840 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -2099,6 +2099,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,
> @@ -2554,6 +2556,65 @@ struct v4l2_ctrl_hevc_scaling_matrix {
>  	__u8	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 {
> +	__u8	delta_idx_minus1;
> +	__u8	delta_rps_sign;
> +	__u8	num_negative_pics;
> +	__u8	num_positive_pics;
> +	__u32	used_by_curr_pic;
> +	__u32	use_delta_flag;
> +	__u16	abs_delta_rps_minus1;
> +	__u16	delta_poc_s0_minus1[16];
> +	__u16	delta_poc_s1_minus1[16];
> +	__u16	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 {
> +	__u16	lt_ref_pic_poc_lsb_sps;
> +	__u16	flags;
> +};
> +
>  /* Stateless VP9 controls */
>  
>  #define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED	0x1
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index add08188f068..5efaeb74ef92 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -1985,6 +1985,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,

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-01-18 21:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09 16:15 [PATCH v8 00/17] media: rkvdec: Add support for VDPU381 and VDPU383 Detlev Casanova
2026-01-09 16:15 ` [PATCH v8 01/17] media: uapi: HEVC: Add v4l2_ctrl_hevc_ext_sps_[ls]t_rps controls Detlev Casanova
2026-01-18 21:48   ` Nicolas Dufresne
2026-01-09 16:15 ` [PATCH v8 02/17] media: v4l2-ctrls: Add hevc_ext_sps_[ls]t_rps controls Detlev Casanova
2026-01-18 21:52   ` Nicolas Dufresne [this message]
2026-01-09 16:15 ` [PATCH v8 03/17] media: visl: Add HEVC short and long term RPS sets Detlev Casanova
2026-01-18 21:57   ` Nicolas Dufresne
2026-01-09 16:15 ` [PATCH v8 04/17] media: rkvdec: Switch to using structs instead of writel Detlev Casanova
2026-01-09 16:15 ` [PATCH v8 05/17] media: rkvdec: Move cabac tables to their own source file Detlev Casanova
2026-01-09 16:15 ` [PATCH v8 06/17] media: rkvdec: Use structs to represent the HW RPS Detlev Casanova
2026-01-09 16:15 ` [PATCH v8 07/17] media: rkvdec: Move h264 functions to common file Detlev Casanova
2026-01-09 16:15 ` [PATCH v8 08/17] media: rkvdec: Move hevc " Detlev Casanova
2026-01-09 16:15 ` [PATCH v8 09/17] media: rkvdec: Add variant specific coded formats list Detlev Casanova
2026-01-18 22:02   ` Nicolas Dufresne
2026-01-09 16:15 ` [PATCH v8 10/17] media: rkvdec: Add RCB and SRAM support Detlev Casanova
2026-01-18 22:08   ` Nicolas Dufresne
2026-01-09 16:15 ` [PATCH v8 11/17] media: rkvdec: Support per-variant interrupt handler Detlev Casanova
2026-01-18 22:10   ` Nicolas Dufresne
2026-01-18 22:12   ` Nicolas Dufresne
2026-01-09 16:15 ` [PATCH v8 12/17] media: rkvdec: Enable all clocks without naming them Detlev Casanova
2026-01-09 16:15 ` [PATCH v8 13/17] media: rkvdec: Disable multicore support Detlev Casanova
2026-01-18 22:13   ` Nicolas Dufresne
2026-01-09 16:15 ` [PATCH v8 14/17] media: rkvdec: Add H264 support for the VDPU381 variant Detlev Casanova
2026-01-09 20:37   ` Diederik de Haas
2026-01-18 22:18   ` Nicolas Dufresne
2026-01-09 16:15 ` [PATCH v8 15/17] media: rkvdec: Add H264 support for the VDPU383 variant Detlev Casanova
2026-01-18 22:20   ` Nicolas Dufresne
2026-01-09 16:15 ` [PATCH v8 16/17] media: rkvdec: Add HEVC support for the VDPU381 variant Detlev Casanova
2026-01-18 22:25   ` Nicolas Dufresne
2026-01-09 16:15 ` [PATCH v8 17/17] media: rkvdec: Add HEVC support for the VDPU383 variant Detlev Casanova

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d347016e0e908663ead7345dcfdc4ecb26bc53c2.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=corbet@lwn.net \
    --cc=detlev.casanova@collabora.com \
    --cc=didi.debian@cknow.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=hansg@kernel.org \
    --cc=heiko@sntech.de \
    --cc=hverkuil@kernel.org \
    --cc=james.cowgill@blaize.com \
    --cc=jonas@kwiboo.se \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=yunkec@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox