[PATCH v2] media: verisilicon: Only accept formats of the queue's kind in TRY_FMT
Arun Iyengar via B4 Relay
devnull+aiyengar1990.gmail.com at kernel.org
Tue Dec 1 02:21:22 PST 2026
From: Arun Iyengar <aiyengar1990 at gmail.com>
S_FMT accepts a raw format on the coded queue. sizeimage then stays zero
and REQBUFS hits WARN_ON(!plane_sizes[i]). Use the default format instead.
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Reported-by: Sashiko <sashiko-bot at kernel.org>
Closes: https://sashiko.dev/#/patchset/20261110-hantro-jpeg-enc-fixes-v1-0-fc4dc7e985d2@gmail.com?part=1
Cc: stable at vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990 at gmail.com>
---
Sashiko listed this as a pre-existing problem in its review of the JPEG
encoder series (Closes link); this patch does not depend on that series.
Orange Pi 5 (RK3588S), 7.3-based kernel, unprivileged user in the video
group. Before: S_FMT takes a raw format on the coded queue of the VEPU121
JPEG encoder and the VPU981 AV1 decoder, and REQBUFS logs the warning.
After: both return their default coded format and the log is clean. The
coded format on the raw queue was not exercised. media next: build only.
Developed with Claude (Anthropic), which wrote the code and the commit
message; I reviewed and tested it.
---
Changes in v2:
- Shorter commit message, code comment dropped. No functional change.
- Link to v1: https://lore.kernel.org/r/20261112-hantro-fmt-role-v1-1-e596d6f4828f@gmail.com
---
drivers/media/platform/verisilicon/hantro_v4l2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/platform/verisilicon/hantro_v4l2.c b/drivers/media/platform/verisilicon/hantro_v4l2.c
index 8d9545423c65..65eae7293f2b 100644
--- a/drivers/media/platform/verisilicon/hantro_v4l2.c
+++ b/drivers/media/platform/verisilicon/hantro_v4l2.c
@@ -337,6 +337,8 @@ static int hantro_try_fmt(const struct hantro_ctx *ctx,
vpu_debug(4, "trying format %p4cc\n", &pix_mp->pixelformat);
fmt = hantro_find_format(ctx, pix_mp->pixelformat);
+ if (fmt && coded != (fmt->codec_mode != HANTRO_MODE_NONE))
+ fmt = NULL;
if (!fmt) {
fmt = hantro_get_default_fmt(ctx, coded, HANTRO_DEFAULT_BIT_DEPTH, HANTRO_AUTO_POSTPROC);
pix_mp->pixelformat = fmt->fourcc;
---
base-commit: 95c189b26efb07257888ccf9d873a5c366aafbc6
change-id: 20261112-hantro-fmt-role-743da2b98ccb
Best regards,
--
Arun Iyengar <aiyengar1990 at gmail.com>
More information about the Linux-rockchip
mailing list