Re: [PATCH] media: verisilicon: av1: Set the monochrome flag

From: Benjamin Gaignard

Date: Sun Dec 06 2026 - 09:43:16 EST



Le 05/12/2026 à 13:18, Arun Iyengar via B4 Relay a écrit :
From: Arun Iyengar <aiyengar1990@xxxxxxxxx>

The decoder's monochrome flag is always cleared, so a 4:0:0 stream is
parsed as 4:2:0 and decodes to garbage. Set it from the sequence header.

Fixes: 727a400686a2 ("media: verisilicon: Add Rockchip AV1 decoder")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Arun Iyengar <aiyengar1990@xxxxxxxxx>

Nack.
If you want to improve monochromatic support you should add a grey pixel format
before and make sure the driver only enumerate it when V4L2_AV1_SEQUENCE_FLAG_MONO_CHROME
is set.

Regards,
Benjamin

---
Tested on an Orange Pi 5 (RK3588S) with fluster av1-1-b8-24-monochrome
and av1-1-b10-24-monochrome: luma is bit-exact (was wrong). The chroma
planes of NV12/P010 are not written; a GREY format follows separately.

Developed with Claude (Anthropic), which wrote the code and the commit
messages. I reviewed every change.
---
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c b/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
index f143df99cdb5..6c8c3f7de2dc 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
@@ -1259,7 +1259,8 @@ static void rockchip_vpu981_av1_dec_set_parameters(struct hantro_ctx *ctx)
hantro_reg_write(vpu, &av1_force_interger_mv,
!!(ctrls->frame->flags & V4L2_AV1_FRAME_FLAG_FORCE_INTEGER_MV));
- hantro_reg_write(vpu, &av1_blackwhite_e, 0);
+ hantro_reg_write(vpu, &av1_blackwhite_e,
+ !!(ctrls->sequence->flags & V4L2_AV1_SEQUENCE_FLAG_MONO_CHROME));
hantro_reg_write(vpu, &av1_delta_q_res_log, ctrls->frame->quantization.delta_q_res);
hantro_reg_write(vpu, &av1_delta_q_present,
!!(ctrls->frame->quantization.flags

---
base-commit: fd568e1139cc43b39fad1108463d1f7681d82ce2
change-id: 20261130-av1-mono-flag-d6f4a2a921be

Best regards,
--
Arun Iyengar <aiyengar1990@xxxxxxxxx>