From: sashiko-bot@kernel.org
To: "Kyrie Wu" <kyrie.wu@mediatek.com>, devicetree@vger.kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH v9 14/14] media: mediatek: decoder: support av1 extend vsi
Date: Tue, 17 Nov 2026 04:14:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-218180@kernel.org> (raw)
In-Reply-To: <20261117032950.1425556-15-kyrie.wu@mediatek.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] media: mtk-vcodec: VCP table sizes set for non-VCP in
vdec_av1_slice_init()
- [Low] media: mediatek: vcodec: duplicate AV1_TILE_SIZE macro and
vdec_av1_get_tiles_num()
--
commit 9047e2aa57e9e09f9e60cb45bd82896702db3562
Author: Kyrie Wu <kyrie.wu@mediatek.com>
media: mediatek: decoder: support av1 extend vsi
This commit adds extended VSI support to the MediaTek AV1 stateless
decoder by storing tile group information in the shared VSI structure when
MTK_VDEC_IS_SUPPORT_EXT is set.
> diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c
> index 2d6e08e722de0..97ca80fd06d6b 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c
> @@ -25,6 +25,9 @@
>
> #define AV1_INVALID_IDX -1
>
> +#define AV1_NON_EXT_VSI_SIZE 0xD50
> +#define AV1_TILE_SIZE 64
> +
> #define AV1_DIV_ROUND_UP_POW2(value, n) \
[ ... ]
> @@ -1403,17 +1413,29 @@ static void vdec_av1_slice_setup_uh(struct vdec_av1_slice_instance *instance,
> vdec_av1_slice_setup_tile(frame, &ctrl_fh->tile_info);
> }
>
> +static
> +struct vdec_av1_slice_tile_group *vdec_av1_get_tile_group(struct vdec_av1_slice_instance *instance,
> + struct vdec_av1_slice_vsi *vsi)
> +{
> + if (IS_VDEC_SUPPORT_EXT(instance->ctx->dev->dec_capability))
> + return &vsi->tile_group;
> + else
> + return &instance->tile_group;
> +}
[ ... ]
> @@ -1608,6 +1630,15 @@ static int vdec_av1_slice_setup_pfc(struct vdec_av1_slice_instance *instance,
> return ret;
> }
>
> +static u32 vdec_av1_get_tiles_num(struct vdec_av1_slice_instance *instance,
> + struct vdec_av1_slice_vsi *vsi)
> +{
> + if (IS_VDEC_SUPPORT_EXT(instance->ctx->dev->dec_capability))
> + return vsi->tile_group.num_tiles;
> + else
> + return instance->tile_group.num_tiles;
> +}
> +
> static void vdec_av1_slice_setup_lat_buffer(struct vdec_av1_slice_instance *instance,
> struct vdec_av1_slice_vsi *vsi,
> struct mtk_vcodec_mem *bs,
> @@ -1648,12 +1679,18 @@ static void vdec_av1_slice_setup_lat_buffer(struct vdec_av1_slice_instance *inst
>
> vsi->tile.buf = instance->tile.dma_addr;
> vsi->tile.size = instance->tile.size;
> - memcpy(lat_buf->tile_addr.va, instance->tile.va, 64 * instance->tile_group.num_tiles);
>
> vsi->cdf_table.buf = instance->cdf_table.dma_addr;
> vsi->cdf_table.size = instance->cdf_table.size;
> vsi->iq_table.buf = instance->iq_table.dma_addr;
> vsi->iq_table.size = instance->iq_table.size;
> +
> + /* lat_buf is used to share hardware decoder syntax between lat and core,
> + * there isn't only one. But there is only one tile.va for each instance.
> + * Need to copy tile information to lat_buf every time.
> + */
> + memcpy(lat_buf->tile_addr.va, instance->tile.va,
> + AV1_TILE_SIZE * vdec_av1_get_tiles_num(instance, vsi));
> }
[Severity: Low]
This isn't a bug, but AV1_TILE_SIZE duplicates the existing
AV1_TILE_BUF_SIZE macro (also 64) used for allocating and indexing the
same tile entries in vdec_av1_slice_alloc_working_buffer() and
vdec_av1_slice_setup_tile_buffer(). Also, vdec_av1_get_tiles_num()
duplicates the IS_VDEC_SUPPORT_EXT() check in vdec_av1_get_tile_group()
instead of using vdec_av1_get_tile_group(instance, vsi)->num_tiles.
[ ... ]
> @@ -1943,10 +1982,20 @@ static int vdec_av1_slice_init(struct mtk_vcodec_dec_ctx *ctx)
> goto error_vsi;
> }
>
> - if (vsi->vsi_size != sizeof(struct vdec_av1_slice_vsi))
> - mtk_vdec_err(ctx, "remote vsi size 0x%x mismatch! expected: 0x%zx\n",
> - vsi->vsi_size, sizeof(struct vdec_av1_slice_vsi));
> + if (IS_VDEC_SUPPORT_EXT(ctx->dev->dec_capability)) {
> + vsi_size = sizeof(struct vdec_av1_slice_vsi);
> + vsi->iq_table_size = AV1_IQ_TABLE_SIZE;
> + vsi->cdf_table_size = AV1_CDF_SIZE;
> + }
[Severity: Medium]
Should setting vsi->iq_table_size and vsi->cdf_table_size to
AV1_IQ_TABLE_SIZE and AV1_CDF_SIZE be guarded by fw_type == VCP rather
than IS_VDEC_SUPPORT_EXT()?
AV1_CDF_SIZE and AV1_IQ_TABLE_SIZE are the partition sizes of the VCP
shared memory region in mtk_vcodec_vcp_dm_addr(), and
vdec_av1_get_cdf_table_addr() and vdec_av1_get_iq_table_addr() only select
those VCP partitions when mtk_vcodec_fw_get_type() is VCP:
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c:vdec_av1_get_cdf_table_addr() {
if (mtk_vcodec_fw_get_type(ctx->dev->fw_handler) == VCP)
return AV1_CDF_MEM;
else
return (u32)vsi->cdf_table_addr;
}
If an SCP platform advertises MTK_VDEC_IS_SUPPORT_EXT via
scp_get_vdec_hw_capa(), overwriting vsi->iq_table_size and
vsi->cdf_table_size here causes vdec_av1_slice_init_cdf_table() and
vdec_av1_slice_init_iq_table() to allocate and memcpy() the VCP partition
sizes from the SCP DMEM addresses vsi->cdf_table_addr and
vsi->iq_table_addr.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117032950.1425556-1-kyrie.wu@mediatek.com?part=14
prev parent reply other threads:[~2026-11-17 4:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 3:29 [PATCH v9 00/14] media: mediatek: vcodec: support video decoder in mt8196 Kyrie Wu
2026-11-17 3:29 ` [PATCH v9 01/14] media: mediatek: vcodec: support vcp architecture Kyrie Wu
2026-11-17 3:29 ` [PATCH v9 02/14] media: mediatek: vcodec: add driver to support vcp Kyrie Wu
2026-11-17 3:55 ` sashiko-bot
2026-11-17 3:29 ` [PATCH v9 03/14] media: mediatek: vcodec: add driver to support vcp encoder Kyrie Wu
2026-11-17 3:53 ` sashiko-bot
2026-11-17 3:29 ` [PATCH v9 04/14] media: mediatek: vcodec: get different firmware ipi id Kyrie Wu
2026-11-17 3:53 ` sashiko-bot
2026-11-17 3:29 ` [PATCH v9 05/14] media: mediatek: vcodec: get share memory address Kyrie Wu
2026-11-17 3:58 ` sashiko-bot
2026-11-17 3:29 ` [PATCH v9 06/14] media: mediatek: vcodec: add debug information Kyrie Wu
2026-11-17 3:29 ` [PATCH v9 07/14] media: mediatek: vcodec: send share memory address to vcp Kyrie Wu
2026-11-17 3:29 ` [PATCH v9 08/14] media: dt-bindings: mediatek,vcodec-subdev-decoder: Add MT8196 Kyrie Wu
2026-11-17 3:39 ` sashiko-bot
2026-11-17 3:29 ` [PATCH v9 09/14] media: mediatek: vcodec: add decoder compatible to support mt8196 Kyrie Wu
2026-11-17 3:29 ` [PATCH v9 10/14] media: mediatek: vcodec: define MT8196 vcodec levels Kyrie Wu
2026-11-17 3:29 ` [PATCH v9 11/14] media: mediatek: vcodec: support 36bit iova address Kyrie Wu
2026-11-17 3:29 ` [PATCH v9 12/14] media: mediatek: vcodec: clean xpc status Kyrie Wu
2026-11-17 4:04 ` sashiko-bot
2026-11-17 3:29 ` [PATCH v9 13/14] media: mediatek: decoder: fill av1 buffer size with picinfo Kyrie Wu
2026-11-17 3:29 ` [PATCH v9 14/14] media: mediatek: decoder: support av1 extend vsi Kyrie Wu
2026-11-17 4:14 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-218180@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kyrie.wu@mediatek.com \
--cc=media-ci@linuxtv.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox