All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Kandpal, Suraj" <suraj.kandpal@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: RE: [PATCH 09/10] drm/i915/hdcp: pass struct drm_device to driver specific HDCP GSC code
Date: Fri, 02 May 2025 12:22:43 +0300	[thread overview]
Message-ID: <87r017wen0.fsf@intel.com> (raw)
In-Reply-To: <SN7PR11MB67506BAD789777010E86BFAFE38D2@SN7PR11MB6750.namprd11.prod.outlook.com>

On Fri, 02 May 2025, "Kandpal, Suraj" <suraj.kandpal@intel.com> wrote:
>> -----Original Message-----
>> From: Nikula, Jani <jani.nikula@intel.com>
>> Sent: Friday, April 25, 2025 1:32 AM
>> To: intel-gfx@lists.freedesktop.org; intel-xe@lists.freedesktop.org
>> Cc: Nikula, Jani <jani.nikula@intel.com>; Kandpal, Suraj
>> <suraj.kandpal@intel.com>
>> Subject: [PATCH 09/10] drm/i915/hdcp: pass struct drm_device to driver
>> specific HDCP GSC code
>> 
>> The driver specific HDCP GSC code will eventually be part of the driver cores
>> rather than display. Remove the struct intel_display references from them, and
>> pass struct drm_device instead.
>> 
>> Cc: Suraj Kandpal <suraj.kandpal@intel.com>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_hdcp.c        |  2 +-
>>  drivers/gpu/drm/i915/display/intel_hdcp_gsc.c    | 12 ++++++------
>>  drivers/gpu/drm/i915/display/intel_hdcp_gsc.h    |  6 +++---
>>  .../drm/i915/display/intel_hdcp_gsc_message.c    |  2 +-
>>  drivers/gpu/drm/xe/display/xe_hdcp_gsc.c         | 16 ++++++++--------
>>  5 files changed, 19 insertions(+), 19 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c
>> b/drivers/gpu/drm/i915/display/intel_hdcp.c
>> index 39bcf8f3d810..3e3038f4ee1f 100644
>> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
>> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
>> @@ -254,7 +254,7 @@ static bool intel_hdcp2_prerequisite(struct
>> intel_connector *connector)
>> 
>>  	/* If MTL+ make sure gsc is loaded and proxy is setup */
>>  	if (USE_HDCP_GSC(display)) {
>> -		if (!intel_hdcp_gsc_check_status(display))
>> +		if (!intel_hdcp_gsc_check_status(display->drm))
>>  			return false;
>>  	}
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp_gsc.c
>> b/drivers/gpu/drm/i915/display/intel_hdcp_gsc.c
>> index 4194ef77f7c3..6a22862d6be1 100644
>> --- a/drivers/gpu/drm/i915/display/intel_hdcp_gsc.c
>> +++ b/drivers/gpu/drm/i915/display/intel_hdcp_gsc.c
>> @@ -19,14 +19,14 @@ struct intel_hdcp_gsc_context {
>>  	void *hdcp_cmd_out;
>>  };
>> 
>> -bool intel_hdcp_gsc_check_status(struct intel_display *display)
>> +bool intel_hdcp_gsc_check_status(struct drm_device *drm)
>>  {
>
> So the thing is this particular function won't be a part of the drm core seeing this actually is a intel specific
> Check to see if gsc cs is present or not.

Not *drm* core, but i915 or xe "driver core", after display has been
split out.

With that clarification, does the patch make more sense? :)

BR,
Jani.


>
>> -	struct drm_i915_private *i915 = to_i915(display->drm);
>> +	struct drm_i915_private *i915 = to_i915(drm);
>>  	struct intel_gt *gt = i915->media_gt;
>>  	struct intel_gsc_uc *gsc = gt ? &gt->uc.gsc : NULL;
>> 
>>  	if (!gsc || !intel_uc_fw_is_running(&gsc->fw)) {
>> -		drm_dbg_kms(display->drm,
>> +		drm_dbg_kms(&i915->drm,
>>  			    "GSC components required for HDCP2.2 are not
>> ready\n");
>>  		return false;
>>  	}
>> @@ -87,9 +87,9 @@ static int intel_hdcp_gsc_initialize_message(struct
>> drm_i915_private *i915,
>>  	return err;
>>  }
>> 
>> -struct intel_hdcp_gsc_context *intel_hdcp_gsc_context_alloc(struct
>> intel_display *display)
>> +struct intel_hdcp_gsc_context *intel_hdcp_gsc_context_alloc(struct
>> +drm_device *drm)
>
> Same thing here this gsc context is the message we get to send to gsc cs
> Again intel specific this initialization will be specific to each driver based on
> Whom it wants to send this data(mei or some other fw component)
>  Too or do the calculations on driver level itself.
>
>>  {
>> -	struct drm_i915_private *i915 = to_i915(display->drm);
>> +	struct drm_i915_private *i915 = to_i915(drm);
>>  	struct intel_hdcp_gsc_context *gsc_context;
>>  	int ret;
>> 
>> @@ -103,7 +103,7 @@ struct intel_hdcp_gsc_context
>> *intel_hdcp_gsc_context_alloc(struct intel_display
>>  	 */
>>  	ret = intel_hdcp_gsc_initialize_message(i915, gsc_context);
>>  	if (ret) {
>> -		drm_err(display->drm, "Could not initialize gsc_context\n");
>> +		drm_err(&i915->drm, "Could not initialize gsc_context\n");
>>  		kfree(gsc_context);
>>  		gsc_context = ERR_PTR(ret);
>>  	}
>> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp_gsc.h
>> b/drivers/gpu/drm/i915/display/intel_hdcp_gsc.h
>> index e963c1fcc39e..e014336aa2e4 100644
>> --- a/drivers/gpu/drm/i915/display/intel_hdcp_gsc.h
>> +++ b/drivers/gpu/drm/i915/display/intel_hdcp_gsc.h
>> @@ -9,15 +9,15 @@
>>  #include <linux/err.h>
>>  #include <linux/types.h>
>> 
>> -struct intel_display;
>> +struct drm_device;
>>  struct intel_hdcp_gsc_context;
>> 
>>  ssize_t intel_hdcp_gsc_msg_send(struct intel_hdcp_gsc_context *gsc_context,
>>  				void *msg_in, size_t msg_in_len,
>>  				void *msg_out, size_t msg_out_len); -bool
>> intel_hdcp_gsc_check_status(struct intel_display *display);
>> +bool intel_hdcp_gsc_check_status(struct drm_device *drm);
>> 
>> -struct intel_hdcp_gsc_context *intel_hdcp_gsc_context_alloc(struct
>> intel_display *display);
>> +struct intel_hdcp_gsc_context *intel_hdcp_gsc_context_alloc(struct
>> +drm_device *drm);
>>  void intel_hdcp_gsc_context_free(struct intel_hdcp_gsc_context
>> *gsc_context);
>> 
>>  #endif /* __INTEL_HDCP_GCS_H__ */
>> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c
>> b/drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c
>> index 4226e8705d2b..98967bb148e3 100644
>> --- a/drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c
>> +++ b/drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c
>> @@ -645,7 +645,7 @@ int intel_hdcp_gsc_init(struct intel_display *display)
>> 
>>  	mutex_lock(&display->hdcp.hdcp_mutex);
>> 
>> -	gsc_context = intel_hdcp_gsc_context_alloc(display);
>> +	gsc_context = intel_hdcp_gsc_context_alloc(display->drm);
>>  	if (IS_ERR(gsc_context)) {
>>  		ret = PTR_ERR(gsc_context);
>>  		kfree(arbiter);
>> diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
>> b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
>> index 078916072c10..b35a6f201d4a 100644
>> --- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
>> +++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
>> @@ -30,9 +30,9 @@ struct intel_hdcp_gsc_context {
>> 
>>  #define HDCP_GSC_HEADER_SIZE sizeof(struct intel_gsc_mtl_header)
>> 
>> -bool intel_hdcp_gsc_check_status(struct intel_display *display)
>> +bool intel_hdcp_gsc_check_status(struct drm_device *drm)
>>  {
>> -	struct xe_device *xe = to_xe_device(display->drm);
>> +	struct xe_device *xe = to_xe_device(drm);
>>  	struct xe_tile *tile = xe_device_get_root_tile(xe);
>>  	struct xe_gt *gt = tile->media_gt;
>>  	struct xe_gsc *gsc = &gt->uc.gsc;
>> @@ -64,10 +64,9 @@ bool intel_hdcp_gsc_check_status(struct intel_display
>> *display)  }
>> 
>>  /*This function helps allocate memory for the command that we will send to
>> gsc cs */ -static int intel_hdcp_gsc_initialize_message(struct intel_display
>> *display,
>> +static int intel_hdcp_gsc_initialize_message(struct xe_device *xe,
>>  					     struct intel_hdcp_gsc_context
>> *gsc_context)  {
>
> Ditto 
>
> Regards,
> Suraj Kandpal
>
>> -	struct xe_device *xe = to_xe_device(display->drm);
>>  	struct xe_bo *bo = NULL;
>>  	u64 cmd_in, cmd_out;
>>  	int ret = 0;
>> @@ -79,7 +78,7 @@ static int intel_hdcp_gsc_initialize_message(struct
>> intel_display *display,
>>  				  XE_BO_FLAG_GGTT);
>> 
>>  	if (IS_ERR(bo)) {
>> -		drm_err(display->drm, "Failed to allocate bo for HDCP
>> streaming command!\n");
>> +		drm_err(&xe->drm, "Failed to allocate bo for HDCP streaming
>> +command!\n");
>>  		ret = PTR_ERR(bo);
>>  		goto out;
>>  	}
>> @@ -97,8 +96,9 @@ static int intel_hdcp_gsc_initialize_message(struct
>> intel_display *display,
>>  	return ret;
>>  }
>> 
>> -struct intel_hdcp_gsc_context *intel_hdcp_gsc_context_alloc(struct
>> intel_display *display)
>> +struct intel_hdcp_gsc_context *intel_hdcp_gsc_context_alloc(struct
>> +drm_device *drm)
>>  {
>> +	struct xe_device *xe = to_xe_device(drm);
>>  	struct intel_hdcp_gsc_context *gsc_context;
>>  	int ret;
>> 
>> @@ -110,9 +110,9 @@ struct intel_hdcp_gsc_context
>> *intel_hdcp_gsc_context_alloc(struct intel_display
>>  	 * NOTE: No need to lock the comp mutex here as it is already
>>  	 * going to be taken before this function called
>>  	 */
>> -	ret = intel_hdcp_gsc_initialize_message(display, gsc_context);
>> +	ret = intel_hdcp_gsc_initialize_message(xe, gsc_context);
>>  	if (ret) {
>> -		drm_err(display->drm, "Could not initialize gsc_context\n");
>> +		drm_err(&xe->drm, "Could not initialize gsc_context\n");
>>  		kfree(gsc_context);
>>  		gsc_context = ERR_PTR(ret);
>>  	}
>> --
>> 2.39.5
>

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-05-02  9:22 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-24 20:01 [PATCH 00/10] drm/i915/hdcp: refactor HDCP GSC Jani Nikula
2025-04-24 20:01 ` [PATCH 01/10] drm/i915/hdcp: remove duplicate declarations Jani Nikula
2025-04-30  4:10   ` Kandpal, Suraj
2025-04-24 20:01 ` [PATCH 02/10] drm/i915/hdcp: deduplicate and refactor HDCP GSC ops initialization Jani Nikula
2025-05-02  3:33   ` Kandpal, Suraj
2025-04-24 20:01 ` [PATCH 03/10] drm/i915/hdcp: split HDCP GSC message alloc/save responsibilities Jani Nikula
2025-05-02  3:36   ` Kandpal, Suraj
2025-04-24 20:01 ` [PATCH 04/10] drm/i915/hdcp: rename struct intel_hdcp_gsc_message to intel_hdcp_gsc_context Jani Nikula
2025-04-30  4:35   ` Kandpal, Suraj
2025-04-30  9:13     ` Jani Nikula
2025-05-02  3:37       ` Kandpal, Suraj
2025-04-24 20:01 ` [PATCH 05/10] drm/i915/hdcp: rename HDCP GSC context alloc/free functions Jani Nikula
2025-05-02  3:43   ` Kandpal, Suraj
2025-04-24 20:01 ` [PATCH 06/10] drm/i915/hdcp: pass the context to the HDCP GSC message interface Jani Nikula
2025-05-02  9:08   ` Kandpal, Suraj
2025-04-24 20:01 ` [PATCH 07/10] drm/i915/hdcp: switch the HDCP GSC message interface from u8* to void* Jani Nikula
2025-04-30  4:25   ` Kandpal, Suraj
2025-04-24 20:01 ` [PATCH 08/10] drm/i915/hdcp: simplify HDCP GSC firmware usage selection Jani Nikula
2025-04-30  4:30   ` Kandpal, Suraj
2025-04-24 20:01 ` [PATCH 09/10] drm/i915/hdcp: pass struct drm_device to driver specific HDCP GSC code Jani Nikula
2025-05-02  9:18   ` Kandpal, Suraj
2025-05-02  9:22     ` Jani Nikula [this message]
2025-05-02  9:45       ` Kandpal, Suraj
2025-05-02 10:29         ` Jani Nikula
2025-04-24 20:01 ` [PATCH 10/10] drm/i915/hdcp: drop unnecessary include from intel_hdcp_gsc.h Jani Nikula
2025-05-02  9:19   ` Kandpal, Suraj
2025-04-24 21:01 ` ✗ Fi.CI.SPARSE: warning for drm/i915/hdcp: refactor HDCP GSC Patchwork
2025-04-24 21:24 ` ✓ i915.CI.BAT: success " Patchwork
2025-04-24 23:41 ` ✓ CI.Patch_applied: " Patchwork
2025-04-24 23:41 ` ✓ CI.checkpatch: " Patchwork
2025-04-24 23:42 ` ✓ CI.KUnit: " Patchwork
2025-04-24 23:51 ` ✓ CI.Build: " Patchwork
2025-04-24 23:53 ` ✓ CI.Hooks: " Patchwork
2025-04-24 23:54 ` ✗ CI.checksparse: warning " Patchwork
2025-04-25  5:46 ` ✗ i915.CI.Full: failure " Patchwork
2025-04-25 22:11 ` ✗ Xe.CI.Full: " 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=87r017wen0.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=suraj.kandpal@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.