[Intel-gfx] [PATCH v2 6/8] drm: Add CP downstream_info property

2019-03-08 Thread Ramalingam C
This patch adds a optional CP downstream info blob property to the
connectors. This enables the Userspace to read the information of HDCP
authenticated downstream topology.

Driver will updated this blob with all downstream information at the
end of the authentication.

In case userspace configures this platform as repeater, then this
information is needed for the authentication with upstream HDCP
transmitter.

v2:
  %s/cp_downstream/content_protection_downstream [daniel]

Signed-off-by: Ramalingam C 
---
 drivers/gpu/drm/drm_atomic_uapi.c |  4 ++
 drivers/gpu/drm/drm_connector.c   | 89 +++
 include/drm/drm_connector.h   | 12 +
 include/uapi/drm/drm_mode.h   | 27 ++
 4 files changed, 132 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c 
b/drivers/gpu/drm/drm_atomic_uapi.c
index f383d4be5a92..51fa217f99f6 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -826,6 +826,10 @@ drm_atomic_connector_get_property(struct drm_connector 
*connector,
*val = state->content_protection;
} else if (property == connector->content_protection_type_property) {
*val = state->content_protection_type;
+   } else if (property ==
+  connector->content_protection_downstream_property) {
+   *val = connector->content_protection_downstream_blob_ptr ?
+   connector->content_protection_downstream_blob_ptr->base.id : 0;
} 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 4ce0830e9fb4..3a11624ca73c 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -245,6 +245,7 @@ int drm_connector_init(struct drm_device *dev,
INIT_LIST_HEAD(&connector->modes);
mutex_init(&connector->mutex);
connector->edid_blob_ptr = NULL;
+   connector->content_protection_downstream_blob_ptr = NULL;
connector->status = connector_status_unknown;
connector->display_info.panel_orientation =
DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
@@ -982,6 +983,25 @@ DRM_ENUM_NAME_FN(drm_get_content_protection_type_name,
  * authentication process. If content type is changed when
  * content_protection is not UNDESIRED, then kernel will disable the HDCP
  * and re-enable with new type in the same atomic commit
+ * Content_protection_downstream_info:
+ * This blob property is used to pass the HDCP downstream topology details
+ * of a HDCP encrypted connector, from kernel to userspace.
+ * This provides all required information to userspace, so that userspace
+ * can implement the HDCP repeater using the kernel as downstream ports of
+ * the repeater. as illustrated below:
+ *
+ *  HDCP Repeaters
+ * +--+
+ * |  |
+ * |   |  |
+ * |   Userspace HDCP Receiver  +->KMD HDCP transmitters  |
+ * |  (Upstream Port)  <--+ (Downstream Ports)|
+ * |   |  |
+ * |  |
+ * +--+
+ *
+ * Kernel will populate this blob only when the HDCP authentication is
+ * successful.
  *
  * max bpc:
  * This range property is used by userspace to limit the bit depth. When
@@ -1610,6 +1630,75 @@ 
drm_connector_attach_content_protection_type_property(struct drm_connector *
 }
 EXPORT_SYMBOL(drm_connector_attach_content_protection_type_property);
 
+/**
+ * drm_connector_attach_content_protection_downstream_property - attach content
+ * protection downstream property
+ *
+ * @connector: connector to attach content protection downstream property on.
+ *
+ * This is used to add support for content protection downstream info on
+ * select connectors. when Intel platform is configured as repeater,
+ * this downstream info is used by userspace, to complete the repeater
+ * authentication of HDCP specification with upstream HDCP transmitter.
+ *
+ * The content protection downstream will be set to
+ * &drm_connector_state.content_protection_downstream
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_attach_content_protection_downstream_property(
+   struct drm_connector *connector)
+{
+   struct drm_device *dev = connector->dev;
+   struct drm_property *prop;
+
+   prop = drm_property_create(dev, DRM_MODE_PROP_BLOB |
+  DRM_MODE_PROP_IMMUTABLE,
+  "CP_downstream_info", 0);
+   if (!prop)
+   

[Intel-gfx] [PATCH v2 6/8] drm: Add CP downstream_info property

2019-03-08 Thread Ramalingam C
This patch adds a optional CP downstream info blob property to the
connectors. This enables the Userspace to read the information of HDCP
authenticated downstream topology.

Driver will updated this blob with all downstream information at the
end of the authentication.

In case userspace configures this platform as repeater, then this
information is needed for the authentication with upstream HDCP
transmitter.

v2:
  %s/cp_downstream/content_protection_downstream [daniel]

Signed-off-by: Ramalingam C 
---
 drivers/gpu/drm/drm_atomic_uapi.c |  4 ++
 drivers/gpu/drm/drm_connector.c   | 89 +++
 include/drm/drm_connector.h   | 12 +
 include/uapi/drm/drm_mode.h   | 27 ++
 4 files changed, 132 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c 
b/drivers/gpu/drm/drm_atomic_uapi.c
index f383d4be5a92..51fa217f99f6 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -826,6 +826,10 @@ drm_atomic_connector_get_property(struct drm_connector 
*connector,
*val = state->content_protection;
} else if (property == connector->content_protection_type_property) {
*val = state->content_protection_type;
+   } else if (property ==
+  connector->content_protection_downstream_property) {
+   *val = connector->content_protection_downstream_blob_ptr ?
+   connector->content_protection_downstream_blob_ptr->base.id : 0;
} 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 4ce0830e9fb4..3a11624ca73c 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -245,6 +245,7 @@ int drm_connector_init(struct drm_device *dev,
INIT_LIST_HEAD(&connector->modes);
mutex_init(&connector->mutex);
connector->edid_blob_ptr = NULL;
+   connector->content_protection_downstream_blob_ptr = NULL;
connector->status = connector_status_unknown;
connector->display_info.panel_orientation =
DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
@@ -982,6 +983,25 @@ DRM_ENUM_NAME_FN(drm_get_content_protection_type_name,
  * authentication process. If content type is changed when
  * content_protection is not UNDESIRED, then kernel will disable the HDCP
  * and re-enable with new type in the same atomic commit
+ * Content_protection_downstream_info:
+ * This blob property is used to pass the HDCP downstream topology details
+ * of a HDCP encrypted connector, from kernel to userspace.
+ * This provides all required information to userspace, so that userspace
+ * can implement the HDCP repeater using the kernel as downstream ports of
+ * the repeater. as illustrated below:
+ *
+ *  HDCP Repeaters
+ * +--+
+ * |  |
+ * |   |  |
+ * |   Userspace HDCP Receiver  +->KMD HDCP transmitters  |
+ * |  (Upstream Port)  <--+ (Downstream Ports)|
+ * |   |  |
+ * |  |
+ * +--+
+ *
+ * Kernel will populate this blob only when the HDCP authentication is
+ * successful.
  *
  * max bpc:
  * This range property is used by userspace to limit the bit depth. When
@@ -1610,6 +1630,75 @@ 
drm_connector_attach_content_protection_type_property(struct drm_connector *
 }
 EXPORT_SYMBOL(drm_connector_attach_content_protection_type_property);
 
+/**
+ * drm_connector_attach_content_protection_downstream_property - attach content
+ * protection downstream property
+ *
+ * @connector: connector to attach content protection downstream property on.
+ *
+ * This is used to add support for content protection downstream info on
+ * select connectors. when Intel platform is configured as repeater,
+ * this downstream info is used by userspace, to complete the repeater
+ * authentication of HDCP specification with upstream HDCP transmitter.
+ *
+ * The content protection downstream will be set to
+ * &drm_connector_state.content_protection_downstream
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_attach_content_protection_downstream_property(
+   struct drm_connector *connector)
+{
+   struct drm_device *dev = connector->dev;
+   struct drm_property *prop;
+
+   prop = drm_property_create(dev, DRM_MODE_PROP_BLOB |
+  DRM_MODE_PROP_IMMUTABLE,
+  "CP_downstream_info", 0);
+   if (!prop)
+