All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@collabora.com>
To: Alex Bee <knaerzche@gmail.com>,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Heiko Stuebner <heiko@sntech.de>,
	maccraft123mc@gmail.com, Chris Healy <cphealy@gmail.com>,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Jernej Skrabec <jernej.skrabec@siol.net>,
	Jonas Karlman <jonas@kwiboo.se>,
	Thierry Reding <thierry.reding@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>, David Airlie <airlied@linux.ie>,
	kernel@collabora.com
Subject: Re: [PATCH 12/12] media: hantro: Add support for the Rockchip PX30
Date: Fri, 25 Jun 2021 21:49:28 -0300	[thread overview]
Message-ID: <45487f17ccb8f430f4db5b197ec23e3c4bf5d280.camel@collabora.com> (raw)
In-Reply-To: <0f129376-1377-8288-7768-91a57790014d@gmail.com>

Hi Alex,

On Fri, 2021-06-25 at 00:39 +0200, Alex Bee wrote:
> Hi Ezequiel,
> 
> Am 24.06.21 um 20:26 schrieb Ezequiel Garcia:
> > From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> > 
> > The PX30 SoC includes both the VDPU2 and VEPU2 blocks which are similar
> > to the RK3399 (Hantro G1/H1 with shuffled registers).
> > 
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> > ---
> >   drivers/staging/media/hantro/hantro_drv.c     |  1 +
> >   drivers/staging/media/hantro/hantro_hw.h      |  1 +
> >   .../staging/media/hantro/rockchip_vpu_hw.c    | 28 +++++++++++++++++++
> >   3 files changed, 30 insertions(+)
> > 
> > diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
> > index 9b5415176bfe..8a2edd67f2c6 100644
> > --- a/drivers/staging/media/hantro/hantro_drv.c
> > +++ b/drivers/staging/media/hantro/hantro_drv.c
> > @@ -582,6 +582,7 @@ static const struct v4l2_file_operations hantro_fops = {
> >   
> >   static const struct of_device_id of_hantro_match[] = {
> >   #ifdef CONFIG_VIDEO_HANTRO_ROCKCHIP
> > +       { .compatible = "rockchip,px30-vpu",   .data = &px30_vpu_variant, },
> >         { .compatible = "rockchip,rk3036-vpu", .data = &rk3036_vpu_variant, },
> >         { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, },
> >         { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, },
> > diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
> > index 9296624654a6..df7b5e3a57b9 100644
> > --- a/drivers/staging/media/hantro/hantro_hw.h
> > +++ b/drivers/staging/media/hantro/hantro_hw.h
> > @@ -209,6 +209,7 @@ enum hantro_enc_fmt {
> >   
> >   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;
> >   extern const struct hantro_variant rk3036_vpu_variant;
> >   extern const struct hantro_variant rk3066_vpu_variant;
> >   extern const struct hantro_variant rk3288_vpu_variant;
> > diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/staging/media/hantro/rockchip_vpu_hw.c
> > index e4e3b5e7689b..e7f56e30b4a8 100644
> > --- a/drivers/staging/media/hantro/rockchip_vpu_hw.c
> > +++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c
> > @@ -16,6 +16,7 @@
> >   
> >   #define RK3066_ACLK_MAX_FREQ (300 * 1000 * 1000)
> >   #define RK3288_ACLK_MAX_FREQ (400 * 1000 * 1000)
> > +#define PX30_ACLK_MAX_FREQ (300 * 1000 * 1000)
> >   
> 
> Not sure it is required (besides semantics) to introduce a new 
> *ACLK_MAX_FREQ here. rk3036_vpu_hw_init could be used to entirely 
> replace px30_vpu_hw_init in px30_vpu_variant.
> 
> (Maybe we can find some more common names, after we know which variant 
> combinations exist)
> 

TBH, I considered getting rid of all the macros and just use something
like 300 * MHZ.

Another alternative is to encode the clock rate in struct hantro_variant
itself.

In any case, I don't see this adding any value, so maybe I'll
just reuse rk3036_vpu_hw_init as you suggest.

> >   /*
> >    * Supported formats.
> > @@ -279,6 +280,12 @@ static int rockchip_vpu_hw_init(struct hantro_dev *vpu)
> >         return 0;
> >   }
> >   
> > +static int px30_vpu_hw_init(struct hantro_dev *vpu)
> > +{
> > +       clk_set_rate(vpu->clocks[0].clk, PX30_ACLK_MAX_FREQ);
> > +       return 0;
> > +}
> > +
> >   static void rk3066_vpu_dec_reset(struct hantro_ctx *ctx)
> >   {
> >         struct hantro_dev *vpu = ctx->dev;
> > @@ -452,6 +459,10 @@ static const char * const rockchip_vpu_clk_names[] = {
> >         "aclk", "hclk"
> >   };
> >   
> > +static const char * const px30_clk_names[] = {
> > +       "aclk", "hclk"
> > +};
> > +
> >   /* VDPU1/VEPU1 */
> >   
> >   const struct hantro_variant rk3036_vpu_variant = {
> > @@ -548,3 +559,20 @@ const struct hantro_variant rk3399_vpu_variant = {
> >         .clk_names = rockchip_vpu_clk_names,
> >         .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names)
> >   };
> > +
> > +const struct hantro_variant px30_vpu_variant = {
> > +       .enc_offset = 0x0,
> > +       .enc_fmts = rockchip_vpu_enc_fmts,
> > +       .num_enc_fmts = ARRAY_SIZE(rockchip_vpu_enc_fmts),
> > +       .dec_offset = 0x400,
> > +       .dec_fmts = rk3399_vpu_dec_fmts,
> > +       .num_dec_fmts = ARRAY_SIZE(rk3399_vpu_dec_fmts),
> > +       .codec = HANTRO_JPEG_ENCODER | HANTRO_MPEG2_DECODER |
> > +                HANTRO_VP8_DECODER | HANTRO_H264_DECODER,
> > +       .codec_ops = rk3399_vpu_codec_ops,
> > +       .irqs = rockchip_vpu2_irqs,
> > +       .num_irqs = ARRAY_SIZE(rockchip_vpu2_irqs),
> > +       .init = px30_vpu_hw_init,
> > +       .clk_names = px30_clk_names,
> > +       .num_clocks = ARRAY_SIZE(px30_clk_names)
> Better re-use rockchip_vpu_clk_names for these two.

Ah, this slipped through. You are right of course.

-- 
Kindly,
Ezequiel


WARNING: multiple messages have this Message-ID (diff)
From: Ezequiel Garcia <ezequiel@collabora.com>
To: Alex Bee <knaerzche@gmail.com>,
	linux-media@vger.kernel.org,  dri-devel@lists.freedesktop.org
Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Jernej Skrabec <jernej.skrabec@siol.net>,
	Jonas Karlman <jonas@kwiboo.se>, David Airlie <airlied@linux.ie>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Thierry Reding <thierry.reding@gmail.com>,
	kernel@collabora.com, Sam Ravnborg <sam@ravnborg.org>,
	Chris Healy <cphealy@gmail.com>,
	maccraft123mc@gmail.com
Subject: Re: [PATCH 12/12] media: hantro: Add support for the Rockchip PX30
Date: Fri, 25 Jun 2021 21:49:28 -0300	[thread overview]
Message-ID: <45487f17ccb8f430f4db5b197ec23e3c4bf5d280.camel@collabora.com> (raw)
In-Reply-To: <0f129376-1377-8288-7768-91a57790014d@gmail.com>

Hi Alex,

On Fri, 2021-06-25 at 00:39 +0200, Alex Bee wrote:
> Hi Ezequiel,
> 
> Am 24.06.21 um 20:26 schrieb Ezequiel Garcia:
> > From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> > 
> > The PX30 SoC includes both the VDPU2 and VEPU2 blocks which are similar
> > to the RK3399 (Hantro G1/H1 with shuffled registers).
> > 
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> > ---
> >   drivers/staging/media/hantro/hantro_drv.c     |  1 +
> >   drivers/staging/media/hantro/hantro_hw.h      |  1 +
> >   .../staging/media/hantro/rockchip_vpu_hw.c    | 28 +++++++++++++++++++
> >   3 files changed, 30 insertions(+)
> > 
> > diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
> > index 9b5415176bfe..8a2edd67f2c6 100644
> > --- a/drivers/staging/media/hantro/hantro_drv.c
> > +++ b/drivers/staging/media/hantro/hantro_drv.c
> > @@ -582,6 +582,7 @@ static const struct v4l2_file_operations hantro_fops = {
> >   
> >   static const struct of_device_id of_hantro_match[] = {
> >   #ifdef CONFIG_VIDEO_HANTRO_ROCKCHIP
> > +       { .compatible = "rockchip,px30-vpu",   .data = &px30_vpu_variant, },
> >         { .compatible = "rockchip,rk3036-vpu", .data = &rk3036_vpu_variant, },
> >         { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, },
> >         { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, },
> > diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
> > index 9296624654a6..df7b5e3a57b9 100644
> > --- a/drivers/staging/media/hantro/hantro_hw.h
> > +++ b/drivers/staging/media/hantro/hantro_hw.h
> > @@ -209,6 +209,7 @@ enum hantro_enc_fmt {
> >   
> >   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;
> >   extern const struct hantro_variant rk3036_vpu_variant;
> >   extern const struct hantro_variant rk3066_vpu_variant;
> >   extern const struct hantro_variant rk3288_vpu_variant;
> > diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/staging/media/hantro/rockchip_vpu_hw.c
> > index e4e3b5e7689b..e7f56e30b4a8 100644
> > --- a/drivers/staging/media/hantro/rockchip_vpu_hw.c
> > +++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c
> > @@ -16,6 +16,7 @@
> >   
> >   #define RK3066_ACLK_MAX_FREQ (300 * 1000 * 1000)
> >   #define RK3288_ACLK_MAX_FREQ (400 * 1000 * 1000)
> > +#define PX30_ACLK_MAX_FREQ (300 * 1000 * 1000)
> >   
> 
> Not sure it is required (besides semantics) to introduce a new 
> *ACLK_MAX_FREQ here. rk3036_vpu_hw_init could be used to entirely 
> replace px30_vpu_hw_init in px30_vpu_variant.
> 
> (Maybe we can find some more common names, after we know which variant 
> combinations exist)
> 

TBH, I considered getting rid of all the macros and just use something
like 300 * MHZ.

Another alternative is to encode the clock rate in struct hantro_variant
itself.

In any case, I don't see this adding any value, so maybe I'll
just reuse rk3036_vpu_hw_init as you suggest.

> >   /*
> >    * Supported formats.
> > @@ -279,6 +280,12 @@ static int rockchip_vpu_hw_init(struct hantro_dev *vpu)
> >         return 0;
> >   }
> >   
> > +static int px30_vpu_hw_init(struct hantro_dev *vpu)
> > +{
> > +       clk_set_rate(vpu->clocks[0].clk, PX30_ACLK_MAX_FREQ);
> > +       return 0;
> > +}
> > +
> >   static void rk3066_vpu_dec_reset(struct hantro_ctx *ctx)
> >   {
> >         struct hantro_dev *vpu = ctx->dev;
> > @@ -452,6 +459,10 @@ static const char * const rockchip_vpu_clk_names[] = {
> >         "aclk", "hclk"
> >   };
> >   
> > +static const char * const px30_clk_names[] = {
> > +       "aclk", "hclk"
> > +};
> > +
> >   /* VDPU1/VEPU1 */
> >   
> >   const struct hantro_variant rk3036_vpu_variant = {
> > @@ -548,3 +559,20 @@ const struct hantro_variant rk3399_vpu_variant = {
> >         .clk_names = rockchip_vpu_clk_names,
> >         .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names)
> >   };
> > +
> > +const struct hantro_variant px30_vpu_variant = {
> > +       .enc_offset = 0x0,
> > +       .enc_fmts = rockchip_vpu_enc_fmts,
> > +       .num_enc_fmts = ARRAY_SIZE(rockchip_vpu_enc_fmts),
> > +       .dec_offset = 0x400,
> > +       .dec_fmts = rk3399_vpu_dec_fmts,
> > +       .num_dec_fmts = ARRAY_SIZE(rk3399_vpu_dec_fmts),
> > +       .codec = HANTRO_JPEG_ENCODER | HANTRO_MPEG2_DECODER |
> > +                HANTRO_VP8_DECODER | HANTRO_H264_DECODER,
> > +       .codec_ops = rk3399_vpu_codec_ops,
> > +       .irqs = rockchip_vpu2_irqs,
> > +       .num_irqs = ARRAY_SIZE(rockchip_vpu2_irqs),
> > +       .init = px30_vpu_hw_init,
> > +       .clk_names = px30_clk_names,
> > +       .num_clocks = ARRAY_SIZE(px30_clk_names)
> Better re-use rockchip_vpu_clk_names for these two.

Ah, this slipped through. You are right of course.

-- 
Kindly,
Ezequiel


  reply	other threads:[~2021-06-26  0:49 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24 18:26 [PATCH 00/12] hantro: Enable H.264 VDPU2 (Odroid Advance Go) Ezequiel Garcia
2021-06-24 18:26 ` Ezequiel Garcia
2021-06-24 18:26 ` [PATCH 01/12] drm/panel: kd35t133: Add panel orientation support Ezequiel Garcia
2021-06-24 18:26   ` Ezequiel Garcia
2021-06-24 18:36   ` Heiko Stübner
2021-06-24 18:36     ` Heiko Stübner
2021-06-24 18:26 ` [PATCH 02/12] arm64: dts: rockchip: Add panel orientation to Odroid Go Advance Ezequiel Garcia
2021-06-24 18:26   ` Ezequiel Garcia
2021-06-24 18:37   ` Heiko Stübner
2021-06-24 18:37     ` Heiko Stübner
2021-06-24 18:44     ` Ezequiel Garcia
2021-06-24 18:44       ` Ezequiel Garcia
2021-06-24 18:26 ` [PATCH 03/12] hantro: vp8: Move noisy WARN_ON to vpu_debug Ezequiel Garcia
2021-06-24 18:26   ` Ezequiel Garcia
2021-06-24 18:26 ` [PATCH 04/12] hantro: Make struct hantro_variant.init() optional Ezequiel Garcia
2021-06-24 18:26   ` Ezequiel Garcia
2021-06-24 18:26 ` [PATCH 05/12] media: hantro: Avoid redundant hantro_get_{dst,src}_buf() calls Ezequiel Garcia
2021-06-24 18:26   ` [PATCH 05/12] media: hantro: Avoid redundant hantro_get_{dst, src}_buf() calls Ezequiel Garcia
2021-06-24 18:26 ` [PATCH 06/12] media: hantro: h264: Move DPB valid and long-term bitmaps Ezequiel Garcia
2021-06-24 18:26   ` Ezequiel Garcia
2021-06-24 18:26 ` [PATCH 07/12] media: hantro: h264: Move reference picture number to a helper Ezequiel Garcia
2021-06-24 18:26   ` Ezequiel Garcia
2021-06-24 18:26 ` [PATCH 08/12] media: hantro: Add H.264 support for Rockchip VDPU2 Ezequiel Garcia
2021-06-24 18:26   ` Ezequiel Garcia
2021-06-24 18:26 ` [PATCH 09/12] media: hantro: Enable H.264 on " Ezequiel Garcia
2021-06-24 18:26   ` Ezequiel Garcia
2021-06-24 23:13   ` Alex Bee
2021-06-24 23:13     ` Alex Bee
2021-06-26  0:46     ` Ezequiel Garcia
2021-06-26  0:46       ` Ezequiel Garcia
2021-06-26  8:33       ` Alex Bee
2021-06-26  8:33         ` Alex Bee
2021-06-29 12:28         ` Ezequiel Garcia
2021-06-29 12:28           ` Ezequiel Garcia
2021-06-30 11:36           ` Alex Bee
2021-06-30 11:36             ` Alex Bee
2021-06-24 18:26 ` [PATCH 10/12] dt-bindings: media: rockchip-vpu: Add PX30 compatible Ezequiel Garcia
2021-06-24 18:26   ` Ezequiel Garcia
2021-06-25  9:21   ` Dafna Hirschfeld
2021-06-25  9:21     ` Dafna Hirschfeld
2021-06-26  0:47     ` Ezequiel Garcia
2021-06-26  0:47       ` Ezequiel Garcia
2021-06-26  8:49       ` Alex Bee
2021-06-26  8:49         ` Alex Bee
2021-06-24 18:26 ` [PATCH 11/12] arm64: dts: rockchip: Add VPU support for the PX30 Ezequiel Garcia
2021-06-24 18:26   ` Ezequiel Garcia
2021-06-24 18:26 ` [PATCH 12/12] media: hantro: Add support for the Rockchip PX30 Ezequiel Garcia
2021-06-24 18:26   ` Ezequiel Garcia
2021-06-24 22:39   ` Alex Bee
2021-06-24 22:39     ` Alex Bee
2021-06-26  0:49     ` Ezequiel Garcia [this message]
2021-06-26  0:49       ` Ezequiel Garcia
2021-06-26  9:17 ` [PATCH 00/12] hantro: Enable H.264 VDPU2 (Odroid Advance Go) Alex Bee
2021-06-26  9:17   ` Alex Bee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45487f17ccb8f430f4db5b197ec23e3c4bf5d280.camel@collabora.com \
    --to=ezequiel@collabora.com \
    --cc=airlied@linux.ie \
    --cc=cphealy@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hverkuil@xs4all.nl \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=kernel@collabora.com \
    --cc=knaerzche@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=maccraft123mc@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=sam@ravnborg.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.