From patchwork Fri Feb 2 06:38:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13542192 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7ADFEC48294 for ; Fri, 2 Feb 2024 06:48:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 908DA10EBDD; Fri, 2 Feb 2024 06:48:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Zkln/wro"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3167610EBBF for ; Fri, 2 Feb 2024 06:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706856493; x=1738392493; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IZK01uEEKk7DoB5PLAsBxt0HEK6gF66qhn4WCDSl348=; b=Zkln/wroUgITy7Qq6b761hq6ihi/TzeYkcJgHQKeje1R96bCOkyITaAm YychzOReOgvOdrJcsXX7LBFNEVFEiykzoevWT/kvEh3evSLN0flBWHKQp geiC21RIgw1QzCWTGQrYiStprkV6gZUA7CIKDg1IBI4L6ru0Avgt4LpqO 5GuL7MGwoQD86iZ2Dx+2RpC1oVsPIlg1+PIJuYPnwxqV6odPF9yyz75xP FGSGZwJKKhPrCRpGontdUO+VjaKbsUoukjRLgcgAEHKsXgJfLy+SpY+ca Z1W99GOAPCaxgjpFTjFuBeLrjUmNJr8vPM5xCmOjjaz76yZ3E/kF4Wua+ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10971"; a="263564" X-IronPort-AV: E=Sophos;i="6.05,237,1701158400"; d="scan'208";a="263564" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2024 22:41:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,237,1701158400"; d="scan'208";a="31084881" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 01 Feb 2024 22:41:08 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 09/11] drm/i915/hdcp: Save acquire_ctx in intel_hdcp Date: Fri, 2 Feb 2024 12:08:50 +0530 Message-Id: <20240202063852.1076862-10-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240202063852.1076862-1-suraj.kandpal@intel.com> References: <20240202063852.1076862-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 --- .../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)