From: Tharit Tangkijwanichakul <tharitt97@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Nicolas Dufresne <nicolas.dufresne@collabora.com>,
Hans Verkuil <hverkuil@kernel.org>,
Pavan Bobba <opensource206@gmail.com>,
Detlev Casanova <detlev.casanova@collabora.com>,
Pengpeng Hou <pengpeng@iscas.ac.cn>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Kees Cook <kees@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
skhan@linuxfoundation.org, me@brighamcampbell.com,
jkoolstra@xs4all.nl,
Tharit Tangkijwanichakul <tharitt97@gmail.com>
Subject: [PATCH v2] media: v4l2-ctrls: default HEVC SPS chroma format to 4:2:0
Date: Tue, 11 Aug 2026 17:04:14 +0000 [thread overview]
Message-ID: <20260811170414.644-1-tharitt97@gmail.com> (raw)
In-Reply-To: <3cfca6fd11f39c6ce161d5a2e7fb650b2e9289ec.camel@collabora.com>
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
prev parent reply other threads:[~2026-08-11 17:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Tharit Tangkijwanichakul [this message]
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=20260811170414.644-1-tharitt97@gmail.com \
--to=tharitt97@gmail.com \
--cc=detlev.casanova@collabora.com \
--cc=hverkuil@kernel.org \
--cc=jkoolstra@xs4all.nl \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=me@brighamcampbell.com \
--cc=nicolas.dufresne@collabora.com \
--cc=opensource206@gmail.com \
--cc=pengpeng@iscas.ac.cn \
--cc=sakari.ailus@linux.intel.com \
--cc=skhan@linuxfoundation.org \
/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 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.