diff mbox series

[RFC,V2,1/2] media: hantro: Add support for i.MX8M Mini

Message ID 20211201013329.15875-2-aford173@gmail.com (mailing list archive)
State New, archived
Headers show
Series arm64: imx8mm: Enable Hantro VPUs | expand

Commit Message

Adam Ford Dec. 1, 2021, 1:33 a.m. UTC
The i.MX8M Mini has a similar implementation of the Hantro G1 and
G2 decoders, but the Mini uses the vpu-blk-ctrl for handling the
VPU resets through the power domain system.  As such, there are
functions present in the 8MQ that are not applicable to the Mini
which requires the driver to have a different compatible flags.

Signed-off-by: Adam Ford <aford173@gmail.com>

Comments

Ezequiel Garcia Dec. 1, 2021, 12:25 p.m. UTC | #1
Hi Adam,

On Tue, 30 Nov 2021 at 22:33, Adam Ford <aford173@gmail.com> wrote:
>
> The i.MX8M Mini has a similar implementation of the Hantro G1 and
> h decoders, but the Mini uses the vpu-blk-ctrl for handling the
> VPU resets through the power domain system.  As such, there are
> functions present in the 8MQ that are not applicable to the Mini
> which requires the driver to have a different compatible flags.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
>
> diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
> index fb82b9297a2b..2aa1c520be50 100644
> --- a/drivers/staging/media/hantro/hantro_drv.c
> +++ b/drivers/staging/media/hantro/hantro_drv.c
> @@ -592,6 +592,8 @@ static const struct of_device_id of_hantro_match[] = {
>         { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, },
>  #endif
>  #ifdef CONFIG_VIDEO_HANTRO_IMX8M
> +       { .compatible = "nxp,imx8mm-vpu", .data = &imx8mm_vpu_variant, },
> +       { .compatible = "nxp,imx8mm-vpu-g2", .data = &imx8mm_vpu_g2_variant },
>         { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },
>         { .compatible = "nxp,imx8mq-vpu-g2", .data = &imx8mq_vpu_g2_variant },
>  #endif
> diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
> index 267a6d33a47b..ae7c3fff760c 100644
> --- a/drivers/staging/media/hantro/hantro_hw.h
> +++ b/drivers/staging/media/hantro/hantro_hw.h
> @@ -211,6 +211,8 @@ enum hantro_enc_fmt {
>         ROCKCHIP_VPU_ENC_FMT_UYVY422 = 3,
>  };
>
> +extern const struct hantro_variant imx8mm_vpu_g2_variant;
> +extern const struct hantro_variant imx8mm_vpu_variant;
>  extern const struct hantro_variant imx8mq_vpu_g2_variant;
>  extern const struct hantro_variant imx8mq_vpu_variant;
>  extern const struct hantro_variant px30_vpu_variant;
> diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c
> index ea919bfb9891..c68516c00c6d 100644
> --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c
> +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c
> @@ -242,6 +242,32 @@ static const struct hantro_codec_ops imx8mq_vpu_g2_codec_ops[] = {
>         },
>  };
>
> +static const struct hantro_codec_ops imx8mm_vpu_codec_ops[] = {
> +       [HANTRO_MODE_MPEG2_DEC] = {
> +               .run = hantro_g1_mpeg2_dec_run,
> +               .init = hantro_mpeg2_dec_init,
> +               .exit = hantro_mpeg2_dec_exit,
> +       },
> +       [HANTRO_MODE_VP8_DEC] = {
> +               .run = hantro_g1_vp8_dec_run,
> +               .init = hantro_vp8_dec_init,
> +               .exit = hantro_vp8_dec_exit,
> +       },
> +       [HANTRO_MODE_H264_DEC] = {
> +               .run = hantro_g1_h264_dec_run,
> +               .init = hantro_h264_dec_init,
> +               .exit = hantro_h264_dec_exit,
> +       },
> +};
> +
> +static const struct hantro_codec_ops imx8mm_vpu_g2_codec_ops[] = {
> +       [HANTRO_MODE_HEVC_DEC] = {
> +               .run = hantro_g2_hevc_dec_run,
> +               .init = hantro_hevc_dec_init,
> +               .exit = hantro_hevc_dec_exit,
> +       },
> +};
> +

I believe you are missing VP9, which explains why you get
a zero fluster score.

Thanks,
Ezequiel
Adam Ford Dec. 1, 2021, 12:36 p.m. UTC | #2
On Wed, Dec 1, 2021 at 6:25 AM Ezequiel Garcia
<ezequiel@vanguardiasur.com.ar> wrote:
>
> Hi Adam,
>
> On Tue, 30 Nov 2021 at 22:33, Adam Ford <aford173@gmail.com> wrote:
> >
> > The i.MX8M Mini has a similar implementation of the Hantro G1 and
> > h decoders, but the Mini uses the vpu-blk-ctrl for handling the
> > VPU resets through the power domain system.  As such, there are
> > functions present in the 8MQ that are not applicable to the Mini
> > which requires the driver to have a different compatible flags.
> >
> > Signed-off-by: Adam Ford <aford173@gmail.com>
> >
> > diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
> > index fb82b9297a2b..2aa1c520be50 100644
> > --- a/drivers/staging/media/hantro/hantro_drv.c
> > +++ b/drivers/staging/media/hantro/hantro_drv.c
> > @@ -592,6 +592,8 @@ static const struct of_device_id of_hantro_match[] = {
> >         { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, },
> >  #endif
> >  #ifdef CONFIG_VIDEO_HANTRO_IMX8M
> > +       { .compatible = "nxp,imx8mm-vpu", .data = &imx8mm_vpu_variant, },
> > +       { .compatible = "nxp,imx8mm-vpu-g2", .data = &imx8mm_vpu_g2_variant },
> >         { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },
> >         { .compatible = "nxp,imx8mq-vpu-g2", .data = &imx8mq_vpu_g2_variant },
> >  #endif
> > diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
> > index 267a6d33a47b..ae7c3fff760c 100644
> > --- a/drivers/staging/media/hantro/hantro_hw.h
> > +++ b/drivers/staging/media/hantro/hantro_hw.h
> > @@ -211,6 +211,8 @@ enum hantro_enc_fmt {
> >         ROCKCHIP_VPU_ENC_FMT_UYVY422 = 3,
> >  };
> >
> > +extern const struct hantro_variant imx8mm_vpu_g2_variant;
> > +extern const struct hantro_variant imx8mm_vpu_variant;
> >  extern const struct hantro_variant imx8mq_vpu_g2_variant;
> >  extern const struct hantro_variant imx8mq_vpu_variant;
> >  extern const struct hantro_variant px30_vpu_variant;
> > diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > index ea919bfb9891..c68516c00c6d 100644
> > --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > @@ -242,6 +242,32 @@ static const struct hantro_codec_ops imx8mq_vpu_g2_codec_ops[] = {
> >         },
> >  };
> >
> > +static const struct hantro_codec_ops imx8mm_vpu_codec_ops[] = {
> > +       [HANTRO_MODE_MPEG2_DEC] = {
> > +               .run = hantro_g1_mpeg2_dec_run,
> > +               .init = hantro_mpeg2_dec_init,
> > +               .exit = hantro_mpeg2_dec_exit,
> > +       },
> > +       [HANTRO_MODE_VP8_DEC] = {
> > +               .run = hantro_g1_vp8_dec_run,
> > +               .init = hantro_vp8_dec_init,
> > +               .exit = hantro_vp8_dec_exit,
> > +       },
> > +       [HANTRO_MODE_H264_DEC] = {
> > +               .run = hantro_g1_h264_dec_run,
> > +               .init = hantro_h264_dec_init,
> > +               .exit = hantro_h264_dec_exit,
> > +       },
> > +};
> > +
> > +static const struct hantro_codec_ops imx8mm_vpu_g2_codec_ops[] = {
> > +       [HANTRO_MODE_HEVC_DEC] = {
> > +               .run = hantro_g2_hevc_dec_run,
> > +               .init = hantro_hevc_dec_init,
> > +               .exit = hantro_hevc_dec_exit,
> > +       },
> > +};
> > +
>
> I believe you are missing VP9, which explains why you get
> a zero fluster score.

That's what I was thinking too and that's why I was wondering if I
should wait on G2 until more of those G2 patches have been finalized
and accepted.  Is there a way to test the HEVC?  I didn't see one in
the fluster list.

adam
>
> Thanks,
> Ezequiel
Ezequiel Garcia Dec. 1, 2021, 12:58 p.m. UTC | #3
On Wed, 1 Dec 2021 at 09:36, Adam Ford <aford173@gmail.com> wrote:
>
> On Wed, Dec 1, 2021 at 6:25 AM Ezequiel Garcia
> <ezequiel@vanguardiasur.com.ar> wrote:
> >
> > Hi Adam,
> >
> > On Tue, 30 Nov 2021 at 22:33, Adam Ford <aford173@gmail.com> wrote:
> > >
> > > The i.MX8M Mini has a similar implementation of the Hantro G1 and
> > > h decoders, but the Mini uses the vpu-blk-ctrl for handling the
> > > VPU resets through the power domain system.  As such, there are
> > > functions present in the 8MQ that are not applicable to the Mini
> > > which requires the driver to have a different compatible flags.
> > >
> > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > >
> > > diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
> > > index fb82b9297a2b..2aa1c520be50 100644
> > > --- a/drivers/staging/media/hantro/hantro_drv.c
> > > +++ b/drivers/staging/media/hantro/hantro_drv.c
> > > @@ -592,6 +592,8 @@ static const struct of_device_id of_hantro_match[] = {
> > >         { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, },
> > >  #endif
> > >  #ifdef CONFIG_VIDEO_HANTRO_IMX8M
> > > +       { .compatible = "nxp,imx8mm-vpu", .data = &imx8mm_vpu_variant, },
> > > +       { .compatible = "nxp,imx8mm-vpu-g2", .data = &imx8mm_vpu_g2_variant },
> > >         { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },
> > >         { .compatible = "nxp,imx8mq-vpu-g2", .data = &imx8mq_vpu_g2_variant },
> > >  #endif
> > > diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
> > > index 267a6d33a47b..ae7c3fff760c 100644
> > > --- a/drivers/staging/media/hantro/hantro_hw.h
> > > +++ b/drivers/staging/media/hantro/hantro_hw.h
> > > @@ -211,6 +211,8 @@ enum hantro_enc_fmt {
> > >         ROCKCHIP_VPU_ENC_FMT_UYVY422 = 3,
> > >  };
> > >
> > > +extern const struct hantro_variant imx8mm_vpu_g2_variant;
> > > +extern const struct hantro_variant imx8mm_vpu_variant;
> > >  extern const struct hantro_variant imx8mq_vpu_g2_variant;
> > >  extern const struct hantro_variant imx8mq_vpu_variant;
> > >  extern const struct hantro_variant px30_vpu_variant;
> > > diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > > index ea919bfb9891..c68516c00c6d 100644
> > > --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > > +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > > @@ -242,6 +242,32 @@ static const struct hantro_codec_ops imx8mq_vpu_g2_codec_ops[] = {
> > >         },
> > >  };
> > >
> > > +static const struct hantro_codec_ops imx8mm_vpu_codec_ops[] = {
> > > +       [HANTRO_MODE_MPEG2_DEC] = {
> > > +               .run = hantro_g1_mpeg2_dec_run,
> > > +               .init = hantro_mpeg2_dec_init,
> > > +               .exit = hantro_mpeg2_dec_exit,
> > > +       },
> > > +       [HANTRO_MODE_VP8_DEC] = {
> > > +               .run = hantro_g1_vp8_dec_run,
> > > +               .init = hantro_vp8_dec_init,
> > > +               .exit = hantro_vp8_dec_exit,
> > > +       },
> > > +       [HANTRO_MODE_H264_DEC] = {
> > > +               .run = hantro_g1_h264_dec_run,
> > > +               .init = hantro_h264_dec_init,
> > > +               .exit = hantro_h264_dec_exit,
> > > +       },
> > > +};
> > > +
> > > +static const struct hantro_codec_ops imx8mm_vpu_g2_codec_ops[] = {
> > > +       [HANTRO_MODE_HEVC_DEC] = {
> > > +               .run = hantro_g2_hevc_dec_run,
> > > +               .init = hantro_hevc_dec_init,
> > > +               .exit = hantro_hevc_dec_exit,
> > > +       },
> > > +};
> > > +
> >
> > I believe you are missing VP9, which explains why you get
> > a zero fluster score.
>
> That's what I was thinking too and that's why I was wondering if I
> should wait on G2 until more of those G2 patches have been finalized
> and accepted.  Is there a way to test the HEVC?  I didn't see one in
> the fluster list.
>

VP9 is on its way to be merged. There is a pull request from Hans
already: see https://www.spinics.net/lists/linux-media/msg202448.html
which includes the git repository and tag you can merge/rebase to test
it.

It would be great if you can test G2 on top of that, but it's also fine
if you want to just submit G1 for now. Up to you.

Regarding HEVC, currently Benjamin is who knows best how to test it.
Thinking about it, perhaps we should document this somewhere?

Regards,
Ezequiel
Nicolas Dufresne Dec. 1, 2021, 9:03 p.m. UTC | #4
Le mercredi 01 décembre 2021 à 09:58 -0300, Ezequiel Garcia a écrit :
> On Wed, 1 Dec 2021 at 09:36, Adam Ford <aford173@gmail.com> wrote:
> > 
> > On Wed, Dec 1, 2021 at 6:25 AM Ezequiel Garcia
> > <ezequiel@vanguardiasur.com.ar> wrote:
> > > 
> > > Hi Adam,
> > > 
> > > On Tue, 30 Nov 2021 at 22:33, Adam Ford <aford173@gmail.com> wrote:
> > > > 
> > > > The i.MX8M Mini has a similar implementation of the Hantro G1 and
> > > > h decoders, but the Mini uses the vpu-blk-ctrl for handling the
> > > > VPU resets through the power domain system.  As such, there are
> > > > functions present in the 8MQ that are not applicable to the Mini
> > > > which requires the driver to have a different compatible flags.
> > > > 
> > > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > > > 
> > > > diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
> > > > index fb82b9297a2b..2aa1c520be50 100644
> > > > --- a/drivers/staging/media/hantro/hantro_drv.c
> > > > +++ b/drivers/staging/media/hantro/hantro_drv.c
> > > > @@ -592,6 +592,8 @@ static const struct of_device_id of_hantro_match[] = {
> > > >         { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, },
> > > >  #endif
> > > >  #ifdef CONFIG_VIDEO_HANTRO_IMX8M
> > > > +       { .compatible = "nxp,imx8mm-vpu", .data = &imx8mm_vpu_variant, },
> > > > +       { .compatible = "nxp,imx8mm-vpu-g2", .data = &imx8mm_vpu_g2_variant },
> > > >         { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },
> > > >         { .compatible = "nxp,imx8mq-vpu-g2", .data = &imx8mq_vpu_g2_variant },
> > > >  #endif
> > > > diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
> > > > index 267a6d33a47b..ae7c3fff760c 100644
> > > > --- a/drivers/staging/media/hantro/hantro_hw.h
> > > > +++ b/drivers/staging/media/hantro/hantro_hw.h
> > > > @@ -211,6 +211,8 @@ enum hantro_enc_fmt {
> > > >         ROCKCHIP_VPU_ENC_FMT_UYVY422 = 3,
> > > >  };
> > > > 
> > > > +extern const struct hantro_variant imx8mm_vpu_g2_variant;
> > > > +extern const struct hantro_variant imx8mm_vpu_variant;
> > > >  extern const struct hantro_variant imx8mq_vpu_g2_variant;
> > > >  extern const struct hantro_variant imx8mq_vpu_variant;
> > > >  extern const struct hantro_variant px30_vpu_variant;
> > > > diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > > > index ea919bfb9891..c68516c00c6d 100644
> > > > --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > > > +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > > > @@ -242,6 +242,32 @@ static const struct hantro_codec_ops imx8mq_vpu_g2_codec_ops[] = {
> > > >         },
> > > >  };
> > > > 
> > > > +static const struct hantro_codec_ops imx8mm_vpu_codec_ops[] = {
> > > > +       [HANTRO_MODE_MPEG2_DEC] = {
> > > > +               .run = hantro_g1_mpeg2_dec_run,
> > > > +               .init = hantro_mpeg2_dec_init,
> > > > +               .exit = hantro_mpeg2_dec_exit,
> > > > +       },
> > > > +       [HANTRO_MODE_VP8_DEC] = {
> > > > +               .run = hantro_g1_vp8_dec_run,
> > > > +               .init = hantro_vp8_dec_init,
> > > > +               .exit = hantro_vp8_dec_exit,
> > > > +       },
> > > > +       [HANTRO_MODE_H264_DEC] = {
> > > > +               .run = hantro_g1_h264_dec_run,
> > > > +               .init = hantro_h264_dec_init,
> > > > +               .exit = hantro_h264_dec_exit,
> > > > +       },
> > > > +};
> > > > +
> > > > +static const struct hantro_codec_ops imx8mm_vpu_g2_codec_ops[] = {
> > > > +       [HANTRO_MODE_HEVC_DEC] = {
> > > > +               .run = hantro_g2_hevc_dec_run,
> > > > +               .init = hantro_hevc_dec_init,
> > > > +               .exit = hantro_hevc_dec_exit,
> > > > +       },
> > > > +};
> > > > +
> > > 
> > > I believe you are missing VP9, which explains why you get
> > > a zero fluster score.
> > 
> > That's what I was thinking too and that's why I was wondering if I
> > should wait on G2 until more of those G2 patches have been finalized
> > and accepted.  Is there a way to test the HEVC?  I didn't see one in
> > the fluster list.
> > 
> 
> VP9 is on its way to be merged. There is a pull request from Hans
> already: see https://www.spinics.net/lists/linux-media/msg202448.html
> which includes the git repository and tag you can merge/rebase to test
> it.
> 
> It would be great if you can test G2 on top of that, but it's also fine
> if you want to just submit G1 for now. Up to you.
> 
> Regarding HEVC, currently Benjamin is who knows best how to test it.
> Thinking about it, perhaps we should document this somewhere?

There is GStreamer-H.265-V4L2SL-Gst1.0 decoder already in fluster. And GStreamer
support is still WIP.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079

We had put on hold the HEVC work in order to focus on VP9. Now that VP9 is on
its way (I've sent another MR today to GStreamer to fix some more tests). I
haven't tested myself imx8mq recently, will likely do soon, so I can give you
the expected score. Your VP8 and H264 score matches the result I got. Note that
H264 driver is missing interlace support, which is half the tests.

We will can resume this work. Help is welcome of course. The HEVC staging API is
by was the worst, so there is quite some work to move this API to stable and
then port all the drivers to the require changes that will be needed.

> 
> Regards,
> Ezequiel
Adam Ford Dec. 2, 2021, 12:58 a.m. UTC | #5
On Wed, Dec 1, 2021 at 3:03 PM Nicolas Dufresne <nicolas@ndufresne.ca> wrote:
>
> Le mercredi 01 décembre 2021 à 09:58 -0300, Ezequiel Garcia a écrit :
> > On Wed, 1 Dec 2021 at 09:36, Adam Ford <aford173@gmail.com> wrote:
> > >
> > > On Wed, Dec 1, 2021 at 6:25 AM Ezequiel Garcia
> > > <ezequiel@vanguardiasur.com.ar> wrote:
> > > >
> > > > Hi Adam,
> > > >
> > > > On Tue, 30 Nov 2021 at 22:33, Adam Ford <aford173@gmail.com> wrote:
> > > > >
> > > > > The i.MX8M Mini has a similar implementation of the Hantro G1 and
> > > > > h decoders, but the Mini uses the vpu-blk-ctrl for handling the
> > > > > VPU resets through the power domain system.  As such, there are
> > > > > functions present in the 8MQ that are not applicable to the Mini
> > > > > which requires the driver to have a different compatible flags.
> > > > >
> > > > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > > > >
> > > > > diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
> > > > > index fb82b9297a2b..2aa1c520be50 100644
> > > > > --- a/drivers/staging/media/hantro/hantro_drv.c
> > > > > +++ b/drivers/staging/media/hantro/hantro_drv.c
> > > > > @@ -592,6 +592,8 @@ static const struct of_device_id of_hantro_match[] = {
> > > > >         { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, },
> > > > >  #endif
> > > > >  #ifdef CONFIG_VIDEO_HANTRO_IMX8M
> > > > > +       { .compatible = "nxp,imx8mm-vpu", .data = &imx8mm_vpu_variant, },
> > > > > +       { .compatible = "nxp,imx8mm-vpu-g2", .data = &imx8mm_vpu_g2_variant },
> > > > >         { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },
> > > > >         { .compatible = "nxp,imx8mq-vpu-g2", .data = &imx8mq_vpu_g2_variant },
> > > > >  #endif
> > > > > diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
> > > > > index 267a6d33a47b..ae7c3fff760c 100644
> > > > > --- a/drivers/staging/media/hantro/hantro_hw.h
> > > > > +++ b/drivers/staging/media/hantro/hantro_hw.h
> > > > > @@ -211,6 +211,8 @@ enum hantro_enc_fmt {
> > > > >         ROCKCHIP_VPU_ENC_FMT_UYVY422 = 3,
> > > > >  };
> > > > >
> > > > > +extern const struct hantro_variant imx8mm_vpu_g2_variant;
> > > > > +extern const struct hantro_variant imx8mm_vpu_variant;
> > > > >  extern const struct hantro_variant imx8mq_vpu_g2_variant;
> > > > >  extern const struct hantro_variant imx8mq_vpu_variant;
> > > > >  extern const struct hantro_variant px30_vpu_variant;
> > > > > diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > > > > index ea919bfb9891..c68516c00c6d 100644
> > > > > --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > > > > +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c
> > > > > @@ -242,6 +242,32 @@ static const struct hantro_codec_ops imx8mq_vpu_g2_codec_ops[] = {
> > > > >         },
> > > > >  };
> > > > >
> > > > > +static const struct hantro_codec_ops imx8mm_vpu_codec_ops[] = {
> > > > > +       [HANTRO_MODE_MPEG2_DEC] = {
> > > > > +               .run = hantro_g1_mpeg2_dec_run,
> > > > > +               .init = hantro_mpeg2_dec_init,
> > > > > +               .exit = hantro_mpeg2_dec_exit,
> > > > > +       },
> > > > > +       [HANTRO_MODE_VP8_DEC] = {
> > > > > +               .run = hantro_g1_vp8_dec_run,
> > > > > +               .init = hantro_vp8_dec_init,
> > > > > +               .exit = hantro_vp8_dec_exit,
> > > > > +       },
> > > > > +       [HANTRO_MODE_H264_DEC] = {
> > > > > +               .run = hantro_g1_h264_dec_run,
> > > > > +               .init = hantro_h264_dec_init,
> > > > > +               .exit = hantro_h264_dec_exit,
> > > > > +       },
> > > > > +};
> > > > > +
> > > > > +static const struct hantro_codec_ops imx8mm_vpu_g2_codec_ops[] = {
> > > > > +       [HANTRO_MODE_HEVC_DEC] = {
> > > > > +               .run = hantro_g2_hevc_dec_run,
> > > > > +               .init = hantro_hevc_dec_init,
> > > > > +               .exit = hantro_hevc_dec_exit,
> > > > > +       },
> > > > > +};
> > > > > +
> > > >
> > > > I believe you are missing VP9, which explains why you get
> > > > a zero fluster score.
> > >
> > > That's what I was thinking too and that's why I was wondering if I
> > > should wait on G2 until more of those G2 patches have been finalized
> > > and accepted.  Is there a way to test the HEVC?  I didn't see one in
> > > the fluster list.
> > >
> >
> > VP9 is on its way to be merged. There is a pull request from Hans
> > already: see https://www.spinics.net/lists/linux-media/msg202448.html
> > which includes the git repository and tag you can merge/rebase to test
> > it.
> >

Thanks for that.  I rebased my work and found some bugs, so I'll be
posting an RFC V3 later tonight.

> > It would be great if you can test G2 on top of that, but it's also fine
> > if you want to just submit G1 for now. Up to you.
> >
> > Regarding HEVC, currently Benjamin is who knows best how to test it.
> > Thinking about it, perhaps we should document this somewhere?
>
> There is GStreamer-H.265-V4L2SL-Gst1.0 decoder already in fluster. And GStreamer
> support is still WIP.
>
> https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079
>
> We had put on hold the HEVC work in order to focus on VP9. Now that VP9 is on
> its way (I've sent another MR today to GStreamer to fix some more tests). I
> haven't tested myself imx8mq recently, will likely do soon, so I can give you
> the expected score. Your VP8 and H264 score matches the result I got. Note that
> H264 driver is missing interlace support, which is half the tests.
>
> We will can resume this work. Help is welcome of course. The HEVC staging API is
> by was the worst, so there is quite some work to move this API to stable and
> then port all the drivers to the require changes that will be needed.

With the latest gstreamer and the rebase off Hans' work along with
some improvements to my code, fluster now runs the VP9...at least for
a while.  It doesn't technically finish because the power domain
appears to choke which causes a hang.  This was reported by Tim
Harvey, and with some of my updates, I can reproduce it now too.  :-(

At least I know I'm off to the right start on the VP9.

adam
>
> >
> > Regards,
> > Ezequiel
>
diff mbox series

Patch

diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
index fb82b9297a2b..2aa1c520be50 100644
--- a/drivers/staging/media/hantro/hantro_drv.c
+++ b/drivers/staging/media/hantro/hantro_drv.c
@@ -592,6 +592,8 @@  static const struct of_device_id of_hantro_match[] = {
 	{ .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, },
 #endif
 #ifdef CONFIG_VIDEO_HANTRO_IMX8M
+	{ .compatible = "nxp,imx8mm-vpu", .data = &imx8mm_vpu_variant, },
+	{ .compatible = "nxp,imx8mm-vpu-g2", .data = &imx8mm_vpu_g2_variant },
 	{ .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },
 	{ .compatible = "nxp,imx8mq-vpu-g2", .data = &imx8mq_vpu_g2_variant },
 #endif
diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
index 267a6d33a47b..ae7c3fff760c 100644
--- a/drivers/staging/media/hantro/hantro_hw.h
+++ b/drivers/staging/media/hantro/hantro_hw.h
@@ -211,6 +211,8 @@  enum hantro_enc_fmt {
 	ROCKCHIP_VPU_ENC_FMT_UYVY422 = 3,
 };
 
+extern const struct hantro_variant imx8mm_vpu_g2_variant;
+extern const struct hantro_variant imx8mm_vpu_variant;
 extern const struct hantro_variant imx8mq_vpu_g2_variant;
 extern const struct hantro_variant imx8mq_vpu_variant;
 extern const struct hantro_variant px30_vpu_variant;
diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c
index ea919bfb9891..c68516c00c6d 100644
--- a/drivers/staging/media/hantro/imx8m_vpu_hw.c
+++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c
@@ -242,6 +242,32 @@  static const struct hantro_codec_ops imx8mq_vpu_g2_codec_ops[] = {
 	},
 };
 
+static const struct hantro_codec_ops imx8mm_vpu_codec_ops[] = {
+	[HANTRO_MODE_MPEG2_DEC] = {
+		.run = hantro_g1_mpeg2_dec_run,
+		.init = hantro_mpeg2_dec_init,
+		.exit = hantro_mpeg2_dec_exit,
+	},
+	[HANTRO_MODE_VP8_DEC] = {
+		.run = hantro_g1_vp8_dec_run,
+		.init = hantro_vp8_dec_init,
+		.exit = hantro_vp8_dec_exit,
+	},
+	[HANTRO_MODE_H264_DEC] = {
+		.run = hantro_g1_h264_dec_run,
+		.init = hantro_h264_dec_init,
+		.exit = hantro_h264_dec_exit,
+	},
+};
+
+static const struct hantro_codec_ops imx8mm_vpu_g2_codec_ops[] = {
+	[HANTRO_MODE_HEVC_DEC] = {
+		.run = hantro_g2_hevc_dec_run,
+		.init = hantro_hevc_dec_init,
+		.exit = hantro_hevc_dec_exit,
+	},
+};
+
 /*
  * VPU variants.
  */
@@ -257,6 +283,11 @@  static const struct hantro_irq imx8mq_g2_irqs[] = {
 static const char * const imx8mq_clk_names[] = { "g1", "g2", "bus" };
 static const char * const imx8mq_reg_names[] = { "g1", "g2", "ctrl" };
 
+static const char * const imx8mm_g1_clk_names[] = { "g1", "bus" };
+static const char * const imx8mm_g1_reg_names[] = { "g1" };
+static const char * const imx8mm_g2_clk_names[] = { "g2", "bus" };
+static const char * const imx8mm_g2_reg_names[] = { "g2" };
+
 const struct hantro_variant imx8mq_vpu_variant = {
 	.dec_fmts = imx8m_vpu_dec_fmts,
 	.num_dec_fmts = ARRAY_SIZE(imx8m_vpu_dec_fmts),
@@ -289,3 +320,29 @@  const struct hantro_variant imx8mq_vpu_g2_variant = {
 	.clk_names = imx8mq_clk_names,
 	.num_clocks = ARRAY_SIZE(imx8mq_clk_names),
 };
+
+const struct hantro_variant imx8mm_vpu_variant = {
+	.dec_fmts = imx8m_vpu_dec_fmts,
+	.num_dec_fmts = ARRAY_SIZE(imx8m_vpu_dec_fmts),
+	.codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER |
+		 HANTRO_H264_DECODER,
+	.codec_ops = imx8mm_vpu_codec_ops,
+	.irqs = imx8mq_irqs,
+	.num_irqs = ARRAY_SIZE(imx8mq_irqs),
+	.clk_names = imx8mm_g1_clk_names,
+	.num_clocks = ARRAY_SIZE(imx8mm_g1_clk_names),
+	.reg_names = imx8mm_g1_reg_names,
+	.num_regs = ARRAY_SIZE(imx8mm_g1_reg_names)
+};
+
+const struct hantro_variant imx8mm_vpu_g2_variant = {
+	.dec_offset = 0x0,
+	.dec_fmts = imx8m_vpu_g2_dec_fmts,
+	.num_dec_fmts = ARRAY_SIZE(imx8m_vpu_g2_dec_fmts),
+	.codec = HANTRO_HEVC_DECODER,
+	.codec_ops = imx8mm_vpu_g2_codec_ops,
+	.irqs = imx8mq_g2_irqs,
+	.num_irqs = ARRAY_SIZE(imx8mq_g2_irqs),
+	.clk_names = imx8mm_g2_clk_names,
+	.num_clocks = ARRAY_SIZE(imx8mm_g2_reg_names),
+};