Re: [PATCH] media: rkvdec: fix v4l2-compliance failure

Nicolas Dufresne <[email protected]>
Newsgroups dev.linux.lists.linux-kernel-mentees,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-rockchip,org.kernel.vger.linux-kernel,org.kernel.vger.linux-media
Organization Collabora Canada
Message-ID <[email protected]>
Hi,

Le jeudi 30 juillet 2026 à 15:36 +0000, Tharit Tangkijwanichakul a écrit :
> rkvdec fails v4l2-compliance in two tests related to
> V4L2_CID_STATELESS_HEVC_SPS. The Control ioctls test reads the control
> with GET_EXT_CTRLS and writes the same value back; TRY_EXT_CTRLS then
> returns -EINVAL because the VDPU38x rkvdec_hevc_validate_sps() rejects
> sps->chroma_format_idc == 0, which is the value returned when the
> control has no default.
> 
>     v4l2-compliance 1.33.0-5491, 64 bits, 64-bit time_t
>     v4l2-compliance SHA: b32589c51481 2026-07-16 08:51:38
>     Control ioctls:
>         fail: v4l2-test-controls.cpp(942):
> 	try_ext_ctrls returned an error (22)
>       test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
>     Buffer ioctls:
>         fail: v4l2-test-buffers.cpp(3102): node->streamon(q.g_type())
>         fail: v4l2-test-buffers.cpp(3157): testBlockingDQBuf(node, m2m_q)
>       test blocking wait: FAIL
> 
> Provide a control default via p_def with chroma_format_idc = 1 (4:2:0),
> which is the only value the VDPU38x SPS validation accepts.
> This fixes both the Control ioctls and the Buffer ioctls failures.
> 
> Tested on Radxa Rock 5B (RK3588).
> 
> Fixes: c9a59dc2acc7 ("media: rkvdec: Add HEVC support for the VDPU381 variant")
> Signed-off-by: Tharit Tangkijwanichakul <[email protected]>
> ---
>  drivers/media/platform/rockchip/rkvdec/rkvdec.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> index 1d1e9bfef8e9..37603f049788 100644
> --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> @@ -236,6 +236,10 @@ static const struct rkvdec_ctrls rkvdec_hevc_ctrls = {
>  	.num_ctrls = ARRAY_SIZE(rkvdec_hevc_ctrl_descs),
>  };
>  
> +static struct v4l2_ctrl_hevc_sps vdpu38x_hevc_sps_default = {
> +	.chroma_format_idc = 1,
> +};
> +
>  static const struct rkvdec_ctrl_desc vdpu38x_hevc_ctrl_descs[] = {
>  	{
>  		.cfg.id = V4L2_CID_STATELESS_HEVC_DECODE_PARAMS,
> @@ -243,6 +247,7 @@ static const struct rkvdec_ctrl_desc vdpu38x_hevc_ctrl_descs[] = {
>  	{
>  		.cfg.id = V4L2_CID_STATELESS_HEVC_SPS,
>  		.cfg.ops = &rkvdec_ctrl_ops,
> +		.cfg.p_def.p_hevc_sps = &vdpu38x_hevc_sps_default,

Thanks for your patch. Have you considered setting this default in v4l2-common
instead ? Monochrome is rarely supported of implemented in codecs, so setting
the global default to 4:2:0 seems like it would be valid for all drivers.

Nicolas

>  	},
>  	{
>  		.cfg.id = V4L2_CID_STATELESS_HEVC_PPS,
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQTvDVKBFcTDwhoEbxLZQZRRKWBy9AUCannaqQAKCRDZQZRRKWBy
9G57AP92mrNZWgsDBwsQ2XuKqcBeRf0Gxt9wn6CCa0p8jJZaggEAtrJ7HoEDXOBa
hQUTaEu7DxXMJvm07IaizMrkf6mhqgw=
=XESv
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.