[PATCH 4/8] drm/vc4: hdmi: Check and warn if we can't reach 4kp60 frequencies

Dave Stevenson dave.stevenson at raspberrypi.com
Tue Mar 2 15:10:37 UTC 2021


On Tue, 2 Mar 2021 at 13:02, Maxime Ripard <maxime at cerno.tech> wrote:
>
> Hi Dave,
>
> Thanks for your review
>
> On Thu, Feb 25, 2021 at 04:38:37PM +0000, Dave Stevenson wrote:
> > On Thu, 25 Feb 2021 at 15:59, Maxime Ripard <maxime at cerno.tech> wrote:
> > >
> > > In order to reach the frequencies needed to output at 594MHz, the
> > > firmware needs to be configured with the appropriate parameters in the
> > > config.txt file (enable_hdmi_4kp60 and force_turbo).
> >
> > force_turbo isn't the right way to go about this as it permanently
> > bumps all the clocks up, even if running the display at VGA.
>
> so enable_hdmi_4kp60 is enough?

No, but force_turbo=1 is the wrong way to go about fixing that.

I'll start a thread with Dom & Tim to discuss the best way of doing
this. Immediate thoughts are that either vc4_hdmi needs to request the
core clock be increased, or potentially the firmware could note the
boosted BVB rate and increase core accordingly.

  Dave

> > > Let's detect it at bind time, warn the user if we can't, and filter out
> > > the relevant modes.
> > >
> > > Signed-off-by: Maxime Ripard <maxime at cerno.tech>
> > > ---
> > >  drivers/gpu/drm/vc4/vc4_hdmi.c | 17 +++++++++++++++++
> > >  drivers/gpu/drm/vc4/vc4_hdmi.h |  8 ++++++++
> > >  2 files changed, 25 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> > > index b5bc742993a4..f05f6da286f7 100644
> > > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> > > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> > > @@ -953,6 +953,9 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
> > >         if (pixel_rate > vc4_hdmi->variant->max_pixel_clock)
> > >                 return -EINVAL;
> > >
> > > +       if (vc4_hdmi->disable_4kp60 && (pixel_rate > HDMI_14_MAX_TMDS_CLK))
> > > +               return -EINVAL;
> > > +
> > >         vc4_state->pixel_rate = pixel_rate;
> > >
> > >         return 0;
> > > @@ -972,6 +975,9 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encoder,
> > >         if ((mode->clock * 1000) > vc4_hdmi->variant->max_pixel_clock)
> > >                 return MODE_CLOCK_HIGH;
> > >
> > > +       if (vc4_hdmi->disable_4kp60 && ((mode->clock * 1000) > HDMI_14_MAX_TMDS_CLK))
> > > +               return MODE_CLOCK_HIGH;
> > > +
> > >         return MODE_OK;
> > >  }
> > >
> > > @@ -1986,6 +1992,17 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
> > >         vc4_hdmi->disable_wifi_frequencies =
> > >                 of_property_read_bool(dev->of_node, "wifi-2.4ghz-coexistence");
> > >
> > > +       if (variant->max_pixel_clock == 600000000) {
> > > +               struct vc4_dev *vc4 = to_vc4_dev(drm);
> > > +               long max_rate = clk_get_max_rate(vc4->hvs->core_clk);
> > > +
> > > +               if (max_rate < 550000000) {
> > > +                       drm_warn(drm, "The core clock cannot reach frequencies high enough to support 4k @ 60Hz.");
> > > +                       drm_warn(drm, "Please change your config.txt file to add hdmi_enable_4kp60 and force_turbo");
> >
> > Do we really want to warn in bind? Again you could have a VGA
> > resolution monitor attached but that would trigger this warning.
> > Can we warn (once) on processing the mode list and filtering out a clk
> > > HDMI_14_MAX_TMDS_CLK mode instead?
>
> That's a good idea indeed, I'll rework the patch to do that
>
> Thanks!
> Maxime


More information about the dri-devel mailing list