[Intel-gfx] [PATCH 1/2] drm/i915: Reuse normal state readout for LVDS/DVO fixed mode

Ville Syrjälä ville.syrjala at linux.intel.com
Tue Oct 10 14:55:42 UTC 2017


On Tue, Oct 10, 2017 at 03:33:33PM +0100, Chris Wilson wrote:
> Quoting Ville Syrjala (2017-10-09 17:19:50)
> > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > 
> > Reuse the normal state readout code to get the fixed mode for LVDS/DVO
> > encoders. This removes some partially duplicated state readout code
> > from LVDS/DVO encoders. The duplicated code wasn't actually even
> > populating the negative h/vsync flags, leading to possible state checker
> > complaints. The normal readout code populates that stuff fully.
> > 
> > Cc: Chris Wilson <chris at chris-wilson.co.uk>
> > Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 50 +++++++++++++++++-------------------
> >  drivers/gpu/drm/i915/intel_drv.h     |  5 ++--
> >  drivers/gpu/drm/i915/intel_dvo.c     | 33 ++++++------------------
> >  drivers/gpu/drm/i915/intel_lvds.c    | 18 ++++---------
> >  4 files changed, 39 insertions(+), 67 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 15844bf92434..f8693374955c 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -10247,48 +10247,44 @@ static void ironlake_pch_clock_get(struct intel_crtc *crtc,
> >                                          &pipe_config->fdi_m_n);
> >  }
> >  
> > -/** Returns the currently programmed mode of the given pipe. */
> > -struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
> > -                                            struct drm_crtc *crtc)
> > +/* Returns the currently programmed mode of the given encoder. */
> > +struct drm_display_mode *
> > +intel_encoder_current_mode(struct intel_encoder *encoder)
> >  {
> > -       struct drm_i915_private *dev_priv = to_i915(dev);
> > -       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > +       struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> > +       struct intel_crtc_state *crtc_state;
> >         struct drm_display_mode *mode;
> > -       struct intel_crtc_state *pipe_config;
> > -       enum pipe pipe = intel_crtc->pipe;
> > +       struct intel_crtc *crtc;
> > +       enum pipe pipe;
> > +
> > +       if (!encoder->get_hw_state(encoder, &pipe))
> > +               return NULL;
> 
> There's no chance that get_hw_state can return a pipe beyond our
> knowledge?

It shouldn't, unless the hardware registers are plain lying to us.
It just checks the port register whether the port is enabled, and
which pipe is connected to it.

> I'm presuming we are part of the early hw setup here, so may
> not have sanitized everything?

I think we should have done enough setup by this time. And we do the
normal state readout very shortly afterwards, so things had better be
ready by then.

-- 
Ville Syrjälä
Intel OTC


More information about the Intel-gfx mailing list