mbox series

[0/5] Support H264 4K on MT8192

Message ID 20210203083752.12586-1-irui.wang@mediatek.com
Headers show
Series Support H264 4K on MT8192 | expand

Message

Irui Wang Feb. 3, 2021, 8:37 a.m. UTC
Add MT8192 H264 venc driver and support H264 4K encoding on MT8192.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
This patch dependents on
"dt-bindings: media: mtk-vcodec: Separating mtk vcodec encoder node" [1]

We need "name" and "core_id" variable in device private data to indicate
current encoder driver.
Please also accept this patch together with [1].

[1]http://lists.infradead.org/pipermail/linux-mediatek/2021-January/021165.html
---
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 H264 4K encoding on MT8192

 .../bindings/media/mediatek-vcodec.txt        | 28 +++++++++
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  1 +
 .../platform/mtk-vcodec/mtk_vcodec_enc.c      | 58 ++++++++++++++-----
 .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c  | 19 ++++++
 .../platform/mtk-vcodec/venc/venc_h264_if.c   |  4 ++
 5 files changed, 95 insertions(+), 15 deletions(-)

Comments

Rob Herring (Arm) Feb. 10, 2021, 10:53 p.m. UTC | #1
On Wed, Feb 03, 2021 at 04:37:48PM +0800, Irui Wang wrote:
> Adds dma-ranges property for DMA addresses translation.

> 

> 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 f85276e629bf..e4644f8caee9 100644

> --- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt

> +++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt

> @@ -23,6 +23,8 @@ Required properties:

>  - iommus : should point to the respective IOMMU block with master port as

>    argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt

>    for details.

> +- dma-ranges : describes how the physical address space of the IOMMU maps

> +  to memory.


dma-ranges is supposed to be in a bus/parent node.

>  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.25.1

>
Rob Herring (Arm) Feb. 10, 2021, 10:54 p.m. UTC | #2
On Wed, Feb 03, 2021 at 04:37:50PM +0800, Irui Wang wrote:
> Updates binding document for mt8192 encoder driver.

> 

> Signed-off-by: Irui Wang <irui.wang@mediatek.com>

> ---

>  .../bindings/media/mediatek-vcodec.txt        | 26 +++++++++++++++++++

>  1 file changed, 26 insertions(+)

> 

> diff --git a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt

> index e4644f8caee9..c7fac557006f 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-avc-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.

> @@ -128,3 +129,28 @@ vcodec_enc_lt: vcodec@19002000 {

>      assigned-clocks = <&topckgen CLK_TOP_VENC_LT_SEL>;

>      assigned-clock-parents = <&topckgen CLK_TOP_VCODECPLL_370P5>;

>    };

> +

> +vcodec_enc: vcodec@0x17020000 {


Don't add an example just for a new compatible.

> +    compatible = "mediatek,mt8192-vcodec-enc";

> +    reg = <0 0x17020000 0 0x2000>;

> +    iommus = <&iommu0 M4U_PORT_L7_VENC_RCPU>,

> +             <&iommu0 M4U_PORT_L7_VENC_REC>,

> +             <&iommu0 M4U_PORT_L7_VENC_BSDMA>,

> +             <&iommu0 M4U_PORT_L7_VENC_SV_COMV>,

> +             <&iommu0 M4U_PORT_L7_VENC_RD_COMV>,

> +             <&iommu0 M4U_PORT_L7_VENC_CUR_LUMA>,

> +             <&iommu0 M4U_PORT_L7_VENC_CUR_CHROMA>,

> +             <&iommu0 M4U_PORT_L7_VENC_REF_LUMA>,

> +             <&iommu0 M4U_PORT_L7_VENC_REF_CHROMA>,

> +             <&iommu0 M4U_PORT_L7_VENC_SUB_R_LUMA>,

> +             <&iommu0 M4U_PORT_L7_VENC_SUB_W_LUMA>;

> +    interrupts = <GIC_SPI 309 IRQ_TYPE_LEVEL_HIGH 0>;

> +    dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;

> +    mediatek,scp = <&scp>;

> +    power-domains = <&scpsys MT8192_POWER_DOMAIN_VENC>;

> +    clocks = <&vencsys CLK_VENC_SET1_VENC>;

> +    clock-names = "venc-set1";

> +    assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>;

> +    assigned-clock-parents = <&topckgen CLK_TOP_UNIVPLL_D4>;

> +};

> +

> -- 

> 2.25.1

>
Irui Wang March 1, 2021, 6:45 a.m. UTC | #3
On Wed, 2021-02-10 at 16:53 -0600, Rob Herring wrote:
> On Wed, Feb 03, 2021 at 04:37:48PM +0800, Irui Wang wrote:

> > Adds dma-ranges property for DMA addresses translation.

> > 

> > 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 f85276e629bf..e4644f8caee9 100644

> > --- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt

> > +++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt

> > @@ -23,6 +23,8 @@ Required properties:

> >  - iommus : should point to the respective IOMMU block with master port as

> >    argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt

> >    for details.

> > +- dma-ranges : describes how the physical address space of the IOMMU maps

> > +  to memory.

> 

> dma-ranges is supposed to be in a bus/parent node.

Dear Rob,

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.

Is this OK? If this is ok for you, I will put this message in the commit
message and binding in next version.

Regards
> 

> >  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.25.1

> >
Hans Verkuil April 29, 2021, 11:15 a.m. UTC | #4
Hi Rob,

On 01/03/2021 07:45, Irui Wang wrote:
> On Wed, 2021-02-10 at 16:53 -0600, Rob Herring wrote:

>> On Wed, Feb 03, 2021 at 04:37:48PM +0800, Irui Wang wrote:

>>> Adds dma-ranges property for DMA addresses translation.

>>>

>>> 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 f85276e629bf..e4644f8caee9 100644

>>> --- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt

>>> +++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt

>>> @@ -23,6 +23,8 @@ Required properties:

>>>  - iommus : should point to the respective IOMMU block with master port as

>>>    argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt

>>>    for details.

>>> +- dma-ranges : describes how the physical address space of the IOMMU maps

>>> +  to memory.

>>

>> dma-ranges is supposed to be in a bus/parent node.

> Dear Rob,

> 

> 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.

> 

> Is this OK? If this is ok for you, I will put this message in the commit

> message and binding in next version.


Can you answer Irui's question? Just a reminder...

Much appreciated!

Regards,

	Hans

> 

> Regards

>>

>>>  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.25.1

>>>

>
Irui Wang May 17, 2021, 7:51 a.m. UTC | #5
Dear Hans, Rob and Maintainers,

Much appreciated for reviewing this patchset, we have sent PATCH-V3 for
the patchset with Rob's comments:
https://patchwork.kernel.org/project/linux-mediatek/cover/20210412124555.26897-1-irui.wang@mediatek.com/

Just Gentle ping for this V3 patch.

Thanks,
Best Regards

On Thu, 2021-04-29 at 13:15 +0200, Hans Verkuil wrote:
> Hi Rob,

> 

> On 01/03/2021 07:45, Irui Wang wrote:

> > On Wed, 2021-02-10 at 16:53 -0600, Rob Herring wrote:

> >> On Wed, Feb 03, 2021 at 04:37:48PM +0800, Irui Wang wrote:

> >>> Adds dma-ranges property for DMA addresses translation.

> >>>

> >>> 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 f85276e629bf..e4644f8caee9 100644

> >>> --- a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt

> >>> +++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt

> >>> @@ -23,6 +23,8 @@ Required properties:

> >>>  - iommus : should point to the respective IOMMU block with master port as

> >>>    argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt

> >>>    for details.

> >>> +- dma-ranges : describes how the physical address space of the IOMMU maps

> >>> +  to memory.

> >>

> >> dma-ranges is supposed to be in a bus/parent node.

> > Dear Rob,

> > 

> > 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.

> > 

> > Is this OK? If this is ok for you, I will put this message in the commit

> > message and binding in next version.

> 

> Can you answer Irui's question? Just a reminder...

> 

> Much appreciated!

> 

> Regards,

> 

> 	Hans

> 

> > 

> > Regards

> >>

> >>>  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.25.1

> >>>

> > 

>