[PATCH] media: verisilicon: av1: Refuse frames 57 to 64 pixels high
From: Arun Iyengar via B4 Relay
Date: Sat Dec 05 2026 - 17:53:03 EST
From: Arun Iyengar <aiyengar1990@xxxxxxxxx>
The RK3588 AV1 decoder does not finish a frame that is 8 blocks (57 to 64
pixels) high: 64 at widths 16 to 256, and 58, 60 and 62 at width 128,
with 64 and 128 pixel superblocks. Each frame ends in the decoder timeout
(status 0x00040100) after about 0.7 seconds and its buffer is returned
with the error flag. Rockchip's MPP computes the height-dependent
registers the same way and has no special case for these heights.
Fail these frames before starting the decoder.
Fixes: 727a400686a2 ("media: verisilicon: Add Rockchip AV1 decoder")
Signed-off-by: Arun Iyengar <aiyengar1990@xxxxxxxxx>
---
Tested on an Orange Pi 5 (RK3588S): AV1 frames 128 wide and 57 to 64 high
are refused without starting the decoder (before: 0.7 s timeout per frame
at heights 58, 60, 62 and 64); heights 49 to 56 and 65 to 80 decode
bit-exact with FFmpeg and GStreamer.
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 | 7 +++++++
1 file changed, 7 insertions(+)
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..171b4088b49e 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
@@ -1375,6 +1375,7 @@ rockchip_vpu981_av1_dec_set_output_buffer(struct hantro_ctx *ctx)
int rockchip_vpu981_av1_dec_run(struct hantro_ctx *ctx)
{
+ struct hantro_av1_dec_ctrls *ctrls = &ctx->av1_dec.ctrls;
struct hantro_dev *vpu = ctx->dev;
struct vb2_v4l2_buffer *vb2_src;
int ret;
@@ -1385,6 +1386,12 @@ int rockchip_vpu981_av1_dec_run(struct hantro_ctx *ctx)
if (ret)
goto prepare_error;
+ /* The decoder times out on frames 8 blocks (57 to 64 pixels) high */
+ if (DIV_ROUND_UP(ctrls->frame->frame_height_minus_1 + 1, 8) == 8) {
+ ret = -EINVAL;
+ goto prepare_error;
+ }
+
vb2_src = hantro_get_src_buf(ctx);
if (!vb2_src) {
ret = -EINVAL;
---
base-commit: fd568e1139cc43b39fad1108463d1f7681d82ce2
change-id: 20261205-b4-av1-min-height-286621097c81
Best regards,
--
Arun Iyengar <aiyengar1990@xxxxxxxxx>