[PATCH 19/26] drm: Add CP System Renewability Msg Property

Ramalingam C ramalingam.c at intel.com
Sun Feb 24 16:39:01 UTC 2019


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.

Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 10 ++++++++++
 drivers/gpu/drm/drm_connector.c   | 34 ++++++++++++++++++++++++++++++++++
 include/drm/drm_connector.h       | 13 +++++++++++++
 3 files changed, 57 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 5289486565ce..9c57d8c07d09 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -754,6 +754,14 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
 			return -EINVAL;
 		}
 		state->cp_content_type = val;
+	} else if (property == connector->cp_srm_property) {
+		if (state->content_protection !=
+		    DRM_MODE_CONTENT_PROTECTION_UNDESIRED &&
+		    state->cp_srm_blob_id != val) {
+			DRM_DEBUG_KMS("Disable CP, then change SRM Blob\n");
+			return -EINVAL;
+		}
+		state->cp_srm_blob_id = val;
 	} else if (property == connector->colorspace_property) {
 		state->colorspace = val;
 	} else if (property == config->writeback_fb_id_property) {
@@ -832,6 +840,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
 		*val = state->content_protection;
 	} else if (property == connector->cp_content_type_property) {
 		*val = state->cp_content_type;
+	} else if (property == connector->cp_srm_property) {
+		*val = state->cp_srm_blob_id;
 	} else if (property == config->writeback_fb_id_property) {
 		/* Writeback framebuffer is one-shot, write and forget */
 		*val = 0;
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index e1581abc6625..a12e5ddc08d4 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -1593,6 +1593,40 @@ drm_connector_attach_cp_content_type_property(struct drm_connector *connector)
 EXPORT_SYMBOL(drm_connector_attach_cp_content_type_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 820feb7f0b42..796e5d5e9e5f 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -525,6 +525,12 @@ struct drm_connector_state {
 	unsigned int cp_content_type;
 
 	/**
+	 * @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;
+
+	/**
 	 * @scaling_mode: Connector property to control the
 	 * upscaling, mostly used for built-in panels.
 	 */
@@ -1048,6 +1054,12 @@ struct drm_connector {
 	struct drm_property *cp_content_type_property;
 
 	/**
+	 * @cp_srm_property: DRM BLOB property for content
+	 * protection SRM information.
+	 */
+	struct drm_property *cp_srm_property;
+
+	/**
 	 * @path_blob_ptr:
 	 *
 	 * DRM blob property data for the DP MST path property. This should only
@@ -1324,6 +1336,7 @@ int drm_connector_attach_content_protection_property(
 		struct drm_connector *connector);
 int drm_connector_attach_cp_content_type_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_colorspace_property(struct drm_connector *connector);
 int drm_mode_create_content_type_property(struct drm_device *dev);
-- 
2.7.4



More information about the Intel-gfx-trybot mailing list