mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: verisilicon: av1: Set the monochrome flag
@ 2026-12-05 12:18 Arun Iyengar via B4 Relay
  2026-12-06 14:42 ` Benjamin Gaignard
  0 siblings, 1 reply; 2+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-05 12:18 UTC (permalink / raw)
  To: Nicolas Dufresne, Benjamin Gaignard, Philipp Zabel,
	Mauro Carvalho Chehab, Heiko Stuebner, Hans Verkuil
  Cc: linux-media, linux-rockchip, linux-arm-kernel, linux-kernel,
	stable, Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

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@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
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@gmail.com>



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

* Re: [PATCH] media: verisilicon: av1: Set the monochrome flag
  2026-12-05 12:18 [PATCH] media: verisilicon: av1: Set the monochrome flag Arun Iyengar via B4 Relay
@ 2026-12-06 14:42 ` Benjamin Gaignard
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Gaignard @ 2026-12-06 14:42 UTC (permalink / raw)
  To: aiyengar1990, Nicolas Dufresne, Philipp Zabel,
	Mauro Carvalho Chehab, Heiko Stuebner, Hans Verkuil
  Cc: linux-media, linux-rockchip, linux-arm-kernel, linux-kernel, stable


Le 05/12/2026 à 13:18, Arun Iyengar via B4 Relay a écrit :
> From: Arun Iyengar <aiyengar1990@gmail.com>
>
> 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@vger.kernel.org
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>

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

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

end of thread, other threads:[~2026-12-06 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-05 12:18 [PATCH] media: verisilicon: av1: Set the monochrome flag Arun Iyengar via B4 Relay
2026-12-06 14:42 ` Benjamin Gaignard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®