clear-pkgs-linux-iot-lts2018/0681-drm-Add-CP-System-Rene...

131 lines
4.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Romli, Khairul Anuar" <khairul.anuar.romli@intel.com>
Date: Fri, 12 Oct 2018 19:39:37 +0800
Subject: [PATCH] drm: Add CP System Renewability Msg Property
This patch adds a drm blob property to the selected connector.
This property will be used to pass the SRM Blob ID from userspace
to kernel.
Revocated ksv list from SRM Table will be used by the kernel in the HDCP
authentication.
Change-Id: Ie2a09d3834386d8ba401762e1c717ea336a1193a
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: Romli, Khairul Anuar <khairul.anuar.romli@intel.com>
---
drivers/gpu/drm/drm_atomic.c | 4 ++++
drivers/gpu/drm/drm_connector.c | 35 +++++++++++++++++++++++++++++++++
include/drm/drm_connector.h | 13 ++++++++++++
3 files changed, 52 insertions(+)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index c52be07dbac7..4dac6f035c61 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1421,6 +1421,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
return set_out_fence_for_connector(state->state, connector,
fence_ptr);
+ } else if (property == connector->cp_srm_property) {
+ state->cp_srm_blob_id = val;
} else if (connector->funcs->atomic_set_property) {
return connector->funcs->atomic_set_property(connector,
state, property, val);
@@ -1511,6 +1513,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
*val = state->scaling_mode;
} else if (property == connector->content_protection_property) {
*val = state->content_protection;
+ } else if (property == connector->cp_srm_property) {
+ *val = state->cp_srm_blob_id;
} else if (property == connector->cp_downstream_property) {
*val = connector->cp_downstream_blob_ptr ?
connector->cp_downstream_blob_ptr->base.id : 0;
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index a729c800af43..27f7375b4f34 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1384,6 +1384,41 @@ int drm_connector_attach_cp_downstream_property(
}
EXPORT_SYMBOL(drm_connector_attach_cp_downstream_property);
+/**
+ * drm_connector_attach_cp_srm_property - attach cp srm
+ * property
+ *
+ * @connector: connector to attach cp srm property on.
+ *
+ * This is used to add support for sending the SRM table from userspace to
+ * kernel on selected connectors. Protected content provider will provide
+ * the system renewability Message(SRM) to userspace before requesting for
+ * HDCP on a port. Hence if a Port supports content protection (mostly HDCP)
+ * then this property will be attached to receive the SRM for revocation check
+ * of the ksvs.
+ *
+ * The srm blob id will be set to &drm_connector_state.cp_srm_blob_id
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_attach_cp_srm_property(struct drm_connector *connector)
+{
+ struct drm_device *dev = connector->dev;
+ struct drm_property *prop;
+
+ prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, "CP_SRM", 0);
+ if (!prop)
+ return -ENOMEM;
+
+ drm_object_attach_property(&connector->base, prop, 0);
+ connector->cp_srm_property = prop;
+
+ return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_cp_srm_property);
+
+
/**
* drm_mode_create_aspect_ratio_property - create aspect ratio property
* @dev: DRM device
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index e268f80578fe..46d9aa4086d4 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -507,6 +507,12 @@ struct drm_connector_state {
* drm_writeback_signal_completion()
*/
struct drm_writeback_job *writeback_job;
+
+ /**
+ * @cp_srm_blob_id: Connector property to pass the SRM table for content
+ * protection. This is most commonly used for HDCP.
+ */
+ unsigned int cp_srm_blob_id;
};
/**
@@ -971,6 +977,12 @@ struct drm_connector {
struct drm_property *cp_downstream_property;
struct drm_property_blob *cp_downstream_blob_ptr;
+ /**
+ * @cp_srm_property: DRM BLOB property for content
+ * protection SRM information.
+ */
+ struct drm_property *cp_srm_property;
+
/**
* @path_blob_ptr:
*
@@ -1260,6 +1272,7 @@ int drm_connector_attach_content_protection_property(
struct drm_connector *connector);
int drm_connector_attach_cp_downstream_property(
struct drm_connector *connector);
+int drm_connector_attach_cp_srm_property(struct drm_connector *connector);
int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
int drm_mode_create_content_type_property(struct drm_device *dev);
void drm_hdmi_avi_infoframe_content_type(struct hdmi_avi_infoframe *frame,
--
https://clearlinux.org