public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 00/10] Enable video decoder & encoder for MT8189
@ 2026-01-27  2:42 Kyrie Wu
  2026-01-27  2:42 ` [PATCH v7 01/10] dt-bindings: media: mediatek: decoder: Add MT8189 mediatek,vcodec-decoder Kyrie Wu
                   ` (9 more replies)
  0 siblings, 10 replies; 32+ messages in thread
From: Kyrie Wu @ 2026-01-27  2:42 UTC (permalink / raw)
  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, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

This series have the follow changing:
Firstly add mt8189 video decoder compatible, profile and level to support
MT8189 kernel driver.
Secondly fix some bugs, including vp 4K profile2 and media device node
number bug.
Lastly, add mt8189 video encoder compatible.

This series has been tested with MT8189 tast test.
Encoding and decoding worked for this chip.

Patches 1-3 Add decoder compatible.
Patches 4-5 Add profile and level supporting.
Patches 6 Add VP9 4K probability size supporting.
Patches 7-8 fix some bugs.
Patches 9-10 Adds encoder compatible.

---
H264 test results:
./fluster.py run -d GStreamer-H.264-V4L2SL-Gst1.0 -j2 -t 90
    JVT-AVC_V1	Ran 96/135 tests successfully

VP9 test results:
./fluster.py run -d GStreamer-VP9-V4L2SL-Gst1.0 -j2 -t 90
	VP9-TEST-VECTORS	Ran 276/305 tests successfully

v4l2-compliance test results:
Compliance test for mtk-vcodec-enc device /dev/video2:
Total for mtk-vcodec-enc device /dev/video2: 47, Succeeded: 46, Failed: 1, Warnings: 0
Compliance test for mtk-vcodec-dec device /dev/video3:
Total for mtk-vcodec-dec device /dev/video3: 48, Succeeded: 48, Failed: 0, Warnings: 0

scp upstream link:
https://patchwork.kernel.org/project/linux-mediatek/patch/20250811015922.32680-1-huayu.zong@mediatek.com/
dtsi upstream link:
https://lore.kernel.org/linux-mediatek/20251030134541.784011-12-jh.hsu@mediatek.com/T/#m847e35de0a5b18fac0ca0624a8559d84964ad5c7

Changes compared with v6:
--refactor the patches of set compatible data, profile and level
--add reviewer to commit messages
--fix commit message errors

Changes compared with v5:
--move default decoder parameters to compatible data structure
--add reviewer to commit messages
--Rebased on top of the latest media tree

Changes compared with v4:
--update H264 & vp9 fluster test results
--update vp9 single core decoder prob size setting and commit messages

Changes compared with v3:
--add reviewer to commit messages
--Rebased on top of the latest media tree

Changes compared with v2:
--add H264 fluster test results
--reorder compatible string for dt-bindings

Changes compared with v1:
--add v4l2-compliance test results
--add scp upstream link
--add HW difference discriptions for dt-bindings commit messages

This series patches dependent on:
[1]
https://patchwork.linuxtv.org/project/linux-media/cover/20250510075357.11761-1-yunfei.dong@mediatek.com/
[2]
https://patchwork.linuxtv.org/project/linux-media/cover/20250814085642.17343-1-kyrie.wu@mediatek.com/

Kyrie Wu (10):
  dt-bindings: media: mediatek: decoder: Add MT8189
    mediatek,vcodec-decoder
  media: mediatek: decoder: Add a new platform data member
  media: mediatek: vcodec: add decoder compatible to support MT8189
  media: mediatek: vcodec: Refactor Decoder profile & level Handling
  media: mediatek: vcodec: Add Decoder profile & level Initialization
  media: mediatek: vcodec: Add VP9 Probability Size Configuration
  media: mediatek: vcodec: Fix vp9 4096x2176 fail for profile2
  media: mediatek: vcodec: Fix media device node number
  dt-bindings: media: Add MT8189 mediatek,vcodec-encoder
  media: mediatek: encoder: Add MT8189 encoder compatible data

 .../media/mediatek,vcodec-encoder.yaml        |   2 +
 .../media/mediatek,vcodec-subdev-decoder.yaml |   5 +-
 .../mediatek/vcodec/decoder/mtk_vcodec_dec.h  |   6 +
 .../vcodec/decoder/mtk_vcodec_dec_drv.c       |  42 +--
 .../vcodec/decoder/mtk_vcodec_dec_drv.h       |  33 ++-
 .../vcodec/decoder/mtk_vcodec_dec_hw.c        |   2 +-
 .../vcodec/decoder/mtk_vcodec_dec_stateful.c  |  14 +
 .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 251 ++++++++++++------
 .../vcodec/decoder/vdec/vdec_vp9_req_lat_if.c |  14 +-
 .../vcodec/encoder/mtk_vcodec_enc_drv.c       |  14 +
 10 files changed, 261 insertions(+), 122 deletions(-)

-- 
2.45.2


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH v7 01/10] dt-bindings: media: mediatek: decoder: Add MT8189 mediatek,vcodec-decoder
  2026-01-27  2:42 [PATCH v7 00/10] Enable video decoder & encoder for MT8189 Kyrie Wu
@ 2026-01-27  2:42 ` Kyrie Wu
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
  2026-03-19 17:51   ` Nicolas Dufresne
  2026-01-27  2:42 ` [PATCH v7 02/10] media: mediatek: decoder: Add a new platform data member Kyrie Wu
                   ` (8 subsequent siblings)
  9 siblings, 2 replies; 32+ messages in thread
From: Kyrie Wu @ 2026-01-27  2:42 UTC (permalink / raw)
  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, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

Add compatible for video decoder on MT8189 platform. Compared with
former ICs, the MT8189 decoder use iommu to instead of smmu, and
use scp architecture, the frequency is only 406MHZ, and cannot reach
more than 700MHZ. It used only one clock. At the same time, the decoder
supports the vp9 decoding protocol for the first time in single IC.

Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
---
 .../bindings/media/mediatek,vcodec-subdev-decoder.yaml       | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
index 74e1d88d3056..ee2bbbdb2d50 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
@@ -75,6 +75,7 @@ properties:
       - mediatek,mt8192-vcodec-dec
       - mediatek,mt8186-vcodec-dec
       - mediatek,mt8188-vcodec-dec
+      - mediatek,mt8189-vcodec-dec
       - mediatek,mt8195-vcodec-dec
       - mediatek,mt8196-vcodec-dec
 
@@ -132,11 +133,11 @@ patternProperties:
           Refer to bindings/iommu/mediatek,iommu.yaml.
 
       clocks:
-        minItems: 4
+        minItems: 1
         maxItems: 5
 
       clock-names:
-        minItems: 4
+        minItems: 1
         maxItems: 5
 
       assigned-clocks:
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v7 02/10] media: mediatek: decoder: Add a new platform data member
  2026-01-27  2:42 [PATCH v7 00/10] Enable video decoder & encoder for MT8189 Kyrie Wu
  2026-01-27  2:42 ` [PATCH v7 01/10] dt-bindings: media: mediatek: decoder: Add MT8189 mediatek,vcodec-decoder Kyrie Wu
@ 2026-01-27  2:42 ` Kyrie Wu
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
  2026-03-19 17:56   ` Nicolas Dufresne
  2026-01-27  2:42 ` [PATCH v7 03/10] media: mediatek: vcodec: add decoder compatible to support MT8189 Kyrie Wu
                   ` (7 subsequent siblings)
  9 siblings, 2 replies; 32+ messages in thread
From: Kyrie Wu @ 2026-01-27  2:42 UTC (permalink / raw)
  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, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

Add a new platform data member to indicate each decoder IC
to avoid the chip name definition keep growing.

Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
---
 .../mediatek/vcodec/decoder/mtk_vcodec_dec.h  |  5 +
 .../vcodec/decoder/mtk_vcodec_dec_drv.c       | 35 ++-----
 .../vcodec/decoder/mtk_vcodec_dec_drv.h       | 15 +--
 .../vcodec/decoder/mtk_vcodec_dec_hw.c        |  2 +-
 .../vcodec/decoder/mtk_vcodec_dec_stateful.c  |  1 +
 .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 92 ++++++++++++++-----
 6 files changed, 86 insertions(+), 64 deletions(-)

diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
index 1af075fc0194..80cb46f1cded 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
@@ -69,6 +69,11 @@ extern const struct v4l2_m2m_ops mtk_vdec_m2m_ops;
 extern const struct media_device_ops mtk_vcodec_media_ops;
 extern const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata;
 extern const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata;
+extern const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata;
+extern const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata;
+extern const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata;
+extern const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata;
+extern const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata;
 extern const struct mtk_vcodec_dec_pdata mtk_lat_sig_core_pdata;
 extern const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata;
 
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
index 7ed40936a0e8..c7af48f684c5 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
@@ -333,24 +333,7 @@ static const struct v4l2_file_operations mtk_vcodec_fops = {
 
 static void mtk_vcodec_dec_get_chip_name(struct mtk_vcodec_dec_dev *vdec_dev)
 {
-	struct device *dev = &vdec_dev->plat_dev->dev;
-
-	if (of_device_is_compatible(dev->of_node, "mediatek,mt8173-vcodec-dec"))
-		vdec_dev->chip_name = MTK_VDEC_MT8173;
-	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8183-vcodec-dec"))
-		vdec_dev->chip_name = MTK_VDEC_MT8183;
-	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8192-vcodec-dec"))
-		vdec_dev->chip_name = MTK_VDEC_MT8192;
-	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8195-vcodec-dec"))
-		vdec_dev->chip_name = MTK_VDEC_MT8195;
-	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8186-vcodec-dec"))
-		vdec_dev->chip_name = MTK_VDEC_MT8186;
-	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8188-vcodec-dec"))
-		vdec_dev->chip_name = MTK_VDEC_MT8188;
-	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8196-vcodec-dec"))
-		vdec_dev->chip_name = MTK_VDEC_MT8196;
-	else
-		vdec_dev->chip_name = MTK_VDEC_INVAL;
+	vdec_dev->chip_name = vdec_dev->vdec_pdata->chip_name;
 }
 
 static int mtk_vcodec_probe(struct platform_device *pdev)
@@ -369,10 +352,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 	dev->plat_dev = pdev;
 
 	mtk_vcodec_dec_get_chip_name(dev);
-	if (dev->chip_name == MTK_VDEC_INVAL) {
-		dev_err(&pdev->dev, "Failed to get decoder chip name");
-		return -EINVAL;
-	}
 
 	dev->vdec_pdata = of_device_get_match_data(&pdev->dev);
 	if (!of_property_read_u32(pdev->dev.of_node, "mediatek,vpu",
@@ -389,7 +368,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 	dma_set_max_seg_size(&pdev->dev, UINT_MAX);
-	if (dev->chip_name == MTK_VDEC_MT8196) {
+	if (dev->chip_name == 8196) {
 		ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36));
 		if (ret) {
 			dev_err(&pdev->dev, "Failed to enable 36-bit DMA: %d\n", ret);
@@ -558,23 +537,23 @@ static const struct of_device_id mtk_vcodec_match[] = {
 	},
 	{
 		.compatible = "mediatek,mt8192-vcodec-dec",
-		.data = &mtk_lat_sig_core_pdata,
+		.data = &mtk_vdec_8192_pdata,
 	},
 	{
 		.compatible = "mediatek,mt8186-vcodec-dec",
-		.data = &mtk_vdec_single_core_pdata,
+		.data = &mtk_vdec_8186_pdata,
 	},
 	{
 		.compatible = "mediatek,mt8195-vcodec-dec",
-		.data = &mtk_lat_sig_core_pdata,
+		.data = &mtk_vdec_8195_pdata,
 	},
 	{
 		.compatible = "mediatek,mt8188-vcodec-dec",
-		.data = &mtk_lat_sig_core_pdata,
+		.data = &mtk_vdec_8188_pdata,
 	},
 	{
 		.compatible = "mediatek,mt8196-vcodec-dec",
-		.data = &mtk_lat_sig_core_pdata,
+		.data = &mtk_vdec_8196_pdata,
 	},
 	{},
 };
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 1cb77619add9..bb293ada6fb2 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
@@ -19,17 +19,6 @@
 #define IS_VDEC_INNER_RACING(capability) ((capability) & MTK_VCODEC_INNER_RACING)
 #define IS_VDEC_SUPPORT_EXT(capability) ((capability) & MTK_VDEC_IS_SUPPORT_EXT)
 
-enum mtk_vcodec_dec_chip_name {
-	MTK_VDEC_INVAL = 0,
-	MTK_VDEC_MT8173 = 8173,
-	MTK_VDEC_MT8183 = 8183,
-	MTK_VDEC_MT8186 = 8186,
-	MTK_VDEC_MT8188 = 8188,
-	MTK_VDEC_MT8192 = 8192,
-	MTK_VDEC_MT8195 = 8195,
-	MTK_VDEC_MT8196 = 8196,
-};
-
 /*
  * enum mtk_vdec_format_types - Structure used to get supported
  *		  format types according to decoder capability
@@ -106,6 +95,7 @@ struct vdec_pic_info {
  *
  * @is_subdev_supported: whether support parent-node architecture(subdev)
  * @uses_stateless_api: whether the decoder uses the stateless API with requests
+ * @chip_name: platforms configuration values
  */
 struct mtk_vcodec_dec_pdata {
 	void (*init_vdec_params)(struct mtk_vcodec_dec_ctx *ctx);
@@ -127,6 +117,7 @@ struct mtk_vcodec_dec_pdata {
 
 	bool is_subdev_supported;
 	bool uses_stateless_api;
+	unsigned int chip_name;
 };
 
 /**
@@ -307,7 +298,7 @@ struct mtk_vcodec_dec_dev {
 	struct mutex dec_racing_info_mutex;
 	struct mtk_vcodec_dbgfs dbgfs;
 
-	enum mtk_vcodec_dec_chip_name chip_name;
+	unsigned int chip_name;
 };
 
 static inline struct mtk_vcodec_dec_ctx *fh_to_dec_ctx(struct v4l2_fh *fh)
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c
index e4e527fe54dc..a926dc14d39d 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c
@@ -76,7 +76,7 @@ static void mtk_vdec_hw_clean_xpc(struct mtk_vdec_hw_dev *dev)
 {
 	u32 val, mask, addr = VDEC_XPC_CLEAN_ADDR;
 
-	if (dev->main_dev->chip_name != MTK_VDEC_MT8196)
+	if (dev->main_dev->chip_name != 8196)
 		return;
 
 	val = dev->hw_idx == MTK_VDEC_LAT0 ? VDEC_XPC_LAT_VAL : VDEC_XPC_CORE_VAL;
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 aa9bdee7a96c..8ddb61670dc6 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
@@ -618,4 +618,5 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata = {
 	.flush_decoder = mtk_vdec_flush_decoder,
 	.is_subdev_supported = false,
 	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
+	.chip_name = 8173,
 };
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 c1cef78471a9..0745bc3ee490 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
@@ -550,16 +550,16 @@ static void mtk_vcodec_dec_fill_h264_level(struct v4l2_ctrl_config *cfg,
 					   struct mtk_vcodec_dec_ctx *ctx)
 {
 	switch (ctx->dev->chip_name) {
-	case MTK_VDEC_MT8192:
-	case MTK_VDEC_MT8188:
+	case 8192:
+	case 8188:
 		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_5_2;
 		break;
-	case MTK_VDEC_MT8195:
-	case MTK_VDEC_MT8196:
+	case 8195:
+	case 8196:
 		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_6_0;
 		break;
-	case MTK_VDEC_MT8183:
-	case MTK_VDEC_MT8186:
+	case 8183:
+	case 8186:
 		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
 		break;
 	default:
@@ -572,9 +572,9 @@ static void mtk_vcodec_dec_fill_h264_profile(struct v4l2_ctrl_config *cfg,
 					     struct mtk_vcodec_dec_ctx *ctx)
 {
 	switch (ctx->dev->chip_name) {
-	case MTK_VDEC_MT8188:
-	case MTK_VDEC_MT8195:
-	case MTK_VDEC_MT8196:
+	case 8188:
+	case 8195:
+	case 8196:
 		cfg->max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10;
 		break;
 	default:
@@ -587,11 +587,11 @@ static void mtk_vcodec_dec_fill_h265_level(struct v4l2_ctrl_config *cfg,
 					   struct mtk_vcodec_dec_ctx *ctx)
 {
 	switch (ctx->dev->chip_name) {
-	case MTK_VDEC_MT8188:
+	case 8188:
 		cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1;
 		break;
-	case MTK_VDEC_MT8195:
-	case MTK_VDEC_MT8196:
+	case 8195:
+	case 8196:
 		cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2;
 		break;
 	default:
@@ -604,9 +604,9 @@ static void mtk_vcodec_dec_fill_h265_profile(struct v4l2_ctrl_config *cfg,
 					     struct mtk_vcodec_dec_ctx *ctx)
 {
 	switch (ctx->dev->chip_name) {
-	case MTK_VDEC_MT8188:
-	case MTK_VDEC_MT8195:
-	case MTK_VDEC_MT8196:
+	case 8188:
+	case 8195:
+	case 8196:
 		cfg->max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10;
 		break;
 	default:
@@ -619,15 +619,15 @@ static void mtk_vcodec_dec_fill_vp9_level(struct v4l2_ctrl_config *cfg,
 					  struct mtk_vcodec_dec_ctx *ctx)
 {
 	switch (ctx->dev->chip_name) {
-	case MTK_VDEC_MT8192:
-	case MTK_VDEC_MT8188:
+	case 8192:
+	case 8188:
 		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1;
 		break;
-	case MTK_VDEC_MT8195:
-	case MTK_VDEC_MT8196:
+	case 8195:
+	case 8196:
 		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2;
 		break;
-	case MTK_VDEC_MT8186:
+	case 8186:
 		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1;
 		break;
 	default:
@@ -640,9 +640,9 @@ static void mtk_vcodec_dec_fill_vp9_profile(struct v4l2_ctrl_config *cfg,
 					    struct mtk_vcodec_dec_ctx *ctx)
 {
 	switch (ctx->dev->chip_name) {
-	case MTK_VDEC_MT8188:
-	case MTK_VDEC_MT8195:
-	case MTK_VDEC_MT8196:
+	case 8188:
+	case 8195:
+	case 8196:
 		cfg->max = V4L2_MPEG_VIDEO_VP9_PROFILE_2;
 		break;
 	default:
@@ -886,6 +886,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata = {
 	.get_cap_buffer = vdec_get_cap_buffer,
 	.is_subdev_supported = false,
 	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
+	.chip_name = 8183,
 };
 
 /* This platform data is used for one lat and one core architecture. */
@@ -906,6 +907,45 @@ const struct mtk_vcodec_dec_pdata mtk_lat_sig_core_pdata = {
 	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
 };
 
+#define MTK_STATELESS_DEC_DATA \
+	.init_vdec_params = mtk_init_vdec_params, \
+	.ctrls_setup = mtk_vcodec_dec_ctrls_setup, \
+	.vdec_vb2_ops = &mtk_vdec_request_vb2_ops, \
+	.vdec_formats = mtk_video_formats, \
+	.num_formats = &num_formats, \
+	.default_out_fmt = &default_out_format, \
+	.default_cap_fmt = &default_cap_format, \
+	.uses_stateless_api = true, \
+	.worker = mtk_vdec_worker, \
+	.flush_decoder = mtk_vdec_flush_decoder, \
+	.cap_to_disp = mtk_vdec_stateless_cap_to_disp, \
+	.get_cap_buffer = vdec_get_cap_buffer, \
+	.is_subdev_supported = true
+
+const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata = {
+	MTK_STATELESS_DEC_DATA,
+	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
+	.chip_name = 8188,
+};
+
+const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
+	MTK_STATELESS_DEC_DATA,
+	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
+	.chip_name = 8192,
+};
+
+const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
+	MTK_STATELESS_DEC_DATA,
+	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
+	.chip_name = 8195,
+};
+
+const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
+	MTK_STATELESS_DEC_DATA,
+	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
+	.chip_name = 8196,
+};
+
 const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata = {
 	.init_vdec_params = mtk_init_vdec_params,
 	.ctrls_setup = mtk_vcodec_dec_ctrls_setup,
@@ -922,3 +962,9 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata = {
 	.is_subdev_supported = true,
 	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
 };
+
+const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata = {
+	MTK_STATELESS_DEC_DATA,
+	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
+	.chip_name = 8186,
+};
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v7 03/10] media: mediatek: vcodec: add decoder compatible to support MT8189
  2026-01-27  2:42 [PATCH v7 00/10] Enable video decoder & encoder for MT8189 Kyrie Wu
  2026-01-27  2:42 ` [PATCH v7 01/10] dt-bindings: media: mediatek: decoder: Add MT8189 mediatek,vcodec-decoder Kyrie Wu
  2026-01-27  2:42 ` [PATCH v7 02/10] media: mediatek: decoder: Add a new platform data member Kyrie Wu
@ 2026-01-27  2:42 ` Kyrie Wu
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
  2026-01-27  2:42 ` [PATCH v7 04/10] media: mediatek: vcodec: Refactor Decoder profile & level Handling Kyrie Wu
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: Kyrie Wu @ 2026-01-27  2:42 UTC (permalink / raw)
  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, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

MT8189 is pure single core architecture. Add its compatible to
initialize platform data.

Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../mediatek/vcodec/decoder/mtk_vcodec_dec.h   |  1 +
 .../vcodec/decoder/mtk_vcodec_dec_drv.c        |  4 ++++
 .../vcodec/decoder/mtk_vcodec_dec_stateless.c  | 18 ++++++++++++++++++
 3 files changed, 23 insertions(+)

diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
index 80cb46f1cded..2bde871c0224 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
@@ -71,6 +71,7 @@ extern const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata;
 extern const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata;
 extern const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata;
 extern const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata;
+extern const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata;
 extern const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata;
 extern const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata;
 extern const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata;
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
index c7af48f684c5..8f52e002a51e 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
@@ -555,6 +555,10 @@ static const struct of_device_id mtk_vcodec_match[] = {
 		.compatible = "mediatek,mt8196-vcodec-dec",
 		.data = &mtk_vdec_8196_pdata,
 	},
+	{
+		.compatible = "mediatek,mt8189-vcodec-dec",
+		.data = &mtk_vdec_8189_pdata,
+	},
 	{},
 };
 
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 0745bc3ee490..aba28d276bdf 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
@@ -968,3 +968,21 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata = {
 	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
 	.chip_name = 8186,
 };
+
+const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
+	.init_vdec_params = mtk_init_vdec_params,
+	.ctrls_setup = mtk_vcodec_dec_ctrls_setup,
+	.vdec_vb2_ops = &mtk_vdec_request_vb2_ops,
+	.vdec_formats = mtk_video_formats,
+	.num_formats = &num_formats,
+	.default_out_fmt = &default_out_format,
+	.default_cap_fmt = &default_cap_format,
+	.uses_stateless_api = true,
+	.worker = mtk_vdec_worker,
+	.flush_decoder = mtk_vdec_flush_decoder,
+	.cap_to_disp = mtk_vdec_stateless_cap_to_disp,
+	.get_cap_buffer = vdec_get_cap_buffer,
+	.is_subdev_supported = true,
+	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
+	.chip_name = 8189,
+};
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v7 04/10] media: mediatek: vcodec: Refactor Decoder profile & level Handling
  2026-01-27  2:42 [PATCH v7 00/10] Enable video decoder & encoder for MT8189 Kyrie Wu
                   ` (2 preceding siblings ...)
  2026-01-27  2:42 ` [PATCH v7 03/10] media: mediatek: vcodec: add decoder compatible to support MT8189 Kyrie Wu
@ 2026-01-27  2:42 ` Kyrie Wu
  2026-03-19 17:58   ` Nicolas Dufresne
  2026-01-27  2:42 ` [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization Kyrie Wu
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: Kyrie Wu @ 2026-01-27  2:42 UTC (permalink / raw)
  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, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

This commit refactors the handling of decoder parameters for H264,
H265, and VP9 codecs by introducing a new structure to standardize
supported level and profile information. By leveraging this changes,
chipset-specific conditional logic in the codec configuration
functions is significantly reduced.

Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../vcodec/decoder/mtk_vcodec_dec_drv.h       | 16 ++++
 .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 93 ++++---------------
 2 files changed, 34 insertions(+), 75 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 bb293ada6fb2..f38b5dc4bb74 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
@@ -76,6 +76,16 @@ struct vdec_pic_info {
 	unsigned int reserved;
 };
 
+/**
+ * struct mtk_vcodec_dec_params - decoder supported parameters
+ * @level: decoder supported vcodec level
+ * @profile: decoder supported vcodec profile
+ */
+struct mtk_vcodec_dec_params {
+	s64 level;
+	s64 profile;
+};
+
 /**
  * struct mtk_vcodec_dec_pdata - compatible data for each IC
  * @init_vdec_params: init vdec params
@@ -96,6 +106,9 @@ struct vdec_pic_info {
  * @is_subdev_supported: whether support parent-node architecture(subdev)
  * @uses_stateless_api: whether the decoder uses the stateless API with requests
  * @chip_name: platforms configuration values
+ * @h264_params: H264 decoder default supported params
+ * @h265_params: H265 decoder default supported params
+ * @vp9_params: VP9 decoder default supported params
  */
 struct mtk_vcodec_dec_pdata {
 	void (*init_vdec_params)(struct mtk_vcodec_dec_ctx *ctx);
@@ -118,6 +131,9 @@ struct mtk_vcodec_dec_pdata {
 	bool is_subdev_supported;
 	bool uses_stateless_api;
 	unsigned int chip_name;
+	struct mtk_vcodec_dec_params h264_params;
+	struct mtk_vcodec_dec_params h265_params;
+	struct mtk_vcodec_dec_params vp9_params;
 };
 
 /**
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 aba28d276bdf..a1f419202a24 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
@@ -549,106 +549,49 @@ static const struct v4l2_ctrl_ops mtk_vcodec_dec_ctrl_ops = {
 static void mtk_vcodec_dec_fill_h264_level(struct v4l2_ctrl_config *cfg,
 					   struct mtk_vcodec_dec_ctx *ctx)
 {
-	switch (ctx->dev->chip_name) {
-	case 8192:
-	case 8188:
-		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_5_2;
-		break;
-	case 8195:
-	case 8196:
-		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_6_0;
-		break;
-	case 8183:
-	case 8186:
-		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
-		break;
-	default:
-		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_4_1;
-		break;
-	}
+	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
+
+	cfg->max = pdev->vdec_pdata->h264_params.level;
 }
 
 static void mtk_vcodec_dec_fill_h264_profile(struct v4l2_ctrl_config *cfg,
 					     struct mtk_vcodec_dec_ctx *ctx)
 {
-	switch (ctx->dev->chip_name) {
-	case 8188:
-	case 8195:
-	case 8196:
-		cfg->max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10;
-		break;
-	default:
-		cfg->max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH;
-		break;
-	}
+	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
+
+	cfg->max = pdev->vdec_pdata->h264_params.profile;
 }
 
 static void mtk_vcodec_dec_fill_h265_level(struct v4l2_ctrl_config *cfg,
 					   struct mtk_vcodec_dec_ctx *ctx)
 {
-	switch (ctx->dev->chip_name) {
-	case 8188:
-		cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1;
-		break;
-	case 8195:
-	case 8196:
-		cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2;
-		break;
-	default:
-		cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_4;
-		break;
-	}
+	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
+
+	cfg->max = pdev->vdec_pdata->h265_params.level;
 }
 
 static void mtk_vcodec_dec_fill_h265_profile(struct v4l2_ctrl_config *cfg,
 					     struct mtk_vcodec_dec_ctx *ctx)
 {
-	switch (ctx->dev->chip_name) {
-	case 8188:
-	case 8195:
-	case 8196:
-		cfg->max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10;
-		break;
-	default:
-		cfg->max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE;
-		break;
-	}
+	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
+
+	cfg->max = pdev->vdec_pdata->h265_params.profile;
 }
 
 static void mtk_vcodec_dec_fill_vp9_level(struct v4l2_ctrl_config *cfg,
 					  struct mtk_vcodec_dec_ctx *ctx)
 {
-	switch (ctx->dev->chip_name) {
-	case 8192:
-	case 8188:
-		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1;
-		break;
-	case 8195:
-	case 8196:
-		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2;
-		break;
-	case 8186:
-		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1;
-		break;
-	default:
-		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0;
-		break;
-	}
+	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
+
+	cfg->max = pdev->vdec_pdata->vp9_params.level;
 }
 
 static void mtk_vcodec_dec_fill_vp9_profile(struct v4l2_ctrl_config *cfg,
 					    struct mtk_vcodec_dec_ctx *ctx)
 {
-	switch (ctx->dev->chip_name) {
-	case 8188:
-	case 8195:
-	case 8196:
-		cfg->max = V4L2_MPEG_VIDEO_VP9_PROFILE_2;
-		break;
-	default:
-		cfg->max = V4L2_MPEG_VIDEO_VP9_PROFILE_1;
-		break;
-	}
+	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
+
+	cfg->max = pdev->vdec_pdata->vp9_params.profile;
 }
 
 static void mtk_vcodec_dec_reset_controls(struct v4l2_ctrl_config *cfg,
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization
  2026-01-27  2:42 [PATCH v7 00/10] Enable video decoder & encoder for MT8189 Kyrie Wu
                   ` (3 preceding siblings ...)
  2026-01-27  2:42 ` [PATCH v7 04/10] media: mediatek: vcodec: Refactor Decoder profile & level Handling Kyrie Wu
@ 2026-01-27  2:42 ` Kyrie Wu
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
  2026-03-19 18:05   ` Nicolas Dufresne
  2026-01-27  2:42 ` [PATCH v7 06/10] media: mediatek: vcodec: Add VP9 Probability Size Configuration Kyrie Wu
                   ` (4 subsequent siblings)
  9 siblings, 2 replies; 32+ messages in thread
From: Kyrie Wu @ 2026-01-27  2:42 UTC (permalink / raw)
  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, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

This commit initializes codec profile & level for VDEC. It sets
default values for H264, H265, and VP9 codecs across multiple
chipset configurations.

Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
---
 .../vcodec/decoder/mtk_vcodec_dec_stateful.c  | 12 +++
 .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 84 +++++++++++++++++++
 2 files changed, 96 insertions(+)

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 8ddb61670dc6..a47906b9d717 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
@@ -619,4 +619,16 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata = {
 	.is_subdev_supported = false,
 	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
 	.chip_name = 8173,
+	.h264_params = {
+		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_1,
+		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
+	},
+	.h265_params = {
+		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
+		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
+	},
+	.vp9_params = {
+		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
+		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
+	},
 };
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 a1f419202a24..b571c4ed3f79 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
@@ -830,6 +830,18 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata = {
 	.is_subdev_supported = false,
 	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
 	.chip_name = 8183,
+	.h264_params = {
+		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
+		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
+	},
+	.h265_params = {
+		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
+		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
+	},
+	.vp9_params = {
+		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
+		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
+	},
 };
 
 /* This platform data is used for one lat and one core architecture. */
@@ -869,24 +881,72 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata = {
 	MTK_STATELESS_DEC_DATA,
 	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
 	.chip_name = 8188,
+	.h264_params = {
+		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
+		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
+	},
+	.h265_params = {
+		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1,
+		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
+	},
+	.vp9_params = {
+		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
+		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
+	},
 };
 
 const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
 	MTK_STATELESS_DEC_DATA,
 	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
 	.chip_name = 8192,
+	.h264_params = {
+		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
+		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
+	},
+	.h265_params = {
+		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
+		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
+	},
+	.vp9_params = {
+		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
+		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
+	},
 };
 
 const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
 	MTK_STATELESS_DEC_DATA,
 	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
 	.chip_name = 8195,
+	.h264_params = {
+		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
+		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
+	},
+	.h265_params = {
+		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
+		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
+	},
+	.vp9_params = {
+		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
+		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
+	},
 };
 
 const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
 	MTK_STATELESS_DEC_DATA,
 	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
 	.chip_name = 8196,
+	.h264_params = {
+		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
+		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
+	},
+	.h265_params = {
+		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
+		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
+	},
+	.vp9_params = {
+		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
+		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
+	},
 };
 
 const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata = {
@@ -910,6 +970,18 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata = {
 	MTK_STATELESS_DEC_DATA,
 	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
 	.chip_name = 8186,
+	.h264_params = {
+		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
+		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
+	},
+	.h265_params = {
+		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
+		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
+	},
+	.vp9_params = {
+		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
+		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
+	},
 };
 
 const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
@@ -928,4 +1000,16 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
 	.is_subdev_supported = true,
 	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
 	.chip_name = 8189,
+	.h264_params = {
+		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
+		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
+	},
+	.h265_params = {
+		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
+		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
+	},
+	.vp9_params = {
+		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
+		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
+	},
 };
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v7 06/10] media: mediatek: vcodec: Add VP9 Probability Size Configuration
  2026-01-27  2:42 [PATCH v7 00/10] Enable video decoder & encoder for MT8189 Kyrie Wu
                   ` (4 preceding siblings ...)
  2026-01-27  2:42 ` [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization Kyrie Wu
@ 2026-01-27  2:42 ` Kyrie Wu
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
  2026-03-19 18:08   ` Nicolas Dufresne
  2026-01-27  2:42 ` [PATCH v7 07/10] media: mediatek: vcodec: Fix vp9 4096x2176 fail for profile2 Kyrie Wu
                   ` (3 subsequent siblings)
  9 siblings, 2 replies; 32+ messages in thread
From: Kyrie Wu @ 2026-01-27  2:42 UTC (permalink / raw)
  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, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

This commit introduces support for configuring the VP9 decoder
probability buffer size. It removes hard-coded values and ensures
chipset-specific buffer sizes are handled dynamically, improving
maintainability and alignment.

Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
---
 .../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 | 10 ++++++++++
 .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c |  4 ++--
 4 files changed, 15 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 f38b5dc4bb74..08cc65054de5 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
@@ -80,10 +80,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;
 };
 
 /**
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 a47906b9d717..99c252e0a2e1 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
@@ -630,5 +630,6 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata = {
 	.vp9_params = {
 		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
 		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
+		.prob_size = 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 b571c4ed3f79..ca39ae3571a3 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.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
@@ -841,6 +844,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata = {
 	.vp9_params = {
 		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
 		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
+		.prob_size = VP9_PROB_BUF_SIZE,
 	},
 };
 
@@ -892,6 +896,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata = {
 	.vp9_params = {
 		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
 		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
+		.prob_size = VP9_PROB_BUF_SIZE,
 	},
 };
 
@@ -910,6 +915,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
 	.vp9_params = {
 		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
 		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
+		.prob_size = VP9_PROB_BUF_SIZE,
 	},
 };
 
@@ -928,6 +934,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
 	.vp9_params = {
 		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
 		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
+		.prob_size = VP9_PROB_BUF_SIZE,
 	},
 };
 
@@ -946,6 +953,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
 	.vp9_params = {
 		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
 		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
+		.prob_size = VP9_4K_PROB_BUF_SIZE,
 	},
 };
 
@@ -981,6 +989,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata = {
 	.vp9_params = {
 		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
 		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
+		.prob_size = VP9_PROB_BUF_SIZE,
 	},
 };
 
@@ -1011,5 +1020,6 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
 	.vp9_params = {
 		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
 		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
+		.prob_size = VP9_4K_PROB_BUF_SIZE,
 	},
 };
diff --git 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
index 82e257bd059f..e8ba99d31e74 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
 
 #define VP9_TILE_BUF_SIZE 4096
-#define VP9_PROB_BUF_SIZE 2560
 #define VP9_COUNTS_BUF_SIZE 16384
 
 #define HDR_FLAG(x) (!!((hdr)->flags & V4L2_VP9_FRAME_FLAG_##x))
@@ -546,6 +545,7 @@ static int vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance *i
 					       struct vdec_vp9_slice_vsi *vsi)
 {
 	struct mtk_vcodec_dec_ctx *ctx = instance->ctx;
+	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
 	enum vdec_vp9_slice_resolution_level level;
 	/* super blocks */
 	unsigned int max_sb_w;
@@ -616,7 +616,7 @@ static int vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance *i
 	}
 
 	if (!instance->prob.va) {
-		instance->prob.size = VP9_PROB_BUF_SIZE;
+		instance->prob.size = pdev->vdec_pdata->vp9_params.prob_size;
 		if (mtk_vcodec_mem_alloc(ctx, &instance->prob))
 			goto err;
 	}
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v7 07/10] media: mediatek: vcodec: Fix vp9 4096x2176 fail for profile2
  2026-01-27  2:42 [PATCH v7 00/10] Enable video decoder & encoder for MT8189 Kyrie Wu
                   ` (5 preceding siblings ...)
  2026-01-27  2:42 ` [PATCH v7 06/10] media: mediatek: vcodec: Add VP9 Probability Size Configuration Kyrie Wu
@ 2026-01-27  2:42 ` Kyrie Wu
  2026-03-19 18:09   ` Nicolas Dufresne
  2026-01-27  2:42 ` [PATCH v7 08/10] media: mediatek: vcodec: Fix media device node number Kyrie Wu
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: Kyrie Wu @ 2026-01-27  2:42 UTC (permalink / raw)
  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, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

The DRAM address of the VP9 decoder tile info buffers may require
as much as 36bits for 4096x2176 resolution. Fold the 4 most significant
bits into the lower (padding) four bits of address.

Fixes: 5d418351ca8f1 ("media: mediatek: vcodec: support stateless VP9 decoding")
Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
 .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 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
index e8ba99d31e74..a958e16eb380 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
@@ -1133,9 +1133,17 @@ static int vdec_vp9_slice_setup_tile_buffer(struct vdec_vp9_slice_instance *inst
 					return -EINVAL;
 			}
 			tiles->size[i][j] = size;
+			/*
+			 * If the system supports 64-bit DMA addresses, the upper 4 bits
+			 * of the address are also encoded into the buffer entry.
+			 * The buffer pointer (tb) is incremented after each entry is written.
+			 */
 			if (tiles->mi_rows[i]) {
 				*tb++ = (size << 3) + ((offset << 3) & 0x7f);
-				*tb++ = pa & ~0xf;
+				*tb = pa & GENMASK(31, 4);
+				if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT))
+					*tb |= (pa >> 32) & GENMASK(3, 0);
+				tb++;
 				*tb++ = (pa << 3) & 0x7f;
 				mi_row = (tiles->mi_rows[i] - 1) & 0x1ff;
 				mi_col = (tiles->mi_cols[j] - 1) & 0x3f;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v7 08/10] media: mediatek: vcodec: Fix media device node number
  2026-01-27  2:42 [PATCH v7 00/10] Enable video decoder & encoder for MT8189 Kyrie Wu
                   ` (6 preceding siblings ...)
  2026-01-27  2:42 ` [PATCH v7 07/10] media: mediatek: vcodec: Fix vp9 4096x2176 fail for profile2 Kyrie Wu
@ 2026-01-27  2:42 ` Kyrie Wu
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
  2026-01-27  2:42 ` [PATCH v7 09/10] dt-bindings: media: Add MT8189 mediatek,vcodec-encoder Kyrie Wu
  2026-01-27  2:42 ` [PATCH v7 10/10] media: mediatek: encoder: Add MT8189 encoder compatible data Kyrie Wu
  9 siblings, 1 reply; 32+ messages in thread
From: Kyrie Wu @ 2026-01-27  2:42 UTC (permalink / raw)
  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, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

change media register device node number to a correct value.
The vfd minor is used to record the number of registered
video device nodes. The mdev_dec.devnode minor counter is
used to record the number of registered media device nodes.

Fixes: 41f03c673cb7b ("media: mediatek: vcodec: replace pr_* with dev_* for v4l2 debug message")
Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
 .../platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c      | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
index 8f52e002a51e..d22ab42e22b6 100644
--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
@@ -495,7 +495,8 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 			goto err_media_reg;
 		}
 
-		dev_dbg(&pdev->dev, "media registered as /dev/media%d", vfd_dec->minor);
+		dev_dbg(&pdev->dev, "media registered as /dev/media%d",
+			dev->mdev_dec.devnode->minor);
 	}
 
 	mtk_vcodec_dbgfs_init(dev, false);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v7 09/10] dt-bindings: media: Add MT8189 mediatek,vcodec-encoder
  2026-01-27  2:42 [PATCH v7 00/10] Enable video decoder & encoder for MT8189 Kyrie Wu
                   ` (7 preceding siblings ...)
  2026-01-27  2:42 ` [PATCH v7 08/10] media: mediatek: vcodec: Fix media device node number Kyrie Wu
@ 2026-01-27  2:42 ` Kyrie Wu
  2026-01-27  2:42 ` [PATCH v7 10/10] media: mediatek: encoder: Add MT8189 encoder compatible data Kyrie Wu
  9 siblings, 0 replies; 32+ messages in thread
From: Kyrie Wu @ 2026-01-27  2:42 UTC (permalink / raw)
  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, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou,
	Krzysztof Kozlowski

Add MT8189 encoder compatible string to distinguish former ICs
MTK's. Compared with MT8196, the maximum resolution of MT8189
encoder is only 4K, and the fps is only 30, which cannot reach
the highest parameter of MT8196: level6.2, 8K@60fps.
Compared with MT8188, the level can only support 5.1, which is less
than 5.2 of MT8188. But the maximum bitrate is 100Mbps, which is twice
that of MT8188. And MT8189 could support NBM mode.

Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../devicetree/bindings/media/mediatek,vcodec-encoder.yaml      | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
index bb4dbf23ccc5..7f355470b63c 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
@@ -22,6 +22,7 @@ properties:
               - mediatek,mt8173-vcodec-enc
               - mediatek,mt8183-vcodec-enc
               - mediatek,mt8188-vcodec-enc
+              - mediatek,mt8189-vcodec-enc
               - mediatek,mt8192-vcodec-enc
               - mediatek,mt8195-vcodec-enc
               - mediatek,mt8196-vcodec-enc
@@ -100,6 +101,7 @@ allOf:
             enum:
               - mediatek,mt8183-vcodec-enc
               - mediatek,mt8188-vcodec-enc
+              - mediatek,mt8189-vcodec-enc
               - mediatek,mt8192-vcodec-enc
               - mediatek,mt8195-vcodec-enc
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v7 10/10] media: mediatek: encoder: Add MT8189 encoder compatible data
  2026-01-27  2:42 [PATCH v7 00/10] Enable video decoder & encoder for MT8189 Kyrie Wu
                   ` (8 preceding siblings ...)
  2026-01-27  2:42 ` [PATCH v7 09/10] dt-bindings: media: Add MT8189 mediatek,vcodec-encoder Kyrie Wu
@ 2026-01-27  2:42 ` Kyrie Wu
  9 siblings, 0 replies; 32+ messages in thread
From: Kyrie Wu @ 2026-01-27  2:42 UTC (permalink / raw)
  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, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

add MT8189 compatible data to initialize platform data for encoder.

Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c
index 86d0ab03f151..5e203caa47d4 100644
--- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c
@@ -469,6 +469,19 @@ static const struct mtk_vcodec_enc_pdata mt8196_pdata = {
 	.set_dma_bit_mask = true,
 };
 
+static const struct mtk_vcodec_enc_pdata mt8189_pdata = {
+	.venc_model_num = 8189,
+	.capture_formats = mtk_video_formats_capture_h264,
+	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264),
+	.output_formats = mtk_video_formats_output,
+	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output),
+	.min_bitrate = 64,
+	.max_bitrate = 100000000,
+	.core_id = VENC_SYS,
+	.uses_common_fw_iface = true,
+	.set_dma_bit_mask = true,
+};
+
 static const struct of_device_id mtk_vcodec_enc_match[] = {
 	{.compatible = "mediatek,mt8173-vcodec-enc",
 			.data = &mt8173_avc_pdata},
@@ -479,6 +492,7 @@ static const struct of_device_id mtk_vcodec_enc_match[] = {
 	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
 	{.compatible = "mediatek,mt8195-vcodec-enc", .data = &mt8195_pdata},
 	{.compatible = "mediatek,mt8196-vcodec-enc", .data = &mt8196_pdata},
+	{.compatible = "mediatek,mt8189-vcodec-enc", .data = &mt8189_pdata},
 	{},
 };
 MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 08/10] media: mediatek: vcodec: Fix media device node number
  2026-01-27  2:42 ` [PATCH v7 08/10] media: mediatek: vcodec: Fix media device node number Kyrie Wu
@ 2026-01-27 12:07   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 32+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-01-27 12:07 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, Hans Verkuil, Nicolas Dufresne,
	Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

Il 27/01/26 03:42, Kyrie Wu ha scritto:
> change media register device node number to a correct value.
> The vfd minor is used to record the number of registered
> video device nodes. The mdev_dec.devnode minor counter is
> used to record the number of registered media device nodes.
> 
> Fixes: 41f03c673cb7b ("media: mediatek: vcodec: replace pr_* with dev_* for v4l2 debug message")
> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 06/10] media: mediatek: vcodec: Add VP9 Probability Size Configuration
  2026-01-27  2:42 ` [PATCH v7 06/10] media: mediatek: vcodec: Add VP9 Probability Size Configuration Kyrie Wu
@ 2026-01-27 12:07   ` AngeloGioacchino Del Regno
  2026-01-28  7:14     ` Kyrie Wu (吴晗)
  2026-03-19 18:08   ` Nicolas Dufresne
  1 sibling, 1 reply; 32+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-01-27 12:07 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, Hans Verkuil, Nicolas Dufresne,
	Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

Il 27/01/26 03:42, Kyrie Wu ha scritto:
> This commit introduces support for configuring the VP9 decoder
> probability buffer size. It removes hard-coded values and ensures
> chipset-specific buffer sizes are handled dynamically, improving
> maintainability and alignment.

Depending on how you see it, the buffer sizes are still static, as those are
defined in const structures and never change during the entire driver life.

Also, never start a commit description with "this commit" - as it's implicit
that you're describing ... this commit.

Moreover, the hardcoded values are not removed - they're just hardcoded in a
different way - as in, they are now hardcoded as a possibly different value
for each decoder.

A better description would be:


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; and
  - VP9_PROB_BUF_SIZE (3840 lines) to newer SoCs (MT8196, MT8189).


After which...
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> 
> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> ---
>   .../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 | 10 ++++++++++
>   .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c |  4 ++--
>   4 files changed, 15 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 f38b5dc4bb74..08cc65054de5 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
> @@ -80,10 +80,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;
>   };
>   
>   /**
> 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 a47906b9d717..99c252e0a2e1 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
> @@ -630,5 +630,6 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata = {
>   	.vp9_params = {
>   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
>   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +		.prob_size = 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 b571c4ed3f79..ca39ae3571a3 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.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
> @@ -841,6 +844,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata = {
>   	.vp9_params = {
>   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
>   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +		.prob_size = VP9_PROB_BUF_SIZE,
>   	},
>   };
>   
> @@ -892,6 +896,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata = {
>   	.vp9_params = {
>   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
>   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +		.prob_size = VP9_PROB_BUF_SIZE,
>   	},
>   };
>   
> @@ -910,6 +915,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
>   	.vp9_params = {
>   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
>   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +		.prob_size = VP9_PROB_BUF_SIZE,
>   	},
>   };
>   
> @@ -928,6 +934,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
>   	.vp9_params = {
>   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +		.prob_size = VP9_PROB_BUF_SIZE,
>   	},
>   };
>   
> @@ -946,6 +953,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
>   	.vp9_params = {
>   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +		.prob_size = VP9_4K_PROB_BUF_SIZE,
>   	},
>   };
>   
> @@ -981,6 +989,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata = {
>   	.vp9_params = {
>   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
>   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +		.prob_size = VP9_PROB_BUF_SIZE,
>   	},
>   };
>   
> @@ -1011,5 +1020,6 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
>   	.vp9_params = {
>   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +		.prob_size = VP9_4K_PROB_BUF_SIZE,
>   	},
>   };
> diff --git 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
> index 82e257bd059f..e8ba99d31e74 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
>   
>   #define VP9_TILE_BUF_SIZE 4096
> -#define VP9_PROB_BUF_SIZE 2560
>   #define VP9_COUNTS_BUF_SIZE 16384
>   
>   #define HDR_FLAG(x) (!!((hdr)->flags & V4L2_VP9_FRAME_FLAG_##x))
> @@ -546,6 +545,7 @@ static int vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance *i
>   					       struct vdec_vp9_slice_vsi *vsi)
>   {
>   	struct mtk_vcodec_dec_ctx *ctx = instance->ctx;
> +	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
>   	enum vdec_vp9_slice_resolution_level level;
>   	/* super blocks */
>   	unsigned int max_sb_w;
> @@ -616,7 +616,7 @@ static int vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance *i
>   	}
>   
>   	if (!instance->prob.va) {
> -		instance->prob.size = VP9_PROB_BUF_SIZE;
> +		instance->prob.size = pdev->vdec_pdata->vp9_params.prob_size;
>   		if (mtk_vcodec_mem_alloc(ctx, &instance->prob))
>   			goto err;
>   	}



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization
  2026-01-27  2:42 ` [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization Kyrie Wu
@ 2026-01-27 12:07   ` AngeloGioacchino Del Regno
  2026-01-28  7:45     ` Kyrie Wu (吴晗)
  2026-03-19 18:05   ` Nicolas Dufresne
  1 sibling, 1 reply; 32+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-01-27 12:07 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, Hans Verkuil, Nicolas Dufresne,
	Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

Il 27/01/26 03:42, Kyrie Wu ha scritto:
> This commit initializes codec profile & level for VDEC. It sets
> default values for H264, H265, and VP9 codecs across multiple
> chipset configurations.
> 

The previous patch "Refactor decoder profile and level handling" will break the
driver if this patch is not also applied at the same time.

The change looks good, but you should squash 05/10 in 04/10, and assign the params
that you're adding here along with the refactoring, so that you get one single
patch that, if applied, doesn't break anything as it doesn't depend on additional
(future, as this is number 5) patch.

Please squash

Cheers,
Angelo

> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> ---
>   .../vcodec/decoder/mtk_vcodec_dec_stateful.c  | 12 +++
>   .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 84 +++++++++++++++++++
>   2 files changed, 96 insertions(+)
> 
> 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 8ddb61670dc6..a47906b9d717 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
> @@ -619,4 +619,16 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata = {
>   	.is_subdev_supported = false,
>   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>   	.chip_name = 8173,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_1,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +	},
>   };
> 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 a1f419202a24..b571c4ed3f79 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> @@ -830,6 +830,18 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata = {
>   	.is_subdev_supported = false,
>   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>   	.chip_name = 8183,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +	},
>   };
>   
>   /* This platform data is used for one lat and one core architecture. */
> @@ -869,24 +881,72 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata = {
>   	MTK_STATELESS_DEC_DATA,
>   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>   	.chip_name = 8188,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +	},
>   };
>   
>   const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
>   	MTK_STATELESS_DEC_DATA,
>   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>   	.chip_name = 8192,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +	},
>   };
>   
>   const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
>   	MTK_STATELESS_DEC_DATA,
>   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>   	.chip_name = 8195,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +	},
>   };
>   
>   const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
>   	MTK_STATELESS_DEC_DATA,
>   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>   	.chip_name = 8196,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +	},
>   };
>   
>   const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata = {
> @@ -910,6 +970,18 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata = {
>   	MTK_STATELESS_DEC_DATA,
>   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>   	.chip_name = 8186,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +	},
>   };
>   
>   const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
> @@ -928,4 +1000,16 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
>   	.is_subdev_supported = true,
>   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>   	.chip_name = 8189,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +	},
>   };



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 01/10] dt-bindings: media: mediatek: decoder: Add MT8189 mediatek,vcodec-decoder
  2026-01-27  2:42 ` [PATCH v7 01/10] dt-bindings: media: mediatek: decoder: Add MT8189 mediatek,vcodec-decoder Kyrie Wu
@ 2026-01-27 12:07   ` AngeloGioacchino Del Regno
  2026-03-19 17:51   ` Nicolas Dufresne
  1 sibling, 0 replies; 32+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-01-27 12:07 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, Hans Verkuil, Nicolas Dufresne,
	Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

Il 27/01/26 03:42, Kyrie Wu ha scritto:
> Add compatible for video decoder on MT8189 platform. Compared with
> former ICs, the MT8189 decoder use iommu to instead of smmu, and
> use scp architecture, the frequency is only 406MHZ, and cannot reach
> more than 700MHZ. It used only one clock. At the same time, the decoder
> supports the vp9 decoding protocol for the first time in single IC.
> 
> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> Acked-by: Rob Herring (Arm) <robh@kernel.org>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 03/10] media: mediatek: vcodec: add decoder compatible to support MT8189
  2026-01-27  2:42 ` [PATCH v7 03/10] media: mediatek: vcodec: add decoder compatible to support MT8189 Kyrie Wu
@ 2026-01-27 12:07   ` AngeloGioacchino Del Regno
  2026-01-28  7:16     ` Kyrie Wu (吴晗)
  0 siblings, 1 reply; 32+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-01-27 12:07 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, Hans Verkuil, Nicolas Dufresne,
	Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

Il 27/01/26 03:42, Kyrie Wu ha scritto:
> MT8189 is pure single core architecture. Add its compatible to
> initialize platform data.
> 
> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>   .../mediatek/vcodec/decoder/mtk_vcodec_dec.h   |  1 +
>   .../vcodec/decoder/mtk_vcodec_dec_drv.c        |  4 ++++
>   .../vcodec/decoder/mtk_vcodec_dec_stateless.c  | 18 ++++++++++++++++++
>   3 files changed, 23 insertions(+)
> 
> diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> index 80cb46f1cded..2bde871c0224 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> @@ -71,6 +71,7 @@ extern const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata;
>   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata;
>   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata;
>   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata;
> +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata;
>   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata;
>   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata;
>   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata;
> diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> index c7af48f684c5..8f52e002a51e 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> @@ -555,6 +555,10 @@ static const struct of_device_id mtk_vcodec_match[] = {
>   		.compatible = "mediatek,mt8196-vcodec-dec",
>   		.data = &mtk_vdec_8196_pdata,
>   	},
> +	{
> +		.compatible = "mediatek,mt8189-vcodec-dec",
> +		.data = &mtk_vdec_8189_pdata,
> +	},
>   	{},
>   };
>   
> 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 0745bc3ee490..aba28d276bdf 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> @@ -968,3 +968,21 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata = {
>   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>   	.chip_name = 8186,
>   };
> +
> +const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
> +	.init_vdec_params = mtk_init_vdec_params,
> +	.ctrls_setup = mtk_vcodec_dec_ctrls_setup,
> +	.vdec_vb2_ops = &mtk_vdec_request_vb2_ops,
> +	.vdec_formats = mtk_video_formats,
> +	.num_formats = &num_formats,
> +	.default_out_fmt = &default_out_format,
> +	.default_cap_fmt = &default_cap_format,
> +	.uses_stateless_api = true,
> +	.worker = mtk_vdec_worker,
> +	.flush_decoder = mtk_vdec_flush_decoder,
> +	.cap_to_disp = mtk_vdec_stateless_cap_to_disp,
> +	.get_cap_buffer = vdec_get_cap_buffer,
> +	.is_subdev_supported = true,

You introduced `MTK_STATELESS_DEC_DATA` in the previous patch... and you should
use it here too.

Cheers,
Angelo

> +	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> +	.chip_name = 8189,
> +};


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 02/10] media: mediatek: decoder: Add a new platform data member
  2026-01-27  2:42 ` [PATCH v7 02/10] media: mediatek: decoder: Add a new platform data member Kyrie Wu
@ 2026-01-27 12:07   ` AngeloGioacchino Del Regno
  2026-01-28  7:18     ` Kyrie Wu (吴晗)
  2026-03-19 17:56   ` Nicolas Dufresne
  1 sibling, 1 reply; 32+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-01-27 12:07 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, Hans Verkuil, Nicolas Dufresne,
	Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

Il 27/01/26 03:42, Kyrie Wu ha scritto:
> Add a new platform data member to indicate each decoder IC
> to avoid the chip name definition keep growing.
> 
> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> ---
>   .../mediatek/vcodec/decoder/mtk_vcodec_dec.h  |  5 +
>   .../vcodec/decoder/mtk_vcodec_dec_drv.c       | 35 ++-----
>   .../vcodec/decoder/mtk_vcodec_dec_drv.h       | 15 +--
>   .../vcodec/decoder/mtk_vcodec_dec_hw.c        |  2 +-
>   .../vcodec/decoder/mtk_vcodec_dec_stateful.c  |  1 +
>   .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 92 ++++++++++++++-----
>   6 files changed, 86 insertions(+), 64 deletions(-)
> 
> diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> index 1af075fc0194..80cb46f1cded 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> @@ -69,6 +69,11 @@ extern const struct v4l2_m2m_ops mtk_vdec_m2m_ops;
>   extern const struct media_device_ops mtk_vcodec_media_ops;
>   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata;
>   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata;
> +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata;
> +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata;
> +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata;
> +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata;
> +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata;
>   extern const struct mtk_vcodec_dec_pdata mtk_lat_sig_core_pdata;
>   extern const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata;
>   
> diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> index 7ed40936a0e8..c7af48f684c5 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> @@ -333,24 +333,7 @@ static const struct v4l2_file_operations mtk_vcodec_fops = {
>   
>   static void mtk_vcodec_dec_get_chip_name(struct mtk_vcodec_dec_dev *vdec_dev)
>   {
> -	struct device *dev = &vdec_dev->plat_dev->dev;
> -
> -	if (of_device_is_compatible(dev->of_node, "mediatek,mt8173-vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8173;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8183-vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8183;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8192-vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8192;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8195-vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8195;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8186-vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8186;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8188-vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8188;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8196-vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8196;
> -	else
> -		vdec_dev->chip_name = MTK_VDEC_INVAL;
> +	vdec_dev->chip_name = vdec_dev->vdec_pdata->chip_name;

While at it, can you please rename `chip_name` to `chip_model`?

"name" makes me (if it's just me, nevermind) always think about a string, not about
an (unsigned) integer number.

In any case, you can already get my

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

...because that was just a nitpick, anyway.

Cheers,
Angelo

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 06/10] media: mediatek: vcodec: Add VP9 Probability Size Configuration
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
@ 2026-01-28  7:14     ` Kyrie Wu (吴晗)
  0 siblings, 0 replies; 32+ messages in thread
From: Kyrie Wu (吴晗) @ 2026-01-28  7:14 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	George Sun (孙林),
	Tiffany Lin (林慧珊), nhebert@chromium.org,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	mchehab@kernel.org, hverkuil@xs4all.nl,
	nicolas.dufresne@collabora.com, Kyrie Wu (吴晗),
	Yunfei Dong (董云飞), conor+dt@kernel.org,
	Irui Wang (王瑞), robh@kernel.org,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, arnd@arndb.de,
	Andrew-CT Chen (陳智迪),
	AngeloGioacchino Del Regno
  Cc: andrzejtp2010@gmail.com, neil.armstrong@linaro.org,
	Yilong Zhou (周易龙)

On Tue, 2026-01-27 at 13:07 +0100, AngeloGioacchino Del Regno wrote:
> Il 27/01/26 03:42, Kyrie Wu ha scritto:
> > This commit introduces support for configuring the VP9 decoder
> > probability buffer size. It removes hard-coded values and ensures
> > chipset-specific buffer sizes are handled dynamically, improving
> > maintainability and alignment.
> 
> Depending on how you see it, the buffer sizes are still static, as
> those are
> defined in const structures and never change during the entire driver
> life.
> 
> Also, never start a commit description with "this commit" - as it's
> implicit
> that you're describing ... this commit.
> 
> Moreover, the hardcoded values are not removed - they're just
> hardcoded in a
> different way - as in, they are now hardcoded as a possibly different
> value
> for each decoder.
> 
> A better description would be:
> 
> 
> 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; and
>   - VP9_PROB_BUF_SIZE (3840 lines) to newer SoCs (MT8196, MT8189).
> 
> 
> After which...
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>

Dear Angelo,

Thanks for your suggestion, I will upgrade this patch
in the next version.

Thanks a lot.

Regards,
Kyrie.
> 
> > 
> > Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> > ---
> >   .../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 | 10
> > ++++++++++
> >   .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c |  4 ++--
> >   4 files changed, 15 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 f38b5dc4bb74..08cc65054de5 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
> > @@ -80,10 +80,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;
> >   };
> >   
> >   /**
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teful.c
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teful.c
> > index a47906b9d717..99c252e0a2e1 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teful.c
> > +++
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teful.c
> > @@ -630,5 +630,6 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8173_pdata = {
> >   	.vp9_params = {
> >   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> >   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > +		.prob_size = 2560,
> >   	},
> >   };
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.c
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.c
> > index b571c4ed3f79..ca39ae3571a3 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.c
> > +++
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.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
> > @@ -841,6 +844,7 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8183_pdata = {
> >   	.vp9_params = {
> >   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> >   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > +		.prob_size = VP9_PROB_BUF_SIZE,
> >   	},
> >   };
> >   
> > @@ -892,6 +896,7 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8188_pdata = {
> >   	.vp9_params = {
> >   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> >   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > +		.prob_size = VP9_PROB_BUF_SIZE,
> >   	},
> >   };
> >   
> > @@ -910,6 +915,7 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8192_pdata = {
> >   	.vp9_params = {
> >   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> >   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > +		.prob_size = VP9_PROB_BUF_SIZE,
> >   	},
> >   };
> >   
> > @@ -928,6 +934,7 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8195_pdata = {
> >   	.vp9_params = {
> >   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> >   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > +		.prob_size = VP9_PROB_BUF_SIZE,
> >   	},
> >   };
> >   
> > @@ -946,6 +953,7 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8196_pdata = {
> >   	.vp9_params = {
> >   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> >   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > +		.prob_size = VP9_4K_PROB_BUF_SIZE,
> >   	},
> >   };
> >   
> > @@ -981,6 +989,7 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8186_pdata = {
> >   	.vp9_params = {
> >   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
> >   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > +		.prob_size = VP9_PROB_BUF_SIZE,
> >   	},
> >   };
> >   
> > @@ -1011,5 +1020,6 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8189_pdata = {
> >   	.vp9_params = {
> >   		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> >   		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > +		.prob_size = VP9_4K_PROB_BUF_SIZE,
> >   	},
> >   };
> > diff --git
> > 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
> > index 82e257bd059f..e8ba99d31e74 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
> >   
> >   #define VP9_TILE_BUF_SIZE 4096
> > -#define VP9_PROB_BUF_SIZE 2560
> >   #define VP9_COUNTS_BUF_SIZE 16384
> >   
> >   #define HDR_FLAG(x) (!!((hdr)->flags & V4L2_VP9_FRAME_FLAG_##x))
> > @@ -546,6 +545,7 @@ static int
> > vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance
> > *i
> >   					       struct
> > vdec_vp9_slice_vsi *vsi)
> >   {
> >   	struct mtk_vcodec_dec_ctx *ctx = instance->ctx;
> > +	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
> >   	enum vdec_vp9_slice_resolution_level level;
> >   	/* super blocks */
> >   	unsigned int max_sb_w;
> > @@ -616,7 +616,7 @@ static int
> > vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance
> > *i
> >   	}
> >   
> >   	if (!instance->prob.va) {
> > -		instance->prob.size = VP9_PROB_BUF_SIZE;
> > +		instance->prob.size = pdev->vdec_pdata-
> > >vp9_params.prob_size;
> >   		if (mtk_vcodec_mem_alloc(ctx, &instance->prob))
> >   			goto err;
> >   	}
> 
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 03/10] media: mediatek: vcodec: add decoder compatible to support MT8189
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
@ 2026-01-28  7:16     ` Kyrie Wu (吴晗)
  0 siblings, 0 replies; 32+ messages in thread
From: Kyrie Wu (吴晗) @ 2026-01-28  7:16 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, yunfei.dong@mediatek.co,
	George Sun (孙林),
	Tiffany Lin (林慧珊), nhebert@chromium.org,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-mediatek@lists.infradead.org, mchehab@kernel.org,
	hverkuil@xs4all.nl, nicolas.dufresne@collabora.com,
	Kyrie Wu (吴晗), conor+dt@kernel.org,
	Irui Wang (王瑞), robh@kernel.org,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, arnd@arndb.de,
	Andrew-CT Chen (陳智迪),
	AngeloGioacchino Del Regno
  Cc: andrzejtp2010@gmail.com, neil.armstrong@linaro.org,
	Yilong Zhou (周易龙)

On Tue, 2026-01-27 at 13:07 +0100, AngeloGioacchino Del Regno wrote:
> Il 27/01/26 03:42, Kyrie Wu ha scritto:
> > MT8189 is pure single core architecture. Add its compatible to
> > initialize platform data.
> > 
> > Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> > Reviewed-by: AngeloGioacchino Del Regno <
> > angelogioacchino.delregno@collabora.com>
> > ---
> >   .../mediatek/vcodec/decoder/mtk_vcodec_dec.h   |  1 +
> >   .../vcodec/decoder/mtk_vcodec_dec_drv.c        |  4 ++++
> >   .../vcodec/decoder/mtk_vcodec_dec_stateless.c  | 18
> > ++++++++++++++++++
> >   3 files changed, 23 insertions(+)
> > 
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> > index 80cb46f1cded..2bde871c0224 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> > +++
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> > @@ -71,6 +71,7 @@ extern const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8173_pdata;
> >   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata;
> >   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata;
> >   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata;
> > +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata;
> >   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata;
> >   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata;
> >   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata;
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv
> > .c
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv
> > .c
> > index c7af48f684c5..8f52e002a51e 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv
> > .c
> > +++
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv
> > .c
> > @@ -555,6 +555,10 @@ static const struct of_device_id
> > mtk_vcodec_match[] = {
> >   		.compatible = "mediatek,mt8196-vcodec-dec",
> >   		.data = &mtk_vdec_8196_pdata,
> >   	},
> > +	{
> > +		.compatible = "mediatek,mt8189-vcodec-dec",
> > +		.data = &mtk_vdec_8189_pdata,
> > +	},
> >   	{},
> >   };
> >   
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.c
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.c
> > index 0745bc3ee490..aba28d276bdf 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.c
> > +++
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.c
> > @@ -968,3 +968,21 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8186_pdata = {
> >   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> >   	.chip_name = 8186,
> >   };
> > +
> > +const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
> > +	.init_vdec_params = mtk_init_vdec_params,
> > +	.ctrls_setup = mtk_vcodec_dec_ctrls_setup,
> > +	.vdec_vb2_ops = &mtk_vdec_request_vb2_ops,
> > +	.vdec_formats = mtk_video_formats,
> > +	.num_formats = &num_formats,
> > +	.default_out_fmt = &default_out_format,
> > +	.default_cap_fmt = &default_cap_format,
> > +	.uses_stateless_api = true,
> > +	.worker = mtk_vdec_worker,
> > +	.flush_decoder = mtk_vdec_flush_decoder,
> > +	.cap_to_disp = mtk_vdec_stateless_cap_to_disp,
> > +	.get_cap_buffer = vdec_get_cap_buffer,
> > +	.is_subdev_supported = true,
> 
> You introduced `MTK_STATELESS_DEC_DATA` in the previous patch... and
> you should
> use it here too.
> 
> Cheers,
> Angelo
> 
Dear Angelo,

sorry for the mistake, I will fix it.

Thanks.

Regards,
Kyrie.

> > +	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > +	.chip_name = 8189,
> > +};
> 
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 02/10] media: mediatek: decoder: Add a new platform data member
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
@ 2026-01-28  7:18     ` Kyrie Wu (吴晗)
  0 siblings, 0 replies; 32+ messages in thread
From: Kyrie Wu (吴晗) @ 2026-01-28  7:18 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	George Sun (孙林),
	Tiffany Lin (林慧珊), nhebert@chromium.org,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	mchehab@kernel.org, hverkuil@xs4all.nl,
	nicolas.dufresne@collabora.com, Kyrie Wu (吴晗),
	Yunfei Dong (董云飞), conor+dt@kernel.org,
	Irui Wang (王瑞), robh@kernel.org,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, arnd@arndb.de,
	Andrew-CT Chen (陳智迪),
	AngeloGioacchino Del Regno
  Cc: andrzejtp2010@gmail.com, neil.armstrong@linaro.org,
	Yilong Zhou (周易龙)

On Tue, 2026-01-27 at 13:07 +0100, AngeloGioacchino Del Regno wrote:
> Il 27/01/26 03:42, Kyrie Wu ha scritto:
> > Add a new platform data member to indicate each decoder IC
> > to avoid the chip name definition keep growing.
> > 
> > Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> > ---
> >   .../mediatek/vcodec/decoder/mtk_vcodec_dec.h  |  5 +
> >   .../vcodec/decoder/mtk_vcodec_dec_drv.c       | 35 ++-----
> >   .../vcodec/decoder/mtk_vcodec_dec_drv.h       | 15 +--
> >   .../vcodec/decoder/mtk_vcodec_dec_hw.c        |  2 +-
> >   .../vcodec/decoder/mtk_vcodec_dec_stateful.c  |  1 +
> >   .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 92
> > ++++++++++++++-----
> >   6 files changed, 86 insertions(+), 64 deletions(-)
> > 
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> > index 1af075fc0194..80cb46f1cded 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> > +++
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> > @@ -69,6 +69,11 @@ extern const struct v4l2_m2m_ops
> > mtk_vdec_m2m_ops;
> >   extern const struct media_device_ops mtk_vcodec_media_ops;
> >   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata;
> >   extern const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata;
> > +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata;
> > +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata;
> > +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata;
> > +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata;
> > +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata;
> >   extern const struct mtk_vcodec_dec_pdata mtk_lat_sig_core_pdata;
> >   extern const struct mtk_vcodec_dec_pdata
> > mtk_vdec_single_core_pdata;
> >   
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv
> > .c
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv
> > .c
> > index 7ed40936a0e8..c7af48f684c5 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv
> > .c
> > +++
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv
> > .c
> > @@ -333,24 +333,7 @@ static const struct v4l2_file_operations
> > mtk_vcodec_fops = {
> >   
> >   static void mtk_vcodec_dec_get_chip_name(struct
> > mtk_vcodec_dec_dev *vdec_dev)
> >   {
> > -	struct device *dev = &vdec_dev->plat_dev->dev;
> > -
> > -	if (of_device_is_compatible(dev->of_node, "mediatek,mt8173-
> > vcodec-dec"))
> > -		vdec_dev->chip_name = MTK_VDEC_MT8173;
> > -	else if (of_device_is_compatible(dev->of_node,
> > "mediatek,mt8183-vcodec-dec"))
> > -		vdec_dev->chip_name = MTK_VDEC_MT8183;
> > -	else if (of_device_is_compatible(dev->of_node,
> > "mediatek,mt8192-vcodec-dec"))
> > -		vdec_dev->chip_name = MTK_VDEC_MT8192;
> > -	else if (of_device_is_compatible(dev->of_node,
> > "mediatek,mt8195-vcodec-dec"))
> > -		vdec_dev->chip_name = MTK_VDEC_MT8195;
> > -	else if (of_device_is_compatible(dev->of_node,
> > "mediatek,mt8186-vcodec-dec"))
> > -		vdec_dev->chip_name = MTK_VDEC_MT8186;
> > -	else if (of_device_is_compatible(dev->of_node,
> > "mediatek,mt8188-vcodec-dec"))
> > -		vdec_dev->chip_name = MTK_VDEC_MT8188;
> > -	else if (of_device_is_compatible(dev->of_node,
> > "mediatek,mt8196-vcodec-dec"))
> > -		vdec_dev->chip_name = MTK_VDEC_MT8196;
> > -	else
> > -		vdec_dev->chip_name = MTK_VDEC_INVAL;
> > +	vdec_dev->chip_name = vdec_dev->vdec_pdata->chip_name;
> 
> While at it, can you please rename `chip_name` to `chip_model`?
> 
> "name" makes me (if it's just me, nevermind) always think about a
> string, not about
> an (unsigned) integer number.
> 
> In any case, you can already get my
> 
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
> 
> ...because that was just a nitpick, anyway.
> 
> Cheers,
> Angelo
Dear Angelo,

Thanks for above suggestion, I will change it.

Regards,
Kyrie.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
@ 2026-01-28  7:45     ` Kyrie Wu (吴晗)
  2026-01-28  9:53       ` AngeloGioacchino Del Regno
  2026-01-28 13:34       ` Nicolas Dufresne
  0 siblings, 2 replies; 32+ messages in thread
From: Kyrie Wu (吴晗) @ 2026-01-28  7:45 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	George Sun (孙林),
	Tiffany Lin (林慧珊), nhebert@chromium.org,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	mchehab@kernel.org, hverkuil@xs4all.nl,
	nicolas.dufresne@collabora.com, Kyrie Wu (吴晗),
	Yunfei Dong (董云飞), conor+dt@kernel.org,
	Irui Wang (王瑞), robh@kernel.org,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, arnd@arndb.de,
	Andrew-CT Chen (陳智迪),
	AngeloGioacchino Del Regno
  Cc: andrzejtp2010@gmail.com, neil.armstrong@linaro.org,
	Yilong Zhou (周易龙)

On Tue, 2026-01-27 at 13:07 +0100, AngeloGioacchino Del Regno wrote:
> Il 27/01/26 03:42, Kyrie Wu ha scritto:
> > This commit initializes codec profile & level for VDEC. It sets
> > default values for H264, H265, and VP9 codecs across multiple
> > chipset configurations.
> > 
> 
> The previous patch "Refactor decoder profile and level handling" will
> break the
> driver if this patch is not also applied at the same time.
> 
> The change looks good, but you should squash 05/10 in 04/10, and
> assign the params
> that you're adding here along with the refactoring, so that you get
> one single
> patch that, if applied, doesn't break anything as it doesn't depend
> on additional
> (future, as this is number 5) patch.
> 
> Please squash
> 
> Cheers,
> Angelo

Dear Angelo,

The 04/10 and 05/10 were designed in one patch in v6,
but Nicolas thought that refactor patch and configuration
were two different changes, should separate them in this
comments: 
https://patchwork.linuxtv.org/project/linux-media/patch/20251202074038.3173-5-kyrie.wu@mediatek.com/

In my mind, refactor profile and level setting and assign
former ICs' parameters could merge into same patch. The
configuration of MT8189 should split to another one, because
it is a new setting.

Do you agree with my opinion? I look forward to your further reply.

Thanks.

Regards,
Kyrie.


> 
> > Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> > ---
> >   .../vcodec/decoder/mtk_vcodec_dec_stateful.c  | 12 +++
> >   .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 84
> > +++++++++++++++++++
> >   2 files changed, 96 insertions(+)
> > 
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teful.c
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teful.c
> > index 8ddb61670dc6..a47906b9d717 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teful.c
> > +++
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teful.c
> > @@ -619,4 +619,16 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8173_pdata = {
> >   	.is_subdev_supported = false,
> >   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> >   	.chip_name = 8173,
> > +	.h264_params = {
> > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_1,
> > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > +	},
> > +	.h265_params = {
> > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > +		.profile =
> > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > +	},
> > +	.vp9_params = {
> > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > +	},
> >   };
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.c
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.c
> > index a1f419202a24..b571c4ed3f79 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.c
> > +++
> > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > teless.c
> > @@ -830,6 +830,18 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8183_pdata = {
> >   	.is_subdev_supported = false,
> >   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> >   	.chip_name = 8183,
> > +	.h264_params = {
> > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > +	},
> > +	.h265_params = {
> > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > +		.profile =
> > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > +	},
> > +	.vp9_params = {
> > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > +	},
> >   };
> >   
> >   /* This platform data is used for one lat and one core
> > architecture. */
> > @@ -869,24 +881,72 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8188_pdata = {
> >   	MTK_STATELESS_DEC_DATA,
> >   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> >   	.chip_name = 8188,
> > +	.h264_params = {
> > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > +	},
> > +	.h265_params = {
> > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1,
> > +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > +	},
> > +	.vp9_params = {
> > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > +	},
> >   };
> >   
> >   const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
> >   	MTK_STATELESS_DEC_DATA,
> >   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> >   	.chip_name = 8192,
> > +	.h264_params = {
> > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > +	},
> > +	.h265_params = {
> > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > +		.profile =
> > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > +	},
> > +	.vp9_params = {
> > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > +	},
> >   };
> >   
> >   const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
> >   	MTK_STATELESS_DEC_DATA,
> >   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> >   	.chip_name = 8195,
> > +	.h264_params = {
> > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > +	},
> > +	.h265_params = {
> > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> > +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > +	},
> > +	.vp9_params = {
> > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > +	},
> >   };
> >   
> >   const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
> >   	MTK_STATELESS_DEC_DATA,
> >   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> >   	.chip_name = 8196,
> > +	.h264_params = {
> > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > +	},
> > +	.h265_params = {
> > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> > +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > +	},
> > +	.vp9_params = {
> > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > +	},
> >   };
> >   
> >   const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata = {
> > @@ -910,6 +970,18 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8186_pdata = {
> >   	MTK_STATELESS_DEC_DATA,
> >   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> >   	.chip_name = 8186,
> > +	.h264_params = {
> > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > +	},
> > +	.h265_params = {
> > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > +		.profile =
> > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > +	},
> > +	.vp9_params = {
> > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
> > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > +	},
> >   };
> >   
> >   const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
> > @@ -928,4 +1000,16 @@ const struct mtk_vcodec_dec_pdata
> > mtk_vdec_8189_pdata = {
> >   	.is_subdev_supported = true,
> >   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> >   	.chip_name = 8189,
> > +	.h264_params = {
> > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > +	},
> > +	.h265_params = {
> > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > +		.profile =
> > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > +	},
> > +	.vp9_params = {
> > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > +	},
> >   };
> 
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization
  2026-01-28  7:45     ` Kyrie Wu (吴晗)
@ 2026-01-28  9:53       ` AngeloGioacchino Del Regno
  2026-01-28 13:39         ` Nicolas Dufresne
  2026-01-28 13:34       ` Nicolas Dufresne
  1 sibling, 1 reply; 32+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-01-28  9:53 UTC (permalink / raw)
  To: Kyrie Wu (吴晗), linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org, George Sun (孙林),
	Tiffany Lin (林慧珊), nhebert@chromium.org,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	mchehab@kernel.org, hverkuil@xs4all.nl,
	nicolas.dufresne@collabora.com,
	Yunfei Dong (董云飞), conor+dt@kernel.org,
	Irui Wang (王瑞), robh@kernel.org,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, arnd@arndb.de,
	Andrew-CT Chen (陳智迪)
  Cc: andrzejtp2010@gmail.com, neil.armstrong@linaro.org,
	Yilong Zhou (周易龙)

Il 28/01/26 08:45, Kyrie Wu (吴晗) ha scritto:
> On Tue, 2026-01-27 at 13:07 +0100, AngeloGioacchino Del Regno wrote:
>> Il 27/01/26 03:42, Kyrie Wu ha scritto:
>>> This commit initializes codec profile & level for VDEC. It sets
>>> default values for H264, H265, and VP9 codecs across multiple
>>> chipset configurations.
>>>
>>
>> The previous patch "Refactor decoder profile and level handling" will
>> break the
>> driver if this patch is not also applied at the same time.
>>
>> The change looks good, but you should squash 05/10 in 04/10, and
>> assign the params
>> that you're adding here along with the refactoring, so that you get
>> one single
>> patch that, if applied, doesn't break anything as it doesn't depend
>> on additional
>> (future, as this is number 5) patch.
>>
>> Please squash
>>
>> Cheers,
>> Angelo
> 
> Dear Angelo,
> 
> The 04/10 and 05/10 were designed in one patch in v6,
> but Nicolas thought that refactor patch and configuration
> were two different changes, should separate them in this
> comments:
> https://patchwork.linuxtv.org/project/linux-media/patch/20251202074038.3173-5-kyrie.wu@mediatek.com/

Even though in this case I disagree with Nicolas, I'm the mediatek maintainer,
not a linux-media maintainer... so... let's go with whatever the media
maintainers think it's best.

> 
> In my mind, refactor profile and level setting and assign
> former ICs' parameters could merge into same patch. The
> configuration of MT8189 should split to another one, because
> it is a new setting.
> 
> Do you agree with my opinion? I look forward to your further reply.
> 

I agree with your opinion, but if linux-media maintainers want those two
patches separated as you just did, I will raise my hands, so...

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com

...because when the two patches are applied at the same time, there's no
breakage. But I want to still repeat my stance on this: single patches
should never depend on subsequent patches to avoid regressions (and I know
you agree as your previous version was compliant with that stance).

Cheers,
Angelo

> Thanks.
> 
> Regards,
> Kyrie.
> 
> 
>>
>>> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
>>> ---
>>>    .../vcodec/decoder/mtk_vcodec_dec_stateful.c  | 12 +++
>>>    .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 84
>>> +++++++++++++++++++
>>>    2 files changed, 96 insertions(+)
>>>
>>> diff --git
>>> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>> teful.c
>>> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>> teful.c
>>> index 8ddb61670dc6..a47906b9d717 100644
>>> ---
>>> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>> teful.c
>>> +++
>>> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>> teful.c
>>> @@ -619,4 +619,16 @@ const struct mtk_vcodec_dec_pdata
>>> mtk_vdec_8173_pdata = {
>>>    	.is_subdev_supported = false,
>>>    	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>>>    	.chip_name = 8173,
>>> +	.h264_params = {
>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_1,
>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
>>> +	},
>>> +	.h265_params = {
>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
>>> +		.profile =
>>> V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
>>> +	},
>>> +	.vp9_params = {
>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
>>> +	},
>>>    };
>>> diff --git
>>> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>> teless.c
>>> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>> teless.c
>>> index a1f419202a24..b571c4ed3f79 100644
>>> ---
>>> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>> teless.c
>>> +++
>>> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>> teless.c
>>> @@ -830,6 +830,18 @@ const struct mtk_vcodec_dec_pdata
>>> mtk_vdec_8183_pdata = {
>>>    	.is_subdev_supported = false,
>>>    	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>>>    	.chip_name = 8183,
>>> +	.h264_params = {
>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
>>> +	},
>>> +	.h265_params = {
>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
>>> +		.profile =
>>> V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
>>> +	},
>>> +	.vp9_params = {
>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
>>> +	},
>>>    };
>>>    
>>>    /* This platform data is used for one lat and one core
>>> architecture. */
>>> @@ -869,24 +881,72 @@ const struct mtk_vcodec_dec_pdata
>>> mtk_vdec_8188_pdata = {
>>>    	MTK_STATELESS_DEC_DATA,
>>>    	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>>>    	.chip_name = 8188,
>>> +	.h264_params = {
>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
>>> +	},
>>> +	.h265_params = {
>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1,
>>> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
>>> +	},
>>> +	.vp9_params = {
>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
>>> +	},
>>>    };
>>>    
>>>    const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
>>>    	MTK_STATELESS_DEC_DATA,
>>>    	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>>>    	.chip_name = 8192,
>>> +	.h264_params = {
>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
>>> +	},
>>> +	.h265_params = {
>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
>>> +		.profile =
>>> V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
>>> +	},
>>> +	.vp9_params = {
>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
>>> +	},
>>>    };
>>>    
>>>    const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
>>>    	MTK_STATELESS_DEC_DATA,
>>>    	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>>>    	.chip_name = 8195,
>>> +	.h264_params = {
>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
>>> +	},
>>> +	.h265_params = {
>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
>>> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
>>> +	},
>>> +	.vp9_params = {
>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
>>> +	},
>>>    };
>>>    
>>>    const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
>>>    	MTK_STATELESS_DEC_DATA,
>>>    	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>>>    	.chip_name = 8196,
>>> +	.h264_params = {
>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
>>> +	},
>>> +	.h265_params = {
>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
>>> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
>>> +	},
>>> +	.vp9_params = {
>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
>>> +	},
>>>    };
>>>    
>>>    const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata = {
>>> @@ -910,6 +970,18 @@ const struct mtk_vcodec_dec_pdata
>>> mtk_vdec_8186_pdata = {
>>>    	MTK_STATELESS_DEC_DATA,
>>>    	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>>>    	.chip_name = 8186,
>>> +	.h264_params = {
>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
>>> +	},
>>> +	.h265_params = {
>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
>>> +		.profile =
>>> V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
>>> +	},
>>> +	.vp9_params = {
>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
>>> +	},
>>>    };
>>>    
>>>    const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
>>> @@ -928,4 +1000,16 @@ const struct mtk_vcodec_dec_pdata
>>> mtk_vdec_8189_pdata = {
>>>    	.is_subdev_supported = true,
>>>    	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>>>    	.chip_name = 8189,
>>> +	.h264_params = {
>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
>>> +	},
>>> +	.h265_params = {
>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
>>> +		.profile =
>>> V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
>>> +	},
>>> +	.vp9_params = {
>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
>>> +	},
>>>    };
>>
>>


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization
  2026-01-28  7:45     ` Kyrie Wu (吴晗)
  2026-01-28  9:53       ` AngeloGioacchino Del Regno
@ 2026-01-28 13:34       ` Nicolas Dufresne
  1 sibling, 0 replies; 32+ messages in thread
From: Nicolas Dufresne @ 2026-01-28 13:34 UTC (permalink / raw)
  To: Kyrie Wu (吴晗), linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org, George Sun (孙林),
	Tiffany Lin (林慧珊), nhebert@chromium.org,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	mchehab@kernel.org, hverkuil@xs4all.nl,
	Yunfei Dong (董云飞), conor+dt@kernel.org,
	Irui Wang (王瑞), robh@kernel.org,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, arnd@arndb.de,
	Andrew-CT Chen (陳智迪),
	AngeloGioacchino Del Regno
  Cc: andrzejtp2010@gmail.com, neil.armstrong@linaro.org,
	Yilong Zhou (周易龙)

[-- Attachment #1: Type: text/plain, Size: 8494 bytes --]

Hi,

Le mercredi 28 janvier 2026 à 07:45 +0000, Kyrie Wu (吴晗) a écrit :
> On Tue, 2026-01-27 at 13:07 +0100, AngeloGioacchino Del Regno wrote:
> > Il 27/01/26 03:42, Kyrie Wu ha scritto:
> > > This commit initializes codec profile & level for VDEC. It sets
> > > default values for H264, H265, and VP9 codecs across multiple
> > > chipset configurations.
> > > 
> > 
> > The previous patch "Refactor decoder profile and level handling" will
> > break the
> > driver if this patch is not also applied at the same time.
> > 
> > The change looks good, but you should squash 05/10 in 04/10, and
> > assign the params
> > that you're adding here along with the refactoring, so that you get
> > one single
> > patch that, if applied, doesn't break anything as it doesn't depend
> > on additional
> > (future, as this is number 5) patch.
> > 
> > Please squash
> > 
> > Cheers,
> > Angelo
> 
> Dear Angelo,
> 
> The 04/10 and 05/10 were designed in one patch in v6,
> but Nicolas thought that refactor patch and configuration
> were two different changes, should separate them in this
> comments: 
> https://patchwork.linuxtv.org/project/linux-media/patch/20251202074038.3173-5-kyrie.wu@mediatek.com/
> 
> In my mind, refactor profile and level setting and assign
> former ICs' parameters could merge into same patch. The
> configuration of MT8189 should split to another one, because
> it is a new setting.

I had assumed you'd be able to refactor without breaking it. Give me enough time
to read again the patches since I don't remember all the details.

Nicolas

> 
> Do you agree with my opinion? I look forward to your further reply.
> 
> Thanks.
> 
> Regards,
> Kyrie.
> 
> 
> > 
> > > Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> > > ---
> > >   .../vcodec/decoder/mtk_vcodec_dec_stateful.c  | 12 +++
> > >   .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 84
> > > +++++++++++++++++++
> > >   2 files changed, 96 insertions(+)
> > > 
> > > diff --git
> > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > teful.c
> > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > teful.c
> > > index 8ddb61670dc6..a47906b9d717 100644
> > > ---
> > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > teful.c
> > > +++
> > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > teful.c
> > > @@ -619,4 +619,16 @@ const struct mtk_vcodec_dec_pdata
> > > mtk_vdec_8173_pdata = {
> > >   	.is_subdev_supported = false,
> > >   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > >   	.chip_name = 8173,
> > > +	.h264_params = {
> > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_1,
> > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > +	},
> > > +	.h265_params = {
> > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > +		.profile =
> > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > +	},
> > > +	.vp9_params = {
> > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > +	},
> > >   };
> > > diff --git
> > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > teless.c
> > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > teless.c
> > > index a1f419202a24..b571c4ed3f79 100644
> > > ---
> > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > teless.c
> > > +++
> > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > teless.c
> > > @@ -830,6 +830,18 @@ const struct mtk_vcodec_dec_pdata
> > > mtk_vdec_8183_pdata = {
> > >   	.is_subdev_supported = false,
> > >   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > >   	.chip_name = 8183,
> > > +	.h264_params = {
> > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > +	},
> > > +	.h265_params = {
> > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > +		.profile =
> > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > +	},
> > > +	.vp9_params = {
> > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > +	},
> > >   };
> > >   
> > >   /* This platform data is used for one lat and one core
> > > architecture. */
> > > @@ -869,24 +881,72 @@ const struct mtk_vcodec_dec_pdata
> > > mtk_vdec_8188_pdata = {
> > >   	MTK_STATELESS_DEC_DATA,
> > >   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > >   	.chip_name = 8188,
> > > +	.h264_params = {
> > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > +	},
> > > +	.h265_params = {
> > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1,
> > > +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > > +	},
> > > +	.vp9_params = {
> > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > +	},
> > >   };
> > >   
> > >   const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
> > >   	MTK_STATELESS_DEC_DATA,
> > >   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > >   	.chip_name = 8192,
> > > +	.h264_params = {
> > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > +	},
> > > +	.h265_params = {
> > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > +		.profile =
> > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > +	},
> > > +	.vp9_params = {
> > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > +	},
> > >   };
> > >   
> > >   const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
> > >   	MTK_STATELESS_DEC_DATA,
> > >   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > >   	.chip_name = 8195,
> > > +	.h264_params = {
> > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > +	},
> > > +	.h265_params = {
> > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> > > +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > > +	},
> > > +	.vp9_params = {
> > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > +	},
> > >   };
> > >   
> > >   const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
> > >   	MTK_STATELESS_DEC_DATA,
> > >   	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > >   	.chip_name = 8196,
> > > +	.h264_params = {
> > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > +	},
> > > +	.h265_params = {
> > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> > > +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > > +	},
> > > +	.vp9_params = {
> > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > +	},
> > >   };
> > >   
> > >   const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata = {
> > > @@ -910,6 +970,18 @@ const struct mtk_vcodec_dec_pdata
> > > mtk_vdec_8186_pdata = {
> > >   	MTK_STATELESS_DEC_DATA,
> > >   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > >   	.chip_name = 8186,
> > > +	.h264_params = {
> > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > +	},
> > > +	.h265_params = {
> > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > +		.profile =
> > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > +	},
> > > +	.vp9_params = {
> > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
> > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > +	},
> > >   };
> > >   
> > >   const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
> > > @@ -928,4 +1000,16 @@ const struct mtk_vcodec_dec_pdata
> > > mtk_vdec_8189_pdata = {
> > >   	.is_subdev_supported = true,
> > >   	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > >   	.chip_name = 8189,
> > > +	.h264_params = {
> > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > +	},
> > > +	.h265_params = {
> > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > +		.profile =
> > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > +	},
> > > +	.vp9_params = {
> > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > +	},
> > >   };
> > 
> > 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization
  2026-01-28  9:53       ` AngeloGioacchino Del Regno
@ 2026-01-28 13:39         ` Nicolas Dufresne
  2026-01-28 14:41           ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 32+ messages in thread
From: Nicolas Dufresne @ 2026-01-28 13:39 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, Kyrie Wu (吴晗),
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	George Sun (孙林),
	Tiffany Lin (林慧珊), nhebert@chromium.org,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	mchehab@kernel.org, hverkuil@xs4all.nl,
	Yunfei Dong (董云飞), conor+dt@kernel.org,
	Irui Wang (王瑞), robh@kernel.org,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, arnd@arndb.de,
	Andrew-CT Chen (陳智迪)
  Cc: andrzejtp2010@gmail.com, neil.armstrong@linaro.org,
	Yilong Zhou (周易龙)

[-- Attachment #1: Type: text/plain, Size: 10238 bytes --]

Hi,

Le mercredi 28 janvier 2026 à 10:53 +0100, AngeloGioacchino Del Regno a écrit :
> Il 28/01/26 08:45, Kyrie Wu (吴晗) ha scritto:
> > On Tue, 2026-01-27 at 13:07 +0100, AngeloGioacchino Del Regno wrote:
> > > Il 27/01/26 03:42, Kyrie Wu ha scritto:
> > > > This commit initializes codec profile & level for VDEC. It sets
> > > > default values for H264, H265, and VP9 codecs across multiple
> > > > chipset configurations.
> > > > 
> > > 
> > > The previous patch "Refactor decoder profile and level handling" will
> > > break the
> > > driver if this patch is not also applied at the same time.
> > > 
> > > The change looks good, but you should squash 05/10 in 04/10, and
> > > assign the params
> > > that you're adding here along with the refactoring, so that you get
> > > one single
> > > patch that, if applied, doesn't break anything as it doesn't depend
> > > on additional
> > > (future, as this is number 5) patch.
> > > 
> > > Please squash
> > > 
> > > Cheers,
> > > Angelo
> > 
> > Dear Angelo,
> > 
> > The 04/10 and 05/10 were designed in one patch in v6,
> > but Nicolas thought that refactor patch and configuration
> > were two different changes, should separate them in this
> > comments:
> > https://patchwork.linuxtv.org/project/linux-media/patch/20251202074038.3173-5-kyrie.wu@mediatek.com/
> 
> Even though in this case I disagree with Nicolas, I'm the mediatek maintainer,
> not a linux-media maintainer... so... let's go with whatever the media
> maintainers think it's best.

No need to disagree, I was not very clear in my reply indeed. What I want to see
is the added MT8189 configuration in isolation. So when I said two patches, the
first one should reorganize the code for existing platform, without breaking it,
and the second should add MT8189 support. I will have a read at these two patch
to understand what is being done wrong, and can provide further feedback later.

The commit description in v6 was only saying that it was adding a configuration
for MT8189.

Nicolas

> 
> > 
> > In my mind, refactor profile and level setting and assign
> > former ICs' parameters could merge into same patch. The
> > configuration of MT8189 should split to another one, because
> > it is a new setting.
> > 
> > Do you agree with my opinion? I look forward to your further reply.
> > 
> 
> I agree with your opinion, but if linux-media maintainers want those two
> patches separated as you just did, I will raise my hands, so...
> 
> Reviewed-by: AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com
> 
> ...because when the two patches are applied at the same time, there's no
> breakage. But I want to still repeat my stance on this: single patches
> should never depend on subsequent patches to avoid regressions (and I know
> you agree as your previous version was compliant with that stance).
> 
> Cheers,
> Angelo
> 
> > Thanks.
> > 
> > Regards,
> > Kyrie.
> > 
> > 
> > > 
> > > > Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> > > > ---
> > > >    .../vcodec/decoder/mtk_vcodec_dec_stateful.c  | 12 +++
> > > >    .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 84
> > > > +++++++++++++++++++
> > > >    2 files changed, 96 insertions(+)
> > > > 
> > > > diff --git
> > > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > > teful.c
> > > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > > teful.c
> > > > index 8ddb61670dc6..a47906b9d717 100644
> > > > ---
> > > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > > teful.c
> > > > +++
> > > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > > teful.c
> > > > @@ -619,4 +619,16 @@ const struct mtk_vcodec_dec_pdata
> > > > mtk_vdec_8173_pdata = {
> > > >    	.is_subdev_supported = false,
> > > >    	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > > >    	.chip_name = 8173,
> > > > +	.h264_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_1,
> > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > > +	},
> > > > +	.h265_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > > +		.profile =
> > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > > +	},
> > > > +	.vp9_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > > +	},
> > > >    };
> > > > diff --git
> > > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > > teless.c
> > > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > > teless.c
> > > > index a1f419202a24..b571c4ed3f79 100644
> > > > ---
> > > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > > teless.c
> > > > +++
> > > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
> > > > teless.c
> > > > @@ -830,6 +830,18 @@ const struct mtk_vcodec_dec_pdata
> > > > mtk_vdec_8183_pdata = {
> > > >    	.is_subdev_supported = false,
> > > >    	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > > >    	.chip_name = 8183,
> > > > +	.h264_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > > +	},
> > > > +	.h265_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > > +		.profile =
> > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > > +	},
> > > > +	.vp9_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > > +	},
> > > >    };
> > > >    
> > > >    /* This platform data is used for one lat and one core
> > > > architecture. */
> > > > @@ -869,24 +881,72 @@ const struct mtk_vcodec_dec_pdata
> > > > mtk_vdec_8188_pdata = {
> > > >    	MTK_STATELESS_DEC_DATA,
> > > >    	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > > >    	.chip_name = 8188,
> > > > +	.h264_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > > +	},
> > > > +	.h265_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1,
> > > > +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > > > +	},
> > > > +	.vp9_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > > +	},
> > > >    };
> > > >    
> > > >    const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
> > > >    	MTK_STATELESS_DEC_DATA,
> > > >    	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > > >    	.chip_name = 8192,
> > > > +	.h264_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > > +	},
> > > > +	.h265_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > > +		.profile =
> > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > > +	},
> > > > +	.vp9_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > > +	},
> > > >    };
> > > >    
> > > >    const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
> > > >    	MTK_STATELESS_DEC_DATA,
> > > >    	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > > >    	.chip_name = 8195,
> > > > +	.h264_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > > +	},
> > > > +	.h265_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> > > > +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > > > +	},
> > > > +	.vp9_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > > +	},
> > > >    };
> > > >    
> > > >    const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
> > > >    	MTK_STATELESS_DEC_DATA,
> > > >    	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > > >    	.chip_name = 8196,
> > > > +	.h264_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > > +	},
> > > > +	.h265_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> > > > +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > > > +	},
> > > > +	.vp9_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > > +	},
> > > >    };
> > > >    
> > > >    const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata = {
> > > > @@ -910,6 +970,18 @@ const struct mtk_vcodec_dec_pdata
> > > > mtk_vdec_8186_pdata = {
> > > >    	MTK_STATELESS_DEC_DATA,
> > > >    	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > > >    	.chip_name = 8186,
> > > > +	.h264_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > > +	},
> > > > +	.h265_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > > +		.profile =
> > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > > +	},
> > > > +	.vp9_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
> > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > > +	},
> > > >    };
> > > >    
> > > >    const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
> > > > @@ -928,4 +1000,16 @@ const struct mtk_vcodec_dec_pdata
> > > > mtk_vdec_8189_pdata = {
> > > >    	.is_subdev_supported = true,
> > > >    	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > > >    	.chip_name = 8189,
> > > > +	.h264_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > > +	},
> > > > +	.h265_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > > +		.profile =
> > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > > +	},
> > > > +	.vp9_params = {
> > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > > +	},
> > > >    };
> > > 
> > > 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization
  2026-01-28 13:39         ` Nicolas Dufresne
@ 2026-01-28 14:41           ` AngeloGioacchino Del Regno
  2026-01-29  2:41             ` Kyrie Wu (吴晗)
  0 siblings, 1 reply; 32+ messages in thread
From: AngeloGioacchino Del Regno @ 2026-01-28 14:41 UTC (permalink / raw)
  To: Nicolas Dufresne, Kyrie Wu (吴晗),
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	George Sun (孙林),
	Tiffany Lin (林慧珊), nhebert@chromium.org,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	mchehab@kernel.org, hverkuil@xs4all.nl,
	Yunfei Dong (董云飞), conor+dt@kernel.org,
	Irui Wang (王瑞), robh@kernel.org,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, arnd@arndb.de,
	Andrew-CT Chen (陳智迪)
  Cc: andrzejtp2010@gmail.com, neil.armstrong@linaro.org,
	Yilong Zhou (周易龙)

Il 28/01/26 14:39, Nicolas Dufresne ha scritto:
> Hi,
> 
> Le mercredi 28 janvier 2026 à 10:53 +0100, AngeloGioacchino Del Regno a écrit :
>> Il 28/01/26 08:45, Kyrie Wu (吴晗) ha scritto:
>>> On Tue, 2026-01-27 at 13:07 +0100, AngeloGioacchino Del Regno wrote:
>>>> Il 27/01/26 03:42, Kyrie Wu ha scritto:
>>>>> This commit initializes codec profile & level for VDEC. It sets
>>>>> default values for H264, H265, and VP9 codecs across multiple
>>>>> chipset configurations.
>>>>>
>>>>
>>>> The previous patch "Refactor decoder profile and level handling" will
>>>> break the
>>>> driver if this patch is not also applied at the same time.
>>>>
>>>> The change looks good, but you should squash 05/10 in 04/10, and
>>>> assign the params
>>>> that you're adding here along with the refactoring, so that you get
>>>> one single
>>>> patch that, if applied, doesn't break anything as it doesn't depend
>>>> on additional
>>>> (future, as this is number 5) patch.
>>>>
>>>> Please squash
>>>>
>>>> Cheers,
>>>> Angelo
>>>
>>> Dear Angelo,
>>>
>>> The 04/10 and 05/10 were designed in one patch in v6,
>>> but Nicolas thought that refactor patch and configuration
>>> were two different changes, should separate them in this
>>> comments:
>>> https://patchwork.linuxtv.org/project/linux-media/patch/20251202074038.3173-5-kyrie.wu@mediatek.com/
>>
>> Even though in this case I disagree with Nicolas, I'm the mediatek maintainer,
>> not a linux-media maintainer... so... let's go with whatever the media
>> maintainers think it's best.
> 
> No need to disagree, I was not very clear in my reply indeed. What I want to see
> is the added MT8189 configuration in isolation. So when I said two patches, the
> first one should reorganize the code for existing platform, without breaking it,
> and the second should add MT8189 support. I will have a read at these two patch
> to understand what is being done wrong, and can provide further feedback later.
> 
> The commit description in v6 was only saying that it was adding a configuration
> for MT8189.
> 

Re-reading what I wrote - my words could be misunderstood as well, so - just in
case anyone did: sorry, that wasn't meant as any form of attack and was purely
about sharing an opinion in a friendlier way than what appears from my previous
words. Eh, writing emails fast .... :-P

Btw.

Happy to see that we're on the same page.

Cheers,
Angelo

> Nicolas
> 
>>
>>>
>>> In my mind, refactor profile and level setting and assign
>>> former ICs' parameters could merge into same patch. The
>>> configuration of MT8189 should split to another one, because
>>> it is a new setting.
>>>
>>> Do you agree with my opinion? I look forward to your further reply.
>>>
>>
>> I agree with your opinion, but if linux-media maintainers want those two
>> patches separated as you just did, I will raise my hands, so...
>>
>> Reviewed-by: AngeloGioacchino Del Regno
>> <angelogioacchino.delregno@collabora.com
>>
>> ...because when the two patches are applied at the same time, there's no
>> breakage. But I want to still repeat my stance on this: single patches
>> should never depend on subsequent patches to avoid regressions (and I know
>> you agree as your previous version was compliant with that stance).
>>
>> Cheers,
>> Angelo
>>
>>> Thanks.
>>>
>>> Regards,
>>> Kyrie.
>>>
>>>
>>>>
>>>>> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
>>>>> ---
>>>>>     .../vcodec/decoder/mtk_vcodec_dec_stateful.c  | 12 +++
>>>>>     .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 84
>>>>> +++++++++++++++++++
>>>>>     2 files changed, 96 insertions(+)
>>>>>
>>>>> diff --git
>>>>> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>>>> teful.c
>>>>> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>>>> teful.c
>>>>> index 8ddb61670dc6..a47906b9d717 100644
>>>>> ---
>>>>> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>>>> teful.c
>>>>> +++
>>>>> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>>>> teful.c
>>>>> @@ -619,4 +619,16 @@ const struct mtk_vcodec_dec_pdata
>>>>> mtk_vdec_8173_pdata = {
>>>>>     	.is_subdev_supported = false,
>>>>>     	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>>>>>     	.chip_name = 8173,
>>>>> +	.h264_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_1,
>>>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
>>>>> +	},
>>>>> +	.h265_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
>>>>> +		.profile =
>>>>> V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
>>>>> +	},
>>>>> +	.vp9_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
>>>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
>>>>> +	},
>>>>>     };
>>>>> diff --git
>>>>> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>>>> teless.c
>>>>> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>>>> teless.c
>>>>> index a1f419202a24..b571c4ed3f79 100644
>>>>> ---
>>>>> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>>>> teless.c
>>>>> +++
>>>>> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_sta
>>>>> teless.c
>>>>> @@ -830,6 +830,18 @@ const struct mtk_vcodec_dec_pdata
>>>>> mtk_vdec_8183_pdata = {
>>>>>     	.is_subdev_supported = false,
>>>>>     	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>>>>>     	.chip_name = 8183,
>>>>> +	.h264_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
>>>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
>>>>> +	},
>>>>> +	.h265_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
>>>>> +		.profile =
>>>>> V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
>>>>> +	},
>>>>> +	.vp9_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
>>>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
>>>>> +	},
>>>>>     };
>>>>>     
>>>>>     /* This platform data is used for one lat and one core
>>>>> architecture. */
>>>>> @@ -869,24 +881,72 @@ const struct mtk_vcodec_dec_pdata
>>>>> mtk_vdec_8188_pdata = {
>>>>>     	MTK_STATELESS_DEC_DATA,
>>>>>     	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>>>>>     	.chip_name = 8188,
>>>>> +	.h264_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
>>>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
>>>>> +	},
>>>>> +	.h265_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1,
>>>>> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
>>>>> +	},
>>>>> +	.vp9_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
>>>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
>>>>> +	},
>>>>>     };
>>>>>     
>>>>>     const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
>>>>>     	MTK_STATELESS_DEC_DATA,
>>>>>     	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>>>>>     	.chip_name = 8192,
>>>>> +	.h264_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
>>>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
>>>>> +	},
>>>>> +	.h265_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
>>>>> +		.profile =
>>>>> V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
>>>>> +	},
>>>>> +	.vp9_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
>>>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
>>>>> +	},
>>>>>     };
>>>>>     
>>>>>     const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
>>>>>     	MTK_STATELESS_DEC_DATA,
>>>>>     	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>>>>>     	.chip_name = 8195,
>>>>> +	.h264_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
>>>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
>>>>> +	},
>>>>> +	.h265_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
>>>>> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
>>>>> +	},
>>>>> +	.vp9_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>>>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
>>>>> +	},
>>>>>     };
>>>>>     
>>>>>     const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
>>>>>     	MTK_STATELESS_DEC_DATA,
>>>>>     	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>>>>>     	.chip_name = 8196,
>>>>> +	.h264_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
>>>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
>>>>> +	},
>>>>> +	.h265_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
>>>>> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
>>>>> +	},
>>>>> +	.vp9_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>>>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
>>>>> +	},
>>>>>     };
>>>>>     
>>>>>     const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata = {
>>>>> @@ -910,6 +970,18 @@ const struct mtk_vcodec_dec_pdata
>>>>> mtk_vdec_8186_pdata = {
>>>>>     	MTK_STATELESS_DEC_DATA,
>>>>>     	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>>>>>     	.chip_name = 8186,
>>>>> +	.h264_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
>>>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
>>>>> +	},
>>>>> +	.h265_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
>>>>> +		.profile =
>>>>> V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
>>>>> +	},
>>>>> +	.vp9_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
>>>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
>>>>> +	},
>>>>>     };
>>>>>     
>>>>>     const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
>>>>> @@ -928,4 +1000,16 @@ const struct mtk_vcodec_dec_pdata
>>>>> mtk_vdec_8189_pdata = {
>>>>>     	.is_subdev_supported = true,
>>>>>     	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>>>>>     	.chip_name = 8189,
>>>>> +	.h264_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
>>>>> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
>>>>> +	},
>>>>> +	.h265_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
>>>>> +		.profile =
>>>>> V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
>>>>> +	},
>>>>> +	.vp9_params = {
>>>>> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>>>>> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
>>>>> +	},
>>>>>     };
>>>>
>>>>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization
  2026-01-28 14:41           ` AngeloGioacchino Del Regno
@ 2026-01-29  2:41             ` Kyrie Wu (吴晗)
  0 siblings, 0 replies; 32+ messages in thread
From: Kyrie Wu (吴晗) @ 2026-01-29  2:41 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	George Sun (孙林),
	Tiffany Lin (林慧珊),
	linux-media@vger.kernel.org, nhebert@chromium.org,
	devicetree@vger.kernel.org, nicolas.dufresne@collabora.com,
	mchehab@kernel.org, hverkuil@xs4all.nl,
	Kyrie Wu (吴晗),
	Yunfei Dong (董云飞), conor+dt@kernel.org,
	Irui Wang (王瑞), robh@kernel.org,
	linux-arm-kernel@lists.infradead.org, matthias.bgg@gmail.com,
	krzk+dt@kernel.org, arnd@arndb.de, AngeloGioacchino Del Regno,
	Andrew-CT Chen (陳智迪)
  Cc: andrzejtp2010@gmail.com, neil.armstrong@linaro.org,
	Yilong Zhou (周易龙)

On Wed, 2026-01-28 at 15:41 +0100, AngeloGioacchino Del Regno wrote:
> Il 28/01/26 14:39, Nicolas Dufresne ha scritto:
> > Hi,
> > 
> > Le mercredi 28 janvier 2026 à 10:53 +0100, AngeloGioacchino Del
> > Regno a écrit :
> > > Il 28/01/26 08:45, Kyrie Wu (吴晗) ha scritto:
> > > > On Tue, 2026-01-27 at 13:07 +0100, AngeloGioacchino Del Regno
> > > > wrote:
> > > > > Il 27/01/26 03:42, Kyrie Wu ha scritto:
> > > > > > This commit initializes codec profile & level for VDEC. It
> > > > > > sets
> > > > > > default values for H264, H265, and VP9 codecs across
> > > > > > multiple
> > > > > > chipset configurations.
> > > > > > 
> > > > > 
> > > > > The previous patch "Refactor decoder profile and level
> > > > > handling" will
> > > > > break the
> > > > > driver if this patch is not also applied at the same time.
> > > > > 
> > > > > The change looks good, but you should squash 05/10 in 04/10,
> > > > > and
> > > > > assign the params
> > > > > that you're adding here along with the refactoring, so that
> > > > > you get
> > > > > one single
> > > > > patch that, if applied, doesn't break anything as it doesn't
> > > > > depend
> > > > > on additional
> > > > > (future, as this is number 5) patch.
> > > > > 
> > > > > Please squash
> > > > > 
> > > > > Cheers,
> > > > > Angelo
> > > > 
> > > > Dear Angelo,
> > > > 
> > > > The 04/10 and 05/10 were designed in one patch in v6,
> > > > but Nicolas thought that refactor patch and configuration
> > > > were two different changes, should separate them in this
> > > > comments:
> > > > 
https://urldefense.com/v3/__https://patchwork.linuxtv.org/project/linux-media/patch/20251202074038.3173-5-kyrie.wu@mediatek.com/__;!!CTRNKA9wMg0ARbw!mpwkB-IxdCmuVuRkqAbB30jxPDQQv95G68LXeKB4Fm-6AWCmiMWRWHWihquINz7K5ePYOxDuyimg4mlljsxwONT8bXTH3kY$
> > > >  
> > > 
> > > Even though in this case I disagree with Nicolas, I'm the
> > > mediatek maintainer,
> > > not a linux-media maintainer... so... let's go with whatever the
> > > media
> > > maintainers think it's best.
> > 
> > No need to disagree, I was not very clear in my reply indeed. What
> > I want to see
> > is the added MT8189 configuration in isolation. So when I said two
> > patches, the
> > first one should reorganize the code for existing platform, without
> > breaking it,
> > and the second should add MT8189 support. I will have a read at
> > these two patch
> > to understand what is being done wrong, and can provide further
> > feedback later.
> > 
> > The commit description in v6 was only saying that it was adding a
> > configuration
> > for MT8189.
> > 
> 
> Re-reading what I wrote - my words could be misunderstood as well, so
> - just in
> case anyone did: sorry, that wasn't meant as any form of attack and
> was purely
> about sharing an opinion in a friendlier way than what appears from
> my previous
> words. Eh, writing emails fast .... :-P
> 
> Btw.
> 
> Happy to see that we're on the same page.
> 
> Cheers,
> Angelo
> 
> > Nicolas

Dear Nicolas and Angelo,

Thanks for both of you to discuss the differences and reach a
consensus. 

I will modify the patch in the next version based on the latest
suggestions.

Thank you both sincerely once again.


Regards,
Kyrie.
> > 
> > > 
> > > > 
> > > > In my mind, refactor profile and level setting and assign
> > > > former ICs' parameters could merge into same patch. The
> > > > configuration of MT8189 should split to another one, because
> > > > it is a new setting.
> > > > 
> > > > Do you agree with my opinion? I look forward to your further
> > > > reply.
> > > > 
> > > 
> > > I agree with your opinion, but if linux-media maintainers want
> > > those two
> > > patches separated as you just did, I will raise my hands, so...
> > > 
> > > Reviewed-by: AngeloGioacchino Del Regno
> > > <angelogioacchino.delregno@collabora.com
> > > 
> > > ...because when the two patches are applied at the same time,
> > > there's no
> > > breakage. But I want to still repeat my stance on this: single
> > > patches
> > > should never depend on subsequent patches to avoid regressions
> > > (and I know
> > > you agree as your previous version was compliant with that
> > > stance).
> > > 
> > > Cheers,
> > > Angelo
> > > 
> > > > Thanks.
> > > > 
> > > > Regards,
> > > > Kyrie.
> > > > 
> > > > 
> > > > > 
> > > > > > Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> > > > > > ---
> > > > > >     .../vcodec/decoder/mtk_vcodec_dec_stateful.c  | 12 +++
> > > > > >     .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 84
> > > > > > +++++++++++++++++++
> > > > > >     2 files changed, 96 insertions(+)
> > > > > > 
> > > > > > diff --git
> > > > > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec
> > > > > > _dec_sta
> > > > > > teful.c
> > > > > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec
> > > > > > _dec_sta
> > > > > > teful.c
> > > > > > index 8ddb61670dc6..a47906b9d717 100644
> > > > > > ---
> > > > > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec
> > > > > > _dec_sta
> > > > > > teful.c
> > > > > > +++
> > > > > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec
> > > > > > _dec_sta
> > > > > > teful.c
> > > > > > @@ -619,4 +619,16 @@ const struct mtk_vcodec_dec_pdata
> > > > > > mtk_vdec_8173_pdata = {
> > > > > >     	.is_subdev_supported = false,
> > > > > >     	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > > > > >     	.chip_name = 8173,
> > > > > > +	.h264_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_1,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > > > > +	},
> > > > > > +	.h265_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > > > > +	},
> > > > > > +	.vp9_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > > > > +	},
> > > > > >     };
> > > > > > diff --git
> > > > > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec
> > > > > > _dec_sta
> > > > > > teless.c
> > > > > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec
> > > > > > _dec_sta
> > > > > > teless.c
> > > > > > index a1f419202a24..b571c4ed3f79 100644
> > > > > > ---
> > > > > > a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec
> > > > > > _dec_sta
> > > > > > teless.c
> > > > > > +++
> > > > > > b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec
> > > > > > _dec_sta
> > > > > > teless.c
> > > > > > @@ -830,6 +830,18 @@ const struct mtk_vcodec_dec_pdata
> > > > > > mtk_vdec_8183_pdata = {
> > > > > >     	.is_subdev_supported = false,
> > > > > >     	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > > > > >     	.chip_name = 8183,
> > > > > > +	.h264_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > > > > +	},
> > > > > > +	.h265_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > > > > +	},
> > > > > > +	.vp9_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > > > > +	},
> > > > > >     };
> > > > > >     
> > > > > >     /* This platform data is used for one lat and one core
> > > > > > architecture. */
> > > > > > @@ -869,24 +881,72 @@ const struct mtk_vcodec_dec_pdata
> > > > > > mtk_vdec_8188_pdata = {
> > > > > >     	MTK_STATELESS_DEC_DATA,
> > > > > >     	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > > > > >     	.chip_name = 8188,
> > > > > > +	.h264_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > > > > +	},
> > > > > > +	.h265_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > > > > > +	},
> > > > > > +	.vp9_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > > > > +	},
> > > > > >     };
> > > > > >     
> > > > > >     const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata =
> > > > > > {
> > > > > >     	MTK_STATELESS_DEC_DATA,
> > > > > >     	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > > > > >     	.chip_name = 8192,
> > > > > > +	.h264_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > > > > +	},
> > > > > > +	.h265_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > > > > +	},
> > > > > > +	.vp9_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > > > > +	},
> > > > > >     };
> > > > > >     
> > > > > >     const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata =
> > > > > > {
> > > > > >     	MTK_STATELESS_DEC_DATA,
> > > > > >     	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > > > > >     	.chip_name = 8195,
> > > > > > +	.h264_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > > > > +	},
> > > > > > +	.h265_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > > > > > +	},
> > > > > > +	.vp9_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > > > > +	},
> > > > > >     };
> > > > > >     
> > > > > >     const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata =
> > > > > > {
> > > > > >     	MTK_STATELESS_DEC_DATA,
> > > > > >     	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> > > > > >     	.chip_name = 8196,
> > > > > > +	.h264_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > > > > +	},
> > > > > > +	.h265_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> > > > > > +	},
> > > > > > +	.vp9_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > > > > +	},
> > > > > >     };
> > > > > >     
> > > > > >     const struct mtk_vcodec_dec_pdata
> > > > > > mtk_vdec_single_core_pdata = {
> > > > > > @@ -910,6 +970,18 @@ const struct mtk_vcodec_dec_pdata
> > > > > > mtk_vdec_8186_pdata = {
> > > > > >     	MTK_STATELESS_DEC_DATA,
> > > > > >     	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > > > > >     	.chip_name = 8186,
> > > > > > +	.h264_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> > > > > > +	},
> > > > > > +	.h265_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > > > > +	},
> > > > > > +	.vp9_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> > > > > > +	},
> > > > > >     };
> > > > > >     
> > > > > >     const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata =
> > > > > > {
> > > > > > @@ -928,4 +1000,16 @@ const struct mtk_vcodec_dec_pdata
> > > > > > mtk_vdec_8189_pdata = {
> > > > > >     	.is_subdev_supported = true,
> > > > > >     	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> > > > > >     	.chip_name = 8189,
> > > > > > +	.h264_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> > > > > > +	},
> > > > > > +	.h265_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> > > > > > +		.profile =
> > > > > > V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> > > > > > +	},
> > > > > > +	.vp9_params = {
> > > > > > +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> > > > > > +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> > > > > > +	},
> > > > > >     };
> > > > > 
> > > > > 
> 
> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 01/10] dt-bindings: media: mediatek: decoder: Add MT8189 mediatek,vcodec-decoder
  2026-01-27  2:42 ` [PATCH v7 01/10] dt-bindings: media: mediatek: decoder: Add MT8189 mediatek,vcodec-decoder Kyrie Wu
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
@ 2026-03-19 17:51   ` Nicolas Dufresne
  1 sibling, 0 replies; 32+ messages in thread
From: Nicolas Dufresne @ 2026-03-19 17:51 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Hans Verkuil, Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun,
	linux-media, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

[-- Attachment #1: Type: text/plain, Size: 1928 bytes --]

Le mardi 27 janvier 2026 à 10:42 +0800, Kyrie Wu a écrit :
> Add compatible for video decoder on MT8189 platform. Compared with
> former ICs, the MT8189 decoder use iommu to instead of smmu, and
> use scp architecture, the frequency is only 406MHZ, and cannot reach
> more than 700MHZ. It used only one clock. At the same time, the decoder

used -> uses

I will edit while applying if no new version is needed.

> supports the vp9 decoding protocol for the first time in single IC.
> 
> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> Acked-by: Rob Herring (Arm) <robh@kernel.org>


Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> ---
>  .../bindings/media/mediatek,vcodec-subdev-decoder.yaml       | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-
> decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-
> decoder.yaml
> index 74e1d88d3056..ee2bbbdb2d50 100644
> --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-
> decoder.yaml
> +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-
> decoder.yaml
> @@ -75,6 +75,7 @@ properties:
>        - mediatek,mt8192-vcodec-dec
>        - mediatek,mt8186-vcodec-dec
>        - mediatek,mt8188-vcodec-dec
> +      - mediatek,mt8189-vcodec-dec
>        - mediatek,mt8195-vcodec-dec
>        - mediatek,mt8196-vcodec-dec
>  
> @@ -132,11 +133,11 @@ patternProperties:
>            Refer to bindings/iommu/mediatek,iommu.yaml.
>  
>        clocks:
> -        minItems: 4
> +        minItems: 1
>          maxItems: 5
>  
>        clock-names:
> -        minItems: 4
> +        minItems: 1
>          maxItems: 5
>  
>        assigned-clocks:

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 02/10] media: mediatek: decoder: Add a new platform data member
  2026-01-27  2:42 ` [PATCH v7 02/10] media: mediatek: decoder: Add a new platform data member Kyrie Wu
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
@ 2026-03-19 17:56   ` Nicolas Dufresne
  1 sibling, 0 replies; 32+ messages in thread
From: Nicolas Dufresne @ 2026-03-19 17:56 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Hans Verkuil, Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun,
	linux-media, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

[-- Attachment #1: Type: text/plain, Size: 14258 bytes --]

Hi,

Le mardi 27 janvier 2026 à 10:42 +0800, Kyrie Wu a écrit :
> Add a new platform data member to indicate each decoder IC
> to avoid the chip name definition keep growing.

I like Angelo's suggestion for chip model. In v8, can you also rephrase this
message, perhaps:
   
   
   Move the chip model information into the codec match data and remove the
   second compatible matching code.
   
You can add to v8:

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

cheers,
Nicolas

> 
> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> ---
>  .../mediatek/vcodec/decoder/mtk_vcodec_dec.h  |  5 +
>  .../vcodec/decoder/mtk_vcodec_dec_drv.c       | 35 ++-----
>  .../vcodec/decoder/mtk_vcodec_dec_drv.h       | 15 +--
>  .../vcodec/decoder/mtk_vcodec_dec_hw.c        |  2 +-
>  .../vcodec/decoder/mtk_vcodec_dec_stateful.c  |  1 +
>  .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 92 ++++++++++++++-----
>  6 files changed, 86 insertions(+), 64 deletions(-)
> 
> diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> index 1af075fc0194..80cb46f1cded 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h
> @@ -69,6 +69,11 @@ extern const struct v4l2_m2m_ops mtk_vdec_m2m_ops;
>  extern const struct media_device_ops mtk_vcodec_media_ops;
>  extern const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata;
>  extern const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata;
> +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata;
> +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata;
> +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata;
> +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata;
> +extern const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata;
>  extern const struct mtk_vcodec_dec_pdata mtk_lat_sig_core_pdata;
>  extern const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata;
>  
> diff --git
> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> index 7ed40936a0e8..c7af48f684c5 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c
> @@ -333,24 +333,7 @@ static const struct v4l2_file_operations mtk_vcodec_fops
> = {
>  
>  static void mtk_vcodec_dec_get_chip_name(struct mtk_vcodec_dec_dev *vdec_dev)
>  {
> -	struct device *dev = &vdec_dev->plat_dev->dev;
> -
> -	if (of_device_is_compatible(dev->of_node, "mediatek,mt8173-vcodec-
> dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8173;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8183-
> vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8183;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8192-
> vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8192;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8195-
> vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8195;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8186-
> vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8186;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8188-
> vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8188;
> -	else if (of_device_is_compatible(dev->of_node, "mediatek,mt8196-
> vcodec-dec"))
> -		vdec_dev->chip_name = MTK_VDEC_MT8196;
> -	else
> -		vdec_dev->chip_name = MTK_VDEC_INVAL;
> +	vdec_dev->chip_name = vdec_dev->vdec_pdata->chip_name;
>  }
>  
>  static int mtk_vcodec_probe(struct platform_device *pdev)
> @@ -369,10 +352,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
>  	dev->plat_dev = pdev;
>  
>  	mtk_vcodec_dec_get_chip_name(dev);
> -	if (dev->chip_name == MTK_VDEC_INVAL) {
> -		dev_err(&pdev->dev, "Failed to get decoder chip name");
> -		return -EINVAL;
> -	}
>  
>  	dev->vdec_pdata = of_device_get_match_data(&pdev->dev);
>  	if (!of_property_read_u32(pdev->dev.of_node, "mediatek,vpu",
> @@ -389,7 +368,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
>  		return -ENODEV;
>  	}
>  	dma_set_max_seg_size(&pdev->dev, UINT_MAX);
> -	if (dev->chip_name == MTK_VDEC_MT8196) {
> +	if (dev->chip_name == 8196) {
>  		ret = dma_set_mask_and_coherent(&pdev->dev,
> DMA_BIT_MASK(36));
>  		if (ret) {
>  			dev_err(&pdev->dev, "Failed to enable 36-bit DMA:
> %d\n", ret);
> @@ -558,23 +537,23 @@ static const struct of_device_id mtk_vcodec_match[] = {
>  	},
>  	{
>  		.compatible = "mediatek,mt8192-vcodec-dec",
> -		.data = &mtk_lat_sig_core_pdata,
> +		.data = &mtk_vdec_8192_pdata,
>  	},
>  	{
>  		.compatible = "mediatek,mt8186-vcodec-dec",
> -		.data = &mtk_vdec_single_core_pdata,
> +		.data = &mtk_vdec_8186_pdata,
>  	},
>  	{
>  		.compatible = "mediatek,mt8195-vcodec-dec",
> -		.data = &mtk_lat_sig_core_pdata,
> +		.data = &mtk_vdec_8195_pdata,
>  	},
>  	{
>  		.compatible = "mediatek,mt8188-vcodec-dec",
> -		.data = &mtk_lat_sig_core_pdata,
> +		.data = &mtk_vdec_8188_pdata,
>  	},
>  	{
>  		.compatible = "mediatek,mt8196-vcodec-dec",
> -		.data = &mtk_lat_sig_core_pdata,
> +		.data = &mtk_vdec_8196_pdata,
>  	},
>  	{},
>  };
> 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 1cb77619add9..bb293ada6fb2 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
> @@ -19,17 +19,6 @@
>  #define IS_VDEC_INNER_RACING(capability) ((capability) &
> MTK_VCODEC_INNER_RACING)
>  #define IS_VDEC_SUPPORT_EXT(capability) ((capability) &
> MTK_VDEC_IS_SUPPORT_EXT)
>  
> -enum mtk_vcodec_dec_chip_name {
> -	MTK_VDEC_INVAL = 0,
> -	MTK_VDEC_MT8173 = 8173,
> -	MTK_VDEC_MT8183 = 8183,
> -	MTK_VDEC_MT8186 = 8186,
> -	MTK_VDEC_MT8188 = 8188,
> -	MTK_VDEC_MT8192 = 8192,
> -	MTK_VDEC_MT8195 = 8195,
> -	MTK_VDEC_MT8196 = 8196,
> -};
> -
>  /*
>   * enum mtk_vdec_format_types - Structure used to get supported
>   *		  format types according to decoder capability
> @@ -106,6 +95,7 @@ struct vdec_pic_info {
>   *
>   * @is_subdev_supported: whether support parent-node architecture(subdev)
>   * @uses_stateless_api: whether the decoder uses the stateless API with
> requests
> + * @chip_name: platforms configuration values
>   */
>  struct mtk_vcodec_dec_pdata {
>  	void (*init_vdec_params)(struct mtk_vcodec_dec_ctx *ctx);
> @@ -127,6 +117,7 @@ struct mtk_vcodec_dec_pdata {
>  
>  	bool is_subdev_supported;
>  	bool uses_stateless_api;
> +	unsigned int chip_name;
>  };
>  
>  /**
> @@ -307,7 +298,7 @@ struct mtk_vcodec_dec_dev {
>  	struct mutex dec_racing_info_mutex;
>  	struct mtk_vcodec_dbgfs dbgfs;
>  
> -	enum mtk_vcodec_dec_chip_name chip_name;
> +	unsigned int chip_name;
>  };
>  
>  static inline struct mtk_vcodec_dec_ctx *fh_to_dec_ctx(struct v4l2_fh *fh)
> diff --git
> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c
> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c
> index e4e527fe54dc..a926dc14d39d 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_hw.c
> @@ -76,7 +76,7 @@ static void mtk_vdec_hw_clean_xpc(struct mtk_vdec_hw_dev
> *dev)
>  {
>  	u32 val, mask, addr = VDEC_XPC_CLEAN_ADDR;
>  
> -	if (dev->main_dev->chip_name != MTK_VDEC_MT8196)
> +	if (dev->main_dev->chip_name != 8196)
>  		return;
>  
>  	val = dev->hw_idx == MTK_VDEC_LAT0 ? VDEC_XPC_LAT_VAL :
> VDEC_XPC_CORE_VAL;
> 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 aa9bdee7a96c..8ddb61670dc6 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
> @@ -618,4 +618,5 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata = {
>  	.flush_decoder = mtk_vdec_flush_decoder,
>  	.is_subdev_supported = false,
>  	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> +	.chip_name = 8173,
>  };
> 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 c1cef78471a9..0745bc3ee490 100644
> ---
> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> +++
> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> @@ -550,16 +550,16 @@ static void mtk_vcodec_dec_fill_h264_level(struct
> v4l2_ctrl_config *cfg,
>  					   struct mtk_vcodec_dec_ctx *ctx)
>  {
>  	switch (ctx->dev->chip_name) {
> -	case MTK_VDEC_MT8192:
> -	case MTK_VDEC_MT8188:
> +	case 8192:
> +	case 8188:
>  		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_5_2;
>  		break;
> -	case MTK_VDEC_MT8195:
> -	case MTK_VDEC_MT8196:
> +	case 8195:
> +	case 8196:
>  		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_6_0;
>  		break;
> -	case MTK_VDEC_MT8183:
> -	case MTK_VDEC_MT8186:
> +	case 8183:
> +	case 8186:
>  		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
>  		break;
>  	default:
> @@ -572,9 +572,9 @@ static void mtk_vcodec_dec_fill_h264_profile(struct
> v4l2_ctrl_config *cfg,
>  					     struct mtk_vcodec_dec_ctx *ctx)
>  {
>  	switch (ctx->dev->chip_name) {
> -	case MTK_VDEC_MT8188:
> -	case MTK_VDEC_MT8195:
> -	case MTK_VDEC_MT8196:
> +	case 8188:
> +	case 8195:
> +	case 8196:
>  		cfg->max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10;
>  		break;
>  	default:
> @@ -587,11 +587,11 @@ static void mtk_vcodec_dec_fill_h265_level(struct
> v4l2_ctrl_config *cfg,
>  					   struct mtk_vcodec_dec_ctx *ctx)
>  {
>  	switch (ctx->dev->chip_name) {
> -	case MTK_VDEC_MT8188:
> +	case 8188:
>  		cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1;
>  		break;
> -	case MTK_VDEC_MT8195:
> -	case MTK_VDEC_MT8196:
> +	case 8195:
> +	case 8196:
>  		cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2;
>  		break;
>  	default:
> @@ -604,9 +604,9 @@ static void mtk_vcodec_dec_fill_h265_profile(struct
> v4l2_ctrl_config *cfg,
>  					     struct mtk_vcodec_dec_ctx *ctx)
>  {
>  	switch (ctx->dev->chip_name) {
> -	case MTK_VDEC_MT8188:
> -	case MTK_VDEC_MT8195:
> -	case MTK_VDEC_MT8196:
> +	case 8188:
> +	case 8195:
> +	case 8196:
>  		cfg->max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10;
>  		break;
>  	default:
> @@ -619,15 +619,15 @@ static void mtk_vcodec_dec_fill_vp9_level(struct
> v4l2_ctrl_config *cfg,
>  					  struct mtk_vcodec_dec_ctx *ctx)
>  {
>  	switch (ctx->dev->chip_name) {
> -	case MTK_VDEC_MT8192:
> -	case MTK_VDEC_MT8188:
> +	case 8192:
> +	case 8188:
>  		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1;
>  		break;
> -	case MTK_VDEC_MT8195:
> -	case MTK_VDEC_MT8196:
> +	case 8195:
> +	case 8196:
>  		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2;
>  		break;
> -	case MTK_VDEC_MT8186:
> +	case 8186:
>  		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1;
>  		break;
>  	default:
> @@ -640,9 +640,9 @@ static void mtk_vcodec_dec_fill_vp9_profile(struct
> v4l2_ctrl_config *cfg,
>  					    struct mtk_vcodec_dec_ctx *ctx)
>  {
>  	switch (ctx->dev->chip_name) {
> -	case MTK_VDEC_MT8188:
> -	case MTK_VDEC_MT8195:
> -	case MTK_VDEC_MT8196:
> +	case 8188:
> +	case 8195:
> +	case 8196:
>  		cfg->max = V4L2_MPEG_VIDEO_VP9_PROFILE_2;
>  		break;
>  	default:
> @@ -886,6 +886,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata = {
>  	.get_cap_buffer = vdec_get_cap_buffer,
>  	.is_subdev_supported = false,
>  	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> +	.chip_name = 8183,
>  };
>  
>  /* This platform data is used for one lat and one core architecture. */
> @@ -906,6 +907,45 @@ const struct mtk_vcodec_dec_pdata mtk_lat_sig_core_pdata
> = {
>  	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>  };
>  
> +#define MTK_STATELESS_DEC_DATA \
> +	.init_vdec_params = mtk_init_vdec_params, \
> +	.ctrls_setup = mtk_vcodec_dec_ctrls_setup, \
> +	.vdec_vb2_ops = &mtk_vdec_request_vb2_ops, \
> +	.vdec_formats = mtk_video_formats, \
> +	.num_formats = &num_formats, \
> +	.default_out_fmt = &default_out_format, \
> +	.default_cap_fmt = &default_cap_format, \
> +	.uses_stateless_api = true, \
> +	.worker = mtk_vdec_worker, \
> +	.flush_decoder = mtk_vdec_flush_decoder, \
> +	.cap_to_disp = mtk_vdec_stateless_cap_to_disp, \
> +	.get_cap_buffer = vdec_get_cap_buffer, \
> +	.is_subdev_supported = true
> +
> +const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata = {
> +	MTK_STATELESS_DEC_DATA,
> +	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> +	.chip_name = 8188,
> +};
> +
> +const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
> +	MTK_STATELESS_DEC_DATA,
> +	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> +	.chip_name = 8192,
> +};
> +
> +const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
> +	MTK_STATELESS_DEC_DATA,
> +	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> +	.chip_name = 8195,
> +};
> +
> +const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
> +	MTK_STATELESS_DEC_DATA,
> +	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
> +	.chip_name = 8196,
> +};
> +
>  const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata = {
>  	.init_vdec_params = mtk_init_vdec_params,
>  	.ctrls_setup = mtk_vcodec_dec_ctrls_setup,
> @@ -922,3 +962,9 @@ const struct mtk_vcodec_dec_pdata
> mtk_vdec_single_core_pdata = {
>  	.is_subdev_supported = true,
>  	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>  };
> +
> +const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata = {
> +	MTK_STATELESS_DEC_DATA,
> +	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
> +	.chip_name = 8186,
> +};

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 04/10] media: mediatek: vcodec: Refactor Decoder profile & level Handling
  2026-01-27  2:42 ` [PATCH v7 04/10] media: mediatek: vcodec: Refactor Decoder profile & level Handling Kyrie Wu
@ 2026-03-19 17:58   ` Nicolas Dufresne
  0 siblings, 0 replies; 32+ messages in thread
From: Nicolas Dufresne @ 2026-03-19 17:58 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Hans Verkuil, Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun,
	linux-media, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

[-- Attachment #1: Type: text/plain, Size: 6309 bytes --]

Le mardi 27 janvier 2026 à 10:42 +0800, Kyrie Wu a écrit :
> This commit refactors the handling of decoder parameters for H264,
> H265, and VP9 codecs by introducing a new structure to standardize
> supported level and profile information. By leveraging this changes,

this changes -> this change

cheers,
Nicolas

> chipset-specific conditional logic in the codec configuration
> functions is significantly reduced.
> 
> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  .../vcodec/decoder/mtk_vcodec_dec_drv.h       | 16 ++++
>  .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 93 ++++---------------
>  2 files changed, 34 insertions(+), 75 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 bb293ada6fb2..f38b5dc4bb74 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
> @@ -76,6 +76,16 @@ struct vdec_pic_info {
>  	unsigned int reserved;
>  };
>  
> +/**
> + * struct mtk_vcodec_dec_params - decoder supported parameters
> + * @level: decoder supported vcodec level
> + * @profile: decoder supported vcodec profile
> + */
> +struct mtk_vcodec_dec_params {
> +	s64 level;
> +	s64 profile;
> +};
> +
>  /**
>   * struct mtk_vcodec_dec_pdata - compatible data for each IC
>   * @init_vdec_params: init vdec params
> @@ -96,6 +106,9 @@ struct vdec_pic_info {
>   * @is_subdev_supported: whether support parent-node architecture(subdev)
>   * @uses_stateless_api: whether the decoder uses the stateless API with requests
>   * @chip_name: platforms configuration values
> + * @h264_params: H264 decoder default supported params
> + * @h265_params: H265 decoder default supported params
> + * @vp9_params: VP9 decoder default supported params
>   */
>  struct mtk_vcodec_dec_pdata {
>  	void (*init_vdec_params)(struct mtk_vcodec_dec_ctx *ctx);
> @@ -118,6 +131,9 @@ struct mtk_vcodec_dec_pdata {
>  	bool is_subdev_supported;
>  	bool uses_stateless_api;
>  	unsigned int chip_name;
> +	struct mtk_vcodec_dec_params h264_params;
> +	struct mtk_vcodec_dec_params h265_params;
> +	struct mtk_vcodec_dec_params vp9_params;
>  };
>  
>  /**
> 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 aba28d276bdf..a1f419202a24 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> @@ -549,106 +549,49 @@ static const struct v4l2_ctrl_ops mtk_vcodec_dec_ctrl_ops = {
>  static void mtk_vcodec_dec_fill_h264_level(struct v4l2_ctrl_config *cfg,
>  					   struct mtk_vcodec_dec_ctx *ctx)
>  {
> -	switch (ctx->dev->chip_name) {
> -	case 8192:
> -	case 8188:
> -		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_5_2;
> -		break;
> -	case 8195:
> -	case 8196:
> -		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_6_0;
> -		break;
> -	case 8183:
> -	case 8186:
> -		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
> -		break;
> -	default:
> -		cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_4_1;
> -		break;
> -	}
> +	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
> +
> +	cfg->max = pdev->vdec_pdata->h264_params.level;
>  }
>  
>  static void mtk_vcodec_dec_fill_h264_profile(struct v4l2_ctrl_config *cfg,
>  					     struct mtk_vcodec_dec_ctx *ctx)
>  {
> -	switch (ctx->dev->chip_name) {
> -	case 8188:
> -	case 8195:
> -	case 8196:
> -		cfg->max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10;
> -		break;
> -	default:
> -		cfg->max = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH;
> -		break;
> -	}
> +	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
> +
> +	cfg->max = pdev->vdec_pdata->h264_params.profile;
>  }
>  
>  static void mtk_vcodec_dec_fill_h265_level(struct v4l2_ctrl_config *cfg,
>  					   struct mtk_vcodec_dec_ctx *ctx)
>  {
> -	switch (ctx->dev->chip_name) {
> -	case 8188:
> -		cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1;
> -		break;
> -	case 8195:
> -	case 8196:
> -		cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2;
> -		break;
> -	default:
> -		cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_4;
> -		break;
> -	}
> +	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
> +
> +	cfg->max = pdev->vdec_pdata->h265_params.level;
>  }
>  
>  static void mtk_vcodec_dec_fill_h265_profile(struct v4l2_ctrl_config *cfg,
>  					     struct mtk_vcodec_dec_ctx *ctx)
>  {
> -	switch (ctx->dev->chip_name) {
> -	case 8188:
> -	case 8195:
> -	case 8196:
> -		cfg->max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10;
> -		break;
> -	default:
> -		cfg->max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE;
> -		break;
> -	}
> +	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
> +
> +	cfg->max = pdev->vdec_pdata->h265_params.profile;
>  }
>  
>  static void mtk_vcodec_dec_fill_vp9_level(struct v4l2_ctrl_config *cfg,
>  					  struct mtk_vcodec_dec_ctx *ctx)
>  {
> -	switch (ctx->dev->chip_name) {
> -	case 8192:
> -	case 8188:
> -		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1;
> -		break;
> -	case 8195:
> -	case 8196:
> -		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2;
> -		break;
> -	case 8186:
> -		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1;
> -		break;
> -	default:
> -		cfg->max = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0;
> -		break;
> -	}
> +	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
> +
> +	cfg->max = pdev->vdec_pdata->vp9_params.level;
>  }
>  
>  static void mtk_vcodec_dec_fill_vp9_profile(struct v4l2_ctrl_config *cfg,
>  					    struct mtk_vcodec_dec_ctx *ctx)
>  {
> -	switch (ctx->dev->chip_name) {
> -	case 8188:
> -	case 8195:
> -	case 8196:
> -		cfg->max = V4L2_MPEG_VIDEO_VP9_PROFILE_2;
> -		break;
> -	default:
> -		cfg->max = V4L2_MPEG_VIDEO_VP9_PROFILE_1;
> -		break;
> -	}
> +	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
> +
> +	cfg->max = pdev->vdec_pdata->vp9_params.profile;
>  }
>  
>  static void mtk_vcodec_dec_reset_controls(struct v4l2_ctrl_config *cfg,

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization
  2026-01-27  2:42 ` [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization Kyrie Wu
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
@ 2026-03-19 18:05   ` Nicolas Dufresne
  1 sibling, 0 replies; 32+ messages in thread
From: Nicolas Dufresne @ 2026-03-19 18:05 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Hans Verkuil, Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun,
	linux-media, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

[-- Attachment #1: Type: text/plain, Size: 6323 bytes --]

Hi,

Just to recap my expectations.

Le mardi 27 janvier 2026 à 10:42 +0800, Kyrie Wu a écrit :
> This commit initializes codec profile & level for VDEC. It sets
> default values for H264, H265, and VP9 codecs across multiple
> chipset configurations.
> 
> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> ---
>  .../vcodec/decoder/mtk_vcodec_dec_stateful.c  | 12 +++
>  .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 84 +++++++++++++++++++
>  2 files changed, 96 insertions(+)
> 
> 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 8ddb61670dc6..a47906b9d717 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
> @@ -619,4 +619,16 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata = {
>  	.is_subdev_supported = false,
>  	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>  	.chip_name = 8173,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_1,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +	},
>  };
> 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 a1f419202a24..b571c4ed3f79 100644
> ---
> a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> +++
> b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> @@ -830,6 +830,18 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata = {
>  	.is_subdev_supported = false,
>  	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>  	.chip_name = 8183,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +	},
>  };
>  
>  /* This platform data is used for one lat and one core architecture. */
> @@ -869,24 +881,72 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata =
> {
>  	MTK_STATELESS_DEC_DATA,
>  	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>  	.chip_name = 8188,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +	},
>  };
>  
>  const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
>  	MTK_STATELESS_DEC_DATA,
>  	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>  	.chip_name = 8192,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +	},
>  };
>  
>  const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
>  	MTK_STATELESS_DEC_DATA,
>  	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>  	.chip_name = 8195,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +	},
>  };
>  
>  const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
>  	MTK_STATELESS_DEC_DATA,
>  	.hw_arch = MTK_VDEC_LAT_SINGLE_CORE,
>  	.chip_name = 8196,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_6_0,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +	},
>  };
>  
>  const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata = {
> @@ -910,6 +970,18 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata = {
>  	MTK_STATELESS_DEC_DATA,
>  	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>  	.chip_name = 8186,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +	},
>  };

All of the above should be squashed into patch 04. Patch 04 should be moved
before any patches related to 8189.

>  
>  const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
> @@ -928,4 +1000,16 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata =
> {
>  	.is_subdev_supported = true,
>  	.hw_arch = MTK_VDEC_PURE_SINGLE_CORE,
>  	.chip_name = 8189,
> +	.h264_params = {
> +		.level = V4L2_MPEG_VIDEO_H264_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10,
> +	},
> +	.h265_params = {
> +		.level = V4L2_MPEG_VIDEO_HEVC_LEVEL_4,
> +		.profile = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE,
> +	},
> +	.vp9_params = {
> +		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
> +		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +	},
>  };

This hunk should be squashed with what is actually patch 03.

regards,
Nicolas

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 06/10] media: mediatek: vcodec: Add VP9 Probability Size Configuration
  2026-01-27  2:42 ` [PATCH v7 06/10] media: mediatek: vcodec: Add VP9 Probability Size Configuration Kyrie Wu
  2026-01-27 12:07   ` AngeloGioacchino Del Regno
@ 2026-03-19 18:08   ` Nicolas Dufresne
  1 sibling, 0 replies; 32+ messages in thread
From: Nicolas Dufresne @ 2026-03-19 18:08 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Hans Verkuil, Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun,
	linux-media, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

[-- Attachment #1: Type: text/plain, Size: 6095 bytes --]

Le mardi 27 janvier 2026 à 10:42 +0800, Kyrie Wu a écrit :
> This commit introduces support for configuring the VP9 decoder
> probability buffer size. It removes hard-coded values and ensures
> chipset-specific buffer sizes are handled dynamically, improving
> maintainability and alignment.

Similar to my previous request, add the prob_size before any MT8189 changes, and
then make one patch that adds MT8189 pdata.

> 
> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> ---
>  .../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 | 10 ++++++++++
>  .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c |  4 ++--
>  4 files changed, 15 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 f38b5dc4bb74..08cc65054de5 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
> @@ -80,10 +80,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;
>  };
>  
>  /**
> 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 a47906b9d717..99c252e0a2e1 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.c
> @@ -630,5 +630,6 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata = {
>  	.vp9_params = {
>  		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
>  		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +		.prob_size = 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 b571c4ed3f79..ca39ae3571a3 100644
> --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c
> +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.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
> @@ -841,6 +844,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8183_pdata = {
>  	.vp9_params = {
>  		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_0,
>  		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +		.prob_size = VP9_PROB_BUF_SIZE,
>  	},
>  };
>  
> @@ -892,6 +896,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8188_pdata = {
>  	.vp9_params = {
>  		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
>  		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +		.prob_size = VP9_PROB_BUF_SIZE,
>  	},
>  };
>  
> @@ -910,6 +915,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8192_pdata = {
>  	.vp9_params = {
>  		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_1,
>  		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +		.prob_size = VP9_PROB_BUF_SIZE,
>  	},
>  };
>  
> @@ -928,6 +934,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8195_pdata = {
>  	.vp9_params = {
>  		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>  		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +		.prob_size = VP9_PROB_BUF_SIZE,
>  	},
>  };
>  
> @@ -946,6 +953,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8196_pdata = {
>  	.vp9_params = {
>  		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>  		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +		.prob_size = VP9_4K_PROB_BUF_SIZE,
>  	},
>  };
>  
> @@ -981,6 +989,7 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8186_pdata = {
>  	.vp9_params = {
>  		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_4_1,
>  		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_1,
> +		.prob_size = VP9_PROB_BUF_SIZE,
>  	},
>  };
>  
> @@ -1011,5 +1020,6 @@ const struct mtk_vcodec_dec_pdata mtk_vdec_8189_pdata = {
>  	.vp9_params = {
>  		.level = V4L2_MPEG_VIDEO_VP9_LEVEL_5_2,
>  		.profile = V4L2_MPEG_VIDEO_VP9_PROFILE_2,
> +		.prob_size = VP9_4K_PROB_BUF_SIZE,
>  	},

So hunk change will be squashed, everything else is refactoring.

Nicolas

>  };
> diff --git 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
> index 82e257bd059f..e8ba99d31e74 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
>  
>  #define VP9_TILE_BUF_SIZE 4096
> -#define VP9_PROB_BUF_SIZE 2560
>  #define VP9_COUNTS_BUF_SIZE 16384
>  
>  #define HDR_FLAG(x) (!!((hdr)->flags & V4L2_VP9_FRAME_FLAG_##x))
> @@ -546,6 +545,7 @@ static int vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance *i
>  					       struct vdec_vp9_slice_vsi *vsi)
>  {
>  	struct mtk_vcodec_dec_ctx *ctx = instance->ctx;
> +	struct mtk_vcodec_dec_dev *pdev = ctx->dev;
>  	enum vdec_vp9_slice_resolution_level level;
>  	/* super blocks */
>  	unsigned int max_sb_w;
> @@ -616,7 +616,7 @@ static int vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance *i
>  	}
>  
>  	if (!instance->prob.va) {
> -		instance->prob.size = VP9_PROB_BUF_SIZE;
> +		instance->prob.size = pdev->vdec_pdata->vp9_params.prob_size;
>  		if (mtk_vcodec_mem_alloc(ctx, &instance->prob))
>  			goto err;
>  	}

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v7 07/10] media: mediatek: vcodec: Fix vp9 4096x2176 fail for profile2
  2026-01-27  2:42 ` [PATCH v7 07/10] media: mediatek: vcodec: Fix vp9 4096x2176 fail for profile2 Kyrie Wu
@ 2026-03-19 18:09   ` Nicolas Dufresne
  0 siblings, 0 replies; 32+ messages in thread
From: Nicolas Dufresne @ 2026-03-19 18:09 UTC (permalink / raw)
  To: Kyrie Wu, Tiffany Lin, Andrew-CT Chen, Yunfei Dong,
	Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Hans Verkuil, Nathan Hebert, Arnd Bergmann, Irui Wang, George Sun,
	linux-media, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek
  Cc: Neil Armstrong, Andrzej Pietrasiewicz, Yilong Zhou

[-- Attachment #1: Type: text/plain, Size: 1992 bytes --]

Le mardi 27 janvier 2026 à 10:42 +0800, Kyrie Wu a écrit :
> The DRAM address of the VP9 decoder tile info buffers may require
> as much as 36bits for 4096x2176 resolution. Fold the 4 most significant
> bits into the lower (padding) four bits of address.
> 
> Fixes: 5d418351ca8f1 ("media: mediatek: vcodec: support stateless VP9 decoding")
> Signed-off-by: Kyrie Wu <kyrie.wu@mediatek.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

In v8, relocate this patch before the addition of the MT8189 pdata, since this
SoC depends on it.

Nicolas

> ---
>  .../mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git 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
> index e8ba99d31e74..a958e16eb380 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
> @@ -1133,9 +1133,17 @@ static int vdec_vp9_slice_setup_tile_buffer(struct vdec_vp9_slice_instance *inst
>  					return -EINVAL;
>  			}
>  			tiles->size[i][j] = size;
> +			/*
> +			 * If the system supports 64-bit DMA addresses, the upper 4 bits
> +			 * of the address are also encoded into the buffer entry.
> +			 * The buffer pointer (tb) is incremented after each entry is written.
> +			 */
>  			if (tiles->mi_rows[i]) {
>  				*tb++ = (size << 3) + ((offset << 3) & 0x7f);
> -				*tb++ = pa & ~0xf;
> +				*tb = pa & GENMASK(31, 4);
> +				if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT))
> +					*tb |= (pa >> 32) & GENMASK(3, 0);
> +				tb++;
>  				*tb++ = (pa << 3) & 0x7f;
>  				mi_row = (tiles->mi_rows[i] - 1) & 0x1ff;
>  				mi_col = (tiles->mi_cols[j] - 1) & 0x3f;

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2026-03-19 18:09 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27  2:42 [PATCH v7 00/10] Enable video decoder & encoder for MT8189 Kyrie Wu
2026-01-27  2:42 ` [PATCH v7 01/10] dt-bindings: media: mediatek: decoder: Add MT8189 mediatek,vcodec-decoder Kyrie Wu
2026-01-27 12:07   ` AngeloGioacchino Del Regno
2026-03-19 17:51   ` Nicolas Dufresne
2026-01-27  2:42 ` [PATCH v7 02/10] media: mediatek: decoder: Add a new platform data member Kyrie Wu
2026-01-27 12:07   ` AngeloGioacchino Del Regno
2026-01-28  7:18     ` Kyrie Wu (吴晗)
2026-03-19 17:56   ` Nicolas Dufresne
2026-01-27  2:42 ` [PATCH v7 03/10] media: mediatek: vcodec: add decoder compatible to support MT8189 Kyrie Wu
2026-01-27 12:07   ` AngeloGioacchino Del Regno
2026-01-28  7:16     ` Kyrie Wu (吴晗)
2026-01-27  2:42 ` [PATCH v7 04/10] media: mediatek: vcodec: Refactor Decoder profile & level Handling Kyrie Wu
2026-03-19 17:58   ` Nicolas Dufresne
2026-01-27  2:42 ` [PATCH v7 05/10] media: mediatek: vcodec: Add Decoder profile & level Initialization Kyrie Wu
2026-01-27 12:07   ` AngeloGioacchino Del Regno
2026-01-28  7:45     ` Kyrie Wu (吴晗)
2026-01-28  9:53       ` AngeloGioacchino Del Regno
2026-01-28 13:39         ` Nicolas Dufresne
2026-01-28 14:41           ` AngeloGioacchino Del Regno
2026-01-29  2:41             ` Kyrie Wu (吴晗)
2026-01-28 13:34       ` Nicolas Dufresne
2026-03-19 18:05   ` Nicolas Dufresne
2026-01-27  2:42 ` [PATCH v7 06/10] media: mediatek: vcodec: Add VP9 Probability Size Configuration Kyrie Wu
2026-01-27 12:07   ` AngeloGioacchino Del Regno
2026-01-28  7:14     ` Kyrie Wu (吴晗)
2026-03-19 18:08   ` Nicolas Dufresne
2026-01-27  2:42 ` [PATCH v7 07/10] media: mediatek: vcodec: Fix vp9 4096x2176 fail for profile2 Kyrie Wu
2026-03-19 18:09   ` Nicolas Dufresne
2026-01-27  2:42 ` [PATCH v7 08/10] media: mediatek: vcodec: Fix media device node number Kyrie Wu
2026-01-27 12:07   ` AngeloGioacchino Del Regno
2026-01-27  2:42 ` [PATCH v7 09/10] dt-bindings: media: Add MT8189 mediatek,vcodec-encoder Kyrie Wu
2026-01-27  2:42 ` [PATCH v7 10/10] media: mediatek: encoder: Add MT8189 encoder compatible data Kyrie Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox