Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Michał Grzelak" <michal.grzelak@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 5/9] drm/i915/hdcp: Pass the full atomic state to intel_hdcp_atomic_check()
Date: Sat, 5 Dec 2026 01:45:10 +0200	[thread overview]
Message-ID: <axNQhuYMxJzkClXe@intel.com> (raw)
In-Reply-To: <g2j5ubelcvkpauvt4nexkdx3cx6sfm57l3ypryiaaade7kez5n@js2quue2fx47>

On Thu, Dec 03, 2026 at 09:04:16PM +0100, Michał Grzelak wrote:
> On Tue, Nov 24, 2026 at 12:51:35AM GMT, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Stop looking at the connector_state->state footgun in
> > intel_hdcp_atomic_check(). Pass the full atomic state
> > from the caller instead.
> > 
> > The connector_state->state pointer is only valid up to
> > swap_state() after which it becomes NULL. In this case
> > the code only gets called during atomic_check() so we
> > do know that the pointer is valid, but it's best to never
> > use it since other people, unaware of the danger, might
> > blindly mimic the same approach elsewhere.
> 
> for same reason, shouldn't we get rid of  'crtc = connector->base.state->crtc;'
> from intel_hdcp_force_14_show() as well?

That's the connector's connector_state. One shouldn't use that
in any code that gets called from the atomic commit paths, there
you should always use the new/old atomic state stuff. But this
is some kind of debugfs file so there it's OK to look at the 
object's current state, as long as one holds the appropriate
mutex that protects said state (connection_mutex in this case).

> 
> if comment does not apply:
> 
> Reviewed-by: Michał Grzelak <michal.grzelak@linux.intel.com>
> 
> BR,
> Michał
> 
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_atomic.c | 2 +-
> >  drivers/gpu/drm/i915/display/intel_hdcp.c   | 6 +++---
> >  drivers/gpu/drm/i915/display/intel_hdcp.h   | 4 +++-
> >  3 files changed, 7 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c
> > index b042c3cc78e1..8badcd4c04ae 100644
> > --- a/drivers/gpu/drm/i915/display/intel_atomic.c
> > +++ b/drivers/gpu/drm/i915/display/intel_atomic.c
> > @@ -124,7 +124,7 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn,
> >  		to_intel_digital_connector_state(old_state);
> >  	struct drm_crtc_state *crtc_state;
> >  
> > -	intel_hdcp_atomic_check(conn, old_state, new_state);
> > +	intel_hdcp_atomic_check(state, conn, old_state, new_state);
> >  
> >  	if (!new_state->crtc)
> >  		return 0;
> > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > index dad0c854e4fa..1eb740243bba 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> > @@ -2684,7 +2684,8 @@ void intel_hdcp_cleanup(struct intel_connector *connector)
> >  	mutex_unlock(&hdcp->mutex);
> >  }
> >  
> > -void intel_hdcp_atomic_check(struct drm_connector *connector,
> > +void intel_hdcp_atomic_check(struct drm_atomic_commit *state,
> > +			     struct drm_connector *connector,
> >  			     struct drm_connector_state *old_state,
> >  			     struct drm_connector_state *new_state)
> >  {
> > @@ -2703,8 +2704,7 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
> >  		return;
> >  	}
> >  
> > -	crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
> > -						   new_state->crtc);
> > +	crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc);
> >  	/*
> >  	 * Fix the HDCP uapi content protection state in case of modeset.
> >  	 * FIXME: As per HDCP content protection property uapi doc, an uevent()
> > diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.h b/drivers/gpu/drm/i915/display/intel_hdcp.h
> > index 00f2b265ab4a..09a344823460 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hdcp.h
> > +++ b/drivers/gpu/drm/i915/display/intel_hdcp.h
> > @@ -10,6 +10,7 @@
> >  
> >  #define HDCP_ENCRYPT_STATUS_CHANGE_TIMEOUT_MS	50
> >  
> > +struct drm_atomic_commit;
> >  struct drm_connector;
> >  struct drm_connector_state;
> >  struct drm_printer;
> > @@ -22,7 +23,8 @@ struct intel_encoder;
> >  struct intel_hdcp_shim;
> >  enum port;
> >  
> > -void intel_hdcp_atomic_check(struct drm_connector *connector,
> > +void intel_hdcp_atomic_check(struct drm_atomic_commit *state,
> > +			     struct drm_connector *connector,
> >  			     struct drm_connector_state *old_state,
> >  			     struct drm_connector_state *new_state);
> >  int intel_hdcp_init(struct intel_connector *connector,
> > -- 
> > 2.56.1
> > 

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2026-12-04 23:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 22:51 [PATCH 0/9] drm/i915: Eliminate foo_state->state pointer usage Ville Syrjala
2026-11-23 22:51 ` [PATCH 1/9] drm/i915/ddi: Pass the atomic state to intel_ddi_port_sync_transcoders() Ville Syrjala
2026-12-03 20:00   ` Michał Grzelak
2026-11-23 22:51 ` [PATCH 2/9] drm/i915/mst: Pass the full atomic state to intel_dp_mtp_tu_compute_config() Ville Syrjala
2026-12-03 20:01   ` Michał Grzelak
2026-11-23 22:51 ` [PATCH 3/9] drm/i915/hdmi: Pass the full atomic state to intel_hdmi_bpc_possible() Ville Syrjala
2026-12-03 20:02   ` Michał Grzelak
2026-11-23 22:51 ` [PATCH 4/9] drm/i915/fdi: Pass the full atomic state to ilk_check_fdi_lanes() Ville Syrjala
2026-12-03 20:03   ` Michał Grzelak
2026-12-04 23:41     ` Ville Syrjälä
2026-11-23 22:51 ` [PATCH 5/9] drm/i915/hdcp: Pass the full atomic state to intel_hdcp_atomic_check() Ville Syrjala
2026-12-03 20:04   ` Michał Grzelak
2026-12-04 23:45     ` Ville Syrjälä [this message]
2026-11-23 22:51 ` [PATCH 6/9] drm/i915/global_state: Pass the full atomic state into intel_atomic_{lock, serialize}_global_state() Ville Syrjala
2026-12-03 20:05   ` Michał Grzelak
2026-11-23 22:51 ` [PATCH 7/9] drm/i915/global_state: Store the display in the global object and use it Ville Syrjala
2026-12-03 20:06   ` Michał Grzelak
2026-11-23 22:51 ` [PATCH 8/9] drm/i915/global_state: Remove the obj_state->state footgun Ville Syrjala
2026-12-03 20:06   ` Michał Grzelak
2026-11-23 22:51 ` [PATCH 9/9] drm/i915/sdvo: Add a FIXME about the connector_state->state footgun Ville Syrjala
2026-12-03 20:07   ` Michał Grzelak
2026-11-23 23:03 ` [PATCH 0/9] drm/i915: Eliminate foo_state->state pointer usage Ville Syrjälä
2026-12-03 20:07   ` Michał Grzelak
2026-11-24  1:29 ` ✓ i915.CI.BAT: success for " Patchwork
2026-11-24  9:39 ` ✗ i915.CI.Full: failure " Patchwork
2026-12-03 20:10 ` [PATCH 0/9] " Jani Nikula

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=axNQhuYMxJzkClXe@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.grzelak@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