mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
drm/i915/hdcp: split HDCP GSC message alloc/save responsibilities
Allocate and initialize the HDCP GSC message in intel_hdcp_gsc_hdcp2_init() as before, but store the pointer to display->hdcp.hdcp_message in the caller. Similarly, pass in the pointer to intel_hdcp_gsc_free_message(). Cc: Suraj Kandpal <suraj.kandpal@intel.com> Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com> Link: https://lore.kernel.org/r/a74fcc941126bf92d12115b5faf4f75099e26242.1745524803.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
parent
1e5206fc34
commit
a07d04146b
|
|
@ -90,37 +90,35 @@ static int intel_hdcp_gsc_initialize_message(struct drm_i915_private *i915,
|
|||
return err;
|
||||
}
|
||||
|
||||
int intel_hdcp_gsc_hdcp2_init(struct intel_display *display)
|
||||
struct intel_hdcp_gsc_message *intel_hdcp_gsc_hdcp2_init(struct intel_display *display)
|
||||
{
|
||||
struct drm_i915_private *i915 = to_i915(display->drm);
|
||||
struct intel_hdcp_gsc_message *hdcp_message;
|
||||
int ret;
|
||||
|
||||
hdcp_message = kzalloc(sizeof(*hdcp_message), GFP_KERNEL);
|
||||
|
||||
if (!hdcp_message)
|
||||
return -ENOMEM;
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
/*
|
||||
* NOTE: No need to lock the comp mutex here as it is already
|
||||
* going to be taken before this function called
|
||||
*/
|
||||
display->hdcp.hdcp_message = hdcp_message;
|
||||
ret = intel_hdcp_gsc_initialize_message(i915, hdcp_message);
|
||||
|
||||
if (ret)
|
||||
if (ret) {
|
||||
drm_err(display->drm, "Could not initialize hdcp_message\n");
|
||||
kfree(hdcp_message);
|
||||
hdcp_message = ERR_PTR(ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return hdcp_message;
|
||||
}
|
||||
|
||||
void intel_hdcp_gsc_free_message(struct intel_display *display)
|
||||
void intel_hdcp_gsc_free_message(struct intel_hdcp_gsc_message *hdcp_message)
|
||||
{
|
||||
struct intel_hdcp_gsc_message *hdcp_message =
|
||||
display->hdcp.hdcp_message;
|
||||
if (!hdcp_message)
|
||||
return;
|
||||
|
||||
hdcp_message->hdcp_cmd_in = NULL;
|
||||
hdcp_message->hdcp_cmd_out = NULL;
|
||||
i915_vma_unpin_and_release(&hdcp_message->vma, I915_VMA_RELEASE_MAP);
|
||||
kfree(hdcp_message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8 *msg_in,
|
|||
size_t msg_out_len);
|
||||
bool intel_hdcp_gsc_check_status(struct intel_display *display);
|
||||
|
||||
int intel_hdcp_gsc_hdcp2_init(struct intel_display *display);
|
||||
void intel_hdcp_gsc_free_message(struct intel_display *display);
|
||||
struct intel_hdcp_gsc_message *intel_hdcp_gsc_hdcp2_init(struct intel_display *display);
|
||||
void intel_hdcp_gsc_free_message(struct intel_hdcp_gsc_message *hdcp_message);
|
||||
|
||||
#endif /* __INTEL_HDCP_GCS_H__ */
|
||||
|
|
|
|||
|
|
@ -633,8 +633,9 @@ static const struct i915_hdcp_ops gsc_hdcp_ops = {
|
|||
|
||||
int intel_hdcp_gsc_init(struct intel_display *display)
|
||||
{
|
||||
struct intel_hdcp_gsc_message *hdcp_message;
|
||||
struct i915_hdcp_arbiter *arbiter;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
arbiter = kzalloc(sizeof(*arbiter), GFP_KERNEL);
|
||||
if (!arbiter)
|
||||
|
|
@ -642,8 +643,9 @@ int intel_hdcp_gsc_init(struct intel_display *display)
|
|||
|
||||
mutex_lock(&display->hdcp.hdcp_mutex);
|
||||
|
||||
ret = intel_hdcp_gsc_hdcp2_init(display);
|
||||
if (ret) {
|
||||
hdcp_message = intel_hdcp_gsc_hdcp2_init(display);
|
||||
if (IS_ERR(hdcp_message)) {
|
||||
ret = PTR_ERR(hdcp_message);
|
||||
kfree(arbiter);
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -651,6 +653,7 @@ int intel_hdcp_gsc_init(struct intel_display *display)
|
|||
display->hdcp.arbiter = arbiter;
|
||||
display->hdcp.arbiter->hdcp_dev = display->drm->dev;
|
||||
display->hdcp.arbiter->ops = &gsc_hdcp_ops;
|
||||
display->hdcp.hdcp_message = hdcp_message;
|
||||
|
||||
out:
|
||||
mutex_unlock(&display->hdcp.hdcp_mutex);
|
||||
|
|
@ -660,7 +663,8 @@ int intel_hdcp_gsc_init(struct intel_display *display)
|
|||
|
||||
void intel_hdcp_gsc_fini(struct intel_display *display)
|
||||
{
|
||||
intel_hdcp_gsc_free_message(display);
|
||||
intel_hdcp_gsc_free_message(display->hdcp.hdcp_message);
|
||||
display->hdcp.hdcp_message = NULL;
|
||||
kfree(display->hdcp.arbiter);
|
||||
display->hdcp.arbiter = NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,15 +99,14 @@ static int intel_hdcp_gsc_initialize_message(struct intel_display *display,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int intel_hdcp_gsc_hdcp2_init(struct intel_display *display)
|
||||
struct intel_hdcp_gsc_message *intel_hdcp_gsc_hdcp2_init(struct intel_display *display)
|
||||
{
|
||||
struct intel_hdcp_gsc_message *hdcp_message;
|
||||
int ret;
|
||||
|
||||
hdcp_message = kzalloc(sizeof(*hdcp_message), GFP_KERNEL);
|
||||
|
||||
if (!hdcp_message)
|
||||
return -ENOMEM;
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
/*
|
||||
* NOTE: No need to lock the comp mutex here as it is already
|
||||
|
|
@ -117,22 +116,19 @@ int intel_hdcp_gsc_hdcp2_init(struct intel_display *display)
|
|||
if (ret) {
|
||||
drm_err(display->drm, "Could not initialize hdcp_message\n");
|
||||
kfree(hdcp_message);
|
||||
return ret;
|
||||
hdcp_message = ERR_PTR(ret);
|
||||
}
|
||||
|
||||
display->hdcp.hdcp_message = hdcp_message;
|
||||
return ret;
|
||||
return hdcp_message;
|
||||
}
|
||||
|
||||
void intel_hdcp_gsc_free_message(struct intel_display *display)
|
||||
void intel_hdcp_gsc_free_message(struct intel_hdcp_gsc_message *hdcp_message)
|
||||
{
|
||||
struct intel_hdcp_gsc_message *hdcp_message = display->hdcp.hdcp_message;
|
||||
if (!hdcp_message)
|
||||
return;
|
||||
|
||||
if (hdcp_message) {
|
||||
xe_bo_unpin_map_no_vm(hdcp_message->hdcp_bo);
|
||||
kfree(hdcp_message);
|
||||
display->hdcp.hdcp_message = NULL;
|
||||
}
|
||||
xe_bo_unpin_map_no_vm(hdcp_message->hdcp_bo);
|
||||
kfree(hdcp_message);
|
||||
}
|
||||
|
||||
static int xe_gsc_send_sync(struct xe_device *xe,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user