[PATCH] media: rkvdec: Reject 4:0:0 HEVC streams

From: Jaroslav Svoboda

Date: Fri Nov 27 2026 - 06:41:59 EST


The HEVC backend of the first rkvdec variant (RK3288, RK3328, RK3399)
accepts an SPS with chroma_format_idc 0, its comment reading "Only 4:0:0
and 4:2:0 are supported". The hardware has no monochrome HEVC: the
RK3328 and RK3399 datasheets list HEVC Main and Main 10 only, and
Rockchip's MPP library notes that its HEVC decoders before the RV1126B
do not support YUV400.

Given a monochrome HEVC stream (x265 fed gray or gray10le pictures),
the RK3328 and the RK3399 decode every picture's luma as zeros, with
IOMMU read faults at addresses near 0 and near the size of one luma
plane. A 2160p stream hung both SoCs after a few seconds; only a power
cycle brought them back.

Reject chroma_format_idc 0, as the VDPU381 and VDPU383 backends already
do, so that setting the SPS control fails and userspace can fall back
to a software decoder.

Tested with this change on v7.3.1, on an RK3328 board and on a Pinebook
Pro (RK3399): a monochrome HEVC stream is now refused at the SPS
control, and 8-bit and 10-bit 4:2:0 streams still decode bit-exact
against FFmpeg. Not tested on linux-next itself, nor on the RK3288.

The problem was found, and this fix and message written, with the help
of an AI coding assistant (Claude Opus 5.5 in Claude Code) during
hardware testing of the boards above.

Fixes: 3595375c2301 ("media: rkvdec: Add HEVC backend")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Jaroslav Svoboda <jaroslav.svoboda@xxxxxxxxx>
---
drivers/media/platform/rockchip/rkvdec/rkvdec-hevc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-hevc.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-hevc.c
index 88e90c438..97466705f 100644
--- a/drivers/media/platform/rockchip/rkvdec/rkvdec-hevc.c
+++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-hevc.c
@@ -487,8 +487,8 @@ static void config_registers(struct rkvdec_ctx *ctx,
static int rkvdec_hevc_validate_sps(struct rkvdec_ctx *ctx,
const struct v4l2_ctrl_hevc_sps *sps)
{
- if (sps->chroma_format_idc > 1)
- /* Only 4:0:0 and 4:2:0 are supported */
+ if (sps->chroma_format_idc != 1)
+ /* Only 4:2:0 is supported */
return -EINVAL;
if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8)
/* Luma and chroma bit depth mismatch */

base-commit: b4e3c4b6a36fd76f57bf3e48638f68ddecc54ba4
--
2.56.0