Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: Re: [PATCH v2 3/4] drm/dp: Add an EDID quirk for the DPCD register access probe
Date: Wed, 4 Jun 2025 19:34:32 +0300	[thread overview]
Message-ID: <aEB1mEt9vnbS1bO3@ideak-desk> (raw)
In-Reply-To: <8e9b69d29d95d6d228fe04e40cdef9e30e5410f1@intel.com>

On Wed, Jun 04, 2025 at 01:11:08PM +0300, Jani Nikula wrote:
> On Tue, 03 Jun 2025, Imre Deak <imre.deak@intel.com> wrote:
> > Reading DPCD registers has side-effects and some of these can cause a
> > problem for instance during link training. Based on this it's better to
> > avoid the probing quirk done before each DPCD register read, limiting
> > this to the monitor which requires it. Add an EDID quirk for this. Leave
> > the quirk enabled by default, allowing it to be disabled after the
> > monitor is detected.
> >
> > v2: Fix lockdep wrt. drm_dp_aux::hw_mutex when calling
> >     drm_dp_dpcd_set_probe_quirk() with a dependent lock already held.
> >
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> >  drivers/gpu/drm/display/drm_dp_helper.c | 13 ++++++++++++-
> >  drivers/gpu/drm/drm_edid.c              |  3 +++
> >  include/drm/display/drm_dp_helper.h     |  6 ++++++
> >  include/drm/drm_edid.h                  |  3 ++-
> >  4 files changed, 23 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
> > index dc622c78db9d4..4dad677ac6ebe 100644
> > --- a/drivers/gpu/drm/display/drm_dp_helper.c
> > +++ b/drivers/gpu/drm/display/drm_dp_helper.c
> > @@ -691,6 +691,17 @@ void drm_dp_dpcd_set_powered(struct drm_dp_aux *aux, bool powered)
> >  }
> >  EXPORT_SYMBOL(drm_dp_dpcd_set_powered);
> >  
> > +/**
> > + * drm_dp_dpcd_set_dpcd_probe_quirk() - Set whether a probing before DPCD access is done
> > + * @aux: DisplayPort AUX channel
> > + * @enable: Enable the probing if required
> > + */
> > +void drm_dp_dpcd_set_probe_quirk(struct drm_dp_aux *aux, bool enable)
> > +{
> > +	WRITE_ONCE(aux->dpcd_probe_disabled, !enable);
> > +}
> > +EXPORT_SYMBOL(drm_dp_dpcd_set_probe_quirk);
> 
> We don't use this yet, which feels a bit odd.

It's used in the next driver patch and I wanted to keep the DRM core and
driver changes separate.

> > +
> >  /**
> >   * drm_dp_dpcd_read() - read a series of bytes from the DPCD
> >   * @aux: DisplayPort AUX channel (SST or MST)
> > @@ -724,7 +735,7 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
> >  	 * We just have to do it before any DPCD access and hope that the
> >  	 * monitor doesn't power down exactly after the throw away read.
> >  	 */
> > -	if (!aux->is_remote) {
> > +	if (!aux->is_remote && !READ_ONCE(aux->dpcd_probe_disabled)) {
> 
> I think it would be worth it to add a small helper to decide whether to
> do a dpcd probe. It would include the ->is_remote check as well, and the
> big comment could be moved there, simplifying drm_dp_dpcd_read().

Ok, can do this.

> 
> >  		ret = drm_dp_dpcd_probe(aux, DP_LANE0_1_STATUS);
> >  		if (ret < 0)
> >  			return ret;
> > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> > index e867315253493..9250b425ae230 100644
> > --- a/drivers/gpu/drm/drm_edid.c
> > +++ b/drivers/gpu/drm/drm_edid.c
> > @@ -255,6 +255,9 @@ static const struct edid_quirk {
> >  };
> >  
> >  static const struct edid_quirk global_edid_quirk_list[] = {
> > +	/* HP ZR24w DP AUX DPCD access requires probing to prevent corruption. */
> > +	DRM_EDID_QUIRK(drm_edid_encode_panel_id('H', 'W', 'P', 0x2869), PANEL_NAME_ANY,
> > +		       BIT(DRM_EDID_QUIRK_DP_DPCD_PROBE)),
> 
> So I think we should keep using EDID_QUIRK(), and maybe add
> EDID_QUIRK_NAME() companion to also assign a name != NULL, so we don't
> have to pass PANEL_NAME_ANY to all uses. Less verbose that way I think.

Imo one macro should accept a quirk matching any panel ID or any panel
name; but for now I can drop the change adding a way for that and use
EDID_QUIRK() here.

> 
> >  };
> >  
> >  /*
> > diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
> > index e4ca35143ff96..75fa9548aefa0 100644
> > --- a/include/drm/display/drm_dp_helper.h
> > +++ b/include/drm/display/drm_dp_helper.h
> > @@ -523,10 +523,16 @@ struct drm_dp_aux {
> >  	 * @no_zero_sized: If the hw can't use zero sized transfers (NVIDIA)
> >  	 */
> >  	bool no_zero_sized;
> > +
> > +	/**
> > +	 * @dpcd_probe_disabled: If probing before a DPCD access is disabled.
> > +	 */
> > +	bool dpcd_probe_disabled;
> 
> Is this a negative just so it's false by default?

Yes.

> 
> >  };
> >  
> >  int drm_dp_dpcd_probe(struct drm_dp_aux *aux, unsigned int offset);
> >  void drm_dp_dpcd_set_powered(struct drm_dp_aux *aux, bool powered);
> > +void drm_dp_dpcd_set_probe_quirk(struct drm_dp_aux *aux, bool enable);
> >  ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
> >  			 void *buffer, size_t size);
> >  ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
> > diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> > index 3d8e168521c82..a878805c81d97 100644
> > --- a/include/drm/drm_edid.h
> > +++ b/include/drm/drm_edid.h
> > @@ -110,7 +110,8 @@ struct detailed_data_string {
> >  #define DRM_EDID_CVT_FLAGS_REDUCED_BLANKING  (1 << 4)
> >  
> >  enum drm_edid_quirk {
> > -	DRM_EDID_QUIRK_NONE,
> > +	/* Do a dummy read before DPCD accesses, to prevent corruption. */
> > +	DRM_EDID_QUIRK_DP_DPCD_PROBE,
> >  };
> >  
> >  struct detailed_data_monitor_range {
> 
> -- 
> Jani Nikula, Intel

  reply	other threads:[~2025-06-04 16:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-03 12:15 [PATCH 0/4] drm/dp: Limit the DPCD probe quirk to the affected monitor Imre Deak
2025-06-03 12:15 ` [PATCH 1/4] drm/dp: Change AUX DPCD probe address from DPCD_REV to LANE0_1_STATUS Imre Deak
2025-06-04  9:53   ` Jani Nikula
2025-06-03 12:15 ` [PATCH 2/4] drm/edid: Add support for quirks visible to DRM core and drivers Imre Deak
2025-06-04  9:13   ` [PATCH v2 " Imre Deak
2025-06-04 10:02     ` Jani Nikula
2025-06-04 16:27       ` Imre Deak
2025-06-03 12:15 ` [PATCH 3/4] drm/dp: Add an EDID quirk for the DPCD register access probe Imre Deak
2025-06-03 15:36   ` [PATCH v2 " Imre Deak
2025-06-04 10:11     ` Jani Nikula
2025-06-04 16:34       ` Imre Deak [this message]
2025-06-03 12:15 ` [PATCH 4/4] drm/i915/dp: Disable the AUX DPCD probe quirk if it's not required Imre Deak
2025-06-04 10:13   ` Jani Nikula
2025-06-03 12:44 ` ✓ CI.Patch_applied: success for drm/dp: Limit the DPCD probe quirk to the affected monitor Patchwork
2025-06-03 12:44 ` ✗ CI.checkpatch: warning " Patchwork
2025-06-03 12:45 ` ✓ CI.KUnit: success " Patchwork
2025-06-03 12:56 ` ✓ CI.Build: " Patchwork
2025-06-03 12:58 ` ✓ CI.Hooks: " Patchwork
2025-06-03 13:00 ` ✗ CI.checksparse: warning " Patchwork
2025-06-03 13:48 ` ✓ Xe.CI.BAT: success " Patchwork
2025-06-03 15:42 ` ✓ CI.Patch_applied: success for drm/dp: Limit the DPCD probe quirk to the affected monitor (rev2) Patchwork
2025-06-03 15:42 ` ✗ CI.checkpatch: warning " Patchwork
2025-06-03 15:43 ` ✗ CI.KUnit: failure " Patchwork
2025-06-04 10:13 ` ✓ CI.Patch_applied: success for drm/dp: Limit the DPCD probe quirk to the affected monitor (rev3) Patchwork
2025-06-04 10:13 ` ✗ CI.checkpatch: warning " Patchwork
2025-06-04 10:14 ` ✓ CI.KUnit: success " Patchwork
2025-06-04 10:33 ` ✓ CI.Hooks: " Patchwork
2025-06-04 10:33 ` ✗ CI.checksparse: warning " Patchwork
2025-06-04 11:21 ` ✓ Xe.CI.BAT: success " Patchwork
2025-06-04 13:58 ` ✗ Xe.CI.Full: failure for drm/dp: Limit the DPCD probe quirk to the affected monitor Patchwork
2025-06-05  3:45 ` ✗ Xe.CI.Full: failure for drm/dp: Limit the DPCD probe quirk to the affected monitor (rev3) 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=aEB1mEt9vnbS1bO3@ideak-desk \
    --to=imre.deak@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=ville.syrjala@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox