All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4,0/6] Support H264 4K on MT8192
@ 2021-05-21  7:01 ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Add MT8192 H264 venc driver and support H264 4K encoding on MT8192.

Change notes:
v4: rebase on Linux 5.13-rc1

Alexandre Courbot (1):
  media: mtk-vcodec: venc: remove redundant code

Irui Wang (5):
  dt-bindings: media: mtk-vcodec: Add dma-ranges property
  media: mtk-vcodec: Support 4GB~8GB range iova space for venc
  dt-bindings: media: mtk-vcodec: Add binding for MT8192 VENC
  media: mtk-vcodec: Add MT8192 H264 venc driver
  media: mtk-vcodec: Support MT8192 H264 4K encoding

 .../bindings/media/mediatek-vcodec.txt        |  3 +
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  1 +
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      | 89 +++++++++++--------
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  | 17 ++++
 .../platform/mtk-vcodec/venc/venc_h264_if.c   |  4 +
 5 files changed, 78 insertions(+), 36 deletions(-)

-- 
2.18.0


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

* [PATCH v4,0/6] Support H264 4K on MT8192
@ 2021-05-21  7:01 ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Add MT8192 H264 venc driver and support H264 4K encoding on MT8192.

Change notes:
v4: rebase on Linux 5.13-rc1

Alexandre Courbot (1):
  media: mtk-vcodec: venc: remove redundant code

Irui Wang (5):
  dt-bindings: media: mtk-vcodec: Add dma-ranges property
  media: mtk-vcodec: Support 4GB~8GB range iova space for venc
  dt-bindings: media: mtk-vcodec: Add binding for MT8192 VENC
  media: mtk-vcodec: Add MT8192 H264 venc driver
  media: mtk-vcodec: Support MT8192 H264 4K encoding

 .../bindings/media/mediatek-vcodec.txt        |  3 +
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  1 +
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      | 89 +++++++++++--------
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  | 17 ++++
 .../platform/mtk-vcodec/venc/venc_h264_if.c   |  4 +
 5 files changed, 78 insertions(+), 36 deletions(-)

-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v4,0/6] Support H264 4K on MT8192
@ 2021-05-21  7:01 ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Add MT8192 H264 venc driver and support H264 4K encoding on MT8192.

Change notes:
v4: rebase on Linux 5.13-rc1

Alexandre Courbot (1):
  media: mtk-vcodec: venc: remove redundant code

Irui Wang (5):
  dt-bindings: media: mtk-vcodec: Add dma-ranges property
  media: mtk-vcodec: Support 4GB~8GB range iova space for venc
  dt-bindings: media: mtk-vcodec: Add binding for MT8192 VENC
  media: mtk-vcodec: Add MT8192 H264 venc driver
  media: mtk-vcodec: Support MT8192 H264 4K encoding

 .../bindings/media/mediatek-vcodec.txt        |  3 +
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  1 +
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      | 89 +++++++++++--------
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  | 17 ++++
 .../platform/mtk-vcodec/venc/venc_h264_if.c   |  4 +
 5 files changed, 78 insertions(+), 36 deletions(-)

-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4,1/6] media: mtk-vcodec: venc: remove redundant code
  2021-05-21  7:01 ` Irui Wang
  (?)
@ 2021-05-21  7:01   ` Irui Wang
  -1 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

From: Alexandre Courbot <acourbot@chromium.org>

vidioc_try_fmt() does clamp height and width when called on the OUTPUT
queue, so clamping them prior to calling this function is redundant. Set
the queue's parameters after calling vidioc_try_fmt() so we can use the
values it computed.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
---
 .../media/platform/mtk-vcodec/mtk_vcodec_enc.c   | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 4831052f475d..42ff13867940 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -443,7 +443,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
 	struct mtk_q_data *q_data;
 	int ret, i;
 	const struct mtk_video_fmt *fmt;
-	struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
 
 	vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
 	if (!vq) {
@@ -468,20 +467,13 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
 		f->fmt.pix.pixelformat = fmt->fourcc;
 	}
 
-	pix_fmt_mp->height = clamp(pix_fmt_mp->height,
-				MTK_VENC_MIN_H,
-				MTK_VENC_MAX_H);
-	pix_fmt_mp->width = clamp(pix_fmt_mp->width,
-				MTK_VENC_MIN_W,
-				MTK_VENC_MAX_W);
-
-	q_data->visible_width = f->fmt.pix_mp.width;
-	q_data->visible_height = f->fmt.pix_mp.height;
-	q_data->fmt = fmt;
-	ret = vidioc_try_fmt(f, q_data->fmt);
+	ret = vidioc_try_fmt(f, fmt);
 	if (ret)
 		return ret;
 
+	q_data->fmt = fmt;
+	q_data->visible_width = f->fmt.pix_mp.width;
+	q_data->visible_height = f->fmt.pix_mp.height;
 	q_data->coded_width = f->fmt.pix_mp.width;
 	q_data->coded_height = f->fmt.pix_mp.height;
 
-- 
2.18.0


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

* [PATCH v4,1/6] media: mtk-vcodec: venc: remove redundant code
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

From: Alexandre Courbot <acourbot@chromium.org>

vidioc_try_fmt() does clamp height and width when called on the OUTPUT
queue, so clamping them prior to calling this function is redundant. Set
the queue's parameters after calling vidioc_try_fmt() so we can use the
values it computed.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
---
 .../media/platform/mtk-vcodec/mtk_vcodec_enc.c   | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 4831052f475d..42ff13867940 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -443,7 +443,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
 	struct mtk_q_data *q_data;
 	int ret, i;
 	const struct mtk_video_fmt *fmt;
-	struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
 
 	vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
 	if (!vq) {
@@ -468,20 +467,13 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
 		f->fmt.pix.pixelformat = fmt->fourcc;
 	}
 
-	pix_fmt_mp->height = clamp(pix_fmt_mp->height,
-				MTK_VENC_MIN_H,
-				MTK_VENC_MAX_H);
-	pix_fmt_mp->width = clamp(pix_fmt_mp->width,
-				MTK_VENC_MIN_W,
-				MTK_VENC_MAX_W);
-
-	q_data->visible_width = f->fmt.pix_mp.width;
-	q_data->visible_height = f->fmt.pix_mp.height;
-	q_data->fmt = fmt;
-	ret = vidioc_try_fmt(f, q_data->fmt);
+	ret = vidioc_try_fmt(f, fmt);
 	if (ret)
 		return ret;
 
+	q_data->fmt = fmt;
+	q_data->visible_width = f->fmt.pix_mp.width;
+	q_data->visible_height = f->fmt.pix_mp.height;
 	q_data->coded_width = f->fmt.pix_mp.width;
 	q_data->coded_height = f->fmt.pix_mp.height;
 
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v4,1/6] media: mtk-vcodec: venc: remove redundant code
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

From: Alexandre Courbot <acourbot@chromium.org>

vidioc_try_fmt() does clamp height and width when called on the OUTPUT
queue, so clamping them prior to calling this function is redundant. Set
the queue's parameters after calling vidioc_try_fmt() so we can use the
values it computed.

Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
---
 .../media/platform/mtk-vcodec/mtk_vcodec_enc.c   | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 4831052f475d..42ff13867940 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -443,7 +443,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
 	struct mtk_q_data *q_data;
 	int ret, i;
 	const struct mtk_video_fmt *fmt;
-	struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
 
 	vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
 	if (!vq) {
@@ -468,20 +467,13 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
 		f->fmt.pix.pixelformat = fmt->fourcc;
 	}
 
-	pix_fmt_mp->height = clamp(pix_fmt_mp->height,
-				MTK_VENC_MIN_H,
-				MTK_VENC_MAX_H);
-	pix_fmt_mp->width = clamp(pix_fmt_mp->width,
-				MTK_VENC_MIN_W,
-				MTK_VENC_MAX_W);
-
-	q_data->visible_width = f->fmt.pix_mp.width;
-	q_data->visible_height = f->fmt.pix_mp.height;
-	q_data->fmt = fmt;
-	ret = vidioc_try_fmt(f, q_data->fmt);
+	ret = vidioc_try_fmt(f, fmt);
 	if (ret)
 		return ret;
 
+	q_data->fmt = fmt;
+	q_data->visible_width = f->fmt.pix_mp.width;
+	q_data->visible_height = f->fmt.pix_mp.height;
 	q_data->coded_width = f->fmt.pix_mp.width;
 	q_data->coded_height = f->fmt.pix_mp.height;
 
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4,2/6] dt-bindings: media: mtk-vcodec: Add dma-ranges property
  2021-05-21  7:01 ` Irui Wang
  (?)
@ 2021-05-21  7:01   ` Irui Wang
  -1 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

The mt8192 iommu support 0~16GB iova. We separate it to four banks:
0~4G; 4G~8G; 8G~12G; 12G~16G.

The "dma-ranges" could be used to adjust the bank we locate.
If we don't set this property. The default range always is 0~4G.

Here we don't have actual bus/parent concept here.  And the iova
requirement is for our HW. Thus put the property in our node.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 Documentation/devicetree/bindings/media/mediatek-vcodec.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
index 06db6837cefd..b7801e3c354a 100644
--- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
+++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
@@ -22,6 +22,8 @@ Required properties:
 - iommus : should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
+- dma-ranges : describes how the physical address space of the IOMMU maps
+  to memory.
 One of the two following nodes:
 - mediatek,vpu : the node of the video processor unit, if using VPU.
 - mediatek,scp : the node of the SCP unit, if using SCP.
-- 
2.18.0


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

* [PATCH v4, 2/6] dt-bindings: media: mtk-vcodec: Add dma-ranges property
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

The mt8192 iommu support 0~16GB iova. We separate it to four banks:
0~4G; 4G~8G; 8G~12G; 12G~16G.

The "dma-ranges" could be used to adjust the bank we locate.
If we don't set this property. The default range always is 0~4G.

Here we don't have actual bus/parent concept here.  And the iova
requirement is for our HW. Thus put the property in our node.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 Documentation/devicetree/bindings/media/mediatek-vcodec.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
index 06db6837cefd..b7801e3c354a 100644
--- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
+++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
@@ -22,6 +22,8 @@ Required properties:
 - iommus : should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
+- dma-ranges : describes how the physical address space of the IOMMU maps
+  to memory.
 One of the two following nodes:
 - mediatek,vpu : the node of the video processor unit, if using VPU.
 - mediatek,scp : the node of the SCP unit, if using SCP.
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v4, 2/6] dt-bindings: media: mtk-vcodec: Add dma-ranges property
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

The mt8192 iommu support 0~16GB iova. We separate it to four banks:
0~4G; 4G~8G; 8G~12G; 12G~16G.

The "dma-ranges" could be used to adjust the bank we locate.
If we don't set this property. The default range always is 0~4G.

Here we don't have actual bus/parent concept here.  And the iova
requirement is for our HW. Thus put the property in our node.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 Documentation/devicetree/bindings/media/mediatek-vcodec.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
index 06db6837cefd..b7801e3c354a 100644
--- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
+++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
@@ -22,6 +22,8 @@ Required properties:
 - iommus : should point to the respective IOMMU block with master port as
   argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.yaml
   for details.
+- dma-ranges : describes how the physical address space of the IOMMU maps
+  to memory.
 One of the two following nodes:
 - mediatek,vpu : the node of the video processor unit, if using VPU.
 - mediatek,scp : the node of the SCP unit, if using SCP.
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4,3/6] media: mtk-vcodec: Support 4GB~8GB range iova space for venc
  2021-05-21  7:01 ` Irui Wang
  (?)
@ 2021-05-21  7:01   ` Irui Wang
  -1 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Use the dma_set_mask_and_coherent helper to set venc
DMA bit mask to support 4GB~8GB range iova space.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index 7d7b8cfc2cc5..26b089e81213 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -361,6 +361,9 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 		goto err_event_workq;
 	}
 
+	if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
+		dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
+
 	ret = video_register_device(vfd_enc, VFL_TYPE_VIDEO, 1);
 	if (ret) {
 		mtk_v4l2_err("Failed to register video device");
-- 
2.18.0


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

* [PATCH v4, 3/6] media: mtk-vcodec: Support 4GB~8GB range iova space for venc
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Use the dma_set_mask_and_coherent helper to set venc
DMA bit mask to support 4GB~8GB range iova space.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index 7d7b8cfc2cc5..26b089e81213 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -361,6 +361,9 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 		goto err_event_workq;
 	}
 
+	if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
+		dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
+
 	ret = video_register_device(vfd_enc, VFL_TYPE_VIDEO, 1);
 	if (ret) {
 		mtk_v4l2_err("Failed to register video device");
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v4, 3/6] media: mtk-vcodec: Support 4GB~8GB range iova space for venc
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Use the dma_set_mask_and_coherent helper to set venc
DMA bit mask to support 4GB~8GB range iova space.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index 7d7b8cfc2cc5..26b089e81213 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -361,6 +361,9 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
 		goto err_event_workq;
 	}
 
+	if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
+		dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
+
 	ret = video_register_device(vfd_enc, VFL_TYPE_VIDEO, 1);
 	if (ret) {
 		mtk_v4l2_err("Failed to register video device");
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4,4/6] dt-bindings: media: mtk-vcodec: Add binding for MT8192 VENC
  2021-05-21  7:01 ` Irui Wang
  (?)
@ 2021-05-21  7:01   ` Irui Wang
  -1 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Updates binding document for mt8192 encoder driver.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 Documentation/devicetree/bindings/media/mediatek-vcodec.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
index b7801e3c354a..4171f8761322 100644
--- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
+++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
@@ -9,6 +9,7 @@ Required properties:
   "mediatek,mt8173-vcodec-enc" for mt8173 avc encoder.
   "mediatek,mt8183-vcodec-enc" for MT8183 encoder.
   "mediatek,mt8173-vcodec-dec" for MT8173 decoder.
+  "mediatek,mt8192-vcodec-enc" for MT8192 encoder.
 - reg : Physical base address of the video codec registers and length of
   memory mapped region.
 - interrupts : interrupt number to the cpu.
-- 
2.18.0


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

* [PATCH v4, 4/6] dt-bindings: media: mtk-vcodec: Add binding for MT8192 VENC
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Updates binding document for mt8192 encoder driver.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 Documentation/devicetree/bindings/media/mediatek-vcodec.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
index b7801e3c354a..4171f8761322 100644
--- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
+++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
@@ -9,6 +9,7 @@ Required properties:
   "mediatek,mt8173-vcodec-enc" for mt8173 avc encoder.
   "mediatek,mt8183-vcodec-enc" for MT8183 encoder.
   "mediatek,mt8173-vcodec-dec" for MT8173 decoder.
+  "mediatek,mt8192-vcodec-enc" for MT8192 encoder.
 - reg : Physical base address of the video codec registers and length of
   memory mapped region.
 - interrupts : interrupt number to the cpu.
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v4, 4/6] dt-bindings: media: mtk-vcodec: Add binding for MT8192 VENC
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Updates binding document for mt8192 encoder driver.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 Documentation/devicetree/bindings/media/mediatek-vcodec.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
index b7801e3c354a..4171f8761322 100644
--- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
+++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
@@ -9,6 +9,7 @@ Required properties:
   "mediatek,mt8173-vcodec-enc" for mt8173 avc encoder.
   "mediatek,mt8183-vcodec-enc" for MT8183 encoder.
   "mediatek,mt8173-vcodec-dec" for MT8173 decoder.
+  "mediatek,mt8192-vcodec-enc" for MT8192 encoder.
 - reg : Physical base address of the video codec registers and length of
   memory mapped region.
 - interrupts : interrupt number to the cpu.
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
  2021-05-21  7:01 ` Irui Wang
  (?)
@ 2021-05-21  7:01   ` Irui Wang
  -1 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Add MT8192 venc driver's compatible and device private data.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  1 +
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index d03cca95e99b..14893d277bb8 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -302,6 +302,7 @@ struct mtk_vcodec_ctx {
 enum mtk_chip {
 	MTK_MT8173,
 	MTK_MT8183,
+	MTK_MT8192,
 };
 
 /**
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index 26b089e81213..78f3dd166917 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -425,12 +425,26 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
 	.core_id = VENC_SYS,
 };
 
+static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
+	.chip = MTK_MT8192,
+	.uses_ext = true,
+	/* MT8192 supports the same capture formats as MT8183*/
+	.capture_formats = mtk_video_formats_capture_mt8183,
+	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183),
+	/* MT8192 supports the same output formats as MT8173 */
+	.output_formats = mtk_video_formats_output_mt8173,
+	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173),
+	.min_bitrate = 64,
+	.max_bitrate = 100000000,
+	.core_id = VENC_SYS,
+};
 static const struct of_device_id mtk_vcodec_enc_match[] = {
 	{.compatible = "mediatek,mt8173-vcodec-enc",
 			.data = &mt8173_avc_pdata},
 	{.compatible = "mediatek,mt8173-vcodec-enc-vp8",
 			.data = &mt8173_vp8_pdata},
 	{.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
+	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
 	{},
 };
 MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
-- 
2.18.0


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

* [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Add MT8192 venc driver's compatible and device private data.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  1 +
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index d03cca95e99b..14893d277bb8 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -302,6 +302,7 @@ struct mtk_vcodec_ctx {
 enum mtk_chip {
 	MTK_MT8173,
 	MTK_MT8183,
+	MTK_MT8192,
 };
 
 /**
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index 26b089e81213..78f3dd166917 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -425,12 +425,26 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
 	.core_id = VENC_SYS,
 };
 
+static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
+	.chip = MTK_MT8192,
+	.uses_ext = true,
+	/* MT8192 supports the same capture formats as MT8183*/
+	.capture_formats = mtk_video_formats_capture_mt8183,
+	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183),
+	/* MT8192 supports the same output formats as MT8173 */
+	.output_formats = mtk_video_formats_output_mt8173,
+	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173),
+	.min_bitrate = 64,
+	.max_bitrate = 100000000,
+	.core_id = VENC_SYS,
+};
 static const struct of_device_id mtk_vcodec_enc_match[] = {
 	{.compatible = "mediatek,mt8173-vcodec-enc",
 			.data = &mt8173_avc_pdata},
 	{.compatible = "mediatek,mt8173-vcodec-enc-vp8",
 			.data = &mt8173_vp8_pdata},
 	{.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
+	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
 	{},
 };
 MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Add MT8192 venc driver's compatible and device private data.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  1 +
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index d03cca95e99b..14893d277bb8 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -302,6 +302,7 @@ struct mtk_vcodec_ctx {
 enum mtk_chip {
 	MTK_MT8173,
 	MTK_MT8183,
+	MTK_MT8192,
 };
 
 /**
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index 26b089e81213..78f3dd166917 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -425,12 +425,26 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
 	.core_id = VENC_SYS,
 };
 
+static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
+	.chip = MTK_MT8192,
+	.uses_ext = true,
+	/* MT8192 supports the same capture formats as MT8183*/
+	.capture_formats = mtk_video_formats_capture_mt8183,
+	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183),
+	/* MT8192 supports the same output formats as MT8173 */
+	.output_formats = mtk_video_formats_output_mt8173,
+	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173),
+	.min_bitrate = 64,
+	.max_bitrate = 100000000,
+	.core_id = VENC_SYS,
+};
 static const struct of_device_id mtk_vcodec_enc_match[] = {
 	{.compatible = "mediatek,mt8173-vcodec-enc",
 			.data = &mt8173_avc_pdata},
 	{.compatible = "mediatek,mt8173-vcodec-enc-vp8",
 			.data = &mt8173_vp8_pdata},
 	{.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
+	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
 	{},
 };
 MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v4,6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
  2021-05-21  7:01 ` Irui Wang
  (?)
@ 2021-05-21  7:01   ` Irui Wang
  -1 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

MT8192 H264 support 4k(3840x2176) and Level 5.1 encoding,
add related path according to enc_capability.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      | 75 ++++++++++++-------
 .../platform/mtk-vcodec/venc/venc_h264_if.c   |  4 +
 2 files changed, 54 insertions(+), 25 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 42ff13867940..7396a5050b45 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -19,23 +19,32 @@
 
 #define MTK_VENC_MIN_W	160U
 #define MTK_VENC_MIN_H	128U
-#define MTK_VENC_MAX_W	1920U
-#define MTK_VENC_MAX_H	1088U
+#define MTK_VENC_HD_MAX_W	1920U
+#define MTK_VENC_HD_MAX_H	1088U
+#define MTK_VENC_4K_MAX_W	3840U
+#define MTK_VENC_4K_MAX_H	2176U
+
 #define DFT_CFG_WIDTH	MTK_VENC_MIN_W
 #define DFT_CFG_HEIGHT	MTK_VENC_MIN_H
 #define MTK_MAX_CTRLS_HINT	20
 
 #define MTK_DEFAULT_FRAMERATE_NUM 1001
 #define MTK_DEFAULT_FRAMERATE_DENOM 30000
+#define MTK_VENC_4K_CAPABILITY_ENABLE BIT(0)
 
 static void mtk_venc_worker(struct work_struct *work);
 
-static const struct v4l2_frmsize_stepwise mtk_venc_framesizes = {
-	MTK_VENC_MIN_W, MTK_VENC_MAX_W, 16,
-	MTK_VENC_MIN_H, MTK_VENC_MAX_H, 16,
+static const struct v4l2_frmsize_stepwise mtk_venc_hd_framesizes = {
+	MTK_VENC_MIN_W, MTK_VENC_HD_MAX_W, 16,
+	MTK_VENC_MIN_H, MTK_VENC_HD_MAX_H, 16,
+};
+
+static const struct v4l2_frmsize_stepwise mtk_venc_4k_framesizes = {
+	MTK_VENC_MIN_W, MTK_VENC_4K_MAX_W, 16,
+	MTK_VENC_MIN_H, MTK_VENC_4K_MAX_H, 16,
 };
 
-#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_framesizes)
+#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_hd_framesizes)
 
 static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl)
 {
@@ -151,17 +160,20 @@ static int vidioc_enum_framesizes(struct file *file, void *fh,
 				  struct v4l2_frmsizeenum *fsize)
 {
 	const struct mtk_video_fmt *fmt;
+	struct mtk_vcodec_ctx *ctx = fh_to_ctx(fh);
 
 	if (fsize->index != 0)
 		return -EINVAL;
 
 	fmt = mtk_venc_find_format(fsize->pixel_format,
-				   fh_to_ctx(fh)->dev->venc_pdata);
+				   ctx->dev->venc_pdata);
 	if (!fmt)
 		return -EINVAL;
 
 	fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
-	fsize->stepwise = mtk_venc_framesizes;
+	fsize->stepwise =
+		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
+		mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;
 
 	return 0;
 }
@@ -248,7 +260,7 @@ static struct mtk_q_data *mtk_venc_get_q_data(struct mtk_vcodec_ctx *ctx,
 /* V4L2 specification suggests the driver corrects the format struct if any of
  * the dimensions is unsupported
  */
-static int vidioc_try_fmt(struct v4l2_format *f,
+static int vidioc_try_fmt(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f,
 			  const struct mtk_video_fmt *fmt)
 {
 	struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
@@ -260,13 +272,22 @@ static int vidioc_try_fmt(struct v4l2_format *f,
 		pix_fmt_mp->plane_fmt[0].bytesperline = 0;
 	} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
 		int tmp_w, tmp_h;
+		unsigned int max_width, max_height;
+
+		if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) {
+			max_width = MTK_VENC_4K_MAX_W;
+			max_height = MTK_VENC_4K_MAX_H;
+		} else {
+			max_width = MTK_VENC_HD_MAX_W;
+			max_height = MTK_VENC_HD_MAX_H;
+		}
 
 		pix_fmt_mp->height = clamp(pix_fmt_mp->height,
 					MTK_VENC_MIN_H,
-					MTK_VENC_MAX_H);
+					max_height);
 		pix_fmt_mp->width = clamp(pix_fmt_mp->width,
 					MTK_VENC_MIN_W,
-					MTK_VENC_MAX_W);
+					max_width);
 
 		/* find next closer width align 16, heign align 32, size align
 		 * 64 rectangle
@@ -275,16 +296,16 @@ static int vidioc_try_fmt(struct v4l2_format *f,
 		tmp_h = pix_fmt_mp->height;
 		v4l_bound_align_image(&pix_fmt_mp->width,
 					MTK_VENC_MIN_W,
-					MTK_VENC_MAX_W, 4,
+					max_width, 4,
 					&pix_fmt_mp->height,
 					MTK_VENC_MIN_H,
-					MTK_VENC_MAX_H, 5, 6);
+					max_height, 5, 6);
 
 		if (pix_fmt_mp->width < tmp_w &&
-			(pix_fmt_mp->width + 16) <= MTK_VENC_MAX_W)
+			(pix_fmt_mp->width + 16) <= max_width)
 			pix_fmt_mp->width += 16;
 		if (pix_fmt_mp->height < tmp_h &&
-			(pix_fmt_mp->height + 32) <= MTK_VENC_MAX_H)
+			(pix_fmt_mp->height + 32) <= max_height)
 			pix_fmt_mp->height += 32;
 
 		mtk_v4l2_debug(0,
@@ -405,7 +426,7 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv,
 	}
 
 	q_data->fmt = fmt;
-	ret = vidioc_try_fmt(f, q_data->fmt);
+	ret = vidioc_try_fmt(ctx, f, q_data->fmt);
 	if (ret)
 		return ret;
 
@@ -467,7 +488,7 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
 		f->fmt.pix.pixelformat = fmt->fourcc;
 	}
 
-	ret = vidioc_try_fmt(f, fmt);
+	ret = vidioc_try_fmt(ctx, f, fmt);
 	if (ret)
 		return ret;
 
@@ -545,7 +566,7 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv,
 	f->fmt.pix_mp.quantization = ctx->quantization;
 	f->fmt.pix_mp.xfer_func = ctx->xfer_func;
 
-	return vidioc_try_fmt(f, fmt);
+	return vidioc_try_fmt(ctx, f, fmt);
 }
 
 static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
@@ -567,7 +588,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
 		f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT;
 	}
 
-	return vidioc_try_fmt(f, fmt);
+	return vidioc_try_fmt(ctx, f, fmt);
 }
 
 static int vidioc_venc_g_selection(struct file *file, void *priv,
@@ -1171,16 +1192,16 @@ void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx)
 
 	v4l_bound_align_image(&q_data->coded_width,
 				MTK_VENC_MIN_W,
-				MTK_VENC_MAX_W, 4,
+				MTK_VENC_HD_MAX_W, 4,
 				&q_data->coded_height,
 				MTK_VENC_MIN_H,
-				MTK_VENC_MAX_H, 5, 6);
+				MTK_VENC_HD_MAX_H, 5, 6);
 
 	if (q_data->coded_width < DFT_CFG_WIDTH &&
-		(q_data->coded_width + 16) <= MTK_VENC_MAX_W)
+		(q_data->coded_width + 16) <= MTK_VENC_HD_MAX_W)
 		q_data->coded_width += 16;
 	if (q_data->coded_height < DFT_CFG_HEIGHT &&
-		(q_data->coded_height + 32) <= MTK_VENC_MAX_H)
+		(q_data->coded_height + 32) <= MTK_VENC_HD_MAX_H)
 		q_data->coded_height += 32;
 
 	q_data->sizeimage[0] =
@@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
 {
 	const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
 	struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
+	const u8 h264_max_level =
+		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
+		V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
 
 	v4l2_ctrl_handler_init(handler, MTK_MAX_CTRLS_HINT);
 
@@ -1240,8 +1264,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
 			V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
 			0, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH);
 	v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL,
-			V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
-			0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
+			       h264_max_level,
+			       0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
+
 	if (handler->error) {
 		mtk_v4l2_err("Init control handler fail %d",
 				handler->error);
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
index d0123dfc5f93..b6a4f2074fa5 100644
--- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
@@ -215,6 +215,10 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst,
 		return 41;
 	case V4L2_MPEG_VIDEO_H264_LEVEL_4_2:
 		return 42;
+	case V4L2_MPEG_VIDEO_H264_LEVEL_5_0:
+		return 50;
+	case V4L2_MPEG_VIDEO_H264_LEVEL_5_1:
+		return 51;
 	default:
 		mtk_vcodec_debug(inst, "unsupported level %d", level);
 		return 31;
-- 
2.18.0


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

* [PATCH v4,6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

MT8192 H264 support 4k(3840x2176) and Level 5.1 encoding,
add related path according to enc_capability.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      | 75 ++++++++++++-------
 .../platform/mtk-vcodec/venc/venc_h264_if.c   |  4 +
 2 files changed, 54 insertions(+), 25 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 42ff13867940..7396a5050b45 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -19,23 +19,32 @@
 
 #define MTK_VENC_MIN_W	160U
 #define MTK_VENC_MIN_H	128U
-#define MTK_VENC_MAX_W	1920U
-#define MTK_VENC_MAX_H	1088U
+#define MTK_VENC_HD_MAX_W	1920U
+#define MTK_VENC_HD_MAX_H	1088U
+#define MTK_VENC_4K_MAX_W	3840U
+#define MTK_VENC_4K_MAX_H	2176U
+
 #define DFT_CFG_WIDTH	MTK_VENC_MIN_W
 #define DFT_CFG_HEIGHT	MTK_VENC_MIN_H
 #define MTK_MAX_CTRLS_HINT	20
 
 #define MTK_DEFAULT_FRAMERATE_NUM 1001
 #define MTK_DEFAULT_FRAMERATE_DENOM 30000
+#define MTK_VENC_4K_CAPABILITY_ENABLE BIT(0)
 
 static void mtk_venc_worker(struct work_struct *work);
 
-static const struct v4l2_frmsize_stepwise mtk_venc_framesizes = {
-	MTK_VENC_MIN_W, MTK_VENC_MAX_W, 16,
-	MTK_VENC_MIN_H, MTK_VENC_MAX_H, 16,
+static const struct v4l2_frmsize_stepwise mtk_venc_hd_framesizes = {
+	MTK_VENC_MIN_W, MTK_VENC_HD_MAX_W, 16,
+	MTK_VENC_MIN_H, MTK_VENC_HD_MAX_H, 16,
+};
+
+static const struct v4l2_frmsize_stepwise mtk_venc_4k_framesizes = {
+	MTK_VENC_MIN_W, MTK_VENC_4K_MAX_W, 16,
+	MTK_VENC_MIN_H, MTK_VENC_4K_MAX_H, 16,
 };
 
-#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_framesizes)
+#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_hd_framesizes)
 
 static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl)
 {
@@ -151,17 +160,20 @@ static int vidioc_enum_framesizes(struct file *file, void *fh,
 				  struct v4l2_frmsizeenum *fsize)
 {
 	const struct mtk_video_fmt *fmt;
+	struct mtk_vcodec_ctx *ctx = fh_to_ctx(fh);
 
 	if (fsize->index != 0)
 		return -EINVAL;
 
 	fmt = mtk_venc_find_format(fsize->pixel_format,
-				   fh_to_ctx(fh)->dev->venc_pdata);
+				   ctx->dev->venc_pdata);
 	if (!fmt)
 		return -EINVAL;
 
 	fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
-	fsize->stepwise = mtk_venc_framesizes;
+	fsize->stepwise =
+		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
+		mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;
 
 	return 0;
 }
@@ -248,7 +260,7 @@ static struct mtk_q_data *mtk_venc_get_q_data(struct mtk_vcodec_ctx *ctx,
 /* V4L2 specification suggests the driver corrects the format struct if any of
  * the dimensions is unsupported
  */
-static int vidioc_try_fmt(struct v4l2_format *f,
+static int vidioc_try_fmt(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f,
 			  const struct mtk_video_fmt *fmt)
 {
 	struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
@@ -260,13 +272,22 @@ static int vidioc_try_fmt(struct v4l2_format *f,
 		pix_fmt_mp->plane_fmt[0].bytesperline = 0;
 	} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
 		int tmp_w, tmp_h;
+		unsigned int max_width, max_height;
+
+		if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) {
+			max_width = MTK_VENC_4K_MAX_W;
+			max_height = MTK_VENC_4K_MAX_H;
+		} else {
+			max_width = MTK_VENC_HD_MAX_W;
+			max_height = MTK_VENC_HD_MAX_H;
+		}
 
 		pix_fmt_mp->height = clamp(pix_fmt_mp->height,
 					MTK_VENC_MIN_H,
-					MTK_VENC_MAX_H);
+					max_height);
 		pix_fmt_mp->width = clamp(pix_fmt_mp->width,
 					MTK_VENC_MIN_W,
-					MTK_VENC_MAX_W);
+					max_width);
 
 		/* find next closer width align 16, heign align 32, size align
 		 * 64 rectangle
@@ -275,16 +296,16 @@ static int vidioc_try_fmt(struct v4l2_format *f,
 		tmp_h = pix_fmt_mp->height;
 		v4l_bound_align_image(&pix_fmt_mp->width,
 					MTK_VENC_MIN_W,
-					MTK_VENC_MAX_W, 4,
+					max_width, 4,
 					&pix_fmt_mp->height,
 					MTK_VENC_MIN_H,
-					MTK_VENC_MAX_H, 5, 6);
+					max_height, 5, 6);
 
 		if (pix_fmt_mp->width < tmp_w &&
-			(pix_fmt_mp->width + 16) <= MTK_VENC_MAX_W)
+			(pix_fmt_mp->width + 16) <= max_width)
 			pix_fmt_mp->width += 16;
 		if (pix_fmt_mp->height < tmp_h &&
-			(pix_fmt_mp->height + 32) <= MTK_VENC_MAX_H)
+			(pix_fmt_mp->height + 32) <= max_height)
 			pix_fmt_mp->height += 32;
 
 		mtk_v4l2_debug(0,
@@ -405,7 +426,7 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv,
 	}
 
 	q_data->fmt = fmt;
-	ret = vidioc_try_fmt(f, q_data->fmt);
+	ret = vidioc_try_fmt(ctx, f, q_data->fmt);
 	if (ret)
 		return ret;
 
@@ -467,7 +488,7 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
 		f->fmt.pix.pixelformat = fmt->fourcc;
 	}
 
-	ret = vidioc_try_fmt(f, fmt);
+	ret = vidioc_try_fmt(ctx, f, fmt);
 	if (ret)
 		return ret;
 
@@ -545,7 +566,7 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv,
 	f->fmt.pix_mp.quantization = ctx->quantization;
 	f->fmt.pix_mp.xfer_func = ctx->xfer_func;
 
-	return vidioc_try_fmt(f, fmt);
+	return vidioc_try_fmt(ctx, f, fmt);
 }
 
 static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
@@ -567,7 +588,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
 		f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT;
 	}
 
-	return vidioc_try_fmt(f, fmt);
+	return vidioc_try_fmt(ctx, f, fmt);
 }
 
 static int vidioc_venc_g_selection(struct file *file, void *priv,
@@ -1171,16 +1192,16 @@ void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx)
 
 	v4l_bound_align_image(&q_data->coded_width,
 				MTK_VENC_MIN_W,
-				MTK_VENC_MAX_W, 4,
+				MTK_VENC_HD_MAX_W, 4,
 				&q_data->coded_height,
 				MTK_VENC_MIN_H,
-				MTK_VENC_MAX_H, 5, 6);
+				MTK_VENC_HD_MAX_H, 5, 6);
 
 	if (q_data->coded_width < DFT_CFG_WIDTH &&
-		(q_data->coded_width + 16) <= MTK_VENC_MAX_W)
+		(q_data->coded_width + 16) <= MTK_VENC_HD_MAX_W)
 		q_data->coded_width += 16;
 	if (q_data->coded_height < DFT_CFG_HEIGHT &&
-		(q_data->coded_height + 32) <= MTK_VENC_MAX_H)
+		(q_data->coded_height + 32) <= MTK_VENC_HD_MAX_H)
 		q_data->coded_height += 32;
 
 	q_data->sizeimage[0] =
@@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
 {
 	const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
 	struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
+	const u8 h264_max_level =
+		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
+		V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
 
 	v4l2_ctrl_handler_init(handler, MTK_MAX_CTRLS_HINT);
 
@@ -1240,8 +1264,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
 			V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
 			0, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH);
 	v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL,
-			V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
-			0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
+			       h264_max_level,
+			       0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
+
 	if (handler->error) {
 		mtk_v4l2_err("Init control handler fail %d",
 				handler->error);
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
index d0123dfc5f93..b6a4f2074fa5 100644
--- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
@@ -215,6 +215,10 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst,
 		return 41;
 	case V4L2_MPEG_VIDEO_H264_LEVEL_4_2:
 		return 42;
+	case V4L2_MPEG_VIDEO_H264_LEVEL_5_0:
+		return 50;
+	case V4L2_MPEG_VIDEO_H264_LEVEL_5_1:
+		return 51;
 	default:
 		mtk_vcodec_debug(inst, "unsupported level %d", level);
 		return 31;
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v4,6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
@ 2021-05-21  7:01   ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-21  7:01 UTC (permalink / raw)
  To: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, Irui Wang, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

MT8192 H264 support 4k(3840x2176) and Level 5.1 encoding,
add related path according to enc_capability.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      | 75 ++++++++++++-------
 .../platform/mtk-vcodec/venc/venc_h264_if.c   |  4 +
 2 files changed, 54 insertions(+), 25 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 42ff13867940..7396a5050b45 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -19,23 +19,32 @@
 
 #define MTK_VENC_MIN_W	160U
 #define MTK_VENC_MIN_H	128U
-#define MTK_VENC_MAX_W	1920U
-#define MTK_VENC_MAX_H	1088U
+#define MTK_VENC_HD_MAX_W	1920U
+#define MTK_VENC_HD_MAX_H	1088U
+#define MTK_VENC_4K_MAX_W	3840U
+#define MTK_VENC_4K_MAX_H	2176U
+
 #define DFT_CFG_WIDTH	MTK_VENC_MIN_W
 #define DFT_CFG_HEIGHT	MTK_VENC_MIN_H
 #define MTK_MAX_CTRLS_HINT	20
 
 #define MTK_DEFAULT_FRAMERATE_NUM 1001
 #define MTK_DEFAULT_FRAMERATE_DENOM 30000
+#define MTK_VENC_4K_CAPABILITY_ENABLE BIT(0)
 
 static void mtk_venc_worker(struct work_struct *work);
 
-static const struct v4l2_frmsize_stepwise mtk_venc_framesizes = {
-	MTK_VENC_MIN_W, MTK_VENC_MAX_W, 16,
-	MTK_VENC_MIN_H, MTK_VENC_MAX_H, 16,
+static const struct v4l2_frmsize_stepwise mtk_venc_hd_framesizes = {
+	MTK_VENC_MIN_W, MTK_VENC_HD_MAX_W, 16,
+	MTK_VENC_MIN_H, MTK_VENC_HD_MAX_H, 16,
+};
+
+static const struct v4l2_frmsize_stepwise mtk_venc_4k_framesizes = {
+	MTK_VENC_MIN_W, MTK_VENC_4K_MAX_W, 16,
+	MTK_VENC_MIN_H, MTK_VENC_4K_MAX_H, 16,
 };
 
-#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_framesizes)
+#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_hd_framesizes)
 
 static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl)
 {
@@ -151,17 +160,20 @@ static int vidioc_enum_framesizes(struct file *file, void *fh,
 				  struct v4l2_frmsizeenum *fsize)
 {
 	const struct mtk_video_fmt *fmt;
+	struct mtk_vcodec_ctx *ctx = fh_to_ctx(fh);
 
 	if (fsize->index != 0)
 		return -EINVAL;
 
 	fmt = mtk_venc_find_format(fsize->pixel_format,
-				   fh_to_ctx(fh)->dev->venc_pdata);
+				   ctx->dev->venc_pdata);
 	if (!fmt)
 		return -EINVAL;
 
 	fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
-	fsize->stepwise = mtk_venc_framesizes;
+	fsize->stepwise =
+		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
+		mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;
 
 	return 0;
 }
@@ -248,7 +260,7 @@ static struct mtk_q_data *mtk_venc_get_q_data(struct mtk_vcodec_ctx *ctx,
 /* V4L2 specification suggests the driver corrects the format struct if any of
  * the dimensions is unsupported
  */
-static int vidioc_try_fmt(struct v4l2_format *f,
+static int vidioc_try_fmt(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f,
 			  const struct mtk_video_fmt *fmt)
 {
 	struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
@@ -260,13 +272,22 @@ static int vidioc_try_fmt(struct v4l2_format *f,
 		pix_fmt_mp->plane_fmt[0].bytesperline = 0;
 	} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
 		int tmp_w, tmp_h;
+		unsigned int max_width, max_height;
+
+		if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) {
+			max_width = MTK_VENC_4K_MAX_W;
+			max_height = MTK_VENC_4K_MAX_H;
+		} else {
+			max_width = MTK_VENC_HD_MAX_W;
+			max_height = MTK_VENC_HD_MAX_H;
+		}
 
 		pix_fmt_mp->height = clamp(pix_fmt_mp->height,
 					MTK_VENC_MIN_H,
-					MTK_VENC_MAX_H);
+					max_height);
 		pix_fmt_mp->width = clamp(pix_fmt_mp->width,
 					MTK_VENC_MIN_W,
-					MTK_VENC_MAX_W);
+					max_width);
 
 		/* find next closer width align 16, heign align 32, size align
 		 * 64 rectangle
@@ -275,16 +296,16 @@ static int vidioc_try_fmt(struct v4l2_format *f,
 		tmp_h = pix_fmt_mp->height;
 		v4l_bound_align_image(&pix_fmt_mp->width,
 					MTK_VENC_MIN_W,
-					MTK_VENC_MAX_W, 4,
+					max_width, 4,
 					&pix_fmt_mp->height,
 					MTK_VENC_MIN_H,
-					MTK_VENC_MAX_H, 5, 6);
+					max_height, 5, 6);
 
 		if (pix_fmt_mp->width < tmp_w &&
-			(pix_fmt_mp->width + 16) <= MTK_VENC_MAX_W)
+			(pix_fmt_mp->width + 16) <= max_width)
 			pix_fmt_mp->width += 16;
 		if (pix_fmt_mp->height < tmp_h &&
-			(pix_fmt_mp->height + 32) <= MTK_VENC_MAX_H)
+			(pix_fmt_mp->height + 32) <= max_height)
 			pix_fmt_mp->height += 32;
 
 		mtk_v4l2_debug(0,
@@ -405,7 +426,7 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv,
 	}
 
 	q_data->fmt = fmt;
-	ret = vidioc_try_fmt(f, q_data->fmt);
+	ret = vidioc_try_fmt(ctx, f, q_data->fmt);
 	if (ret)
 		return ret;
 
@@ -467,7 +488,7 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
 		f->fmt.pix.pixelformat = fmt->fourcc;
 	}
 
-	ret = vidioc_try_fmt(f, fmt);
+	ret = vidioc_try_fmt(ctx, f, fmt);
 	if (ret)
 		return ret;
 
@@ -545,7 +566,7 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv,
 	f->fmt.pix_mp.quantization = ctx->quantization;
 	f->fmt.pix_mp.xfer_func = ctx->xfer_func;
 
-	return vidioc_try_fmt(f, fmt);
+	return vidioc_try_fmt(ctx, f, fmt);
 }
 
 static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
@@ -567,7 +588,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
 		f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT;
 	}
 
-	return vidioc_try_fmt(f, fmt);
+	return vidioc_try_fmt(ctx, f, fmt);
 }
 
 static int vidioc_venc_g_selection(struct file *file, void *priv,
@@ -1171,16 +1192,16 @@ void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx)
 
 	v4l_bound_align_image(&q_data->coded_width,
 				MTK_VENC_MIN_W,
-				MTK_VENC_MAX_W, 4,
+				MTK_VENC_HD_MAX_W, 4,
 				&q_data->coded_height,
 				MTK_VENC_MIN_H,
-				MTK_VENC_MAX_H, 5, 6);
+				MTK_VENC_HD_MAX_H, 5, 6);
 
 	if (q_data->coded_width < DFT_CFG_WIDTH &&
-		(q_data->coded_width + 16) <= MTK_VENC_MAX_W)
+		(q_data->coded_width + 16) <= MTK_VENC_HD_MAX_W)
 		q_data->coded_width += 16;
 	if (q_data->coded_height < DFT_CFG_HEIGHT &&
-		(q_data->coded_height + 32) <= MTK_VENC_MAX_H)
+		(q_data->coded_height + 32) <= MTK_VENC_HD_MAX_H)
 		q_data->coded_height += 32;
 
 	q_data->sizeimage[0] =
@@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
 {
 	const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
 	struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
+	const u8 h264_max_level =
+		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
+		V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
 
 	v4l2_ctrl_handler_init(handler, MTK_MAX_CTRLS_HINT);
 
@@ -1240,8 +1264,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
 			V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
 			0, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH);
 	v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL,
-			V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
-			0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
+			       h264_max_level,
+			       0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
+
 	if (handler->error) {
 		mtk_v4l2_err("Init control handler fail %d",
 				handler->error);
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
index d0123dfc5f93..b6a4f2074fa5 100644
--- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
@@ -215,6 +215,10 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst,
 		return 41;
 	case V4L2_MPEG_VIDEO_H264_LEVEL_4_2:
 		return 42;
+	case V4L2_MPEG_VIDEO_H264_LEVEL_5_0:
+		return 50;
+	case V4L2_MPEG_VIDEO_H264_LEVEL_5_1:
+		return 51;
 	default:
 		mtk_vcodec_debug(inst, "unsupported level %d", level);
 		return 31;
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4,1/6] media: mtk-vcodec: venc: remove redundant code
  2021-05-21  7:01   ` Irui Wang
  (?)
@ 2021-05-21  8:05     ` Tzung-Bi Shih
  -1 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:05 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
>
> From: Alexandre Courbot <acourbot@chromium.org>
>
> vidioc_try_fmt() does clamp height and width when called on the OUTPUT
> queue, so clamping them prior to calling this function is redundant. Set
> the queue's parameters after calling vidioc_try_fmt() so we can use the
> values it computed.
>
> Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

From the guideline[1]:
Notably, the last Signed-off-by: must always be that of the developer
submitting the patch

You should provide your signed-off.


[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by

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

* Re: [PATCH v4,1/6] media: mtk-vcodec: venc: remove redundant code
@ 2021-05-21  8:05     ` Tzung-Bi Shih
  0 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:05 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
>
> From: Alexandre Courbot <acourbot@chromium.org>
>
> vidioc_try_fmt() does clamp height and width when called on the OUTPUT
> queue, so clamping them prior to calling this function is redundant. Set
> the queue's parameters after calling vidioc_try_fmt() so we can use the
> values it computed.
>
> Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

From the guideline[1]:
Notably, the last Signed-off-by: must always be that of the developer
submitting the patch

You should provide your signed-off.


[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v4,1/6] media: mtk-vcodec: venc: remove redundant code
@ 2021-05-21  8:05     ` Tzung-Bi Shih
  0 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:05 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
>
> From: Alexandre Courbot <acourbot@chromium.org>
>
> vidioc_try_fmt() does clamp height and width when called on the OUTPUT
> queue, so clamping them prior to calling this function is redundant. Set
> the queue's parameters after calling vidioc_try_fmt() so we can use the
> values it computed.
>
> Signed-off-by: Alexandre Courbot <acourbot@chromium.org>

From the guideline[1]:
Notably, the last Signed-off-by: must always be that of the developer
submitting the patch

You should provide your signed-off.


[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4,3/6] media: mtk-vcodec: Support 4GB~8GB range iova space for venc
  2021-05-21  7:01   ` Irui Wang
  (?)
@ 2021-05-21  8:06     ` Tzung-Bi Shih
  -1 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:06 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
> +       if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
> +               dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
> +

From your previous dt-bindings patch[1], it has 4 banks.
> 0~4G; 4G~8G; 8G~12G; 12G~16G.

But, the code treats it as a boolean.  I.e. 0~4GB if non-existent;
otherwise, 4GB~8GB.

[1]: https://patchwork.linuxtv.org/project/linux-media/patch/20210521070139.20644-3-irui.wang@mediatek.com/

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

* Re: [PATCH v4,3/6] media: mtk-vcodec: Support 4GB~8GB range iova space for venc
@ 2021-05-21  8:06     ` Tzung-Bi Shih
  0 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:06 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
> +       if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
> +               dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
> +

From your previous dt-bindings patch[1], it has 4 banks.
> 0~4G; 4G~8G; 8G~12G; 12G~16G.

But, the code treats it as a boolean.  I.e. 0~4GB if non-existent;
otherwise, 4GB~8GB.

[1]: https://patchwork.linuxtv.org/project/linux-media/patch/20210521070139.20644-3-irui.wang@mediatek.com/

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v4,3/6] media: mtk-vcodec: Support 4GB~8GB range iova space for venc
@ 2021-05-21  8:06     ` Tzung-Bi Shih
  0 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:06 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
> +       if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
> +               dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
> +

From your previous dt-bindings patch[1], it has 4 banks.
> 0~4G; 4G~8G; 8G~12G; 12G~16G.

But, the code treats it as a boolean.  I.e. 0~4GB if non-existent;
otherwise, 4GB~8GB.

[1]: https://patchwork.linuxtv.org/project/linux-media/patch/20210521070139.20644-3-irui.wang@mediatek.com/

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
  2021-05-21  7:01   ` Irui Wang
  (?)
@ 2021-05-21  8:06     ` Tzung-Bi Shih
  -1 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:06 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
>
> Add MT8192 venc driver's compatible and device private data.
>
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>

Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>

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

* Re: [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
@ 2021-05-21  8:06     ` Tzung-Bi Shih
  0 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:06 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
>
> Add MT8192 venc driver's compatible and device private data.
>
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>

Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
@ 2021-05-21  8:06     ` Tzung-Bi Shih
  0 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:06 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
>
> Add MT8192 venc driver's compatible and device private data.
>
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>

Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4,6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
  2021-05-21  7:01   ` Irui Wang
  (?)
@ 2021-05-21  8:06     ` Tzung-Bi Shih
  -1 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:06 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
>         fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
> -       fsize->stepwise = mtk_venc_framesizes;
> +       fsize->stepwise =
> +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +               mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;

Use a normal if .. else .. is more readable.

> @@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
>  {
>         const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
>         struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
> +       const u8 h264_max_level =
> +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +               V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;

Again, I would like it to be a normal if .. else ..

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

* Re: [PATCH v4, 6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
@ 2021-05-21  8:06     ` Tzung-Bi Shih
  0 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:06 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
>         fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
> -       fsize->stepwise = mtk_venc_framesizes;
> +       fsize->stepwise =
> +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +               mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;

Use a normal if .. else .. is more readable.

> @@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
>  {
>         const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
>         struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
> +       const u8 h264_max_level =
> +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +               V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;

Again, I would like it to be a normal if .. else ..

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v4, 6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
@ 2021-05-21  8:06     ` Tzung-Bi Shih
  0 siblings, 0 replies; 51+ messages in thread
From: Tzung-Bi Shih @ 2021-05-21  8:06 UTC (permalink / raw)
  To: Irui Wang
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
>         fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
> -       fsize->stepwise = mtk_venc_framesizes;
> +       fsize->stepwise =
> +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +               mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;

Use a normal if .. else .. is more readable.

> @@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
>  {
>         const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
>         struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
> +       const u8 h264_max_level =
> +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +               V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;

Again, I would like it to be a normal if .. else ..

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4,3/6] media: mtk-vcodec: Support 4GB~8GB range iova space for venc
  2021-05-21  8:06     ` Tzung-Bi Shih
  (?)
@ 2021-05-22  9:50       ` Yong Wu
  -1 siblings, 0 replies; 51+ messages in thread
From: Yong Wu @ 2021-05-22  9:50 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Irui Wang, Alexandre Courbot, Hans Verkuil, Tiffany Lin,
	Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa, Hsin-Yi Wang, Maoguang Meng,
	Longfei Wang, Yunfei Dong, Fritz Koenig, Tzung-Bi Shih,
	linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, 2021-05-21 at 16:06 +0800, Tzung-Bi Shih wrote:
> On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
> > +       if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
> > +               dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
> > +
> 
> From your previous dt-bindings patch[1], it has 4 banks.
> > 0~4G; 4G~8G; 8G~12G; 12G~16G.
> 
> But, the code treats it as a boolean.  I.e. 0~4GB if non-existent;
> otherwise, 4GB~8GB.

Here DMA_BIT_MASK(34) means dma address support 34bits(16GB).

The code is ok for me. Only the commit message should not say 4G-8G. it
could be something like:

Use the dma_set_mask_and_coherent helper to set venc DMA bit mask to
support 34bits iova space(16GB) that the mt8192 iommu HW support. Whole
the iova range separate to 0~4G/4G~8G/8G~12G/12G~16G, Regarding which
iova range VENC actually locate, it depend on the dma-ranges property of
the venc dtsi node.

> 
> [1]: https://patchwork.linuxtv.org/project/linux-media/patch/20210521070139.20644-3-irui.wang@mediatek.com/
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek


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

* Re: [PATCH v4,3/6] media: mtk-vcodec: Support 4GB~8GB range iova space for venc
@ 2021-05-22  9:50       ` Yong Wu
  0 siblings, 0 replies; 51+ messages in thread
From: Yong Wu @ 2021-05-22  9:50 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Irui Wang, Alexandre Courbot, Hans Verkuil, Tiffany Lin,
	Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa, Hsin-Yi Wang, Maoguang Meng,
	Longfei Wang, Yunfei Dong, Fritz Koenig, Tzung-Bi Shih,
	linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, 2021-05-21 at 16:06 +0800, Tzung-Bi Shih wrote:
> On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
> > +       if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
> > +               dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
> > +
> 
> From your previous dt-bindings patch[1], it has 4 banks.
> > 0~4G; 4G~8G; 8G~12G; 12G~16G.
> 
> But, the code treats it as a boolean.  I.e. 0~4GB if non-existent;
> otherwise, 4GB~8GB.

Here DMA_BIT_MASK(34) means dma address support 34bits(16GB).

The code is ok for me. Only the commit message should not say 4G-8G. it
could be something like:

Use the dma_set_mask_and_coherent helper to set venc DMA bit mask to
support 34bits iova space(16GB) that the mt8192 iommu HW support. Whole
the iova range separate to 0~4G/4G~8G/8G~12G/12G~16G, Regarding which
iova range VENC actually locate, it depend on the dma-ranges property of
the venc dtsi node.

> 
> [1]: https://patchwork.linuxtv.org/project/linux-media/patch/20210521070139.20644-3-irui.wang@mediatek.com/
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v4,3/6] media: mtk-vcodec: Support 4GB~8GB range iova space for venc
@ 2021-05-22  9:50       ` Yong Wu
  0 siblings, 0 replies; 51+ messages in thread
From: Yong Wu @ 2021-05-22  9:50 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Irui Wang, Alexandre Courbot, Hans Verkuil, Tiffany Lin,
	Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa, Hsin-Yi Wang, Maoguang Meng,
	Longfei Wang, Yunfei Dong, Fritz Koenig, Tzung-Bi Shih,
	linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, 2021-05-21 at 16:06 +0800, Tzung-Bi Shih wrote:
> On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
> > +       if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))
> > +               dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
> > +
> 
> From your previous dt-bindings patch[1], it has 4 banks.
> > 0~4G; 4G~8G; 8G~12G; 12G~16G.
> 
> But, the code treats it as a boolean.  I.e. 0~4GB if non-existent;
> otherwise, 4GB~8GB.

Here DMA_BIT_MASK(34) means dma address support 34bits(16GB).

The code is ok for me. Only the commit message should not say 4G-8G. it
could be something like:

Use the dma_set_mask_and_coherent helper to set venc DMA bit mask to
support 34bits iova space(16GB) that the mt8192 iommu HW support. Whole
the iova range separate to 0~4G/4G~8G/8G~12G/12G~16G, Regarding which
iova range VENC actually locate, it depend on the dma-ranges property of
the venc dtsi node.

> 
> [1]: https://patchwork.linuxtv.org/project/linux-media/patch/20210521070139.20644-3-irui.wang@mediatek.com/
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4,6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
  2021-05-21  8:06     ` Tzung-Bi Shih
  (?)
@ 2021-05-24  2:39       ` Irui Wang
  -1 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-24  2:39 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, 2021-05-21 at 16:06 +0800, Tzung-Bi Shih wrote:
> On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
> >         fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
> > -       fsize->stepwise = mtk_venc_framesizes;
> > +       fsize->stepwise =
> > +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> > +               mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;
> 
> Use a normal if .. else .. is more readable.
if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE)
	fsize->stepwise = mtk_venc_4k_framesizes;
else
	fsize->stepwise = mtk_venc_hd_framesizes;

> 
> > @@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
> >  {
> >         const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
> >         struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
> > +       const u8 h264_max_level =
> > +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> > +               V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
> Again, I would like it to be a normal if .. else ..
u8 h264_max_level;
if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE)
	h264_max_level = V4L2_MPEG_VIDEO_H264_LEVEL_5_1;
else
	h264_max_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2;

Patch V5 will be sent with these if there is no more comments.

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

* Re: [PATCH v4,6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
@ 2021-05-24  2:39       ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-24  2:39 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, 2021-05-21 at 16:06 +0800, Tzung-Bi Shih wrote:
> On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
> >         fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
> > -       fsize->stepwise = mtk_venc_framesizes;
> > +       fsize->stepwise =
> > +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> > +               mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;
> 
> Use a normal if .. else .. is more readable.
if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE)
	fsize->stepwise = mtk_venc_4k_framesizes;
else
	fsize->stepwise = mtk_venc_hd_framesizes;

> 
> > @@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
> >  {
> >         const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
> >         struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
> > +       const u8 h264_max_level =
> > +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> > +               V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
> Again, I would like it to be a normal if .. else ..
u8 h264_max_level;
if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE)
	h264_max_level = V4L2_MPEG_VIDEO_H264_LEVEL_5_1;
else
	h264_max_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2;

Patch V5 will be sent with these if there is no more comments.
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v4,6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
@ 2021-05-24  2:39       ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-05-24  2:39 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List,
	moderated list:ARM/Mediatek SoC support, srv_heupstream,
	moderated list:ARM/Mediatek SoC support,
	Project_Global_Chrome_Upstream_Group

On Fri, 2021-05-21 at 16:06 +0800, Tzung-Bi Shih wrote:
> On Fri, May 21, 2021 at 3:02 PM Irui Wang <irui.wang@mediatek.com> wrote:
> >         fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
> > -       fsize->stepwise = mtk_venc_framesizes;
> > +       fsize->stepwise =
> > +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> > +               mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;
> 
> Use a normal if .. else .. is more readable.
if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE)
	fsize->stepwise = mtk_venc_4k_framesizes;
else
	fsize->stepwise = mtk_venc_hd_framesizes;

> 
> > @@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
> >  {
> >         const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
> >         struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
> > +       const u8 h264_max_level =
> > +               (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> > +               V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
> Again, I would like it to be a normal if .. else ..
u8 h264_max_level;
if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE)
	h264_max_level = V4L2_MPEG_VIDEO_H264_LEVEL_5_1;
else
	h264_max_level = V4L2_MPEG_VIDEO_H264_LEVEL_4_2;

Patch V5 will be sent with these if there is no more comments.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
  2021-05-21  7:01   ` Irui Wang
  (?)
@ 2021-05-28  5:27     ` Dafna Hirschfeld
  -1 siblings, 0 replies; 51+ messages in thread
From: Dafna Hirschfeld @ 2021-05-28  5:27 UTC (permalink / raw)
  To: Irui Wang, Alexandre Courbot, Hans Verkuil, Tiffany Lin,
	Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa, Hsin-Yi Wang, Maoguang Meng,
	Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Hi

On 21.05.21 10:01, Irui Wang wrote:
> Add MT8192 venc driver's compatible and device private data.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>   drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  1 +
>   .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 14 ++++++++++++++
>   2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> index d03cca95e99b..14893d277bb8 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> @@ -302,6 +302,7 @@ struct mtk_vcodec_ctx {
>   enum mtk_chip {
>   	MTK_MT8173,
>   	MTK_MT8183,
> +	MTK_MT8192,
>   };
>   
>   /**
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> index 26b089e81213..78f3dd166917 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> @@ -425,12 +425,26 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
>   	.core_id = VENC_SYS,
>   };
>   
> +static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
> +	.chip = MTK_MT8192,
> +	.uses_ext = true,
> +	/* MT8192 supports the same capture formats as MT8183*/

missing space before '*/'

> +	.capture_formats = mtk_video_formats_capture_mt8183,
> +	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183),
> +	/* MT8192 supports the same output formats as MT8173 */
> +	.output_formats = mtk_video_formats_output_mt8173,
> +	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173),

If all three models mt8173, mt8183 and mt8192 support the same formats then
we should probably not name the structs according to one of the models, so maybe:

s/mtk_video_formats_capture_mt8183/mtk_video_formats_capture/
s/mtk_video_formats_output_mt8173/mtk_video_formats_output/

or some other naming

Thanks,
Dafna


> +	.min_bitrate = 64,
> +	.max_bitrate = 100000000,
> +	.core_id = VENC_SYS,
> +};
>   static const struct of_device_id mtk_vcodec_enc_match[] = {
>   	{.compatible = "mediatek,mt8173-vcodec-enc",
>   			.data = &mt8173_avc_pdata},
>   	{.compatible = "mediatek,mt8173-vcodec-enc-vp8",
>   			.data = &mt8173_vp8_pdata},
>   	{.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
> +	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
> 

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

* Re: [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
@ 2021-05-28  5:27     ` Dafna Hirschfeld
  0 siblings, 0 replies; 51+ messages in thread
From: Dafna Hirschfeld @ 2021-05-28  5:27 UTC (permalink / raw)
  To: Irui Wang, Alexandre Courbot, Hans Verkuil, Tiffany Lin,
	Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa, Hsin-Yi Wang, Maoguang Meng,
	Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Hi

On 21.05.21 10:01, Irui Wang wrote:
> Add MT8192 venc driver's compatible and device private data.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>   drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  1 +
>   .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 14 ++++++++++++++
>   2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> index d03cca95e99b..14893d277bb8 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> @@ -302,6 +302,7 @@ struct mtk_vcodec_ctx {
>   enum mtk_chip {
>   	MTK_MT8173,
>   	MTK_MT8183,
> +	MTK_MT8192,
>   };
>   
>   /**
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> index 26b089e81213..78f3dd166917 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> @@ -425,12 +425,26 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
>   	.core_id = VENC_SYS,
>   };
>   
> +static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
> +	.chip = MTK_MT8192,
> +	.uses_ext = true,
> +	/* MT8192 supports the same capture formats as MT8183*/

missing space before '*/'

> +	.capture_formats = mtk_video_formats_capture_mt8183,
> +	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183),
> +	/* MT8192 supports the same output formats as MT8173 */
> +	.output_formats = mtk_video_formats_output_mt8173,
> +	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173),

If all three models mt8173, mt8183 and mt8192 support the same formats then
we should probably not name the structs according to one of the models, so maybe:

s/mtk_video_formats_capture_mt8183/mtk_video_formats_capture/
s/mtk_video_formats_output_mt8173/mtk_video_formats_output/

or some other naming

Thanks,
Dafna


> +	.min_bitrate = 64,
> +	.max_bitrate = 100000000,
> +	.core_id = VENC_SYS,
> +};
>   static const struct of_device_id mtk_vcodec_enc_match[] = {
>   	{.compatible = "mediatek,mt8173-vcodec-enc",
>   			.data = &mt8173_avc_pdata},
>   	{.compatible = "mediatek,mt8173-vcodec-enc-vp8",
>   			.data = &mt8173_vp8_pdata},
>   	{.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
> +	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
> 

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
@ 2021-05-28  5:27     ` Dafna Hirschfeld
  0 siblings, 0 replies; 51+ messages in thread
From: Dafna Hirschfeld @ 2021-05-28  5:27 UTC (permalink / raw)
  To: Irui Wang, Alexandre Courbot, Hans Verkuil, Tiffany Lin,
	Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa, Hsin-Yi Wang, Maoguang Meng,
	Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Hi

On 21.05.21 10:01, Irui Wang wrote:
> Add MT8192 venc driver's compatible and device private data.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>   drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  1 +
>   .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 14 ++++++++++++++
>   2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> index d03cca95e99b..14893d277bb8 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> @@ -302,6 +302,7 @@ struct mtk_vcodec_ctx {
>   enum mtk_chip {
>   	MTK_MT8173,
>   	MTK_MT8183,
> +	MTK_MT8192,
>   };
>   
>   /**
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> index 26b089e81213..78f3dd166917 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> @@ -425,12 +425,26 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
>   	.core_id = VENC_SYS,
>   };
>   
> +static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
> +	.chip = MTK_MT8192,
> +	.uses_ext = true,
> +	/* MT8192 supports the same capture formats as MT8183*/

missing space before '*/'

> +	.capture_formats = mtk_video_formats_capture_mt8183,
> +	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183),
> +	/* MT8192 supports the same output formats as MT8173 */
> +	.output_formats = mtk_video_formats_output_mt8173,
> +	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173),

If all three models mt8173, mt8183 and mt8192 support the same formats then
we should probably not name the structs according to one of the models, so maybe:

s/mtk_video_formats_capture_mt8183/mtk_video_formats_capture/
s/mtk_video_formats_output_mt8173/mtk_video_formats_output/

or some other naming

Thanks,
Dafna


> +	.min_bitrate = 64,
> +	.max_bitrate = 100000000,
> +	.core_id = VENC_SYS,
> +};
>   static const struct of_device_id mtk_vcodec_enc_match[] = {
>   	{.compatible = "mediatek,mt8173-vcodec-enc",
>   			.data = &mt8173_avc_pdata},
>   	{.compatible = "mediatek,mt8173-vcodec-enc-vp8",
>   			.data = &mt8173_vp8_pdata},
>   	{.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
> +	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4,6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
  2021-05-21  7:01   ` Irui Wang
  (?)
@ 2021-05-28  5:57     ` Dafna Hirschfeld
  -1 siblings, 0 replies; 51+ messages in thread
From: Dafna Hirschfeld @ 2021-05-28  5:57 UTC (permalink / raw)
  To: Irui Wang, Alexandre Courbot, Hans Verkuil, Tiffany Lin,
	Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa, Hsin-Yi Wang, Maoguang Meng,
	Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Hi,

On 21.05.21 10:01, Irui Wang wrote:
> MT8192 H264 support 4k(3840x2176) and Level 5.1 encoding,
> add related path according to enc_capability.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      | 75 ++++++++++++-------
>   .../platform/mtk-vcodec/venc/venc_h264_if.c   |  4 +
>   2 files changed, 54 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> index 42ff13867940..7396a5050b45 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> @@ -19,23 +19,32 @@
>   
>   #define MTK_VENC_MIN_W	160U
>   #define MTK_VENC_MIN_H	128U
> -#define MTK_VENC_MAX_W	1920U
> -#define MTK_VENC_MAX_H	1088U
> +#define MTK_VENC_HD_MAX_W	1920U
> +#define MTK_VENC_HD_MAX_H	1088U
> +#define MTK_VENC_4K_MAX_W	3840U
> +#define MTK_VENC_4K_MAX_H	2176U
> +
>   #define DFT_CFG_WIDTH	MTK_VENC_MIN_W
>   #define DFT_CFG_HEIGHT	MTK_VENC_MIN_H
>   #define MTK_MAX_CTRLS_HINT	20
>   
>   #define MTK_DEFAULT_FRAMERATE_NUM 1001
>   #define MTK_DEFAULT_FRAMERATE_DENOM 30000
> +#define MTK_VENC_4K_CAPABILITY_ENABLE BIT(0)
>   
>   static void mtk_venc_worker(struct work_struct *work);
>   
> -static const struct v4l2_frmsize_stepwise mtk_venc_framesizes = {
> -	MTK_VENC_MIN_W, MTK_VENC_MAX_W, 16,
> -	MTK_VENC_MIN_H, MTK_VENC_MAX_H, 16,
> +static const struct v4l2_frmsize_stepwise mtk_venc_hd_framesizes = {
> +	MTK_VENC_MIN_W, MTK_VENC_HD_MAX_W, 16,
> +	MTK_VENC_MIN_H, MTK_VENC_HD_MAX_H, 16,
> +};
> +
> +static const struct v4l2_frmsize_stepwise mtk_venc_4k_framesizes = {
> +	MTK_VENC_MIN_W, MTK_VENC_4K_MAX_W, 16,
> +	MTK_VENC_MIN_H, MTK_VENC_4K_MAX_H, 16,
>   };
>   
> -#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_framesizes)
> +#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_hd_framesizes)

This define is never used so it can be removed.

Thanks,
Dafna

>   
>   static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl)
>   {
> @@ -151,17 +160,20 @@ static int vidioc_enum_framesizes(struct file *file, void *fh,
>   				  struct v4l2_frmsizeenum *fsize)
>   {
>   	const struct mtk_video_fmt *fmt;
> +	struct mtk_vcodec_ctx *ctx = fh_to_ctx(fh);
>   
>   	if (fsize->index != 0)
>   		return -EINVAL;
>   
>   	fmt = mtk_venc_find_format(fsize->pixel_format,
> -				   fh_to_ctx(fh)->dev->venc_pdata);
> +				   ctx->dev->venc_pdata);
>   	if (!fmt)
>   		return -EINVAL;
>   
>   	fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
> -	fsize->stepwise = mtk_venc_framesizes;
> +	fsize->stepwise =
> +		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +		mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;
>   
>   	return 0;
>   }
> @@ -248,7 +260,7 @@ static struct mtk_q_data *mtk_venc_get_q_data(struct mtk_vcodec_ctx *ctx,
>   /* V4L2 specification suggests the driver corrects the format struct if any of
>    * the dimensions is unsupported
>    */
> -static int vidioc_try_fmt(struct v4l2_format *f,
> +static int vidioc_try_fmt(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f,
>   			  const struct mtk_video_fmt *fmt)
>   {
>   	struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
> @@ -260,13 +272,22 @@ static int vidioc_try_fmt(struct v4l2_format *f,
>   		pix_fmt_mp->plane_fmt[0].bytesperline = 0;
>   	} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
>   		int tmp_w, tmp_h;
> +		unsigned int max_width, max_height;
> +
> +		if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) {
> +			max_width = MTK_VENC_4K_MAX_W;
> +			max_height = MTK_VENC_4K_MAX_H;
> +		} else {
> +			max_width = MTK_VENC_HD_MAX_W;
> +			max_height = MTK_VENC_HD_MAX_H;
> +		}
>   
>   		pix_fmt_mp->height = clamp(pix_fmt_mp->height,
>   					MTK_VENC_MIN_H,
> -					MTK_VENC_MAX_H);
> +					max_height);
>   		pix_fmt_mp->width = clamp(pix_fmt_mp->width,
>   					MTK_VENC_MIN_W,
> -					MTK_VENC_MAX_W);
> +					max_width);
>   
>   		/* find next closer width align 16, heign align 32, size align
>   		 * 64 rectangle
> @@ -275,16 +296,16 @@ static int vidioc_try_fmt(struct v4l2_format *f,
>   		tmp_h = pix_fmt_mp->height;
>   		v4l_bound_align_image(&pix_fmt_mp->width,
>   					MTK_VENC_MIN_W,
> -					MTK_VENC_MAX_W, 4,
> +					max_width, 4,
>   					&pix_fmt_mp->height,
>   					MTK_VENC_MIN_H,
> -					MTK_VENC_MAX_H, 5, 6);
> +					max_height, 5, 6);
>   
>   		if (pix_fmt_mp->width < tmp_w &&
> -			(pix_fmt_mp->width + 16) <= MTK_VENC_MAX_W)
> +			(pix_fmt_mp->width + 16) <= max_width)
>   			pix_fmt_mp->width += 16;
>   		if (pix_fmt_mp->height < tmp_h &&
> -			(pix_fmt_mp->height + 32) <= MTK_VENC_MAX_H)
> +			(pix_fmt_mp->height + 32) <= max_height)
>   			pix_fmt_mp->height += 32;
>   
>   		mtk_v4l2_debug(0,
> @@ -405,7 +426,7 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv,
>   	}
>   
>   	q_data->fmt = fmt;
> -	ret = vidioc_try_fmt(f, q_data->fmt);
> +	ret = vidioc_try_fmt(ctx, f, q_data->fmt);
>   	if (ret)
>   		return ret;
>   
> @@ -467,7 +488,7 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
>   		f->fmt.pix.pixelformat = fmt->fourcc;
>   	}
>   
> -	ret = vidioc_try_fmt(f, fmt);
> +	ret = vidioc_try_fmt(ctx, f, fmt);
>   	if (ret)
>   		return ret;
>   
> @@ -545,7 +566,7 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv,
>   	f->fmt.pix_mp.quantization = ctx->quantization;
>   	f->fmt.pix_mp.xfer_func = ctx->xfer_func;
>   
> -	return vidioc_try_fmt(f, fmt);
> +	return vidioc_try_fmt(ctx, f, fmt);
>   }
>   
>   static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
> @@ -567,7 +588,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
>   		f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT;
>   	}
>   
> -	return vidioc_try_fmt(f, fmt);
> +	return vidioc_try_fmt(ctx, f, fmt);
>   }
>   
>   static int vidioc_venc_g_selection(struct file *file, void *priv,
> @@ -1171,16 +1192,16 @@ void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx)
>   
>   	v4l_bound_align_image(&q_data->coded_width,
>   				MTK_VENC_MIN_W,
> -				MTK_VENC_MAX_W, 4,
> +				MTK_VENC_HD_MAX_W, 4,
>   				&q_data->coded_height,
>   				MTK_VENC_MIN_H,
> -				MTK_VENC_MAX_H, 5, 6);
> +				MTK_VENC_HD_MAX_H, 5, 6);
>   
>   	if (q_data->coded_width < DFT_CFG_WIDTH &&
> -		(q_data->coded_width + 16) <= MTK_VENC_MAX_W)
> +		(q_data->coded_width + 16) <= MTK_VENC_HD_MAX_W)
>   		q_data->coded_width += 16;
>   	if (q_data->coded_height < DFT_CFG_HEIGHT &&
> -		(q_data->coded_height + 32) <= MTK_VENC_MAX_H)
> +		(q_data->coded_height + 32) <= MTK_VENC_HD_MAX_H)
>   		q_data->coded_height += 32;
>   
>   	q_data->sizeimage[0] =
> @@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
>   {
>   	const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
>   	struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
> +	const u8 h264_max_level =
> +		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +		V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
>   
>   	v4l2_ctrl_handler_init(handler, MTK_MAX_CTRLS_HINT);
>   
> @@ -1240,8 +1264,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
>   			V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
>   			0, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH);
>   	v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL,
> -			V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> -			0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
> +			       h264_max_level,
> +			       0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
> +
>   	if (handler->error) {
>   		mtk_v4l2_err("Init control handler fail %d",
>   				handler->error);
> diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> index d0123dfc5f93..b6a4f2074fa5 100644
> --- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> +++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> @@ -215,6 +215,10 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst,
>   		return 41;
>   	case V4L2_MPEG_VIDEO_H264_LEVEL_4_2:
>   		return 42;
> +	case V4L2_MPEG_VIDEO_H264_LEVEL_5_0:
> +		return 50;
> +	case V4L2_MPEG_VIDEO_H264_LEVEL_5_1:
> +		return 51;
>   	default:
>   		mtk_vcodec_debug(inst, "unsupported level %d", level);
>   		return 31;
> 

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

* Re: [PATCH v4, 6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
@ 2021-05-28  5:57     ` Dafna Hirschfeld
  0 siblings, 0 replies; 51+ messages in thread
From: Dafna Hirschfeld @ 2021-05-28  5:57 UTC (permalink / raw)
  To: Irui Wang, Alexandre Courbot, Hans Verkuil, Tiffany Lin,
	Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa, Hsin-Yi Wang, Maoguang Meng,
	Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Hi,

On 21.05.21 10:01, Irui Wang wrote:
> MT8192 H264 support 4k(3840x2176) and Level 5.1 encoding,
> add related path according to enc_capability.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      | 75 ++++++++++++-------
>   .../platform/mtk-vcodec/venc/venc_h264_if.c   |  4 +
>   2 files changed, 54 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> index 42ff13867940..7396a5050b45 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> @@ -19,23 +19,32 @@
>   
>   #define MTK_VENC_MIN_W	160U
>   #define MTK_VENC_MIN_H	128U
> -#define MTK_VENC_MAX_W	1920U
> -#define MTK_VENC_MAX_H	1088U
> +#define MTK_VENC_HD_MAX_W	1920U
> +#define MTK_VENC_HD_MAX_H	1088U
> +#define MTK_VENC_4K_MAX_W	3840U
> +#define MTK_VENC_4K_MAX_H	2176U
> +
>   #define DFT_CFG_WIDTH	MTK_VENC_MIN_W
>   #define DFT_CFG_HEIGHT	MTK_VENC_MIN_H
>   #define MTK_MAX_CTRLS_HINT	20
>   
>   #define MTK_DEFAULT_FRAMERATE_NUM 1001
>   #define MTK_DEFAULT_FRAMERATE_DENOM 30000
> +#define MTK_VENC_4K_CAPABILITY_ENABLE BIT(0)
>   
>   static void mtk_venc_worker(struct work_struct *work);
>   
> -static const struct v4l2_frmsize_stepwise mtk_venc_framesizes = {
> -	MTK_VENC_MIN_W, MTK_VENC_MAX_W, 16,
> -	MTK_VENC_MIN_H, MTK_VENC_MAX_H, 16,
> +static const struct v4l2_frmsize_stepwise mtk_venc_hd_framesizes = {
> +	MTK_VENC_MIN_W, MTK_VENC_HD_MAX_W, 16,
> +	MTK_VENC_MIN_H, MTK_VENC_HD_MAX_H, 16,
> +};
> +
> +static const struct v4l2_frmsize_stepwise mtk_venc_4k_framesizes = {
> +	MTK_VENC_MIN_W, MTK_VENC_4K_MAX_W, 16,
> +	MTK_VENC_MIN_H, MTK_VENC_4K_MAX_H, 16,
>   };
>   
> -#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_framesizes)
> +#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_hd_framesizes)

This define is never used so it can be removed.

Thanks,
Dafna

>   
>   static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl)
>   {
> @@ -151,17 +160,20 @@ static int vidioc_enum_framesizes(struct file *file, void *fh,
>   				  struct v4l2_frmsizeenum *fsize)
>   {
>   	const struct mtk_video_fmt *fmt;
> +	struct mtk_vcodec_ctx *ctx = fh_to_ctx(fh);
>   
>   	if (fsize->index != 0)
>   		return -EINVAL;
>   
>   	fmt = mtk_venc_find_format(fsize->pixel_format,
> -				   fh_to_ctx(fh)->dev->venc_pdata);
> +				   ctx->dev->venc_pdata);
>   	if (!fmt)
>   		return -EINVAL;
>   
>   	fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
> -	fsize->stepwise = mtk_venc_framesizes;
> +	fsize->stepwise =
> +		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +		mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;
>   
>   	return 0;
>   }
> @@ -248,7 +260,7 @@ static struct mtk_q_data *mtk_venc_get_q_data(struct mtk_vcodec_ctx *ctx,
>   /* V4L2 specification suggests the driver corrects the format struct if any of
>    * the dimensions is unsupported
>    */
> -static int vidioc_try_fmt(struct v4l2_format *f,
> +static int vidioc_try_fmt(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f,
>   			  const struct mtk_video_fmt *fmt)
>   {
>   	struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
> @@ -260,13 +272,22 @@ static int vidioc_try_fmt(struct v4l2_format *f,
>   		pix_fmt_mp->plane_fmt[0].bytesperline = 0;
>   	} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
>   		int tmp_w, tmp_h;
> +		unsigned int max_width, max_height;
> +
> +		if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) {
> +			max_width = MTK_VENC_4K_MAX_W;
> +			max_height = MTK_VENC_4K_MAX_H;
> +		} else {
> +			max_width = MTK_VENC_HD_MAX_W;
> +			max_height = MTK_VENC_HD_MAX_H;
> +		}
>   
>   		pix_fmt_mp->height = clamp(pix_fmt_mp->height,
>   					MTK_VENC_MIN_H,
> -					MTK_VENC_MAX_H);
> +					max_height);
>   		pix_fmt_mp->width = clamp(pix_fmt_mp->width,
>   					MTK_VENC_MIN_W,
> -					MTK_VENC_MAX_W);
> +					max_width);
>   
>   		/* find next closer width align 16, heign align 32, size align
>   		 * 64 rectangle
> @@ -275,16 +296,16 @@ static int vidioc_try_fmt(struct v4l2_format *f,
>   		tmp_h = pix_fmt_mp->height;
>   		v4l_bound_align_image(&pix_fmt_mp->width,
>   					MTK_VENC_MIN_W,
> -					MTK_VENC_MAX_W, 4,
> +					max_width, 4,
>   					&pix_fmt_mp->height,
>   					MTK_VENC_MIN_H,
> -					MTK_VENC_MAX_H, 5, 6);
> +					max_height, 5, 6);
>   
>   		if (pix_fmt_mp->width < tmp_w &&
> -			(pix_fmt_mp->width + 16) <= MTK_VENC_MAX_W)
> +			(pix_fmt_mp->width + 16) <= max_width)
>   			pix_fmt_mp->width += 16;
>   		if (pix_fmt_mp->height < tmp_h &&
> -			(pix_fmt_mp->height + 32) <= MTK_VENC_MAX_H)
> +			(pix_fmt_mp->height + 32) <= max_height)
>   			pix_fmt_mp->height += 32;
>   
>   		mtk_v4l2_debug(0,
> @@ -405,7 +426,7 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv,
>   	}
>   
>   	q_data->fmt = fmt;
> -	ret = vidioc_try_fmt(f, q_data->fmt);
> +	ret = vidioc_try_fmt(ctx, f, q_data->fmt);
>   	if (ret)
>   		return ret;
>   
> @@ -467,7 +488,7 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
>   		f->fmt.pix.pixelformat = fmt->fourcc;
>   	}
>   
> -	ret = vidioc_try_fmt(f, fmt);
> +	ret = vidioc_try_fmt(ctx, f, fmt);
>   	if (ret)
>   		return ret;
>   
> @@ -545,7 +566,7 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv,
>   	f->fmt.pix_mp.quantization = ctx->quantization;
>   	f->fmt.pix_mp.xfer_func = ctx->xfer_func;
>   
> -	return vidioc_try_fmt(f, fmt);
> +	return vidioc_try_fmt(ctx, f, fmt);
>   }
>   
>   static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
> @@ -567,7 +588,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
>   		f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT;
>   	}
>   
> -	return vidioc_try_fmt(f, fmt);
> +	return vidioc_try_fmt(ctx, f, fmt);
>   }
>   
>   static int vidioc_venc_g_selection(struct file *file, void *priv,
> @@ -1171,16 +1192,16 @@ void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx)
>   
>   	v4l_bound_align_image(&q_data->coded_width,
>   				MTK_VENC_MIN_W,
> -				MTK_VENC_MAX_W, 4,
> +				MTK_VENC_HD_MAX_W, 4,
>   				&q_data->coded_height,
>   				MTK_VENC_MIN_H,
> -				MTK_VENC_MAX_H, 5, 6);
> +				MTK_VENC_HD_MAX_H, 5, 6);
>   
>   	if (q_data->coded_width < DFT_CFG_WIDTH &&
> -		(q_data->coded_width + 16) <= MTK_VENC_MAX_W)
> +		(q_data->coded_width + 16) <= MTK_VENC_HD_MAX_W)
>   		q_data->coded_width += 16;
>   	if (q_data->coded_height < DFT_CFG_HEIGHT &&
> -		(q_data->coded_height + 32) <= MTK_VENC_MAX_H)
> +		(q_data->coded_height + 32) <= MTK_VENC_HD_MAX_H)
>   		q_data->coded_height += 32;
>   
>   	q_data->sizeimage[0] =
> @@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
>   {
>   	const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
>   	struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
> +	const u8 h264_max_level =
> +		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +		V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
>   
>   	v4l2_ctrl_handler_init(handler, MTK_MAX_CTRLS_HINT);
>   
> @@ -1240,8 +1264,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
>   			V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
>   			0, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH);
>   	v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL,
> -			V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> -			0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
> +			       h264_max_level,
> +			       0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
> +
>   	if (handler->error) {
>   		mtk_v4l2_err("Init control handler fail %d",
>   				handler->error);
> diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> index d0123dfc5f93..b6a4f2074fa5 100644
> --- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> +++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> @@ -215,6 +215,10 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst,
>   		return 41;
>   	case V4L2_MPEG_VIDEO_H264_LEVEL_4_2:
>   		return 42;
> +	case V4L2_MPEG_VIDEO_H264_LEVEL_5_0:
> +		return 50;
> +	case V4L2_MPEG_VIDEO_H264_LEVEL_5_1:
> +		return 51;
>   	default:
>   		mtk_vcodec_debug(inst, "unsupported level %d", level);
>   		return 31;
> 

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v4, 6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding
@ 2021-05-28  5:57     ` Dafna Hirschfeld
  0 siblings, 0 replies; 51+ messages in thread
From: Dafna Hirschfeld @ 2021-05-28  5:57 UTC (permalink / raw)
  To: Irui Wang, Alexandre Courbot, Hans Verkuil, Tiffany Lin,
	Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa, Hsin-Yi Wang, Maoguang Meng,
	Longfei Wang, Yong Wu
  Cc: Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Hi,

On 21.05.21 10:01, Irui Wang wrote:
> MT8192 H264 support 4k(3840x2176) and Level 5.1 encoding,
> add related path according to enc_capability.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>   .../platform/mtk-vcodec/mtk_vcodec_enc.c      | 75 ++++++++++++-------
>   .../platform/mtk-vcodec/venc/venc_h264_if.c   |  4 +
>   2 files changed, 54 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> index 42ff13867940..7396a5050b45 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> @@ -19,23 +19,32 @@
>   
>   #define MTK_VENC_MIN_W	160U
>   #define MTK_VENC_MIN_H	128U
> -#define MTK_VENC_MAX_W	1920U
> -#define MTK_VENC_MAX_H	1088U
> +#define MTK_VENC_HD_MAX_W	1920U
> +#define MTK_VENC_HD_MAX_H	1088U
> +#define MTK_VENC_4K_MAX_W	3840U
> +#define MTK_VENC_4K_MAX_H	2176U
> +
>   #define DFT_CFG_WIDTH	MTK_VENC_MIN_W
>   #define DFT_CFG_HEIGHT	MTK_VENC_MIN_H
>   #define MTK_MAX_CTRLS_HINT	20
>   
>   #define MTK_DEFAULT_FRAMERATE_NUM 1001
>   #define MTK_DEFAULT_FRAMERATE_DENOM 30000
> +#define MTK_VENC_4K_CAPABILITY_ENABLE BIT(0)
>   
>   static void mtk_venc_worker(struct work_struct *work);
>   
> -static const struct v4l2_frmsize_stepwise mtk_venc_framesizes = {
> -	MTK_VENC_MIN_W, MTK_VENC_MAX_W, 16,
> -	MTK_VENC_MIN_H, MTK_VENC_MAX_H, 16,
> +static const struct v4l2_frmsize_stepwise mtk_venc_hd_framesizes = {
> +	MTK_VENC_MIN_W, MTK_VENC_HD_MAX_W, 16,
> +	MTK_VENC_MIN_H, MTK_VENC_HD_MAX_H, 16,
> +};
> +
> +static const struct v4l2_frmsize_stepwise mtk_venc_4k_framesizes = {
> +	MTK_VENC_MIN_W, MTK_VENC_4K_MAX_W, 16,
> +	MTK_VENC_MIN_H, MTK_VENC_4K_MAX_H, 16,
>   };
>   
> -#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_framesizes)
> +#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_venc_hd_framesizes)

This define is never used so it can be removed.

Thanks,
Dafna

>   
>   static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl)
>   {
> @@ -151,17 +160,20 @@ static int vidioc_enum_framesizes(struct file *file, void *fh,
>   				  struct v4l2_frmsizeenum *fsize)
>   {
>   	const struct mtk_video_fmt *fmt;
> +	struct mtk_vcodec_ctx *ctx = fh_to_ctx(fh);
>   
>   	if (fsize->index != 0)
>   		return -EINVAL;
>   
>   	fmt = mtk_venc_find_format(fsize->pixel_format,
> -				   fh_to_ctx(fh)->dev->venc_pdata);
> +				   ctx->dev->venc_pdata);
>   	if (!fmt)
>   		return -EINVAL;
>   
>   	fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
> -	fsize->stepwise = mtk_venc_framesizes;
> +	fsize->stepwise =
> +		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +		mtk_venc_4k_framesizes : mtk_venc_hd_framesizes;
>   
>   	return 0;
>   }
> @@ -248,7 +260,7 @@ static struct mtk_q_data *mtk_venc_get_q_data(struct mtk_vcodec_ctx *ctx,
>   /* V4L2 specification suggests the driver corrects the format struct if any of
>    * the dimensions is unsupported
>    */
> -static int vidioc_try_fmt(struct v4l2_format *f,
> +static int vidioc_try_fmt(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f,
>   			  const struct mtk_video_fmt *fmt)
>   {
>   	struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
> @@ -260,13 +272,22 @@ static int vidioc_try_fmt(struct v4l2_format *f,
>   		pix_fmt_mp->plane_fmt[0].bytesperline = 0;
>   	} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
>   		int tmp_w, tmp_h;
> +		unsigned int max_width, max_height;
> +
> +		if (ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) {
> +			max_width = MTK_VENC_4K_MAX_W;
> +			max_height = MTK_VENC_4K_MAX_H;
> +		} else {
> +			max_width = MTK_VENC_HD_MAX_W;
> +			max_height = MTK_VENC_HD_MAX_H;
> +		}
>   
>   		pix_fmt_mp->height = clamp(pix_fmt_mp->height,
>   					MTK_VENC_MIN_H,
> -					MTK_VENC_MAX_H);
> +					max_height);
>   		pix_fmt_mp->width = clamp(pix_fmt_mp->width,
>   					MTK_VENC_MIN_W,
> -					MTK_VENC_MAX_W);
> +					max_width);
>   
>   		/* find next closer width align 16, heign align 32, size align
>   		 * 64 rectangle
> @@ -275,16 +296,16 @@ static int vidioc_try_fmt(struct v4l2_format *f,
>   		tmp_h = pix_fmt_mp->height;
>   		v4l_bound_align_image(&pix_fmt_mp->width,
>   					MTK_VENC_MIN_W,
> -					MTK_VENC_MAX_W, 4,
> +					max_width, 4,
>   					&pix_fmt_mp->height,
>   					MTK_VENC_MIN_H,
> -					MTK_VENC_MAX_H, 5, 6);
> +					max_height, 5, 6);
>   
>   		if (pix_fmt_mp->width < tmp_w &&
> -			(pix_fmt_mp->width + 16) <= MTK_VENC_MAX_W)
> +			(pix_fmt_mp->width + 16) <= max_width)
>   			pix_fmt_mp->width += 16;
>   		if (pix_fmt_mp->height < tmp_h &&
> -			(pix_fmt_mp->height + 32) <= MTK_VENC_MAX_H)
> +			(pix_fmt_mp->height + 32) <= max_height)
>   			pix_fmt_mp->height += 32;
>   
>   		mtk_v4l2_debug(0,
> @@ -405,7 +426,7 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv,
>   	}
>   
>   	q_data->fmt = fmt;
> -	ret = vidioc_try_fmt(f, q_data->fmt);
> +	ret = vidioc_try_fmt(ctx, f, q_data->fmt);
>   	if (ret)
>   		return ret;
>   
> @@ -467,7 +488,7 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,
>   		f->fmt.pix.pixelformat = fmt->fourcc;
>   	}
>   
> -	ret = vidioc_try_fmt(f, fmt);
> +	ret = vidioc_try_fmt(ctx, f, fmt);
>   	if (ret)
>   		return ret;
>   
> @@ -545,7 +566,7 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv,
>   	f->fmt.pix_mp.quantization = ctx->quantization;
>   	f->fmt.pix_mp.xfer_func = ctx->xfer_func;
>   
> -	return vidioc_try_fmt(f, fmt);
> +	return vidioc_try_fmt(ctx, f, fmt);
>   }
>   
>   static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
> @@ -567,7 +588,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
>   		f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT;
>   	}
>   
> -	return vidioc_try_fmt(f, fmt);
> +	return vidioc_try_fmt(ctx, f, fmt);
>   }
>   
>   static int vidioc_venc_g_selection(struct file *file, void *priv,
> @@ -1171,16 +1192,16 @@ void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx)
>   
>   	v4l_bound_align_image(&q_data->coded_width,
>   				MTK_VENC_MIN_W,
> -				MTK_VENC_MAX_W, 4,
> +				MTK_VENC_HD_MAX_W, 4,
>   				&q_data->coded_height,
>   				MTK_VENC_MIN_H,
> -				MTK_VENC_MAX_H, 5, 6);
> +				MTK_VENC_HD_MAX_H, 5, 6);
>   
>   	if (q_data->coded_width < DFT_CFG_WIDTH &&
> -		(q_data->coded_width + 16) <= MTK_VENC_MAX_W)
> +		(q_data->coded_width + 16) <= MTK_VENC_HD_MAX_W)
>   		q_data->coded_width += 16;
>   	if (q_data->coded_height < DFT_CFG_HEIGHT &&
> -		(q_data->coded_height + 32) <= MTK_VENC_MAX_H)
> +		(q_data->coded_height + 32) <= MTK_VENC_HD_MAX_H)
>   		q_data->coded_height += 32;
>   
>   	q_data->sizeimage[0] =
> @@ -1210,6 +1231,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
>   {
>   	const struct v4l2_ctrl_ops *ops = &mtk_vcodec_enc_ctrl_ops;
>   	struct v4l2_ctrl_handler *handler = &ctx->ctrl_hdl;
> +	const u8 h264_max_level =
> +		(ctx->dev->enc_capability & MTK_VENC_4K_CAPABILITY_ENABLE) ?
> +		V4L2_MPEG_VIDEO_H264_LEVEL_5_1 : V4L2_MPEG_VIDEO_H264_LEVEL_4_2;
>   
>   	v4l2_ctrl_handler_init(handler, MTK_MAX_CTRLS_HINT);
>   
> @@ -1240,8 +1264,9 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)
>   			V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
>   			0, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH);
>   	v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL,
> -			V4L2_MPEG_VIDEO_H264_LEVEL_4_2,
> -			0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
> +			       h264_max_level,
> +			       0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0);
> +
>   	if (handler->error) {
>   		mtk_v4l2_err("Init control handler fail %d",
>   				handler->error);
> diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> index d0123dfc5f93..b6a4f2074fa5 100644
> --- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> +++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
> @@ -215,6 +215,10 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst,
>   		return 41;
>   	case V4L2_MPEG_VIDEO_H264_LEVEL_4_2:
>   		return 42;
> +	case V4L2_MPEG_VIDEO_H264_LEVEL_5_0:
> +		return 50;
> +	case V4L2_MPEG_VIDEO_H264_LEVEL_5_1:
> +		return 51;
>   	default:
>   		mtk_vcodec_debug(inst, "unsupported level %d", level);
>   		return 31;
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4,2/6] dt-bindings: media: mtk-vcodec: Add dma-ranges property
  2021-05-21  7:01   ` Irui Wang
  (?)
@ 2021-06-02 18:50     ` Rob Herring
  -1 siblings, 0 replies; 51+ messages in thread
From: Rob Herring @ 2021-06-02 18:50 UTC (permalink / raw)
  To: Irui Wang
  Cc: Tiffany Lin, Maoguang Meng, Alexandre Courbot, linux-media,
	Longfei Wang, Yong Wu, Project_Global_Chrome_Upstream_Group,
	Tomasz Figa, linux-mediatek, Rob Herring, Matthias Brugger,
	Andrew-CT Chen, devicetree, Hans Verkuil, Hsin-Yi Wang,
	Tzung-Bi Shih, Fritz Koenig, Mauro Carvalho Chehab,
	srv_heupstream, linux-arm-kernel, Yunfei Dong, linux-kernel

On Fri, 21 May 2021 15:01:35 +0800, Irui Wang wrote:
> The mt8192 iommu support 0~16GB iova. We separate it to four banks:
> 0~4G; 4G~8G; 8G~12G; 12G~16G.
> 
> The "dma-ranges" could be used to adjust the bank we locate.
> If we don't set this property. The default range always is 0~4G.
> 
> Here we don't have actual bus/parent concept here.  And the iova
> requirement is for our HW. Thus put the property in our node.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>  Documentation/devicetree/bindings/media/mediatek-vcodec.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v4,2/6] dt-bindings: media: mtk-vcodec: Add dma-ranges property
@ 2021-06-02 18:50     ` Rob Herring
  0 siblings, 0 replies; 51+ messages in thread
From: Rob Herring @ 2021-06-02 18:50 UTC (permalink / raw)
  To: Irui Wang
  Cc: Tiffany Lin, Maoguang Meng, Alexandre Courbot, linux-media,
	Longfei Wang, Yong Wu, Project_Global_Chrome_Upstream_Group,
	Tomasz Figa, linux-mediatek, Rob Herring, Matthias Brugger,
	Andrew-CT Chen, devicetree, Hans Verkuil, Hsin-Yi Wang,
	Tzung-Bi Shih, Fritz Koenig, Mauro Carvalho Chehab,
	srv_heupstream, linux-arm-kernel, Yunfei Dong, linux-kernel

On Fri, 21 May 2021 15:01:35 +0800, Irui Wang wrote:
> The mt8192 iommu support 0~16GB iova. We separate it to four banks:
> 0~4G; 4G~8G; 8G~12G; 12G~16G.
> 
> The "dma-ranges" could be used to adjust the bank we locate.
> If we don't set this property. The default range always is 0~4G.
> 
> Here we don't have actual bus/parent concept here.  And the iova
> requirement is for our HW. Thus put the property in our node.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>  Documentation/devicetree/bindings/media/mediatek-vcodec.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v4,2/6] dt-bindings: media: mtk-vcodec: Add dma-ranges property
@ 2021-06-02 18:50     ` Rob Herring
  0 siblings, 0 replies; 51+ messages in thread
From: Rob Herring @ 2021-06-02 18:50 UTC (permalink / raw)
  To: Irui Wang
  Cc: Tiffany Lin, Maoguang Meng, Alexandre Courbot, linux-media,
	Longfei Wang, Yong Wu, Project_Global_Chrome_Upstream_Group,
	Tomasz Figa, linux-mediatek, Rob Herring, Matthias Brugger,
	Andrew-CT Chen, devicetree, Hans Verkuil, Hsin-Yi Wang,
	Tzung-Bi Shih, Fritz Koenig, Mauro Carvalho Chehab,
	srv_heupstream, linux-arm-kernel, Yunfei Dong, linux-kernel

On Fri, 21 May 2021 15:01:35 +0800, Irui Wang wrote:
> The mt8192 iommu support 0~16GB iova. We separate it to four banks:
> 0~4G; 4G~8G; 8G~12G; 12G~16G.
> 
> The "dma-ranges" could be used to adjust the bank we locate.
> If we don't set this property. The default range always is 0~4G.
> 
> Here we don't have actual bus/parent concept here.  And the iova
> requirement is for our HW. Thus put the property in our node.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>  Documentation/devicetree/bindings/media/mediatek-vcodec.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
  2021-05-28  5:27     ` Dafna Hirschfeld
  (?)
@ 2021-06-03  3:55       ` Irui Wang
  -1 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-06-03  3:55 UTC (permalink / raw)
  To: Dafna Hirschfeld
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Hi,

On Fri, 2021-05-28 at 08:27 +0300, Dafna Hirschfeld wrote:
> Hi
> 
> On 21.05.21 10:01, Irui Wang wrote:
> > Add MT8192 venc driver's compatible and device private data.
> > 
> > Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> > ---
> >   drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  1 +
> >   .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 14 ++++++++++++++
> >   2 files changed, 15 insertions(+)
> > 
> > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> > index d03cca95e99b..14893d277bb8 100644
> > --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> > @@ -302,6 +302,7 @@ struct mtk_vcodec_ctx {
> >   enum mtk_chip {
> >   	MTK_MT8173,
> >   	MTK_MT8183,
> > +	MTK_MT8192,
> >   };
> >   
> >   /**
> > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> > index 26b089e81213..78f3dd166917 100644
> > --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> > @@ -425,12 +425,26 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
> >   	.core_id = VENC_SYS,
> >   };
> >   
> > +static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
> > +	.chip = MTK_MT8192,
> > +	.uses_ext = true,
> > +	/* MT8192 supports the same capture formats as MT8183*/
> 
> missing space before '*/'
> 
> > +	.capture_formats = mtk_video_formats_capture_mt8183,
> > +	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183),
> > +	/* MT8192 supports the same output formats as MT8173 */
> > +	.output_formats = mtk_video_formats_output_mt8173,
> > +	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173),
> 
> If all three models mt8173, mt8183 and mt8192 support the same formats then
> we should probably not name the structs according to one of the models, so maybe:
> 
> s/mtk_video_formats_capture_mt8183/mtk_video_formats_capture/
> s/mtk_video_formats_output_mt8173/mtk_video_formats_output/
> 
> or some other naming
> 
> Thanks,
> Dafna

Thanks for your review and comments, we will rename these in another
patchset, this patchset just for MT8192 now.
> 
> 
> > +	.min_bitrate = 64,
> > +	.max_bitrate = 100000000,
> > +	.core_id = VENC_SYS,
> > +};
> >   static const struct of_device_id mtk_vcodec_enc_match[] = {
> >   	{.compatible = "mediatek,mt8173-vcodec-enc",
> >   			.data = &mt8173_avc_pdata},
> >   	{.compatible = "mediatek,mt8173-vcodec-enc-vp8",
> >   			.data = &mt8173_vp8_pdata},
> >   	{.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
> > +	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
> >   	{},
> >   };
> >   MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
> > 


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

* Re: [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
@ 2021-06-03  3:55       ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-06-03  3:55 UTC (permalink / raw)
  To: Dafna Hirschfeld
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Hi,

On Fri, 2021-05-28 at 08:27 +0300, Dafna Hirschfeld wrote:
> Hi
> 
> On 21.05.21 10:01, Irui Wang wrote:
> > Add MT8192 venc driver's compatible and device private data.
> > 
> > Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> > ---
> >   drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  1 +
> >   .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 14 ++++++++++++++
> >   2 files changed, 15 insertions(+)
> > 
> > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> > index d03cca95e99b..14893d277bb8 100644
> > --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> > @@ -302,6 +302,7 @@ struct mtk_vcodec_ctx {
> >   enum mtk_chip {
> >   	MTK_MT8173,
> >   	MTK_MT8183,
> > +	MTK_MT8192,
> >   };
> >   
> >   /**
> > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> > index 26b089e81213..78f3dd166917 100644
> > --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> > @@ -425,12 +425,26 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
> >   	.core_id = VENC_SYS,
> >   };
> >   
> > +static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
> > +	.chip = MTK_MT8192,
> > +	.uses_ext = true,
> > +	/* MT8192 supports the same capture formats as MT8183*/
> 
> missing space before '*/'
> 
> > +	.capture_formats = mtk_video_formats_capture_mt8183,
> > +	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183),
> > +	/* MT8192 supports the same output formats as MT8173 */
> > +	.output_formats = mtk_video_formats_output_mt8173,
> > +	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173),
> 
> If all three models mt8173, mt8183 and mt8192 support the same formats then
> we should probably not name the structs according to one of the models, so maybe:
> 
> s/mtk_video_formats_capture_mt8183/mtk_video_formats_capture/
> s/mtk_video_formats_output_mt8173/mtk_video_formats_output/
> 
> or some other naming
> 
> Thanks,
> Dafna

Thanks for your review and comments, we will rename these in another
patchset, this patchset just for MT8192 now.
> 
> 
> > +	.min_bitrate = 64,
> > +	.max_bitrate = 100000000,
> > +	.core_id = VENC_SYS,
> > +};
> >   static const struct of_device_id mtk_vcodec_enc_match[] = {
> >   	{.compatible = "mediatek,mt8173-vcodec-enc",
> >   			.data = &mt8173_avc_pdata},
> >   	{.compatible = "mediatek,mt8173-vcodec-enc-vp8",
> >   			.data = &mt8173_vp8_pdata},
> >   	{.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
> > +	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
> >   	{},
> >   };
> >   MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
> > 

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver
@ 2021-06-03  3:55       ` Irui Wang
  0 siblings, 0 replies; 51+ messages in thread
From: Irui Wang @ 2021-06-03  3:55 UTC (permalink / raw)
  To: Dafna Hirschfeld
  Cc: Alexandre Courbot, Hans Verkuil, Tiffany Lin, Andrew-CT Chen,
	Mauro Carvalho Chehab, Rob Herring, Matthias Brugger,
	Tomasz Figa, Hsin-Yi Wang, Maoguang Meng, Longfei Wang, Yong Wu,
	Yunfei Dong, Fritz Koenig, Tzung-Bi Shih, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, srv_heupstream,
	linux-mediatek, Project_Global_Chrome_Upstream_Group

Hi,

On Fri, 2021-05-28 at 08:27 +0300, Dafna Hirschfeld wrote:
> Hi
> 
> On 21.05.21 10:01, Irui Wang wrote:
> > Add MT8192 venc driver's compatible and device private data.
> > 
> > Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> > ---
> >   drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  1 +
> >   .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 14 ++++++++++++++
> >   2 files changed, 15 insertions(+)
> > 
> > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> > index d03cca95e99b..14893d277bb8 100644
> > --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> > @@ -302,6 +302,7 @@ struct mtk_vcodec_ctx {
> >   enum mtk_chip {
> >   	MTK_MT8173,
> >   	MTK_MT8183,
> > +	MTK_MT8192,
> >   };
> >   
> >   /**
> > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> > index 26b089e81213..78f3dd166917 100644
> > --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> > @@ -425,12 +425,26 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = {
> >   	.core_id = VENC_SYS,
> >   };
> >   
> > +static const struct mtk_vcodec_enc_pdata mt8192_pdata = {
> > +	.chip = MTK_MT8192,
> > +	.uses_ext = true,
> > +	/* MT8192 supports the same capture formats as MT8183*/
> 
> missing space before '*/'
> 
> > +	.capture_formats = mtk_video_formats_capture_mt8183,
> > +	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183),
> > +	/* MT8192 supports the same output formats as MT8173 */
> > +	.output_formats = mtk_video_formats_output_mt8173,
> > +	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173),
> 
> If all three models mt8173, mt8183 and mt8192 support the same formats then
> we should probably not name the structs according to one of the models, so maybe:
> 
> s/mtk_video_formats_capture_mt8183/mtk_video_formats_capture/
> s/mtk_video_formats_output_mt8173/mtk_video_formats_output/
> 
> or some other naming
> 
> Thanks,
> Dafna

Thanks for your review and comments, we will rename these in another
patchset, this patchset just for MT8192 now.
> 
> 
> > +	.min_bitrate = 64,
> > +	.max_bitrate = 100000000,
> > +	.core_id = VENC_SYS,
> > +};
> >   static const struct of_device_id mtk_vcodec_enc_match[] = {
> >   	{.compatible = "mediatek,mt8173-vcodec-enc",
> >   			.data = &mt8173_avc_pdata},
> >   	{.compatible = "mediatek,mt8173-vcodec-enc-vp8",
> >   			.data = &mt8173_vp8_pdata},
> >   	{.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
> > +	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
> >   	{},
> >   };
> >   MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
> > 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-06-03  4:00 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21  7:01 [PATCH v4,0/6] Support H264 4K on MT8192 Irui Wang
2021-05-21  7:01 ` Irui Wang
2021-05-21  7:01 ` Irui Wang
2021-05-21  7:01 ` [PATCH v4,1/6] media: mtk-vcodec: venc: remove redundant code Irui Wang
2021-05-21  7:01   ` Irui Wang
2021-05-21  7:01   ` Irui Wang
2021-05-21  8:05   ` Tzung-Bi Shih
2021-05-21  8:05     ` Tzung-Bi Shih
2021-05-21  8:05     ` Tzung-Bi Shih
2021-05-21  7:01 ` [PATCH v4,2/6] dt-bindings: media: mtk-vcodec: Add dma-ranges property Irui Wang
2021-05-21  7:01   ` [PATCH v4, 2/6] " Irui Wang
2021-05-21  7:01   ` Irui Wang
2021-06-02 18:50   ` [PATCH v4,2/6] " Rob Herring
2021-06-02 18:50     ` Rob Herring
2021-06-02 18:50     ` Rob Herring
2021-05-21  7:01 ` [PATCH v4,3/6] media: mtk-vcodec: Support 4GB~8GB range iova space for venc Irui Wang
2021-05-21  7:01   ` [PATCH v4, 3/6] " Irui Wang
2021-05-21  7:01   ` Irui Wang
2021-05-21  8:06   ` [PATCH v4,3/6] " Tzung-Bi Shih
2021-05-21  8:06     ` Tzung-Bi Shih
2021-05-21  8:06     ` Tzung-Bi Shih
2021-05-22  9:50     ` Yong Wu
2021-05-22  9:50       ` Yong Wu
2021-05-22  9:50       ` Yong Wu
2021-05-21  7:01 ` [PATCH v4,4/6] dt-bindings: media: mtk-vcodec: Add binding for MT8192 VENC Irui Wang
2021-05-21  7:01   ` [PATCH v4, 4/6] " Irui Wang
2021-05-21  7:01   ` Irui Wang
2021-05-21  7:01 ` [PATCH v4,5/6] media: mtk-vcodec: Add MT8192 H264 venc driver Irui Wang
2021-05-21  7:01   ` Irui Wang
2021-05-21  7:01   ` Irui Wang
2021-05-21  8:06   ` Tzung-Bi Shih
2021-05-21  8:06     ` Tzung-Bi Shih
2021-05-21  8:06     ` Tzung-Bi Shih
2021-05-28  5:27   ` Dafna Hirschfeld
2021-05-28  5:27     ` Dafna Hirschfeld
2021-05-28  5:27     ` Dafna Hirschfeld
2021-06-03  3:55     ` Irui Wang
2021-06-03  3:55       ` Irui Wang
2021-06-03  3:55       ` Irui Wang
2021-05-21  7:01 ` [PATCH v4,6/6] media: mtk-vcodec: Support MT8192 H264 4K encoding Irui Wang
2021-05-21  7:01   ` Irui Wang
2021-05-21  7:01   ` Irui Wang
2021-05-21  8:06   ` Tzung-Bi Shih
2021-05-21  8:06     ` [PATCH v4, 6/6] " Tzung-Bi Shih
2021-05-21  8:06     ` Tzung-Bi Shih
2021-05-24  2:39     ` [PATCH v4,6/6] " Irui Wang
2021-05-24  2:39       ` Irui Wang
2021-05-24  2:39       ` Irui Wang
2021-05-28  5:57   ` Dafna Hirschfeld
2021-05-28  5:57     ` [PATCH v4, 6/6] " Dafna Hirschfeld
2021-05-28  5:57     ` Dafna Hirschfeld

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.