[Intel-gfx] [PATCH 4/9] drm/i915/ddi: Track power reference taken for encoder DDI IO use

Imre Deak imre.deak at intel.com
Mon Nov 30 23:39:02 UTC 2020


On Tue, Dec 01, 2020 at 12:07:21AM +0200, Imre Deak wrote:
> On Mon, Nov 30, 2020 at 10:00:33PM +0000, Chris Wilson wrote:
> > Quoting Imre Deak (2020-11-30 21:21:55)
> > > Add wakeref tracking for the DDI encoders' DDI_IO display power domain
> > > references.
> > > 
> > > Cc: Chris Wilson <chris at chris-wilson.co.uk>
> > > Signed-off-by: Imre Deak <imre.deak at intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_ddi.c      | 38 ++++++++++++-------
> > >  .../drm/i915/display/intel_display_types.h    |  1 +
> > >  2 files changed, 25 insertions(+), 14 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> > > index 92940a0c5ef8..9518d298b0f7 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> > > @@ -2285,9 +2285,11 @@ static void intel_ddi_get_power_domains(struct intel_encoder *encoder,
> > >         dig_port = enc_to_dig_port(encoder);
> > >  
> > >         if (!intel_phy_is_tc(dev_priv, phy) ||
> > > -           dig_port->tc_mode != TC_PORT_TBT_ALT)
> > > -               intel_display_power_get(dev_priv,
> > > -                                       dig_port->ddi_io_power_domain);
> > > +           dig_port->tc_mode != TC_PORT_TBT_ALT) {
> > > +               drm_WARN_ON(&dev_priv->drm, dig_port->ddi_io_wakeref);
> > > +               dig_port->ddi_io_wakeref = intel_display_power_get(dev_priv,
> > > +                                                                  dig_port->ddi_io_power_domain);
> > > +       }
> > 
> > > @@ -3958,8 +3967,9 @@ static void intel_ddi_post_disable_hdmi(struct intel_atomic_state *state,
> > >  
> > >         intel_disable_ddi_buf(encoder, old_crtc_state);
> > >  
> > > -       intel_display_power_put_unchecked(dev_priv,
> > > -                                         dig_port->ddi_io_power_domain);
> > > +       intel_display_power_put(dev_priv,
> > > +                               dig_port->ddi_io_power_domain,
> > > +                               fetch_and_zero(&dig_port->ddi_io_wakeref));
> > 
> > I remember that once we had trouble with this being a macro and not
> > evaluating the fetch_and_zero() when used as an argument.
> > 
> > Looks like we still have the same trouble with
> > 
> > #if !IS_ENABLED(CONFIG_DRM_I915_DEBUG_RUNTIME_PM)
> > static inline void
> > intel_display_power_put(struct drm_i915_private *i915,
> >                         enum intel_display_power_domain domain,
> >                         intel_wakeref_t wakeref)
> > {
> >         intel_display_power_put_unchecked(i915, domain);
> > }
> > #endif
> > 
> > will cause the ddi_io_wakeref to not be cleared, and the warn on to be
> > hit in non-debug builds.

Actually, this would be the case only if intel_display_power_put() was a
macro (which it was at one point, but we've changed it to be an inline
function just to avoid the same issue).

So I think the wakeref zeroing is still ok.

> 
> Arg, screwed it again.
> 
> > -Chris


More information about the Intel-gfx mailing list