[PATCH v3 0/5] media: verisilicon: Fix the JPEG encoder format handling

From: Arun Iyengar via B4 Relay

Date: Thu Nov 26 2026 - 12:01:16 EST


This series fixes the format handling of the Hantro JPEG encoders, found
with v4l2-ctl, v4l2-compliance and GStreamer on the RK3588 VEPU121.

Patch 1 keeps the coded format while CAPTURE buffers exist. Patch 2 sets
the coded size from the OUTPUT format. Patch 3 reports the fixed JPEG
colorimetry. Patch 4 restores the raw format descriptor when a CAPTURE
S_FMT can't reset it; this was the IOMMU fault at IOVA 0 seen with
v4l2-ctl --stream-mmap. Patch 5 limits the frame size to 8176x8176.

The VEPU2 stream limit in 64-bit words is patch 2 of Sergei Khomenkov's
v3 [1].

[1] https://lore.kernel.org/r/20261124-hantro-buflimit-v3-0-780903970ca0@xxxxxxxxx
[2] https://lore.kernel.org/r/20261126-b4-v4l2-enc-sizeimage-v1-1-dd2cb99bd717@xxxxxxxxx

Based on v7.4-rc1; on top of [1], patches 3 and 5 need git am -3.

Tested on Orange Pi 5 (RK3588S, VEPU121), v7.3-based KASAN kernel that
also carries the change of [1] 2/3: GStreamer encodes (NV12/I420/YUY2,
720p to 4K) and v4l2-compliance pass. The v2 reproducer no longer
faults; its 8 frames end in buffer full, as the CAPTURE sizeimage stays
at the 96x32 default (6768 bytes). The dev-encoder.rst proposal for
that case is [2]. H1 untested.

Developed with Claude (Anthropic), which wrote the code and the commit
messages. I reviewed every change.

Signed-off-by: Arun Iyengar <aiyengar1990@xxxxxxxxx>
---
Changes in v3:
- Dropped the CAPTURE sizeimage minimum (v2 2/7) and the job-time
geometry check (v2 4/7) (Nicolas); with [1], a too small CAPTURE
buffer ends in buffer full
- Spec proposal for the CAPTURE sizeimage sent as [2] (Nicolas)
- Patch 2: only width/height follow OUTPUT; sizeimage and -EBUSY dropped
- Patch 4: only restore the descriptor in hantro_reset_raw_fmt()
- Patch 5: Fixes tag (Sashiko)
- Shorter commit messages and comments
- Link to v2: https://patch.msgid.link/20261112-hantro-jpeg-enc-fixes-v2-0-de03e643c75d@xxxxxxxxx

---
Arun Iyengar (5):
media: verisilicon: Keep the encoder CAPTURE format while buffers exist
media: verisilicon: Keep the encoder coded size in sync with OUTPUT
media: verisilicon: Report fixed JPEG colorimetry on the encoder
media: verisilicon: Restore the encoder raw format when its reset fails
media: verisilicon: rockchip: Limit the JPEG encoder to 8176x8176

drivers/media/platform/verisilicon/hantro_v4l2.c | 26 ++++++++++++++++++++--
.../media/platform/verisilicon/rockchip_vpu_hw.c | 7 ++++--
2 files changed, 29 insertions(+), 4 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261110-hantro-jpeg-enc-fixes-9ff8bf6a491f

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