gsc_context = kzalloc(sizeof(*gsc_context), GFP_KERNEL); if (!gsc_context) 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
*/
ret = intel_hdcp_gsc_initialize_message(i915, gsc_context); if (ret) {
drm_err(&i915->drm, "Could not initialize gsc_context\n");
kfree(gsc_context);
gsc_context = ERR_PTR(ret);
}
return gsc_context;
}
void intel_hdcp_gsc_context_free(struct intel_hdcp_gsc_context *gsc_context)
{ if (!gsc_context) return;
ret = intel_gsc_uc_heci_cmd_submit_packet(>->uc.gsc, addr_in,
header_in->message_size,
addr_out,
msg_out_len + sizeof(*header_out)); if (ret) {
drm_err(&i915->drm, "failed to send gsc HDCP msg (%d)\n", ret); return ret;
}
/* * Checking validity marker and header status to see if some error has * blocked us from sending message to gsc cs
*/ if (header_out->validity_marker != GSC_HECI_VALIDITY_MARKER) {
drm_err(&i915->drm, "invalid validity marker\n"); return -EINVAL;
}
if (header_out->status != 0) {
drm_err(&i915->drm, "header status indicates error %d\n",
header_out->status); return -EINVAL;
}
/* * This function can now be used for sending requests and will also handle * receipt of reply messages hence no different function of message retrieval * is required. We will initialize intel_hdcp_gsc_context structure then add * gsc cs memory header as stated in specs after which the normal HDCP payload * will follow
*/
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)
{ struct drm_i915_private *i915 = gsc_context->i915; struct intel_gt *gt = i915->media_gt; struct intel_gsc_mtl_header *header_in, *header_out; const size_t max_msg_size = PAGE_SIZE - sizeof(*header_in);
u64 addr_in, addr_out, host_session_id;
u32 reply_size, msg_size_in, msg_size_out; int ret, tries = 0;
if (!intel_uc_uses_gsc_uc(>->uc)) return -ENODEV;
if (msg_in_len > max_msg_size || msg_out_len > max_msg_size) return -ENOSPC;
/* * Keep sending request in case the pending bit is set no need to add * message handle as we are using same address hence loc. of header is * same and it will contain the message handle. we will send the message * 20 times each message 50 ms apart
*/ do {
ret = intel_gsc_send_sync(i915, header_in, header_out, addr_in,
addr_out, msg_out_len);
/* Only try again if gsc says so */ if (ret != -EAGAIN) break;
msleep(50);
} while (++tries < 20);
if (ret) goto err;
/* we use the same mem for the reply, so header is in the same loc */
reply_size = header_out->message_size - sizeof(*header_out); if (reply_size > msg_out_len) {
drm_warn(&i915->drm, "caller with insufficient HDCP reply size %u (%d)\n",
reply_size, (u32)msg_out_len);
reply_size = msg_out_len;
} elseif (reply_size != msg_out_len) {
drm_dbg_kms(&i915->drm, "caller unexpected HCDP reply size %u (%d)\n",
reply_size, (u32)msg_out_len);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.