From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: "Yunfei Dong" <yunfei.dong@mediatek.com>,
"Nícolas F . R . A . Prado" <nfraprado@collabora.com>,
"Sebastian Fricke" <sebastian.fricke@collabora.com>,
"Hans Verkuil" <hverkuil-cisco@xs4all.nl>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
"Nathan Hebert" <nhebert@chromium.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>,
Fritz Koenig <frkoenig@chromium.org>,
Daniel Vetter <daniel@ffwll.ch>,
Steve Cho <stevecho@chromium.org>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
Project_Global_Chrome_Upstream_Group@mediatek.com
Subject: Re: [PATCH v2 14/14] media: mediatek: decoder: support av1 extend vsi
Date: Fri, 28 Nov 2025 15:26:15 -0500 [thread overview]
Message-ID: <1f1191bb664bf0c437deabbd9f947d127b5b4dd2.camel@collabora.com> (raw)
In-Reply-To: <20250815085232.30240-15-yunfei.dong@mediatek.com>
[-- Attachment #1: Type: text/plain, Size: 5845 bytes --]
Hi,
Le vendredi 15 août 2025 à 16:52 +0800, Yunfei Dong a écrit :
> The driver can't access tile buffer address for extend architecture,
> set tile group information in vcp and share it with kernel.
>
> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> ---
> .../vcodec/decoder/vdec/vdec_av1_req_lat_if.c | 46 ++++++++++++++++---
> 1 file changed, 39 insertions(+), 7 deletions(-)
>
> 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 6070485e26c4..43541faeea87 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,8 @@
>
> #define AV1_INVALID_IDX -1
>
> +#define AV1_NON_EXT_VSI_SIZE 0xD50
> +
> #define AV1_DIV_ROUND_UP_POW2(value, n) \
> ({ \
> typeof(n) _n = n; \
> @@ -641,6 +643,8 @@ struct vdec_av1_slice_fb {
> * @frame: current frame info
> * @state: status after decode done
> * @cur_lst_tile_id: tile id for large scale
> + * @tile_group: tile group info
> + * @reserved: reserved
> */
> struct vdec_av1_slice_vsi {
> /* lat */
> @@ -665,6 +669,8 @@ struct vdec_av1_slice_vsi {
> struct vdec_av1_slice_frame frame;
> struct vdec_av1_slice_state state;
> u32 cur_lst_tile_id;
> + struct vdec_av1_slice_tile_group tile_group;
> + unsigned int reserved[4];
> };
>
> /**
> @@ -1394,13 +1400,18 @@ static int vdec_av1_slice_setup_tile_group(struct vdec_av1_slice_instance *insta
> struct vdec_av1_slice_vsi *vsi)
> {
> struct v4l2_ctrl_av1_tile_group_entry *ctrl_tge;
> - struct vdec_av1_slice_tile_group *tile_group = &instance->tile_group;
> + struct vdec_av1_slice_tile_group *tile_group;
> struct vdec_av1_slice_uncompressed_header *uh = &vsi->frame.uh;
> struct vdec_av1_slice_tile *tile = &uh->tile;
> struct v4l2_ctrl *ctrl;
> u32 tge_size;
> int i;
>
> + if (IS_VDEC_SUPPORT_EXT(instance->ctx->dev->dec_capability))
> + tile_group = &vsi->tile_group;
> + else
> + tile_group = &instance->tile_group;
> +
> ctrl = v4l2_ctrl_find(&instance->ctx->ctrl_hdl, V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY);
> if (!ctrl)
> return -EINVAL;
> @@ -1601,6 +1612,7 @@ static void vdec_av1_slice_setup_lat_buffer(struct vdec_av1_slice_instance *inst
> struct vdec_lat_buf *lat_buf)
> {
> struct vdec_av1_slice_work_buffer *work_buffer;
> + u32 num_tiles;
> int i;
>
> vsi->bs.dma_addr = bs->dma_addr;
> @@ -1635,12 +1647,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);
Can you define the magic number 64 please.
>
> 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;
> +
> + if (IS_VDEC_SUPPORT_EXT(instance->ctx->dev->dec_capability))
> + num_tiles = vsi->tile_group.num_tiles;
> + else
> + num_tiles = instance->tile_group.num_tiles;
> +
> + memcpy(lat_buf->tile_addr.va, instance->tile.va, 64 * num_tiles);
I bet its shared.
> }
>
> static void vdec_av1_slice_setup_seg_buffer(struct vdec_av1_slice_instance *instance,
> @@ -1663,7 +1681,7 @@ static void vdec_av1_slice_setup_tile_buffer(struct vdec_av1_slice_instance *ins
> struct vdec_av1_slice_vsi *vsi,
> struct mtk_vcodec_mem *bs)
> {
> - struct vdec_av1_slice_tile_group *tile_group = &instance->tile_group;
> + struct vdec_av1_slice_tile_group *tile_group;
> struct vdec_av1_slice_uncompressed_header *uh = &vsi->frame.uh;
> struct vdec_av1_slice_tile *tile = &uh->tile;
> u32 tile_num, tile_row, tile_col;
> @@ -1674,6 +1692,11 @@ static void vdec_av1_slice_setup_tile_buffer(struct vdec_av1_slice_instance *ins
> u32 *tile_info_buf = instance->tile.va;
> u64 pa = (u64)bs->dma_addr;
>
> + if (IS_VDEC_SUPPORT_EXT(instance->ctx->dev->dec_capability))
> + tile_group = &vsi->tile_group;
> + else
> + tile_group = &instance->tile_group;
> +
Second time this is repeated, perhaps make a small helper ?
> if (uh->disable_cdf_update == 0)
> allow_update_cdf = 1;
>
> @@ -1887,7 +1910,7 @@ static int vdec_av1_slice_init(struct mtk_vcodec_dec_ctx *ctx)
> {
> struct vdec_av1_slice_instance *instance;
> struct vdec_av1_slice_init_vsi *vsi;
> - int ret;
> + int ret, vsi_size = AV1_NON_EXT_VSI_SIZE;
>
> instance = kzalloc(sizeof(*instance), GFP_KERNEL);
> if (!instance)
> @@ -1926,9 +1949,18 @@ 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;
> + }
> +
> + if (vsi->vsi_size != vsi_size) {
> + mtk_vdec_err(ctx, "remote vsi size 0x%x mismatch! expected: 0x%x\n",
> + vsi->vsi_size, vsi_size);
> + ret = -EINVAL;
> + goto error_vsi;
> + }
>
> instance->irq_enabled = 1;
> instance->inneracing_mode = IS_VDEC_INNER_RACING(instance->ctx->dev->dec_capability);
cheers,
Nicolas
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-11-28 20:26 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 8:52 [PATCH v2 00/14] media: mediatek: vcodec: support video decoder in mt8196 Yunfei Dong
2025-08-15 8:52 ` [PATCH v2 01/14] dt-bindings: media: mediatek: vcodec: add decoder dt-bindings for mt8196 Yunfei Dong
2025-08-19 9:01 ` Krzysztof Kozlowski
2025-08-19 9:05 ` Krzysztof Kozlowski
2025-11-28 19:32 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 02/14] media: mediatek: vcodec: add decoder compatible to support mt8196 Yunfei Dong
2025-11-28 19:34 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 03/14] media: mediatek: vcodec: add driver to support vcp Yunfei Dong
2025-11-28 20:01 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 04/14] media: mediatek: vcodec: add driver to support vcp encoder Yunfei Dong
2025-11-28 20:05 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 05/14] media: mediatek: vcodec: get different firmware ipi id Yunfei Dong
2025-11-28 20:07 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 06/14] media: mediatek: vcodec: get share memory address Yunfei Dong
2025-11-28 20:12 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 07/14] media: mediatek: vcodec: define MT8196 vcodec levels Yunfei Dong
2025-11-28 19:37 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 08/14] media: mediatek: vcodec: support vcp architecture Yunfei Dong
2025-11-28 20:14 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 09/14] media: mediatek: vcodec: support 36bit iova address Yunfei Dong
2025-11-28 20:15 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 10/14] media: mediatek: vcodec: clean xpc status Yunfei Dong
2025-11-28 20:19 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 11/14] media: mediatek: vcodec: add debug information Yunfei Dong
2025-11-28 20:20 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 12/14] media: mediatek: vcodec: send share memory address to vcp Yunfei Dong
2025-11-28 20:22 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 13/14] media: mediatek: decoder: fill av1 buffer size with picinfo Yunfei Dong
2025-11-28 20:23 ` Nicolas Dufresne
2025-08-15 8:52 ` [PATCH v2 14/14] media: mediatek: decoder: support av1 extend vsi Yunfei Dong
2025-11-28 20:26 ` Nicolas Dufresne [this message]
2025-11-28 19:30 ` [PATCH v2 00/14] media: mediatek: vcodec: support video decoder in mt8196 Nicolas Dufresne
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=1f1191bb664bf0c437deabbd9f947d127b5b4dd2.camel@collabora.com \
--to=nicolas.dufresne@collabora.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=benjamin.gaignard@collabora.com \
--cc=daniel.almeida@collabora.com \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=frkoenig@chromium.org \
--cc=hsinyi@chromium.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=nfraprado@collabora.com \
--cc=nhebert@chromium.org \
--cc=sebastian.fricke@collabora.com \
--cc=stevecho@chromium.org \
--cc=yunfei.dong@mediatek.com \
/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
all inboxes | Powered by JetHome®