[PATCH v26 4/4] media: platform: mtk-mdp3: add MediaTek MDP3 driver

20181221122106 created moudy.ho at mediatek.com
Fri Aug 19 21:33:31 PDT 2022


Hi Hans,


On Fri, 2022-08-19 at 17:37 +0200, Hans Verkuil wrote:
> Hi Moudy,
> 
> On 19/08/2022 10:54, Moudy Ho wrote:
> > This patch adds driver for MediaTek's Media Data Path ver.3 (MDP3).
> > It provides the following functions:
> >   color transform, format conversion, resize, crop, rotate, flip
> >   and additional image quality enhancement.
> > 
> > The MDP3 driver is mainly used for Google Chromebook products to
> > import the new architecture to set the HW settings as shown below:
> >   User -> V4L2 framework
> >     -> MDP3 driver -> SCP (setting calculations)
> >       -> MDP3 driver -> CMDQ (GCE driver) -> HW
> > 
> > Each modules' related operation control is sited in mtk-mdp3-comp.c
> > Each modules' register table is defined in file with "mdp_reg_"
> > prefix
> > GCE related API, operation control  sited in mtk-mdp3-cmdq.c
> > V4L2 m2m device functions are implemented in mtk-mdp3-m2m.c
> > Probe, power, suspend/resume, system level functions are defined in
> > mtk-mdp3-core.c
> > 
> > Signed-off-by: Ping-Hsun Wu <ping-hsun.wu at mediatek.com>
> > Signed-off-by: daoyuan huang <daoyuan.huang at mediatek.com>
> > Signed-off-by: Moudy Ho <moudy.ho at mediatek.com>
> > Tested-by: AngeloGioacchino Del Regno <
> > angelogioacchino.delregno at collabora.com>
> > ---
> >  drivers/media/platform/mediatek/Kconfig       |    1 +
> >  drivers/media/platform/mediatek/Makefile      |    1 +
> >  drivers/media/platform/mediatek/mdp3/Kconfig  |   20 +
> >  drivers/media/platform/mediatek/mdp3/Makefile |    6 +
> >  .../platform/mediatek/mdp3/mdp_reg_ccorr.h    |   19 +
> >  .../platform/mediatek/mdp3/mdp_reg_rdma.h     |   65 ++
> >  .../platform/mediatek/mdp3/mdp_reg_rsz.h      |   39 +
> >  .../platform/mediatek/mdp3/mdp_reg_wdma.h     |   47 +
> >  .../platform/mediatek/mdp3/mdp_reg_wrot.h     |   55 +
> >  .../platform/mediatek/mdp3/mtk-img-ipi.h      |  290 +++++
> >  .../platform/mediatek/mdp3/mtk-mdp3-cmdq.c    |  466 ++++++++
> >  .../platform/mediatek/mdp3/mtk-mdp3-cmdq.h    |   43 +
> >  .../platform/mediatek/mdp3/mtk-mdp3-comp.c    | 1031
> > +++++++++++++++++
> >  .../platform/mediatek/mdp3/mtk-mdp3-comp.h    |  186 +++
> >  .../platform/mediatek/mdp3/mtk-mdp3-core.c    |  357 ++++++
> >  .../platform/mediatek/mdp3/mtk-mdp3-core.h    |   94 ++
> >  .../platform/mediatek/mdp3/mtk-mdp3-m2m.c     |  724 ++++++++++++
> >  .../platform/mediatek/mdp3/mtk-mdp3-m2m.h     |   48 +
> >  .../platform/mediatek/mdp3/mtk-mdp3-regs.c    |  733 ++++++++++++
> >  .../platform/mediatek/mdp3/mtk-mdp3-regs.h    |  373 ++++++
> >  .../platform/mediatek/mdp3/mtk-mdp3-vpu.c     |  313 +++++
> >  .../platform/mediatek/mdp3/mtk-mdp3-vpu.h     |   78 ++
> >  22 files changed, 4989 insertions(+)
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/Kconfig
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/Makefile
> >  create mode 100644
> > drivers/media/platform/mediatek/mdp3/mdp_reg_ccorr.h
> >  create mode 100644
> > drivers/media/platform/mediatek/mdp3/mdp_reg_rdma.h
> >  create mode 100644
> > drivers/media/platform/mediatek/mdp3/mdp_reg_rsz.h
> >  create mode 100644
> > drivers/media/platform/mediatek/mdp3/mdp_reg_wdma.h
> >  create mode 100644
> > drivers/media/platform/mediatek/mdp3/mdp_reg_wrot.h
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-img-
> > ipi.h
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > cmdq.c
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > cmdq.h
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > comp.c
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > comp.h
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > core.c
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > core.h
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > m2m.c
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > m2m.h
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > regs.c
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > regs.h
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > vpu.c
> >  create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-
> > vpu.h
> > 
> > diff --git a/drivers/media/platform/mediatek/Kconfig
> > b/drivers/media/platform/mediatek/Kconfig
> > index af47d9888552..84104e2cd024 100644
> > --- a/drivers/media/platform/mediatek/Kconfig
> > +++ b/drivers/media/platform/mediatek/Kconfig
> > @@ -6,3 +6,4 @@ source
> > "drivers/media/platform/mediatek/jpeg/Kconfig"
> >  source "drivers/media/platform/mediatek/mdp/Kconfig"
> >  source "drivers/media/platform/mediatek/vcodec/Kconfig"
> >  source "drivers/media/platform/mediatek/vpu/Kconfig"
> > +source "drivers/media/platform/mediatek/mdp3/Kconfig"
> > diff --git a/drivers/media/platform/mediatek/Makefile
> > b/drivers/media/platform/mediatek/Makefile
> > index d3850a13f128..38e6ba917fe5 100644
> > --- a/drivers/media/platform/mediatek/Makefile
> > +++ b/drivers/media/platform/mediatek/Makefile
> > @@ -3,3 +3,4 @@ obj-y += jpeg/
> >  obj-y += mdp/
> >  obj-y += vcodec/
> >  obj-y += vpu/
> > +obj-y += mdp3/
> > diff --git a/drivers/media/platform/mediatek/mdp3/Kconfig
> > b/drivers/media/platform/mediatek/mdp3/Kconfig
> > new file mode 100644
> > index 000000000000..8c8e59687417
> > --- /dev/null
> > +++ b/drivers/media/platform/mediatek/mdp3/Kconfig
> > @@ -0,0 +1,20 @@
> > +# SPDX-License-Identifier: GPL-2.0-only
> > +config VIDEO_MEDIATEK_MDP3
> > +	tristate "MediaTek MDP v3 driver"
> > +	depends on MTK_IOMMU || COMPILE_TEST
> > +	depends on VIDEO_DEV
> > +	depends on ARCH_MEDIATEK || COMPILE_TEST
> > +	depends on MTK_MMSYS || COMPILE_TEST
> 
> It turned out that this will cause link errors if MTK_MMSYS is not
> set:
> 
> ERROR: modpost: "mtk_mutex_write_sof"
> [drivers/media/platform/mediatek/mdp3/mtk-mdp3.ko] undefined!
> ERROR: modpost: "mtk_mutex_enable_by_cmdq"
> [drivers/media/platform/mediatek/mdp3/mtk-mdp3.ko] undefined!
> ERROR: modpost: "mtk_mutex_put"
> [drivers/media/platform/mediatek/mdp3/mtk-mdp3.ko] undefined!
> ERROR: modpost: "mtk_mutex_write_mod"
> [drivers/media/platform/mediatek/mdp3/mtk-mdp3.ko] undefined!
> ERROR: modpost: "mtk_mutex_unprepare"
> [drivers/media/platform/mediatek/mdp3/mtk-mdp3.ko] undefined!
> ERROR: modpost: "mtk_mutex_get"
> [drivers/media/platform/mediatek/mdp3/mtk-mdp3.ko] undefined!
> ERROR: modpost: "mtk_mutex_prepare"
> [drivers/media/platform/mediatek/mdp3/mtk-mdp3.ko] undefined!
> 
> I wonder if it isn't better to do 'select MTK_MMSYS': that seems to
> work fine.
> 
> What do you think?
> 
> Regards,
> 
> 	Hans
> 

Thank you for bringing this up for discussion, this was added on v10 at
Geert's suggestion.
But I didn't take into account all the conditions to avoid the issue
you mentioned, and replacing "depend on" with "select" would be a
better option to avoid compilation errors in various combinations.
Please allow me to release a new version that fixes this problem.

Thanks,
Moudy Ho

> > +	depends on HAS_DMA
> > +	select VIDEOBUF2_DMA_CONTIG
> > +	select V4L2_MEM2MEM_DEV
> > +	select VIDEO_MEDIATEK_VPU
> > +	select MTK_CMDQ
> > +	select MTK_SCP
> > +	default n
> > +	help
> > +	    It is a v4l2 driver and present in MediaTek MT8183 SoC.
> > +	    The driver supports scaling and color space conversion.
> > +
> > +	    To compile this driver as a module, choose M here: the
> > +	    module will be called mtk-mdp3.




More information about the Linux-mediatek mailing list