Refactor i915 HDCP for XE
Subsystems (3)
v5 cover Refactor i915 HDCP for XE
This patch series contains some refactors for i915 side of things which will help with a cleaner code and maximum reuse of code for XE going forward.
Suraj Kandpal (2):
drm/i915/hdcp: Move checks for gsc health status drm/i915/hdcp: Move common message filling function to its own file
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_hdcp.c | 8 +- drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 617 +----------------- drivers/gpu/drm/i915/display/intel_hdcp_gsc.h | 1 + .../drm/i915/display/intel_hdcp_gsc_message.c | 592 +++++++++++++++++ .../drm/i915/display/intel_hdcp_gsc_message.h | 72 ++ 6 files changed, 692 insertions(+), 599 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.h
Signature · 1 line
2.25.1
PATCH v5 1/2 drm/i915/hdcp: Move checks for gsc health status
Move checks for gsc components required for HDCP 2.2 to work into intel_hdcp_gsc.c. This will also help with XE refactor on HDCP's side.
--- drivers/gpu/drm/i915/display/intel_hdcp.c | 8 +------- drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 14 ++++++++++++++ drivers/gpu/drm/i915/display/intel_hdcp_gsc.h | 1 + 3 files changed, 16 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +1 -7
@@ -173,14 +173,8 @@ bool intel_hdcp2_capable(struct intel_connector *connector)/* If MTL+ make sure gsc is loaded and proxy is setup */ if (intel_hdcp_gsc_cs_required (i915)) { -struct intel_gt *gt = i915->media_gt; -struct intel_gsc_uc *gsc = gt ? >->uc.gsc :NULL ; - -if (!gsc || !intel_uc_fw_is_running (&gsc->fw)) { -drm_dbg_kms (&i915->drm, -"GSC components required for HDCP2.2 are not ready\n" ); +if (!intel_hdcp_gsc_check_status (i915))return false; - } }/* MEI/GSC interface is solid depending on which is used */
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +14 -0
@@ -17,6 +17,20 @@ bool intel_hdcp_gsc_cs_required(struct drm_i915_private *i915)return DISPLAY_VER (i915) >=14 ; } +bool intel_hdcp_gsc_check_status (struct drm_i915_private *i915) +{ +struct intel_gt *gt = i915->media_gt; +struct intel_gsc_uc *gsc = gt ? >->uc.gsc :NULL ; + +if (!gsc || !intel_uc_fw_is_running (&gsc->fw)) { +drm_dbg_kms (&i915->drm, +"GSC components required for HDCP2.2 are not ready\n" ); +return false; + } + +return true; +} +static int gsc_hdcp_initiate_session (struct device *dev,struct hdcp_port_data *data,struct hdcp2_ake_init *ake_data)
drivers/gpu/drm/i915/display/intel_hdcp_gsc.h +1 -0
@@ -23,5 +23,6 @@ ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8 *msg_in, size_t msg_out_len);int intel_hdcp_gsc_init (struct drm_i915_private *i915);void intel_hdcp_gsc_fini (struct drm_i915_private *i915); +bool intel_hdcp_gsc_check_status (struct drm_i915_private *i915);#endif /* __INTEL_HDCP_GCS_H__ */
Signature · 1 line
2.25.1
Jani Nikula
maintainerRe: [Intel-gfx] [PATCH v5 1/2] drm/i915/hdcp: Move checks for gsc health status
Quoted 17 lines · Suraj Kandpal
Move checks for gsc components required for HDCP 2.2 to work into
intel_hdcp_gsc.c. This will also help with XE refactor on HDCP's side.Signed-off-by Suraj Kandpal <[email protected]>Reviewed-by Uma Shankar <[email protected]>--- drivers/gpu/drm/i915/display/intel_hdcp.c | 8 +------- drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 14 ++++++++++++++ drivers/gpu/drm/i915/display/intel_hdcp_gsc.h | 1 + 3 files changed, 16 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/display/intel_hdcp.c +0
-0
drivers/gpu/drm/i915/display/intel_hdcp.c bool intel_hdcp2_capable(struct intel_connector *connector) · line 176
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +1
-6@@ -173,14 +173,8 @@ bool intel_hdcp2_capable(struct intel_connector *connector)/* If MTL+ make sure gsc is loaded and proxy is setup */ if (intel_hdcp_gsc_cs_required (i915)) { -struct intel_gt *gt = i915->media_gt; -struct intel_gsc_uc *gsc = gt ? >->uc.gsc :NULL ; - -if (!gsc || !intel_uc_fw_is_running (&gsc->fw)) { -drm_dbg_kms (&i915->drm, -"GSC components required for HDCP2.2 are not ready\n" ); +if (!intel_hdcp_gsc_check_status (i915))
Naming nitpick, though not intended to block the patch:
I always stop at functions named "check" that return a value. What does the return value mean? The above code reads, "if not check status".
So I usually try to name functions so that it's obvious on both sides what it means, when you read it aloud. For example, "if not status ok".
Just something to consider for the future.
BR,
Jani.
Quoted 41 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0
-1return false; - } }/* MEI/GSC interface is solid depending on which is used */ drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +14
-0@@ -17,6 +17,20 @@ bool intel_hdcp_gsc_cs_required(struct drm_i915_private *i915)return DISPLAY_VER (i915) >=14 ; } +bool intel_hdcp_gsc_check_status (struct drm_i915_private *i915) +{ +struct intel_gt *gt = i915->media_gt; +struct intel_gsc_uc *gsc = gt ? >->uc.gsc :NULL ; + +if (!gsc || !intel_uc_fw_is_running (&gsc->fw)) { +drm_dbg_kms (&i915->drm, +"GSC components required for HDCP2.2 are not ready\n" ); +return false; + } + +return true; +} +static int gsc_hdcp_initiate_session (struct device *dev,struct hdcp_port_data *data,struct hdcp2_ake_init *ake_data)drivers/gpu/drm/i915/display/intel_hdcp_gsc.h +1
-0@@ -23,5 +23,6 @@ ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8 *msg_in, size_t msg_out_len);int intel_hdcp_gsc_init (struct drm_i915_private *i915);void intel_hdcp_gsc_fini (struct drm_i915_private *i915); +bool intel_hdcp_gsc_check_status (struct drm_i915_private *i915);#endif /* __INTEL_HDCP_GCS_H__ */
Signature · 1 line
Jani Nikula, Intel
Re: [Intel-gfx] [PATCH v5 1/2] drm/i915/hdcp: Move checks for gsc health status
Quoted 42 lines
-----Original Message-----
From: Jani Nikula <[email protected]>
Sent: Monday, October 9, 2023 3:37 PM
To: Kandpal, Suraj <[email protected]>; [email protected]
Subject: Re: [Intel-gfx] [PATCH v5 1/2] drm/i915/hdcp: Move checks for gsc health statusQuoted 17 lines · Suraj Kandpal
Move checks for gsc components required for HDCP 2.2 to work into
intel_hdcp_gsc.c. This will also help with XE refactor on HDCP's side.Signed-off-by Suraj Kandpal <[email protected]>Reviewed-by Uma Shankar <[email protected]>--- drivers/gpu/drm/i915/display/intel_hdcp.c | 8 +------- drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 14 ++++++++++++++ drivers/gpu/drm/i915/display/intel_hdcp_gsc.h | 1 + 3 files changed, 16 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/display/intel_hdcp.c +0
-0drivers/gpu/drm/i915/display/intel_hdcp.c bool intel_hdcp2_capable(struct intel_connector · line 182
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0
-6@@ -173,14 +173,8 @@ bool intel_hdcp2_capable(struct intel_connector *connector)/* If MTL+ make sure gsc is loaded and proxy is setup */ if (intel_hdcp_gsc_cs_required (i915)) { -struct intel_gt *gt = i915->media_gt; -struct intel_gsc_uc *gsc = gt ? >->uc.gsc :NULL ; - -if (!gsc || !intel_uc_fw_is_running (&gsc->fw)) { - drm_dbg_kms(&i915->drm, - "GSC components required for HDCP2.2 arenot ready\n");
drivers/gpu/drm/i915/display/intel_hdcp.c bool intel_hdcp2_capable(struct intel_connector *connector) · line 176
Quoted 1 line
drivers/gpu/drm/i915/display/intel_hdcp.c +1
-0+if (!intel_hdcp_gsc_check_status (i915))Naming nitpick, though not intended to block the patch:
Quoted 9 lines
I always stop at functions named "check" that return a value. What does the return value mean? The above code reads, "if not check status".
So I usually try to name functions so that it's obvious on both sides what it means, when you read it aloud. For example, "if not status ok".
Just something to consider for the future.
Got it Jani will keep this in mind in future
Regards,
Suraj Kandpal
Quoted 53 lines
BR,
Jani.drivers/gpu/drm/i915/display/intel_hdcp_gsc.c bool intel_hdcp_gsc_cs_required(struct
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0
-1return false; - } }/* MEI/GSC interface is solid depending on which is used */ diff
--gita/drivers/gpu/drm/i915/display/intel_hdcp_gsc.cb/drivers/gpu/drm/i915/display/intel_hdcp_gsc.c
indexd753db3eef15..d355d610bc9f100644drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +0
-0@@ -17,6 +17,20 @@ bool intel_hdcp_gsc_cs_required(struct
drm_i915_private*i915)drivers/gpu/drm/i915/display/intel_hdcp_gsc.c bool intel_hdcp_gsc_cs_required(struct drm_i915_private *i915)
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +7
-0return DISPLAY_VER (i915) >=14 ; } +bool intel_hdcp_gsc_check_status (struct drm_i915_private *i915) { +struct intel_gt *gt = i915->media_gt; +struct intel_gsc_uc *gsc = gt ? >->uc.gsc :NULL ; + +if (!gsc || !intel_uc_fw_is_running (&gsc->fw)) { + drm_dbg_kms(&i915->drm, + "GSC components required for HDCP2.2 are notready\n");
drivers/gpu/drm/i915/display/intel_hdcp_gsc.h ssize_t intel_hdcp_gsc_msg_send(struct
Quoted 15 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +6
-0+return false; + } + +return true; +} + static int gsc_hdcp_initiate_session(struct device *dev, struct hdcp_port_data *data, struct hdcp2_ake_init *ake_data) diff --git
a/drivers/gpu/drm/i915/display/intel_hdcp_gsc.hb/drivers/gpu/drm/i915/display/intel_hdcp_gsc.h
indexcbf96551e534..eba2057c5a9e100644drivers/gpu/drm/i915/display/intel_hdcp_gsc.h +0
-0@@ -23,5 +23,6 @@ ssize_t intel_hdcp_gsc_msg_send(struct
drm_i915_private*i915, u8*msg_in,drivers/gpu/drm/i915/display/intel_hdcp_gsc.h ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8 *msg_in, · line 28
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.h +1
-0size_t msg_out_len);int intel_hdcp_gsc_init (struct drm_i915_private *i915);void intel_hdcp_gsc_fini (struct drm_i915_private *i915); +bool intel_hdcp_gsc_check_status (struct drm_i915_private *i915);#endif /* __INTEL_HDCP_GCS_H__ */ --
Jani Nikula, Intel
PATCH v5 2/2 drm/i915/hdcp: Move common message filling function to its own file
In reply to Suraj KandpalCreate a new file intel_hdcp_gsc_message that contain functions which fill the hdcp messages we send to gsc cs this refactor will help us reuse code for Xe later on
--v2
-add the missed file for proper build
--v3
-use forward declarations instead of #includes [Jani]
--v4
-move linux/err.h to intel_hdcp_gsc_message.c from intel_hdcp_gsc_message.h [Jani]
--v5
-move linux include on top of drm includes [Uma]
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 615 +----------------- .../drm/i915/display/intel_hdcp_gsc_message.c | 592 +++++++++++++++++ .../drm/i915/display/intel_hdcp_gsc_message.h | 72 ++ 4 files changed, 682 insertions(+), 598 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -269,6 +269,7 @@ i915-y += \ display/intel_global_state.o \ display/intel_hdcp.o \ display/intel_hdcp_gsc.o \ + display/intel_hdcp_gsc_message.o \ display/intel_hotplug.o \ display/intel_hotplug_irq.o \ display/intel_hti.o \
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +17 -598
633 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c new file +592 -0
592 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.h new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
2.25.1