From nobody Sat Oct 4 16:23:27 2025 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15AE32D876C; Fri, 15 Aug 2025 08:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755247988; cv=none; b=HirUofGtgKsJLYZx/3zUSxGBZmS1BPuNyMIQRc1RampjfoFhl819DRKQvlcq5ayCzN4ahe4fDo+CmNb/GcyIVrjyMj8HA+aLxSsU464eM+vtvQ4KhvBg/sdtRrOYbEOvo6/yPUMNabodrvUomAJro60Eu6NXo4cOis7Sob1hvec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755247988; c=relaxed/simple; bh=87gzOCS7BY0zqtT+1Wj7KUUjjFuK6Jt2D+XZ9nEAqzg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Pib1w8if665DkM/p/dEYZawKE0qVdOrPgpJWTp3dwz+WyieRsNn1FlOgutDalYFFLrIG50fEPsz1m8csDAwpAhghHzuDfLnegY7LdOEmXzalIhiPgiq1KMVCFE+kqhIN3h03TqHabYu+gTEBOI3tRHOM5QQcLN6r8QWz/z6t9l8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=mwR3SlyU; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="mwR3SlyU" X-UUID: 40fbfc5079b511f0b33aeb1e7f16c2b6-20250815 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=tQBsvhrt8U4jRDvYim4ISpMoYGz+FkkDdT4pQKZQR+Q=; b=mwR3SlyUWLa9frrB5G5GRD0VrfB4rLH3Hi0lcN1UDUA1g+LfjUpwWU6pKk2/HJ3CHh7bUATKBQz3fB2s8oXY4TwqZlc+ffc2QIiz3qRaHcZbFfZMmkKeXwdMQlxb5sk284uU4w7Vmk0Rg6ZG7sv2fBhrDoMdaDES0gk0K+uLBUk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.3,REQID:eba6563c-c56b-43f1-a710-8d71cf46799e,IP:0,UR L:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:-5 X-CID-META: VersionHash:f1326cf,CLOUDID:4e8e2b7a-966c-41bd-96b5-7d0b3c22e782,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:-5,Content:0|15|50,EDM: -3,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0, AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 40fbfc5079b511f0b33aeb1e7f16c2b6-20250815 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1738095341; Fri, 15 Aug 2025 16:53:03 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.39; Fri, 15 Aug 2025 16:53:00 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1258.39 via Frontend Transport; Fri, 15 Aug 2025 16:53:00 +0800 From: Yunfei Dong To: =?UTF-8?q?N=C3=ADcolas=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , Sebastian Fricke , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert , Daniel Almeida CC: Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , "Yunfei Dong" , , , , , , Subject: [PATCH v2 14/14] media: mediatek: decoder: support av1 extend vsi Date: Fri, 15 Aug 2025 16:52:27 +0800 Message-ID: <20250815085232.30240-15-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250815085232.30240-1-yunfei.dong@mediatek.com> References: <20250815085232.30240-1-yunfei.dong@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-MTK: N Content-Type: text/plain; charset="utf-8" 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 --- .../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_r= eq_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 @@ =20 #define AV1_INVALID_IDX -1 =20 +#define AV1_NON_EXT_VSI_SIZE 0xD50 + #define AV1_DIV_ROUND_UP_POW2(value, n) \ ({ \ typeof(n) _n =3D 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]; }; =20 /** @@ -1394,13 +1400,18 @@ static int vdec_av1_slice_setup_tile_group(struct v= dec_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 =3D &instance->tile_group; + struct vdec_av1_slice_tile_group *tile_group; struct vdec_av1_slice_uncompressed_header *uh =3D &vsi->frame.uh; struct vdec_av1_slice_tile *tile =3D &uh->tile; struct v4l2_ctrl *ctrl; u32 tge_size; int i; =20 + if (IS_VDEC_SUPPORT_EXT(instance->ctx->dev->dec_capability)) + tile_group =3D &vsi->tile_group; + else + tile_group =3D &instance->tile_group; + ctrl =3D 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 vd= ec_av1_slice_instance *inst struct vdec_lat_buf *lat_buf) { struct vdec_av1_slice_work_buffer *work_buffer; + u32 num_tiles; int i; =20 vsi->bs.dma_addr =3D bs->dma_addr; @@ -1635,12 +1647,18 @@ static void vdec_av1_slice_setup_lat_buffer(struct = vdec_av1_slice_instance *inst =20 vsi->tile.buf =3D instance->tile.dma_addr; vsi->tile.size =3D instance->tile.size; - memcpy(lat_buf->tile_addr.va, instance->tile.va, 64 * instance->tile_grou= p.num_tiles); =20 vsi->cdf_table.buf =3D instance->cdf_table.dma_addr; vsi->cdf_table.size =3D instance->cdf_table.size; vsi->iq_table.buf =3D instance->iq_table.dma_addr; vsi->iq_table.size =3D instance->iq_table.size; + + if (IS_VDEC_SUPPORT_EXT(instance->ctx->dev->dec_capability)) + num_tiles =3D vsi->tile_group.num_tiles; + else + num_tiles =3D instance->tile_group.num_tiles; + + memcpy(lat_buf->tile_addr.va, instance->tile.va, 64 * num_tiles); } =20 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 v= dec_av1_slice_instance *ins struct vdec_av1_slice_vsi *vsi, struct mtk_vcodec_mem *bs) { - struct vdec_av1_slice_tile_group *tile_group =3D &instance->tile_group; + struct vdec_av1_slice_tile_group *tile_group; struct vdec_av1_slice_uncompressed_header *uh =3D &vsi->frame.uh; struct vdec_av1_slice_tile *tile =3D &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 =3D instance->tile.va; u64 pa =3D (u64)bs->dma_addr; =20 + if (IS_VDEC_SUPPORT_EXT(instance->ctx->dev->dec_capability)) + tile_group =3D &vsi->tile_group; + else + tile_group =3D &instance->tile_group; + if (uh->disable_cdf_update =3D=3D 0) allow_update_cdf =3D 1; =20 @@ -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 =3D AV1_NON_EXT_VSI_SIZE; =20 instance =3D 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; } =20 - if (vsi->vsi_size !=3D 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 =3D sizeof(struct vdec_av1_slice_vsi); + vsi->iq_table_size =3D AV1_IQ_TABLE_SIZE; + vsi->cdf_table_size =3D AV1_CDF_SIZE; + } + + if (vsi->vsi_size !=3D vsi_size) { + mtk_vdec_err(ctx, "remote vsi size 0x%x mismatch! expected: 0x%x\n", + vsi->vsi_size, vsi_size); + ret =3D -EINVAL; + goto error_vsi; + } =20 instance->irq_enabled =3D 1; instance->inneracing_mode =3D IS_VDEC_INNER_RACING(instance->ctx->dev->de= c_capability); --=20 2.45.2