[PATCH] media: verisilicon: Limit the i.MX8MM G1 decoder to 1920 pixel wide pictures

From: Arun Iyengar via B4 Relay

Date: Thu Nov 19 2026 - 05:08:04 EST


From: Arun Iyengar <aiyengar1990@xxxxxxxxx>

The i.MX8MM G1 uses the i.MX8MQ format table, which allows H.264, VP8
and NV12 up to 3840x2160. The i.MX 8M Mini data sheet rates the decoder
at 1080p60, and NXP's hantro_v4l2 driver offers a decoder of that size
1920 pixels wide and up to 4096 high.

Give it its own table with these formats limited to 1920 pixels wide.
Heights are kept so that portrait pictures such as 1080x1920 are still
accepted, as in NXP's driver.

Fixes: cf1abc501a5c ("media: hantro: Add support for i.MX8MM Hantro-G1")
Reported-by: Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx>
Closes: https://lore.kernel.org/r/f041c5d87698ab3be8283ecc71ead0679327238e.camel@xxxxxxxxxxxxx
Signed-off-by: Arun Iyengar <aiyengar1990@xxxxxxxxx>
---
Not tested on hardware: I have no i.MX8MM board, so the limit is from the
data sheet and NXP's driver, not from the decoder's configuration
register. Build-tested only (W=1 arm64). The i.MX8MQ table is unchanged:
NXP's driver gives VP8 the same 4096x4096 as H.264 there.

Developed with Claude (Anthropic), which wrote the code and the commit
messages. I reviewed every change.
---
drivers/media/platform/verisilicon/imx8m_vpu_hw.c | 58 ++++++++++++++++++++++-
1 file changed, 56 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
index fa4224de4b99..805c57a4adcb 100644
--- a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
@@ -148,6 +148,60 @@ static const struct hantro_fmt imx8m_vpu_dec_fmts[] = {
},
};

+static const struct hantro_fmt imx8mm_vpu_g1_dec_fmts[] = {
+ {
+ .fourcc = V4L2_PIX_FMT_NV12,
+ .codec_mode = HANTRO_MODE_NONE,
+ .frmsize = {
+ .min_width = FMT_MIN_WIDTH,
+ .max_width = FMT_FHD_WIDTH,
+ .step_width = MB_DIM,
+ .min_height = FMT_MIN_HEIGHT,
+ .max_height = FMT_UHD_HEIGHT,
+ .step_height = MB_DIM,
+ },
+ },
+ {
+ .fourcc = V4L2_PIX_FMT_MPEG2_SLICE,
+ .codec_mode = HANTRO_MODE_MPEG2_DEC,
+ .max_depth = 2,
+ .frmsize = {
+ .min_width = FMT_MIN_WIDTH,
+ .max_width = FMT_FHD_WIDTH,
+ .step_width = MB_DIM,
+ .min_height = FMT_MIN_HEIGHT,
+ .max_height = FMT_FHD_HEIGHT,
+ .step_height = MB_DIM,
+ },
+ },
+ {
+ .fourcc = V4L2_PIX_FMT_VP8_FRAME,
+ .codec_mode = HANTRO_MODE_VP8_DEC,
+ .max_depth = 2,
+ .frmsize = {
+ .min_width = FMT_MIN_WIDTH,
+ .max_width = FMT_FHD_WIDTH,
+ .step_width = MB_DIM,
+ .min_height = FMT_MIN_HEIGHT,
+ .max_height = FMT_UHD_HEIGHT,
+ .step_height = MB_DIM,
+ },
+ },
+ {
+ .fourcc = V4L2_PIX_FMT_H264_SLICE,
+ .codec_mode = HANTRO_MODE_H264_DEC,
+ .max_depth = 2,
+ .frmsize = {
+ .min_width = FMT_MIN_WIDTH,
+ .max_width = FMT_FHD_WIDTH,
+ .step_width = MB_DIM,
+ .min_height = FMT_MIN_HEIGHT,
+ .max_height = FMT_UHD_HEIGHT,
+ .step_height = MB_DIM,
+ },
+ },
+};
+
static const struct hantro_fmt imx8m_vpu_g2_postproc_fmts[] = {
{
.fourcc = V4L2_PIX_FMT_NV12,
@@ -382,8 +436,8 @@ const struct hantro_variant imx8mq_vpu_g2_variant = {
};

const struct hantro_variant imx8mm_vpu_g1_variant = {
- .dec_fmts = imx8m_vpu_dec_fmts,
- .num_dec_fmts = ARRAY_SIZE(imx8m_vpu_dec_fmts),
+ .dec_fmts = imx8mm_vpu_g1_dec_fmts,
+ .num_dec_fmts = ARRAY_SIZE(imx8mm_vpu_g1_dec_fmts),
.codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER |
HANTRO_H264_DECODER,
.codec_ops = imx8mq_vpu_g1_codec_ops,

---
base-commit: aa0f4c41d4870a18e65772a1817af16427200371
change-id: 20261119-hantro-imx8mm-vp8-23fe87f19d49

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