]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/i915/hdcp: pass struct drm_device to driver specific HDCP GSC code
authorJani Nikula <jani.nikula@intel.com>
Thu, 24 Apr 2025 20:01:41 +0000 (23:01 +0300)
committerJani Nikula <jani.nikula@intel.com>
Fri, 2 May 2025 10:26:19 +0000 (13:26 +0300)
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>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://lore.kernel.org/r/bf9aa8e44e18eef41e3077a2966935b4e2649b62.1745524803.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_hdcp.c
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c
drivers/gpu/drm/i915/display/intel_hdcp_gsc.h
drivers/gpu/drm/i915/display/intel_hdcp_gsc_message.c
drivers/gpu/drm/xe/display/xe_hdcp_gsc.c

index 39bcf8f3d8100a5b6d3e050b31dece2b65a1df91..3e3038f4ee1f8525a2598ef475131e40a3413ee1 100644 (file)
@@ -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;
        }
 
index 4194ef77f7c386b4fa5ab27a54ff3e4d20e91a14..6a22862d6be1012f026c35180271694ad701e546 100644 (file)
@@ -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)
 {
-       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 @@ out_unpin:
        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)
 {
-       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);
        }
index e963c1fcc39ec49e39a7419b8de86205caea23b0..e014336aa2e48b862b019cf2b5e00839d5d3bba4 100644 (file)
@@ -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__ */
index 4226e8705d2b3b425281d33a270630321774046e..98967bb148e380696ddfd88187ce2d395d17c7c8 100644 (file)
@@ -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);
index 078916072c107717dd9c4b5349b836f7dc055994..b35a6f201d4a7a8e95ff136e6cc02bf7d31696e5 100644 (file)
@@ -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 @@ out:
 }
 
 /*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)
 {
-       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 @@ out:
        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);
        }