All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suraj Kandpal <suraj.kandpal@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com,
	Suraj Kandpal <suraj.kandpal@intel.com>
Subject: [PATCH 09/11] drm/i915/hdcp: Save acquire_ctx in intel_hdcp
Date: Fri,  2 Feb 2024 12:08:50 +0530	[thread overview]
Message-ID: <20240202063852.1076862-10-suraj.kandpal@intel.com> (raw)
In-Reply-To: <20240202063852.1076862-1-suraj.kandpal@intel.com>

Save acquire_ctx in intel_hdcp so that it can be used later
for locking to get vcpi id without need to propate intel_atomic_state.
Furthermore it can be called from work_struct where deriving
intel_atomic_state is not possible.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
 .../gpu/drm/i915/display/intel_display_types.h    |  1 +
 drivers/gpu/drm/i915/display/intel_hdcp.c         | 15 ++++++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 7e7a370a3b30..d7b2af07b499 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -545,6 +545,7 @@ struct intel_hdcp {
 	u64 value;
 	struct delayed_work check_work;
 	struct work_struct prop_work;
+	struct drm_modeset_acquire_ctx *acquire_ctx;
 
 	/* HDCP1.4 Encryption status */
 	bool hdcp_encrypted;
diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
index 2b739249b60c..f6eccbd9e7ae 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -30,12 +30,13 @@
 #define KEY_LOAD_TRIES	5
 #define HDCP2_LC_RETRY_CNT			3
 
-static int intel_conn_to_vcpi(struct drm_atomic_state *state,
-			      struct intel_connector *connector)
+static int intel_conn_to_vcpi(struct intel_connector *connector)
 {
 	struct drm_dp_mst_topology_mgr *mgr;
 	struct drm_dp_mst_atomic_payload *payload;
 	struct drm_dp_mst_topology_state *mst_state;
+	struct intel_hdcp *hdcp = &connector->hdcp;
+	struct drm_modeset_acquire_ctx *acquire_ctx = hdcp->acquire_ctx;
 	int vcpi = 0;
 
 	/* For HDMI this is forced to be 0x0. For DP SST also this is 0x0. */
@@ -43,7 +44,7 @@ static int intel_conn_to_vcpi(struct drm_atomic_state *state,
 		return 0;
 	mgr = connector->port->mgr;
 
-	drm_modeset_lock(&mgr->base.lock, state->acquire_ctx);
+	drm_modeset_lock(&mgr->base.lock, acquire_ctx);
 	mst_state = to_drm_dp_mst_topology_state(mgr->base.state);
 	payload = drm_atomic_get_mst_payload_state(mst_state, connector->port);
 	if (drm_WARN_ON(mgr->dev, !payload))
@@ -2315,8 +2316,7 @@ int intel_hdcp_init(struct intel_connector *connector,
 }
 
 static int
-intel_hdcp_set_streams(struct intel_digital_port *dig_port,
-		       struct intel_atomic_state *state)
+intel_hdcp_set_streams(struct intel_digital_port *dig_port)
 {
 	struct drm_connector_list_iter conn_iter;
 	struct intel_digital_port *conn_dig_port;
@@ -2345,7 +2345,7 @@ intel_hdcp_set_streams(struct intel_digital_port *dig_port,
 			continue;
 
 		data->streams[data->k].stream_id =
-			intel_conn_to_vcpi(&state->base, connector);
+			intel_conn_to_vcpi(connector);
 		data->k++;
 
 		/* if there is only one active stream */
@@ -2400,12 +2400,13 @@ static int _intel_hdcp_enable(struct intel_atomic_state *state,
 		dig_port->hdcp_port_data.hdcp_transcoder =
 			intel_get_hdcp_transcoder(hdcp->cpu_transcoder);
 
+	hdcp->acquire_ctx = state->base.acquire_ctx;
 	/*
 	 * Considering that HDCP2.2 is more secure than HDCP1.4, If the setup
 	 * is capable of HDCP2.2, it is preferred to use HDCP2.2.
 	 */
 	if (intel_hdcp2_capable(connector)) {
-		ret = intel_hdcp_set_streams(dig_port, state);
+		ret = intel_hdcp_set_streams(dig_port);
 		if (!ret) {
 			ret = _intel_hdcp2_enable(connector);
 			if (!ret)
-- 
2.25.1


  parent reply	other threads:[~2024-02-02  6:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02  6:38 [PATCH 00/11] HDCP Type1 MST fixes Suraj Kandpal
2024-02-02  6:38 ` [PATCH 01/11] drm/i915/hdcp: Move to direct reads for HDCP Suraj Kandpal
2024-02-02  6:38 ` [PATCH 02/11] drm/i915/hdcp: Move source hdcp2 checks into its own function Suraj Kandpal
2024-02-02  6:38 ` [PATCH 03/11] drm/i915/hdcp: Refactor intel_dp_hdcp2_capable Suraj Kandpal
2024-02-02  6:38 ` [PATCH 04/11] drm/i915/hdcp: Pass drm_dp_aux to read_bcaps function Suraj Kandpal
2024-02-02  6:38 ` [PATCH 05/11] drm/i915/hdcp: Add new remote capability check shim function Suraj Kandpal
2024-02-02 10:01   ` Nautiyal, Ankit K
2024-02-02  6:38 ` [PATCH 06/11] drm/i915/hdcp: HDCP Capability for the downstream device Suraj Kandpal
2024-02-02  9:56   ` Nautiyal, Ankit K
2024-02-02  6:38 ` [PATCH 07/11] drm/i915/hdcp: Remove additional timing for reading mst hdcp message Suraj Kandpal
2024-02-02  6:38 ` [PATCH 08/11] drm/i915/hdcp: Extract hdcp structure from correct connector Suraj Kandpal
2024-02-02  6:38 ` Suraj Kandpal [this message]
2024-02-02  6:38 ` [PATCH 10/11] drm/i915/hdcp: Allocate stream id after HDCP AKE stage Suraj Kandpal
2024-02-02  6:38 ` [PATCH 11/11] drm/i915/hdcp: Read Rxcaps for robustibility Suraj Kandpal
2024-02-02  7:20 ` ✗ Fi.CI.SPARSE: warning for HDCP Type1 MST fixes Patchwork
2024-02-02  7:39 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-02-04  7:39 [PATCH 00/11] " Suraj Kandpal
2024-02-04  7:39 ` [PATCH 09/11] drm/i915/hdcp: Save acquire_ctx in intel_hdcp Suraj Kandpal
2024-02-04 14:24 [PATCH 00/11] HDCP Type1 MST fixes Suraj Kandpal
2024-02-04 14:25 ` [PATCH 09/11] drm/i915/hdcp: Save acquire_ctx in intel_hdcp Suraj Kandpal

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=20240202063852.1076862-10-suraj.kandpal@intel.com \
    --to=suraj.kandpal@intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=uma.shankar@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.