From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F059606A322 for ; Fri, 4 Dec 2026 23:45:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=RFvQn6Tb Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DF1371131DF; Fri, 4 Dec 2026 23:45:47 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7A71E10ED0F; Fri, 4 Dec 2026 23:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796427941; x=1827963941; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=0+mLY2zeEwUMnvewm8RHL+3RW57qGD2/NHW6C3Zr+Y0=; b=RFvQn6TbHvxkz+sswSuP96pOLH9XQNPELwdePi2W2k89n6dg9V4nitjw k5n6tMvx0xiU68yTQa3p0Ww0gpm0Zeb1p0Rm1v2jCIppXxoLKQ+c29eAD yDhFuqUxsj/ofIG+xV2evPgYe+6TL49RPWVZdfaz2mZ7TWnLxwZ/5c9QT sBNFaBEmrhzkUnv1OYlIoSTjoxyr959psOFNRNOSdSuywgFgS2nZhTcPT 8OERxZyGRjG7IwLu9icG7dYa74X8e7iK69/7hJ0lUUIyoLFJMdbT5bVj1 6MIc0mB7+sJI6fXhzySS48+EFwA7EOoFuutlzfT8zS9u+fzqR83CimI53 Q==; X-CSE-ConnectionGUID: CtSwHjoTRcS51uijnApwuw== X-CSE-MsgGUID: okX83nbNTPe9N3YS3Us0oA== X-IronPort-AV: E=McAfee;i="6800,10657,11986"; a="5305292" X-IronPort-AV: E=Sophos;i="6.29,79,1794902400"; d="scan'208";a="5305292" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 15:45:41 -0800 X-CSE-ConnectionGUID: klIKIuUZSHmHE8ZF0uXakw== X-CSE-MsgGUID: 125nlicFSoaMZ+pgnF1F7Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,79,1794902400"; d="scan'208";a="13999856" Received: from amilburn-desk.amilburn-desk (HELO localhost) ([10.245.245.100]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 15:45:40 -0800 Date: Sat, 5 Dec 2026 01:45:10 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: =?utf-8?Q?Micha=C5=82?= Grzelak 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() Message-ID: References: <20261123225139.23087-1-ville.syrjala@linux.intel.com> <20261123225139.23087-6-ville.syrjala@linux.intel.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Patchwork-Hint: comment Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs Bertel Jungin Aukio 5, 02600 Espoo, Finland X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-gfx" X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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ä > > > > 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 > > BR, > Michał > > > > > Signed-off-by: Ville Syrjälä > > --- > > 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