All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: "Hogander, Jouni" <jouni.hogander@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook
Date: Wed, 7 Feb 2024 17:49:14 +0200	[thread overview]
Message-ID: <ZcOmelDv30dLPZN2@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <ZcOPVGlO+QAcysLP@ideak-desk.fi.intel.com>

On Wed, Feb 07, 2024 at 04:10:28PM +0200, Imre Deak wrote:
> 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?
> 
> Some default and EDID override modes are also added to the connector
> mode list, similarly to when the HW access in intel_sdvo_get_tv_modes()
> fails (along with any modes specified via the kernel command line, which
> happens unconditionally, see drm_helper_probe_add_cmdline_mode()).
> 
> All the modes detected by the encoder detect and the connector get_modes
> hooks gets added to the drm_connector::probed_modes list. From this
> __drm_helper_update_and_validate() will copy any new modes to the
> drm_connector::modes list (which will be returned to user space/kernel
> client). Thus, returning 0 from the above TV connector get_modes hook
> will preserve the list of modes on the drm_connector::modes list from an
> earlier encoder detect/connector get_modes call.

Drat, I realized the above is not quite correct. All the modes on
drm_connector:modes will be flagged as MODE_STALE and removed by
drm_mode_prune_invalid(). This means if get_modes() returns 0 only the
default/override modes will be returned, not the ones detected in an
earlier detect/get_modes call. I think this is ok, matching the case
where HW access fails, but needs at least a clarficiation in the
comment. Thanks for questioning it..

> 
> > >
> > > >
> > > > Signed-off-by: Imre Deak <imre.deak@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.
> > 
> > >
> > > 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.
> > >
> > 

  reply	other threads:[~2024-02-07 15:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 15:39 [PATCH 0/2] drm/i915: Prevent HW access during init from connector hooks Imre Deak
2024-02-06 15:39 ` [PATCH 1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook Imre Deak
2024-02-07 13:26   ` Hogander, Jouni
2024-02-07 13:45     ` Hogander, Jouni
2024-02-07 14:10       ` Imre Deak
2024-02-07 15:49         ` Imre Deak [this message]
2024-02-07 14:16       ` Imre Deak
2024-02-07 15:35         ` Hogander, Jouni
2024-02-08 11:18   ` [PATCH v2 " Imre Deak
2024-02-06 15:39 ` [PATCH 2/2] drm/i915: Prevent HW access during init from connector get_modes hooks Imre Deak
2024-02-07 15:36   ` Hogander, Jouni
2024-02-06 17:01 ` ✓ Fi.CI.BAT: success for drm/i915: Prevent HW access during init from connector hooks Patchwork
2024-02-06 20:18 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-02-08 19:26 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Prevent HW access during init from connector hooks (rev2) Patchwork
2024-02-08 19:40 ` ✓ Fi.CI.BAT: success " Patchwork
2024-02-08 23:36 ` ✓ Fi.CI.IGT: " Patchwork

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=ZcOmelDv30dLPZN2@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jouni.hogander@intel.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.