[PATCH 0/2] media: rockchip: Decode monochrome H.264 to GREY
From: Arun Iyengar via B4 Relay
Date: Thu Nov 19 2026 - 20:12:10 EST
The Rockchip Hantro (G1/VDPU2) and rkvdec decoders write no chroma for
4:0:0 H.264, but the drivers offer only formats with chroma. Offer GREY
for such streams.
Tested on an Orange Pi 5 (RK3588S: VDPU121 and rkvdec), 7.3-based tree
(patch 1 there differs in the control ops struct and an out-of-tree AVS+
format table; build-tested on media next), with GStreamer v4l2codecs
patched locally to map GREY and to renegotiate on a chroma format
change: JVT-FR-EXT HPCAMOLQ_BRCM_B and HPCVMOLQ_BRCM_B now pass on both
decoders, other fluster H.264, HEVC, VP8, VP9 and AV1 results unchanged.
Other SoCs are untested. Userspace without GREY support no longer gets
NV12 for these streams: unpatched GStreamer stops with an error instead
of showing wrong chroma.
A change between 4:0:0 and 4:2:0 inside a stream needs new CAPTURE
buffers: Hantro refuses the new SPS with -EBUSY while CAPTURE streams,
rkvdec while CAPTURE buffers exist (as before). Unpatched GStreamer
does not renegotiate for it. With the local patch a 4:0:0 + 4:2:0 +
4:0:0 concatenation decodes bit-exact on Hantro; on rkvdec it was run
only with an out-of-tree busy check.
Conflicts in hantro_try_fmt() with my pending "media: verisilicon: Only
accept formats of the queue's kind in TRY_FMT" [1]; I will rebase
whichever goes second.
[1] https://lore.kernel.org/r/20261112-hantro-fmt-role-v1-1-e596d6f4828f@xxxxxxxxx
Developed with Claude (Anthropic), which wrote the code and the commit
messages. I reviewed every change.
---
Arun Iyengar (2):
media: verisilicon: Decode monochrome H.264 to GREY on Rockchip
media: rkvdec: Decode monochrome H.264 to GREY
.../platform/rockchip/rkvdec/rkvdec-h264-common.c | 4 ++-
drivers/media/platform/rockchip/rkvdec/rkvdec.c | 4 +++
drivers/media/platform/rockchip/rkvdec/rkvdec.h | 1 +
drivers/media/platform/verisilicon/hantro.h | 4 +++
drivers/media/platform/verisilicon/hantro_drv.c | 40 ++++++++++++++++++++--
drivers/media/platform/verisilicon/hantro_v4l2.c | 27 ++++++++++++---
.../media/platform/verisilicon/rockchip_vpu_hw.c | 39 +++++++++++++++++++++
7 files changed, 111 insertions(+), 8 deletions(-)
---
base-commit: aa0f4c41d4870a18e65772a1817af16427200371
change-id: 20261114-b4-h264-monochrome-grey-7d1fabf34027
Best regards,
--
Arun Iyengar <aiyengar1990@xxxxxxxxx>