[PATCH v3 2/5] media: verisilicon: Keep the encoder coded size in sync with OUTPUT

Arun Iyengar via B4 Relay devnull+aiyengar1990.gmail.com at kernel.org
Thu Nov 26 09:00:54 PST 2026


From: Arun Iyengar <aiyengar1990 at gmail.com>

Setting the OUTPUT format leaves the coded size at the 96x32 default,
so the JPEG header does not match the encoded frame. The OUTPUT S_FMT
resets the crop to the full frame: copy its size to the coded format.

Fixes: 953aaa1492c5 ("media: rockchip/vpu: Prepare things to support decoders")
Signed-off-by: Arun Iyengar <aiyengar1990 at gmail.com>
---
 drivers/media/platform/verisilicon/hantro_v4l2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/platform/verisilicon/hantro_v4l2.c b/drivers/media/platform/verisilicon/hantro_v4l2.c
index 0d6d4f36d012..88b1cf66b713 100644
--- a/drivers/media/platform/verisilicon/hantro_v4l2.c
+++ b/drivers/media/platform/verisilicon/hantro_v4l2.c
@@ -561,6 +561,12 @@ static int hantro_set_fmt_out(struct hantro_ctx *ctx,
 	ctx->vpu_src_fmt = hantro_find_format(ctx, pix_mp->pixelformat);
 	ctx->src_fmt = *pix_mp;
 
+	/* Setting the OUTPUT format resets the encoder crop to the full frame. */
+	if (ctx->is_encoder) {
+		ctx->dst_fmt.width = pix_mp->width;
+		ctx->dst_fmt.height = pix_mp->height;
+	}
+
 	/*
 	 * Current raw format might have become invalid with newly
 	 * selected codec, so reset it to default just to be safe and

-- 
2.55.0





More information about the Linux-rockchip mailing list