[PATCH v3 5/5] media: verisilicon: rockchip: Limit the JPEG encoder to 8176x8176

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


From: Arun Iyengar <aiyengar1990 at gmail.com>

The VEPU2 and H1 JPEG encoders take the picture size in 9-bit
macroblock counts: 8192 pixels is programmed as 0 on VEPU2 and runs
into the width field on H1. Limit both dimensions to 511 macroblocks.

Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Signed-off-by: Arun Iyengar <aiyengar1990 at gmail.com>
---
 drivers/media/platform/verisilicon/rockchip_vpu_hw.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
index 02673be9878e..d295e9571a8e 100644
--- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c
@@ -20,6 +20,9 @@
 
 #define ROCKCHIP_VPU981_MIN_SIZE 64
 
+/* 9-bit macroblock counts */
+#define ROCKCHIP_VPU_JPEG_ENC_MAX_SIZE (511 * MB_DIM)
+
 /*
  * Supported formats.
  */
@@ -52,10 +55,10 @@ static const struct hantro_fmt rockchip_vpu_enc_fmts[] = {
 		.header_size = JPEG_HEADER_SIZE,
 		.frmsize = {
 			.min_width = 96,
-			.max_width = 8192,
+			.max_width = ROCKCHIP_VPU_JPEG_ENC_MAX_SIZE,
 			.step_width = MB_DIM,
 			.min_height = 32,
-			.max_height = 8192,
+			.max_height = ROCKCHIP_VPU_JPEG_ENC_MAX_SIZE,
 			.step_height = MB_DIM,
 		},
 	},

-- 
2.55.0





More information about the Linux-rockchip mailing list