All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: rkvdec: fix v4l2-compliance failure
@ 2026-07-30 15:36 ` Tharit Tangkijwanichakul
  0 siblings, 0 replies; 7+ messages in thread
From: Tharit Tangkijwanichakul @ 2026-07-30 15:36 UTC (permalink / raw)
  To: Detlev Casanova, Ezequiel Garcia
  Cc: Mauro Carvalho Chehab, Heiko Stuebner, Nicolas Dufresne,
	Hans Verkuil, linux-media, linux-rockchip, linux-arm-kernel,
	linux-kernel, linux-kernel-mentees, skhan, me, jkoolstra,
	Tharit Tangkijwanichakul

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 <tharitt97@gmail.com>
---
 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,
 	},
 	{
 		.cfg.id = V4L2_CID_STATELESS_HEVC_PPS,
-- 
2.47.3


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] media: rkvdec: fix v4l2-compliance failure
@ 2026-07-30 15:36 ` Tharit Tangkijwanichakul
  0 siblings, 0 replies; 7+ messages in thread
From: Tharit Tangkijwanichakul @ 2026-07-30 15:36 UTC (permalink / raw)
  To: Detlev Casanova, Ezequiel Garcia
  Cc: Mauro Carvalho Chehab, Heiko Stuebner, Nicolas Dufresne,
	Hans Verkuil, linux-media, linux-rockchip, linux-arm-kernel,
	linux-kernel, linux-kernel-mentees, skhan, me, jkoolstra,
	Tharit Tangkijwanichakul

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 <tharitt97@gmail.com>
---
 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,
 	},
 	{
 		.cfg.id = V4L2_CID_STATELESS_HEVC_PPS,
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] media: rkvdec: fix v4l2-compliance failure
  2026-07-30 15:36 ` Tharit Tangkijwanichakul
@ 2026-08-10 14:05   ` Nicolas Dufresne
  -1 siblings, 0 replies; 7+ messages in thread
From: Nicolas Dufresne @ 2026-08-10 14:05 UTC (permalink / raw)
  To: Tharit Tangkijwanichakul, Detlev Casanova, Ezequiel Garcia
  Cc: Mauro Carvalho Chehab, Heiko Stuebner, Hans Verkuil, linux-media,
	linux-rockchip, linux-arm-kernel, linux-kernel,
	linux-kernel-mentees, skhan, me, jkoolstra

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

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 <tharitt97@gmail.com>
> ---
>  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,

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] media: rkvdec: fix v4l2-compliance failure
@ 2026-08-10 14:05   ` Nicolas Dufresne
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Dufresne @ 2026-08-10 14:05 UTC (permalink / raw)
  To: Tharit Tangkijwanichakul, Detlev Casanova, Ezequiel Garcia
  Cc: Mauro Carvalho Chehab, Heiko Stuebner, Hans Verkuil, linux-media,
	linux-rockchip, linux-arm-kernel, linux-kernel,
	linux-kernel-mentees, skhan, me, jkoolstra


[-- Attachment #1.1: Type: text/plain, Size: 2714 bytes --]

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 <tharitt97@gmail.com>
> ---
>  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,

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

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] media: rkvdec: fix v4l2-compliance failure
  2026-08-10 14:05   ` Nicolas Dufresne
@ 2026-08-11 16:38     ` Tharit Tangkijwanichakul
  -1 siblings, 0 replies; 7+ messages in thread
From: Tharit Tangkijwanichakul @ 2026-08-11 16:38 UTC (permalink / raw)
  To: Nicolas Dufresne
  Cc: Detlev Casanova, Ezequiel Garcia, Mauro Carvalho Chehab,
	Heiko Stuebner, Hans Verkuil, linux-media, linux-rockchip,
	linux-arm-kernel, linux-kernel, linux-kernel-mentees, skhan, me,
	jkoolstra

Hi Nicolas,

Thanks for the suggestion.

I moved the default out of rkvdec and into the common V4L2 compound
control initialization, making V4L2_CTRL_TYPE_HEVC_SPS default
chroma_format_idc to 1 (4:2:0).

I'll send this as v2.

Thanks,
Tharit

On Mon, Aug 10, 2026 at 9:05 PM Nicolas Dufresne
<nicolas.dufresne@collabora.com> wrote:
>
> 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 <tharitt97@gmail.com>
> > ---
> >  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,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] media: rkvdec: fix v4l2-compliance failure
@ 2026-08-11 16:38     ` Tharit Tangkijwanichakul
  0 siblings, 0 replies; 7+ messages in thread
From: Tharit Tangkijwanichakul @ 2026-08-11 16:38 UTC (permalink / raw)
  To: Nicolas Dufresne
  Cc: Detlev Casanova, Ezequiel Garcia, Mauro Carvalho Chehab,
	Heiko Stuebner, Hans Verkuil, linux-media, linux-rockchip,
	linux-arm-kernel, linux-kernel, linux-kernel-mentees, skhan, me,
	jkoolstra

Hi Nicolas,

Thanks for the suggestion.

I moved the default out of rkvdec and into the common V4L2 compound
control initialization, making V4L2_CTRL_TYPE_HEVC_SPS default
chroma_format_idc to 1 (4:2:0).

I'll send this as v2.

Thanks,
Tharit

On Mon, Aug 10, 2026 at 9:05 PM Nicolas Dufresne
<nicolas.dufresne@collabora.com> wrote:
>
> 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 <tharitt97@gmail.com>
> > ---
> >  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,

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] media: v4l2-ctrls: default HEVC SPS chroma format to 4:2:0
  2026-08-10 14:05   ` Nicolas Dufresne
  (?)
  (?)
@ 2026-08-11 17:04   ` Tharit Tangkijwanichakul
  -1 siblings, 0 replies; 7+ messages in thread
From: Tharit Tangkijwanichakul @ 2026-08-11 17:04 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Nicolas Dufresne, Hans Verkuil, Pavan Bobba, Detlev Casanova,
	Pengpeng Hou, Sakari Ailus, Kees Cook, linux-media, linux-kernel,
	skhan, me, jkoolstra, Tharit Tangkijwanichakul

The default value of a compound control is zero initialized when no
explicit default is provided. For V4L2_CTRL_TYPE_HEVC_SPS this results
in chroma_format_idc being set to 0, which represents monochrome video.

Most stateless HEVC decoders do not support monochrome video. In
particular, the VDPU38x variant of 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.

    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

Set the common HEVC SPS compound control default to
chroma_format_idc = 1, corresponding to 4:2:0.

Fixes: c9a59dc2acc7 ("media: rkvdec: Add HEVC support for the VDPU381 variant")
Signed-off-by: Tharit Tangkijwanichakul <tharitt97@gmail.com>
---
Changes in v2:
- Move the HEVC SPS default from rkvdec to the common V4L2 control core,
  as suggested by Nicolas Dufresne.
- Default V4L2_CTRL_TYPE_HEVC_SPS chroma_format_idc to 1 (4:2:0).

 drivers/media/v4l2-core/v4l2-ctrls-core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
index ba047d7d8601..d7adf334a0ad 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
@@ -112,6 +112,7 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx,
 	struct v4l2_ctrl_fwht_params *p_fwht_params;
 	struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix;
 	struct v4l2_ctrl_av1_sequence *p_av1_sequence;
+	struct v4l2_ctrl_hevc_sps *p_hevc_sps;
 	void *p = ptr.p + idx * ctrl->elem_size;
 
 	if (ctrl->p_def.p_const)
@@ -185,6 +186,12 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx,
 		 */
 		memset(p_h264_scaling_matrix, 16, sizeof(*p_h264_scaling_matrix));
 		break;
+	case V4L2_CTRL_TYPE_HEVC_SPS:
+		p_hevc_sps = p;
+
+		/* 4:2:0 */
+		p_hevc_sps->chroma_format_idc = 1;
+		break;
 	}
 }
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-08-11 17:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30 15:36 [PATCH] media: rkvdec: fix v4l2-compliance failure Tharit Tangkijwanichakul
2026-07-30 15:36 ` Tharit Tangkijwanichakul
2026-08-10 14:05 ` Nicolas Dufresne
2026-08-10 14:05   ` Nicolas Dufresne
2026-08-11 16:38   ` Tharit Tangkijwanichakul
2026-08-11 16:38     ` Tharit Tangkijwanichakul
2026-08-11 17:04   ` [PATCH v2] media: v4l2-ctrls: default HEVC SPS chroma format to 4:2:0 Tharit Tangkijwanichakul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.