mbox series

[v2,00/14] Using component framework to support multi hardware decode

Message ID 20210717081233.7809-1-yunfei.dong@mediatek.com (mailing list archive)
Headers show
Series Using component framework to support multi hardware decode | expand

Message

Yunfei Dong July 17, 2021, 8:12 a.m. UTC
This series adds support for multi hardware decode into mtk-vcodec, by first
adding component framework to manage each hardware information: interrupt,
clock, register bases and power. Secondly add core thread to deal with core
hardware message, at the same time, add msg queue for different hardware
share messages. Lastly, the architecture of different specs are not the same,
using specs type to separate them.

This series has been tested with both MT8183 and MT8173. Decoding was working
for both chips.

Patches 1,2 rewrite get register bases and power on/off interface.

Patch 3-5 add component framework to support multi hardware.

Patches 6-14 add interfaces to support core hardware.
----
This patch dependents on "media: mtk-vcodec: support for MT8183 decoder"[1].

Multi hardware decode is based on stateless decoder, MT8183 is the first
time to add stateless decoder. Otherwise it will cause conflict.
Please also accept this patch together with [1].

[1]https://lore.kernel.org/patchwork/project/lkml/list/?series=507084
----

Changes compared with v1:
- Fix many comments for patch 3/14
- Remove unnecessary code for patch 4/14
- Using enum mtk_vdec_hw_count instead of magic numbers for patch 6/14
- Reconstructed get/put lat buffer for lat and core hardware for patch 7/14
- Using yaml format to instead of txt file for patch 12/14

Yunfei Dong (14):
  media: mtk-vcodec: Get numbers of register bases from DT
  media: mtk-vcodec: Refactor vcodec pm interface
  media: mtk-vcodec: Use component framework to manage each hardware
    information
  dt-bindings: media: mtk-vcodec: Separate video encoder and decoder
    dt-bindings
  media: mtk-vcodec: Use pure single core for MT8183
  media: mtk-vcodec: Add irq interface for core hardware
  media: mtk-vcodec: Add msg queue feature for lat and core architecture
  media: mtk-vcodec: Generalize power and clock on/off interfaces
  media: mtk-vcodec: Add new interface to lock different hardware
  media: mtk-vcodec: Add core thread
  media: mtk-vcodec: Support 34bits dma address for vdec
  dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for mt8192
  media: mtk-vcodec: Add core dec and dec end ipi msg
  media: mtk-vcodec: Use codec type to separate different hardware

 .../media/mediatek-vcodec-comp-decoder.yaml   | 150 +++++++++
 ...vcodec.txt => mediatek-vcodec-decoder.txt} |  62 +---
 .../media/mediatek-vcodec-encoder.txt         |  73 +++++
 drivers/media/platform/mtk-vcodec/Makefile    |   2 +
 .../platform/mtk-vcodec/mtk_vcodec_dec.c      |   4 +-
 .../platform/mtk-vcodec/mtk_vcodec_dec.h      |   1 +
 .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  | 297 +++++++++++++++---
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   | 194 ++++++++++++
 .../platform/mtk-vcodec/mtk_vcodec_dec_hw.h   |  50 +++
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   |  98 ++++--
 .../platform/mtk-vcodec/mtk_vcodec_dec_pm.h   |  13 +-
 .../mtk-vcodec/mtk_vcodec_dec_stateful.c      |   1 +
 .../mtk-vcodec/mtk_vcodec_dec_stateless.c     |   1 +
 .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  72 ++++-
 .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   |   1 -
 .../platform/mtk-vcodec/mtk_vcodec_intr.c     |  32 +-
 .../platform/mtk-vcodec/mtk_vcodec_intr.h     |   4 +-
 .../platform/mtk-vcodec/mtk_vcodec_util.c     |  87 ++++-
 .../platform/mtk-vcodec/mtk_vcodec_util.h     |   8 +-
 .../media/platform/mtk-vcodec/vdec_drv_if.c   |  21 +-
 .../media/platform/mtk-vcodec/vdec_ipi_msg.h  |  16 +-
 .../platform/mtk-vcodec/vdec_msg_queue.c      | 286 +++++++++++++++++
 .../platform/mtk-vcodec/vdec_msg_queue.h      | 143 +++++++++
 .../media/platform/mtk-vcodec/vdec_vpu_if.c   |  46 ++-
 .../media/platform/mtk-vcodec/vdec_vpu_if.h   |  22 ++
 25 files changed, 1516 insertions(+), 168 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/mediatek-vcodec-comp-decoder.yaml
 rename Documentation/devicetree/bindings/media/{mediatek-vcodec.txt => mediatek-vcodec-decoder.txt} (56%)
 create mode 100644 Documentation/devicetree/bindings/media/mediatek-vcodec-encoder.txt
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.h
 create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.c
 create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.h

Comments

Dafna Hirschfeld July 19, 2021, 7 a.m. UTC | #1
On 17.07.21 10:12, Yunfei Dong wrote:
> This series adds support for multi hardware decode into mtk-vcodec, by first
> adding component framework to manage each hardware information: interrupt,
> clock, register bases and power. Secondly add core thread to deal with core
> hardware message, at the same time, add msg queue for different hardware
> share messages. Lastly, the architecture of different specs are not the same,
> using specs type to separate them.
> 
> This series has been tested with both MT8183 and MT8173. Decoding was working
> for both chips.

Hi, I am currently working on stabilizing the codec drivers on mt8173 chromeos
  device (elm). It would be very helpful if you provide information on how you
tested the code.
Did you test it on chromeos userspace?
Did you use the test-tast framework?
What tests did you run?

Thanks,
Dafna

> 
> Patches 1,2 rewrite get register bases and power on/off interface.
> 
> Patch 3-5 add component framework to support multi hardware.
> 
> Patches 6-14 add interfaces to support core hardware.
> ----
> This patch dependents on "media: mtk-vcodec: support for MT8183 decoder"[1].
> 
> Multi hardware decode is based on stateless decoder, MT8183 is the first
> time to add stateless decoder. Otherwise it will cause conflict.
> Please also accept this patch together with [1].
> 
> [1]https://lore.kernel.org/patchwork/project/lkml/list/?series=507084
> ----
> 
> Changes compared with v1:
> - Fix many comments for patch 3/14
> - Remove unnecessary code for patch 4/14
> - Using enum mtk_vdec_hw_count instead of magic numbers for patch 6/14
> - Reconstructed get/put lat buffer for lat and core hardware for patch 7/14
> - Using yaml format to instead of txt file for patch 12/14
> 
> Yunfei Dong (14):
>    media: mtk-vcodec: Get numbers of register bases from DT
>    media: mtk-vcodec: Refactor vcodec pm interface
>    media: mtk-vcodec: Use component framework to manage each hardware
>      information
>    dt-bindings: media: mtk-vcodec: Separate video encoder and decoder
>      dt-bindings
>    media: mtk-vcodec: Use pure single core for MT8183
>    media: mtk-vcodec: Add irq interface for core hardware
>    media: mtk-vcodec: Add msg queue feature for lat and core architecture
>    media: mtk-vcodec: Generalize power and clock on/off interfaces
>    media: mtk-vcodec: Add new interface to lock different hardware
>    media: mtk-vcodec: Add core thread
>    media: mtk-vcodec: Support 34bits dma address for vdec
>    dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for mt8192
>    media: mtk-vcodec: Add core dec and dec end ipi msg
>    media: mtk-vcodec: Use codec type to separate different hardware
> 
>   .../media/mediatek-vcodec-comp-decoder.yaml   | 150 +++++++++
>   ...vcodec.txt => mediatek-vcodec-decoder.txt} |  62 +---
>   .../media/mediatek-vcodec-encoder.txt         |  73 +++++
>   drivers/media/platform/mtk-vcodec/Makefile    |   2 +
>   .../platform/mtk-vcodec/mtk_vcodec_dec.c      |   4 +-
>   .../platform/mtk-vcodec/mtk_vcodec_dec.h      |   1 +
>   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  | 297 +++++++++++++++---
>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   | 194 ++++++++++++
>   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.h   |  50 +++
>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   |  98 ++++--
>   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.h   |  13 +-
>   .../mtk-vcodec/mtk_vcodec_dec_stateful.c      |   1 +
>   .../mtk-vcodec/mtk_vcodec_dec_stateless.c     |   1 +
>   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  72 ++++-
>   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   |   1 -
>   .../platform/mtk-vcodec/mtk_vcodec_intr.c     |  32 +-
>   .../platform/mtk-vcodec/mtk_vcodec_intr.h     |   4 +-
>   .../platform/mtk-vcodec/mtk_vcodec_util.c     |  87 ++++-
>   .../platform/mtk-vcodec/mtk_vcodec_util.h     |   8 +-
>   .../media/platform/mtk-vcodec/vdec_drv_if.c   |  21 +-
>   .../media/platform/mtk-vcodec/vdec_ipi_msg.h  |  16 +-
>   .../platform/mtk-vcodec/vdec_msg_queue.c      | 286 +++++++++++++++++
>   .../platform/mtk-vcodec/vdec_msg_queue.h      | 143 +++++++++
>   .../media/platform/mtk-vcodec/vdec_vpu_if.c   |  46 ++-
>   .../media/platform/mtk-vcodec/vdec_vpu_if.h   |  22 ++
>   25 files changed, 1516 insertions(+), 168 deletions(-)
>   create mode 100644 Documentation/devicetree/bindings/media/mediatek-vcodec-comp-decoder.yaml
>   rename Documentation/devicetree/bindings/media/{mediatek-vcodec.txt => mediatek-vcodec-decoder.txt} (56%)
>   create mode 100644 Documentation/devicetree/bindings/media/mediatek-vcodec-encoder.txt
>   create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
>   create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.h
>   create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.c
>   create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.h
>
Yunfei Dong July 22, 2021, 11:44 a.m. UTC | #2
On Mon, 2021-07-19 at 09:00 +0200, Dafna Hirschfeld wrote:
> 
> On 17.07.21 10:12, Yunfei Dong wrote:
> > This series adds support for multi hardware decode into mtk-vcodec, by first
> > adding component framework to manage each hardware information: interrupt,
> > clock, register bases and power. Secondly add core thread to deal with core
> > hardware message, at the same time, add msg queue for different hardware
> > share messages. Lastly, the architecture of different specs are not the same,
> > using specs type to separate them.
> > 
> > This series has been tested with both MT8183 and MT8173. Decoding was working
> > for both chips.
> 
> Hi, I am currently working on stabilizing the codec drivers on mt8173 chromeos
>   device (elm). It would be very helpful if you provide information on how you
> tested the code.
> Did you test it on chromeos userspace?
> Did you use the test-tast framework?
> What tests did you run?
> 
> Thanks,
> Dafna
> 
Hi Dafna,

Adding component framework is just used for mt8192 and mt8195.
MT8173 and MT8183 still use the the older architecture. In another way,
mt8192 and mt8195 is stateless decode, mt8173 is stateful decode, it is
different. I just porting these patches to mt8173 branch, and just need
to do several simple test.

Thanks,
Yunfei Dong
> > 
> > Patches 1,2 rewrite get register bases and power on/off interface.
> > 
> > Patch 3-5 add component framework to support multi hardware.
> > 
> > Patches 6-14 add interfaces to support core hardware.
> > ----
> > This patch dependents on "media: mtk-vcodec: support for MT8183 decoder"[1].
> > 
> > Multi hardware decode is based on stateless decoder, MT8183 is the first
> > time to add stateless decoder. Otherwise it will cause conflict.
> > Please also accept this patch together with [1].
> > 
> > [1]https://lore.kernel.org/patchwork/project/lkml/list/?series=507084
> > ----
> > 
> > Changes compared with v1:
> > - Fix many comments for patch 3/14
> > - Remove unnecessary code for patch 4/14
> > - Using enum mtk_vdec_hw_count instead of magic numbers for patch 6/14
> > - Reconstructed get/put lat buffer for lat and core hardware for patch 7/14
> > - Using yaml format to instead of txt file for patch 12/14
> > 
> > Yunfei Dong (14):
> >    media: mtk-vcodec: Get numbers of register bases from DT
> >    media: mtk-vcodec: Refactor vcodec pm interface
> >    media: mtk-vcodec: Use component framework to manage each hardware
> >      information
> >    dt-bindings: media: mtk-vcodec: Separate video encoder and decoder
> >      dt-bindings
> >    media: mtk-vcodec: Use pure single core for MT8183
> >    media: mtk-vcodec: Add irq interface for core hardware
> >    media: mtk-vcodec: Add msg queue feature for lat and core architecture
> >    media: mtk-vcodec: Generalize power and clock on/off interfaces
> >    media: mtk-vcodec: Add new interface to lock different hardware
> >    media: mtk-vcodec: Add core thread
> >    media: mtk-vcodec: Support 34bits dma address for vdec
> >    dt-bindings: media: mtk-vcodec: Adds decoder dt-bindings for mt8192
> >    media: mtk-vcodec: Add core dec and dec end ipi msg
> >    media: mtk-vcodec: Use codec type to separate different hardware
> > 
> >   .../media/mediatek-vcodec-comp-decoder.yaml   | 150 +++++++++
> >   ...vcodec.txt => mediatek-vcodec-decoder.txt} |  62 +---
> >   .../media/mediatek-vcodec-encoder.txt         |  73 +++++
> >   drivers/media/platform/mtk-vcodec/Makefile    |   2 +
> >   .../platform/mtk-vcodec/mtk_vcodec_dec.c      |   4 +-
> >   .../platform/mtk-vcodec/mtk_vcodec_dec.h      |   1 +
> >   .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  | 297 +++++++++++++++---
> >   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.c   | 194 ++++++++++++
> >   .../platform/mtk-vcodec/mtk_vcodec_dec_hw.h   |  50 +++
> >   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c   |  98 ++++--
> >   .../platform/mtk-vcodec/mtk_vcodec_dec_pm.h   |  13 +-
> >   .../mtk-vcodec/mtk_vcodec_dec_stateful.c      |   1 +
> >   .../mtk-vcodec/mtk_vcodec_dec_stateless.c     |   1 +
> >   .../platform/mtk-vcodec/mtk_vcodec_drv.h      |  72 ++++-
> >   .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c   |   1 -
> >   .../platform/mtk-vcodec/mtk_vcodec_intr.c     |  32 +-
> >   .../platform/mtk-vcodec/mtk_vcodec_intr.h     |   4 +-
> >   .../platform/mtk-vcodec/mtk_vcodec_util.c     |  87 ++++-
> >   .../platform/mtk-vcodec/mtk_vcodec_util.h     |   8 +-
> >   .../media/platform/mtk-vcodec/vdec_drv_if.c   |  21 +-
> >   .../media/platform/mtk-vcodec/vdec_ipi_msg.h  |  16 +-
> >   .../platform/mtk-vcodec/vdec_msg_queue.c      | 286 +++++++++++++++++
> >   .../platform/mtk-vcodec/vdec_msg_queue.h      | 143 +++++++++
> >   .../media/platform/mtk-vcodec/vdec_vpu_if.c   |  46 ++-
> >   .../media/platform/mtk-vcodec/vdec_vpu_if.h   |  22 ++
> >   25 files changed, 1516 insertions(+), 168 deletions(-)
> >   create mode 100644 Documentation/devicetree/bindings/media/mediatek-vcodec-comp-decoder.yaml
> >   rename Documentation/devicetree/bindings/media/{mediatek-vcodec.txt => mediatek-vcodec-decoder.txt} (56%)
> >   create mode 100644 Documentation/devicetree/bindings/media/mediatek-vcodec-encoder.txt
> >   create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.c
> >   create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_hw.h
> >   create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.c
> >   create mode 100644 drivers/media/platform/mtk-vcodec/vdec_msg_queue.h
> >