From nobody Thu Apr 2 02:42:25 2026 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (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 4B83031E855; Fri, 20 Mar 2026 05:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773986398; cv=none; b=A3jsY49rXPPHIoBIYIURE1BVsZProyg/Hn0/zont2q+Fwm95WhNgNmFS3ihJEm3gKh7kOD7NpHDFaRXg4tFQhyjXf61zzqIHr4o/Oplx1fT52l4QT4eW4ehUMyYuoaYrMXzvRZ2vZ8iX9mHhnualic4EyDEz9Bpa5LZBkv+JPbk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773986398; c=relaxed/simple; bh=/UMfdf5YoEmKMVfDXTfTBXvMC5AVZjwBS0WLdSlen20=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kr0GOpF75xRpZMGoDPcGgVJPx0EPmVaQBPR1XPbaOTZgWKpqVokARwBJRw0QNHTu5BIStfEkPWZZ/opfdoA93gFvQfEFry4M9CxL/b+WGxtwU5Ys3FyZ8KSeOAKi0iVE1LRl5ZvoL/kdl/0II0th40n9TPwqOP29BFwhscB5ukI= 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=q6LReLr8; arc=none smtp.client-ip=60.244.123.138 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="q6LReLr8" X-UUID: 021cf0c6242211f1a02d4725871ece0b-20260320 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=fhBNGVzH6ZA6SeIDl+YE56CrdjmD+7fRIviIjg8va0Q=; b=q6LReLr897iZLYYTKmRzmqqa9wqGvplaGA5EGyhxwxxY3e40E7DjBIfm0IMfWjXaAipfLxuAvlaYY1VgHQ+SP1nkd83+9sW/lNUgR4IdYNva3K11qUUvPi3nzWjGAYhO4cgR1RXCPh2bY3HgiLmk6AqhY3RKaHDMjLGjE3+JgOA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:16ada09e-9362-42c6-94cc-3b16df4cc5dd,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:e7bac3a,CLOUDID:d9d1efd4-060f-4ecc-9ee0-121eeeb4a682,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|836|888|898,TC:-5,Content: 0|15|50,EDM:-3,IP:nil,URL:0,File:130,RT:0,Bulk:nil,QS:nil,BEC:-1,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: 021cf0c6242211f1a02d4725871ece0b-20260320 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 519455777; Fri, 20 Mar 2026 13:59:50 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Fri, 20 Mar 2026 13:59:49 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.2562.29 via Frontend Transport; Fri, 20 Mar 2026 13:59:48 +0800 From: Kyrie Wu To: Tiffany Lin , Andrew-CT Chen , Yunfei Dong , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Kyrie Wu , Hans Verkuil , Nicolas Dufresne , Nathan Hebert , Arnd Bergmann , Irui Wang , George Sun , , , , , CC: Neil Armstrong , Andrzej Pietrasiewicz , Yilong Zhou Subject: [PATCH v8 4/9] media: mediatek: vcodec: Add VP9 Probability Size Configuration Date: Fri, 20 Mar 2026 13:59:35 +0800 Message-ID: <20260320055940.15961-5-kyrie.wu@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20260320055940.15961-1-kyrie.wu@mediatek.com> References: <20260320055940.15961-1-kyrie.wu@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" Introduce support for using different probability buffer sizes for different stateless decoders: in particular, the VP9 decoder can use a different size on different SoCs because of different hardware capabilities. Move the hardcoded single probability buffer size value to decoder params, introduce a new VP9_4K_PROB_BUF_SIZE and assign: - VP9_PROB_BUF_SIZE (2560 lines) to legacy SoCs; - VP9_4K_PROB_BUF_SIZE (3840 lines) to newer SoCs (MT8196, MT8189). Signed-off-by: Kyrie Wu Reviewed-by: AngeloGioacchino Del Regno --- .../mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h | 2 ++ .../mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c | 1 + .../mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c | 9 +++++++++ .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 4 ++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_= drv.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h index 4ffc0eae855b..43dc0b22fdb0 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h @@ -82,10 +82,12 @@ struct vdec_pic_info { * struct mtk_vcodec_dec_params - decoder supported parameters * @level: decoder supported vcodec level * @profile: decoder supported vcodec profile + * @prob_size: vp9 decoder probability size */ struct mtk_vcodec_dec_params { s64 level; s64 profile; + size_t prob_size; }; =20 /** diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_= stateful.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_= stateful.c index 64f32976d15e..5dcbe6550419 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_statefu= l.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_statefu= l.c @@ -630,5 +630,6 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata = =3D { .vp9_params =3D { .level =3D V4L2_MPEG_VIDEO_VP9_LEVEL_4_0, .profile =3D V4L2_MPEG_VIDEO_VP9_PROFILE_1, + .prob_size =3D 2560, }, }; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_= stateless.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec= _stateless.c index efcd28f5f289..748725e563d8 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_statele= ss.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_statele= ss.c @@ -10,6 +10,9 @@ #include "mtk_vcodec_dec_pm.h" #include "vdec_drv_if.h" +#define VP9_PROB_BUF_SIZE 2560 +#define VP9_4K_PROB_BUF_SIZE 3840 /** * struct mtk_stateless_control - CID control type * @cfg: control configuration @@ -890,6 +893,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata = =3D { .vp9_params =3D { .level =3D V4L2_MPEG_VIDEO_VP9_LEVEL_4_0, .profile =3D V4L2_MPEG_VIDEO_VP9_PROFILE_1, + .prob_size =3D VP9_PROB_BUF_SIZE, }, }; =20 @@ -941,6 +945,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata = =3D { .vp9_params =3D { .level =3D V4L2_MPEG_VIDEO_VP9_LEVEL_5_1, .profile =3D V4L2_MPEG_VIDEO_VP9_PROFILE_2, + .prob_size =3D VP9_PROB_BUF_SIZE, }, }; =20 @@ -959,6 +964,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = =3D { .vp9_params =3D { .level =3D V4L2_MPEG_VIDEO_VP9_LEVEL_5_1, .profile =3D V4L2_MPEG_VIDEO_VP9_PROFILE_2, + .prob_size =3D VP9_PROB_BUF_SIZE, }, }; =20 @@ -977,6 +983,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = =3D { .vp9_params =3D { .level =3D V4L2_MPEG_VIDEO_VP9_LEVEL_5_1, .profile =3D V4L2_MPEG_VIDEO_VP9_PROFILE_1, + .prob_size =3D VP9_PROB_BUF_SIZE, }, }; =20 @@ -995,6 +1002,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = =3D { .vp9_params =3D { .level =3D V4L2_MPEG_VIDEO_VP9_LEVEL_5_2, .profile =3D V4L2_MPEG_VIDEO_VP9_PROFILE_2, + .prob_size =3D VP9_4K_PROB_BUF_SIZE, }, }; =20 @@ -1030,5 +1038,6 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata= =3D { .vp9_params =3D { .level =3D V4L2_MPEG_VIDEO_VP9_LEVEL_4_1, .profile =3D V4L2_MPEG_VIDEO_VP9_PROFILE_1, + .prob_size =3D VP9_PROB_BUF_SIZE, }, }; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_r= eq_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_= req_lat_if.c index 08d10b3578ae..6123666ce1d5 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_= if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_= if.c @@ -22,7 +22,6 @@ #define VP9_RESET_FRAME_CONTEXT_ALL 3 =20 #define VP9_TILE_BUF_SIZE 4096 -#define VP9_PROB_BUF_SIZE 2560 #define VP9_COUNTS_BUF_SIZE 16384 =20 #define HDR_FLAG(x) (!!((hdr)->flags & V4L2_VP9_FRAME_FLAG_##x)) @@ -552,6 +551,7 @@ static int vdec_vp9_slice_alloc_working_buffer(struct v= dec_vp9_slice_instance *i struct vdec_vp9_slice_vsi *vsi) { struct mtk_vcodec_dec_ctx *ctx =3D instance->ctx; + struct mtk_vcodec_dec_dev *pdev =3D ctx->dev; enum vdec_vp9_slice_resolution_level level; /* super blocks */ unsigned int max_sb_w; @@ -622,7 +622,7 @@ static int vdec_vp9_slice_alloc_working_buffer(struct v= dec_vp9_slice_instance *i } =20 if (!instance->prob.va) { - instance->prob.size =3D VP9_PROB_BUF_SIZE; + instance->prob.size =3D pdev->vdec_pdata->vp9_params.prob_size; if (mtk_vcodec_mem_alloc(ctx, &instance->prob)) goto err; } --=20 2.45.2