[PATCH 1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook

Imre Deak imre.deak at intel.com
Wed Feb 7 14:16:13 UTC 2024


On Wed, Feb 07, 2024 at 03:45:15PM +0200, Hogander, Jouni wrote:
> On Wed, 2024-02-07 at 15:26 +0200, Hogander, Jouni wrote:
> > On Tue, 2024-02-06 at 17:39 +0200, Imre Deak wrote:
> > > Prevent accessing the HW from the SDVO/TV get_modes connector hook.
> > > Returning 0 from the hook will make the caller -
> > > drm_helper_probe_single_connector_modes() - keep the previously
> > > detected
> > > mode list of the connector.
> >
> > I don't see where this is done? Not sure if looking at wrong place,
> > but
> > I see it tries using some override edid and in case that fails as
> > well
> > uses drm_add_modes_noedid?
> >
> > >
> > > Signed-off-by: Imre Deak <imre.deak at intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_sdvo.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c
> > > b/drivers/gpu/drm/i915/display/intel_sdvo.c
> > > index 2571ef5a1b211..ccea0efbd136f 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> > > @@ -2287,6 +2287,7 @@ static const struct drm_display_mode
> > > sdvo_tv_modes[] = {
> > >  static int intel_sdvo_get_tv_modes(struct drm_connector
> > > *connector)
> >
> > I see intel_sdvo_get_tv_modes is called from intel_sdvo_get_modes.
> > Why there is no need to do the same in intel_sdvo_get_lvds_modes and
> > intel_sdvo_get_ddc_modes as well?
> 
> It seems you are taking care of intel_svdo_get_ddc_modes in next patch.
> Intel_svdo_get_lvds_modes doesn't touch the hw -> nothing to do there.

Yes, all the connectors that read out an EDID - vs. the TV connector
which doesn't - is handled by the next patch. And yes, the connectors
which don't access the HW in the get_modes hook doesn't need this check.
Btw, I think all the connectors should work - eventually - in this way:
access the HW only in the encoder detect hook and from the get_modes
hook only return the detected mode list w/o accessing the HW. DP-SST and
HDMI do already the correct thing wrt. this.

> 
> >
> > BR,
> >
> > Jouni Högander
> >
> > >  {
> > >         struct intel_sdvo *intel_sdvo =
> > > intel_attached_sdvo(to_intel_connector(connector));
> > > +       struct drm_i915_private *i915 = to_i915(intel_sdvo-
> > > > base.base.dev);
> > >         struct intel_sdvo_connector *intel_sdvo_connector =
> > >                 to_intel_sdvo_connector(connector);
> > >         const struct drm_connector_state *conn_state = connector-
> > > > state;
> > > @@ -2298,6 +2299,9 @@ static int intel_sdvo_get_tv_modes(struct
> > > drm_connector *connector)
> > >         DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
> > >                       connector->base.id, connector->name);
> > >
> > > +       if (!intel_display_driver_check_access(i915))
> > > +               return 0;
> > > +
> > >         /*
> > >          * Read the list of supported input resolutions for the
> > > selected TV
> > >          * format.
> >
> 


More information about the Intel-gfx mailing list