All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/Documentation: Fix rowspan value in drm-kms-properties
@ 2014-12-03 19:57 Sean Paul
  2014-12-03 19:57 ` [PATCH 2/2] drm: Add Content Protection Desired property to drm Sean Paul
  2014-12-04 10:03 ` [PATCH 1/2] drm/Documentation: Fix rowspan value in drm-kms-properties Daniel Vetter
  0 siblings, 2 replies; 8+ messages in thread
From: Sean Paul @ 2014-12-03 19:57 UTC (permalink / raw)
  To: dri-devel

The "DRM" rowspan wasn't updated in commit cc7096fb6d1d (drm/mode: document path
property and function to set it. (v1.1)), so increment it by one to fix the
table.

Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 Documentation/DocBook/drm.tmpl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 56e2a9b..85287cb 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -2546,7 +2546,7 @@ void intel_crt_init(struct drm_device *dev)
 	<td valign="top" >Description/Restrictions</td>
 	</tr>
 	<tr>
-	<td rowspan="23" valign="top" >DRM</td>
+	<td rowspan="24" valign="top" >DRM</td>
 	<td rowspan="3" valign="top" >Generic</td>
 	<td valign="top" >“EDID”</td>
 	<td valign="top" >BLOB | IMMUTABLE</td>
-- 
2.2.0.rc0.207.ga3a616c

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] drm: Add Content Protection Desired property to drm
  2014-12-03 19:57 [PATCH 1/2] drm/Documentation: Fix rowspan value in drm-kms-properties Sean Paul
@ 2014-12-03 19:57 ` Sean Paul
  2014-12-03 21:31   ` Ville Syrjälä
  2014-12-04 10:03 ` [PATCH 1/2] drm/Documentation: Fix rowspan value in drm-kms-properties Daniel Vetter
  1 sibling, 1 reply; 8+ messages in thread
From: Sean Paul @ 2014-12-03 19:57 UTC (permalink / raw)
  To: dri-devel

Add a new standard connector property to track whether content protection
(ex: hdcp) is desired by userspace. While there are 3 possible states for the
property, userspace should only change the value to desired or undesired.
Upon setting the value to desired, the driver is responsible for protecting
the link and setting the value to enabled. Disabling protection should happen
immediately.

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 Documentation/DocBook/drm.tmpl | 19 +++++++++++++++++--
 drivers/gpu/drm/drm_crtc.c     | 14 ++++++++++++++
 drivers/gpu/drm/drm_sysfs.c    | 22 ++++++++++++++++++++++
 include/drm/drm_crtc.h         |  2 ++
 include/uapi/drm/drm_mode.h    |  5 +++++
 5 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 85287cb..86633f2 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -2546,8 +2546,8 @@ void intel_crt_init(struct drm_device *dev)
 	<td valign="top" >Description/Restrictions</td>
 	</tr>
 	<tr>
-	<td rowspan="24" valign="top" >DRM</td>
-	<td rowspan="3" valign="top" >Generic</td>
+	<td rowspan="25" valign="top" >DRM</td>
+	<td rowspan="4" valign="top" >Generic</td>
 	<td valign="top" >“EDID”</td>
 	<td valign="top" >BLOB | IMMUTABLE</td>
 	<td valign="top" >0</td>
@@ -2562,6 +2562,21 @@ void intel_crt_init(struct drm_device *dev)
 	<td valign="top" >Contains DPMS operation mode value.</td>
 	</tr>
 	<tr>
+	<td valign="top" >“Content Protection”</td>
+	<td valign="top" >ENUM</td>
+	<td valign="top" >{ “Undesired”, “Desired”, “Enabled” }</td>
+	<td valign="top" >Connector</td>
+	<td valign="top" >Contains the current state of content protection on
+		the link. User space should set this property to "Desired" to
+		enable protection. Once the driver has authenticated the
+		connection, it shall set the value to "Enabled". To disable
+		protection, user space shall set the value to "Undesired", which
+		will tear down the encryption. If at any point the link becomes
+		unprotected, the driver shall transition from "Enabled" down to
+		"Desired" and may retry if appropriate.
+	</td>
+	</tr>
+	<tr>
 	<td valign="top" >“PATH”</td>
 	<td valign="top" >BLOB | IMMUTABLE</td>
 	<td valign="top" >0</td>
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index de79283..5df5b7b 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -77,6 +77,14 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] =
 	{ DRM_PLANE_TYPE_CURSOR, "Cursor" },
 };
 
+static struct drm_prop_enum_list drm_cp_enum_list[] = {
+	{ DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" },
+	{ DRM_MODE_CONTENT_PROTECTION_DESIRED, "Desired" },
+	{ DRM_MODE_CONTENT_PROTECTION_ENABLED, "Enabled" },
+};
+
+DRM_ENUM_NAME_FN(drm_get_content_protection_name, drm_cp_enum_list)
+
 /*
  * Optional properties
  */
@@ -1319,6 +1327,7 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
 	struct drm_property *edid;
 	struct drm_property *dpms;
 	struct drm_property *dev_path;
+	struct drm_property *content_protection;
 
 	/*
 	 * Standard properties (apply to all connectors)
@@ -1339,6 +1348,11 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
 				       "PATH", 0);
 	dev->mode_config.path_property = dev_path;
 
+	content_protection = drm_property_create_enum(dev, 0,
+			"Content Protection", drm_cp_enum_list,
+			ARRAY_SIZE(drm_cp_enum_list));
+	dev->mode_config.content_protection_property = content_protection;
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index cc3d6d6..b4019b5 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -214,6 +214,27 @@ static ssize_t enabled_show(struct device *device,
 			"disabled");
 }
 
+static ssize_t content_protection_show(struct device *device,
+				struct device_attribute *attr, char *buf)
+{
+	struct drm_connector *connector = to_drm_connector(device);
+	struct drm_device *dev = connector->dev;
+	struct drm_property *prop;
+	uint64_t cp;
+	int ret;
+
+	prop = dev->mode_config.content_protection_property;
+	if (!prop)
+		return 0;
+
+	ret = drm_object_property_get_value(&connector->base, prop, &cp);
+	if (ret)
+		return 0;
+
+	return snprintf(buf, PAGE_SIZE, "%s\n",
+			drm_get_content_protection_name((int)cp));
+}
+
 static ssize_t edid_show(struct file *filp, struct kobject *kobj,
 			 struct bin_attribute *attr, char *buf, loff_t off,
 			 size_t count)
@@ -344,6 +365,7 @@ static struct device_attribute connector_attrs[] = {
 	__ATTR_RO(enabled),
 	__ATTR_RO(dpms),
 	__ATTR_RO(modes),
+	__ATTR_RO(content_protection),
 };
 
 /* These attributes are for both DVI-I connectors and all types of tv-out. */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index dd2c16e..b185f13 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1023,6 +1023,7 @@ struct drm_mode_config {
 	struct drm_property *path_property;
 	struct drm_property *plane_type_property;
 	struct drm_property *rotation_property;
+	struct drm_property *content_protection_property;
 
 	/* DVI-I properties */
 	struct drm_property *dvi_i_subconnector_property;
@@ -1171,6 +1172,7 @@ extern void drm_encoder_cleanup(struct drm_encoder *encoder);
 extern const char *drm_get_connector_status_name(enum drm_connector_status status);
 extern const char *drm_get_subpixel_order_name(enum subpixel_order order);
 extern const char *drm_get_dpms_name(int val);
+extern const char *drm_get_content_protection_name(int val);
 extern const char *drm_get_dvi_i_subconnector_name(int val);
 extern const char *drm_get_dvi_i_select_name(int val);
 extern const char *drm_get_tv_subconnector_name(int val);
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 86574b0..e1f0e41 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -81,6 +81,11 @@
 #define DRM_MODE_DPMS_SUSPEND	2
 #define DRM_MODE_DPMS_OFF	3
 
+/* Content Protection Flags */
+#define DRM_MODE_CONTENT_PROTECTION_UNDESIRED   0
+#define DRM_MODE_CONTENT_PROTECTION_DESIRED     1
+#define DRM_MODE_CONTENT_PROTECTION_ENABLED     2
+
 /* Scaling mode options */
 #define DRM_MODE_SCALE_NONE		0 /* Unmodified timing (display or
 					     software can still scale) */
-- 
2.2.0.rc0.207.ga3a616c

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] drm: Add Content Protection Desired property to drm
  2014-12-03 19:57 ` [PATCH 2/2] drm: Add Content Protection Desired property to drm Sean Paul
@ 2014-12-03 21:31   ` Ville Syrjälä
  2014-12-04 10:03     ` Daniel Vetter
  0 siblings, 1 reply; 8+ messages in thread
From: Ville Syrjälä @ 2014-12-03 21:31 UTC (permalink / raw)
  To: Sean Paul; +Cc: dri-devel

On Wed, Dec 03, 2014 at 11:57:41AM -0800, Sean Paul wrote:
> Add a new standard connector property to track whether content protection
> (ex: hdcp) is desired by userspace. While there are 3 possible states for the
> property, userspace should only change the value to desired or undesired.
> Upon setting the value to desired, the driver is responsible for protecting
> the link and setting the value to enabled. Disabling protection should happen
> immediately.

Having a magic part r/w part r/o property doesn't sound very appealing
to me. I'm thinking it would be cleaner to just have two properties for
such things.

> 
> Cc: Rob Clark <robdclark@gmail.com>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  Documentation/DocBook/drm.tmpl | 19 +++++++++++++++++--
>  drivers/gpu/drm/drm_crtc.c     | 14 ++++++++++++++
>  drivers/gpu/drm/drm_sysfs.c    | 22 ++++++++++++++++++++++
>  include/drm/drm_crtc.h         |  2 ++
>  include/uapi/drm/drm_mode.h    |  5 +++++
>  5 files changed, 60 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
> index 85287cb..86633f2 100644
> --- a/Documentation/DocBook/drm.tmpl
> +++ b/Documentation/DocBook/drm.tmpl
> @@ -2546,8 +2546,8 @@ void intel_crt_init(struct drm_device *dev)
>  	<td valign="top" >Description/Restrictions</td>
>  	</tr>
>  	<tr>
> -	<td rowspan="24" valign="top" >DRM</td>
> -	<td rowspan="3" valign="top" >Generic</td>
> +	<td rowspan="25" valign="top" >DRM</td>
> +	<td rowspan="4" valign="top" >Generic</td>
>  	<td valign="top" >“EDID”</td>
>  	<td valign="top" >BLOB | IMMUTABLE</td>
>  	<td valign="top" >0</td>
> @@ -2562,6 +2562,21 @@ void intel_crt_init(struct drm_device *dev)
>  	<td valign="top" >Contains DPMS operation mode value.</td>
>  	</tr>
>  	<tr>
> +	<td valign="top" >“Content Protection”</td>
> +	<td valign="top" >ENUM</td>
> +	<td valign="top" >{ “Undesired”, “Desired”, “Enabled” }</td>
> +	<td valign="top" >Connector</td>
> +	<td valign="top" >Contains the current state of content protection on
> +		the link. User space should set this property to "Desired" to
> +		enable protection. Once the driver has authenticated the
> +		connection, it shall set the value to "Enabled". To disable
> +		protection, user space shall set the value to "Undesired", which
> +		will tear down the encryption. If at any point the link becomes
> +		unprotected, the driver shall transition from "Enabled" down to
> +		"Desired" and may retry if appropriate.
> +	</td>
> +	</tr>
> +	<tr>
>  	<td valign="top" >“PATH”</td>
>  	<td valign="top" >BLOB | IMMUTABLE</td>
>  	<td valign="top" >0</td>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index de79283..5df5b7b 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -77,6 +77,14 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] =
>  	{ DRM_PLANE_TYPE_CURSOR, "Cursor" },
>  };
>  
> +static struct drm_prop_enum_list drm_cp_enum_list[] = {
> +	{ DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" },
> +	{ DRM_MODE_CONTENT_PROTECTION_DESIRED, "Desired" },
> +	{ DRM_MODE_CONTENT_PROTECTION_ENABLED, "Enabled" },
> +};
> +
> +DRM_ENUM_NAME_FN(drm_get_content_protection_name, drm_cp_enum_list)
> +
>  /*
>   * Optional properties
>   */
> @@ -1319,6 +1327,7 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
>  	struct drm_property *edid;
>  	struct drm_property *dpms;
>  	struct drm_property *dev_path;
> +	struct drm_property *content_protection;
>  
>  	/*
>  	 * Standard properties (apply to all connectors)
> @@ -1339,6 +1348,11 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
>  				       "PATH", 0);
>  	dev->mode_config.path_property = dev_path;
>  
> +	content_protection = drm_property_create_enum(dev, 0,
> +			"Content Protection", drm_cp_enum_list,
> +			ARRAY_SIZE(drm_cp_enum_list));
> +	dev->mode_config.content_protection_property = content_protection;
> +
>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index cc3d6d6..b4019b5 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -214,6 +214,27 @@ static ssize_t enabled_show(struct device *device,
>  			"disabled");
>  }
>  
> +static ssize_t content_protection_show(struct device *device,
> +				struct device_attribute *attr, char *buf)
> +{
> +	struct drm_connector *connector = to_drm_connector(device);
> +	struct drm_device *dev = connector->dev;
> +	struct drm_property *prop;
> +	uint64_t cp;
> +	int ret;
> +
> +	prop = dev->mode_config.content_protection_property;
> +	if (!prop)
> +		return 0;
> +
> +	ret = drm_object_property_get_value(&connector->base, prop, &cp);
> +	if (ret)
> +		return 0;
> +
> +	return snprintf(buf, PAGE_SIZE, "%s\n",
> +			drm_get_content_protection_name((int)cp));
> +}
> +
>  static ssize_t edid_show(struct file *filp, struct kobject *kobj,
>  			 struct bin_attribute *attr, char *buf, loff_t off,
>  			 size_t count)
> @@ -344,6 +365,7 @@ static struct device_attribute connector_attrs[] = {
>  	__ATTR_RO(enabled),
>  	__ATTR_RO(dpms),
>  	__ATTR_RO(modes),
> +	__ATTR_RO(content_protection),
>  };
>  
>  /* These attributes are for both DVI-I connectors and all types of tv-out. */
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index dd2c16e..b185f13 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -1023,6 +1023,7 @@ struct drm_mode_config {
>  	struct drm_property *path_property;
>  	struct drm_property *plane_type_property;
>  	struct drm_property *rotation_property;
> +	struct drm_property *content_protection_property;
>  
>  	/* DVI-I properties */
>  	struct drm_property *dvi_i_subconnector_property;
> @@ -1171,6 +1172,7 @@ extern void drm_encoder_cleanup(struct drm_encoder *encoder);
>  extern const char *drm_get_connector_status_name(enum drm_connector_status status);
>  extern const char *drm_get_subpixel_order_name(enum subpixel_order order);
>  extern const char *drm_get_dpms_name(int val);
> +extern const char *drm_get_content_protection_name(int val);
>  extern const char *drm_get_dvi_i_subconnector_name(int val);
>  extern const char *drm_get_dvi_i_select_name(int val);
>  extern const char *drm_get_tv_subconnector_name(int val);
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index 86574b0..e1f0e41 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -81,6 +81,11 @@
>  #define DRM_MODE_DPMS_SUSPEND	2
>  #define DRM_MODE_DPMS_OFF	3
>  
> +/* Content Protection Flags */
> +#define DRM_MODE_CONTENT_PROTECTION_UNDESIRED   0
> +#define DRM_MODE_CONTENT_PROTECTION_DESIRED     1
> +#define DRM_MODE_CONTENT_PROTECTION_ENABLED     2
> +
>  /* Scaling mode options */
>  #define DRM_MODE_SCALE_NONE		0 /* Unmodified timing (display or
>  					     software can still scale) */
> -- 
> 2.2.0.rc0.207.ga3a616c
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] drm: Add Content Protection Desired property to drm
  2014-12-03 21:31   ` Ville Syrjälä
@ 2014-12-04 10:03     ` Daniel Vetter
  2014-12-04 15:47       ` Rob Clark
  2014-12-04 19:03       ` [PATCH v2 2/2] drm: Add Content Protection properties " Sean Paul
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Vetter @ 2014-12-04 10:03 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: dri-devel

On Wed, Dec 03, 2014 at 11:31:47PM +0200, Ville Syrjälä wrote:
> On Wed, Dec 03, 2014 at 11:57:41AM -0800, Sean Paul wrote:
> > Add a new standard connector property to track whether content protection
> > (ex: hdcp) is desired by userspace. While there are 3 possible states for the
> > property, userspace should only change the value to desired or undesired.
> > Upon setting the value to desired, the driver is responsible for protecting
> > the link and setting the value to enabled. Disabling protection should happen
> > immediately.
> 
> Having a magic part r/w part r/o property doesn't sound very appealing
> to me. I'm thinking it would be cleaner to just have two properties for
> such things.

Yeah I think we should have a separate property which displays the current
sink key/id to indicate to userspace whether hdcp is established and to
what sink it's locked.

And we should have an upstream implementation to review, not just the doc
update, too.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] drm/Documentation: Fix rowspan value in drm-kms-properties
  2014-12-03 19:57 [PATCH 1/2] drm/Documentation: Fix rowspan value in drm-kms-properties Sean Paul
  2014-12-03 19:57 ` [PATCH 2/2] drm: Add Content Protection Desired property to drm Sean Paul
@ 2014-12-04 10:03 ` Daniel Vetter
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2014-12-04 10:03 UTC (permalink / raw)
  To: Sean Paul; +Cc: dri-devel

On Wed, Dec 03, 2014 at 11:57:40AM -0800, Sean Paul wrote:
> The "DRM" rowspan wasn't updated in commit cc7096fb6d1d (drm/mode: document path
> property and function to set it. (v1.1)), so increment it by one to fix the
> table.
> 
> Cc: Dave Airlie <airlied@linux.ie>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Pulled into my drm-misc tree.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] drm: Add Content Protection Desired property to drm
  2014-12-04 10:03     ` Daniel Vetter
@ 2014-12-04 15:47       ` Rob Clark
  2014-12-04 19:03       ` [PATCH v2 2/2] drm: Add Content Protection properties " Sean Paul
  1 sibling, 0 replies; 8+ messages in thread
From: Rob Clark @ 2014-12-04 15:47 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: dri-devel

On Thu, Dec 4, 2014 at 5:03 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Wed, Dec 03, 2014 at 11:31:47PM +0200, Ville Syrjälä wrote:
>> On Wed, Dec 03, 2014 at 11:57:41AM -0800, Sean Paul wrote:
>> > Add a new standard connector property to track whether content protection
>> > (ex: hdcp) is desired by userspace. While there are 3 possible states for the
>> > property, userspace should only change the value to desired or undesired.
>> > Upon setting the value to desired, the driver is responsible for protecting
>> > the link and setting the value to enabled. Disabling protection should happen
>> > immediately.
>>
>> Having a magic part r/w part r/o property doesn't sound very appealing
>> to me. I'm thinking it would be cleaner to just have two properties for
>> such things.
>
> Yeah I think we should have a separate property which displays the current
> sink key/id to indicate to userspace whether hdcp is established and to
> what sink it's locked.
>
> And we should have an upstream implementation to review, not just the doc
> update, too.

Since we are starting to get patches for driver support for HDCP, I'd
asked Sean to send this patch to get the process going on what we want
the interface to look like.  It is fine to defer merging until we have
driver bits to go along with it, but either way I think now is a good
time to sort out what we want it to look like from userspace

BR,
-R


> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] drm: Add Content Protection properties to drm
  2014-12-04 10:03     ` Daniel Vetter
  2014-12-04 15:47       ` Rob Clark
@ 2014-12-04 19:03       ` Sean Paul
  2016-12-20 18:36         ` Daniel Vetter
  1 sibling, 1 reply; 8+ messages in thread
From: Sean Paul @ 2014-12-04 19:03 UTC (permalink / raw)
  To: ville.syrjala, daniel, robdclark, dri-devel

Add new standard connector properties to track whether content protection
(ex: hdcp) is desired by userspace. There are two properties involved,
"Content Protection" and "Content Protection KSV".

The "Content Protection" property allows userspace to request protection
on a connector. Set "Desired" to enable, "Undesired" to disable.

The "Content Protection KSV" property reflects the current state of
protection. If the KSV is 0, the connection is not protected. Once the
driver has enabled protection, it will update the the value with the KSV
(or similarly unique identifier, if not using HDCP) of the first-hop
device (sink or repeater).

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---

Changes in v2:
	- Split property into 2
		- one for desired/undesired
		- one for disabled/ksv

 Documentation/DocBook/drm.tmpl | 27 ++++++++++++++++++++++++--
 drivers/gpu/drm/drm_crtc.c     | 18 +++++++++++++++++
 drivers/gpu/drm/drm_sysfs.c    | 44 ++++++++++++++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h         |  3 +++
 include/uapi/drm/drm_mode.h    |  4 ++++
 5 files changed, 94 insertions(+), 2 deletions(-)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 85287cb..8aa6828 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -2546,8 +2546,8 @@ void intel_crt_init(struct drm_device *dev)
 	<td valign="top" >Description/Restrictions</td>
 	</tr>
 	<tr>
-	<td rowspan="24" valign="top" >DRM</td>
-	<td rowspan="3" valign="top" >Generic</td>
+	<td rowspan="26" valign="top" >DRM</td>
+	<td rowspan="5" valign="top" >Generic</td>
 	<td valign="top" >“EDID”</td>
 	<td valign="top" >BLOB | IMMUTABLE</td>
 	<td valign="top" >0</td>
@@ -2562,6 +2562,29 @@ void intel_crt_init(struct drm_device *dev)
 	<td valign="top" >Contains DPMS operation mode value.</td>
 	</tr>
 	<tr>
+	<td valign="top" >“Content Protection”</td>
+	<td valign="top" >ENUM</td>
+	<td valign="top" >{ “Undesired”, “Desired” }</td>
+	<td valign="top" >Connector</td>
+	<td valign="top" >Contains the current request state of content
+		protection from userspace. If "Desired", the driver shall
+		attempt to encrypt the connection, retrying as appropriate. If
+		"Undesired", userspace does not need the connection to be
+		protected.
+	</td>
+	</tr>
+	<tr>
+	<td valign="top" >“Content Protection KSV”</td>
+	<td valign="top" >RANGE | IMMUTABLE</td>
+	<td valign="top" >40-bit Receiver/Repeater KSV</td>
+	<td valign="top" >Connector</td>
+	<td valign="top" >Contains the 40-bit KSV (or similarly unique sink
+		identifier, if not using HDCP) of the first hop device connected
+		to the connector if content protection is enabled. If content
+		protection is disabled, this value should be set to 0.
+	</td>
+	</tr>
+	<tr>
 	<td valign="top" >“PATH”</td>
 	<td valign="top" >BLOB | IMMUTABLE</td>
 	<td valign="top" >0</td>
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index de79283..ba78837 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -77,6 +77,13 @@ static const struct drm_prop_enum_list drm_plane_type_enum_list[] =
 	{ DRM_PLANE_TYPE_CURSOR, "Cursor" },
 };
 
+static struct drm_prop_enum_list drm_cp_enum_list[] = {
+	{ DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" },
+	{ DRM_MODE_CONTENT_PROTECTION_DESIRED, "Desired" },
+};
+
+DRM_ENUM_NAME_FN(drm_get_content_protection_name, drm_cp_enum_list)
+
 /*
  * Optional properties
  */
@@ -1319,6 +1326,8 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
 	struct drm_property *edid;
 	struct drm_property *dpms;
 	struct drm_property *dev_path;
+	struct drm_property *cp;
+	struct drm_property *cp_ksv;
 
 	/*
 	 * Standard properties (apply to all connectors)
@@ -1339,6 +1348,15 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
 				       "PATH", 0);
 	dev->mode_config.path_property = dev_path;
 
+	cp = drm_property_create_enum(dev, 0,
+				      "Content Protection", drm_cp_enum_list,
+				      ARRAY_SIZE(drm_cp_enum_list));
+	dev->mode_config.content_protection_property = cp;
+
+	cp_ksv = drm_property_create_range(dev, DRM_MODE_PROP_IMMUTABLE,
+				     "Content Protection KSV", 0, 0xFFFFFFFFFF);
+	dev->mode_config.content_protection_ksv_property = cp_ksv;
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index cc3d6d6..c3550f1 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -214,6 +214,48 @@ static ssize_t enabled_show(struct device *device,
 			"disabled");
 }
 
+static ssize_t content_protection_show(struct device *device,
+				       struct device_attribute *attr, char *buf)
+{
+	struct drm_connector *connector = to_drm_connector(device);
+	struct drm_device *dev = connector->dev;
+	struct drm_property *prop;
+	uint64_t cp;
+	int ret;
+
+	prop = dev->mode_config.content_protection_property;
+	if (!prop)
+		return 0;
+
+	ret = drm_object_property_get_value(&connector->base, prop, &cp);
+	if (ret)
+		return 0;
+
+	return snprintf(buf, PAGE_SIZE, "%s\n",
+			drm_get_content_protection_name((int)cp));
+}
+
+static ssize_t content_protection_ksv_show(struct device *device,
+					   struct device_attribute *attr,
+					   char *buf)
+{
+	struct drm_connector *connector = to_drm_connector(device);
+	struct drm_device *dev = connector->dev;
+	struct drm_property *prop;
+	uint64_t ksv;
+	int ret;
+
+	prop = dev->mode_config.content_protection_ksv_property;
+	if (!prop)
+		return 0;
+
+	ret = drm_object_property_get_value(&connector->base, prop, &ksv);
+	if (ret)
+		return 0;
+
+	return snprintf(buf, PAGE_SIZE, "%llx\n", ksv);
+}
+
 static ssize_t edid_show(struct file *filp, struct kobject *kobj,
 			 struct bin_attribute *attr, char *buf, loff_t off,
 			 size_t count)
@@ -344,6 +386,8 @@ static struct device_attribute connector_attrs[] = {
 	__ATTR_RO(enabled),
 	__ATTR_RO(dpms),
 	__ATTR_RO(modes),
+	__ATTR_RO(content_protection),
+	__ATTR_RO(content_protection_ksv),
 };
 
 /* These attributes are for both DVI-I connectors and all types of tv-out. */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index dd2c16e..3fc0643 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1023,6 +1023,8 @@ struct drm_mode_config {
 	struct drm_property *path_property;
 	struct drm_property *plane_type_property;
 	struct drm_property *rotation_property;
+	struct drm_property *content_protection_property;
+	struct drm_property *content_protection_ksv_property;
 
 	/* DVI-I properties */
 	struct drm_property *dvi_i_subconnector_property;
@@ -1171,6 +1173,7 @@ extern void drm_encoder_cleanup(struct drm_encoder *encoder);
 extern const char *drm_get_connector_status_name(enum drm_connector_status status);
 extern const char *drm_get_subpixel_order_name(enum subpixel_order order);
 extern const char *drm_get_dpms_name(int val);
+extern const char *drm_get_content_protection_name(int val);
 extern const char *drm_get_dvi_i_subconnector_name(int val);
 extern const char *drm_get_dvi_i_select_name(int val);
 extern const char *drm_get_tv_subconnector_name(int val);
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 86574b0..e2904f5 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -81,6 +81,10 @@
 #define DRM_MODE_DPMS_SUSPEND	2
 #define DRM_MODE_DPMS_OFF	3
 
+/* Content Protection Flags */
+#define DRM_MODE_CONTENT_PROTECTION_UNDESIRED   0
+#define DRM_MODE_CONTENT_PROTECTION_DESIRED     1
+
 /* Scaling mode options */
 #define DRM_MODE_SCALE_NONE		0 /* Unmodified timing (display or
 					     software can still scale) */
-- 
2.2.0.rc0.207.ga3a616c

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] drm: Add Content Protection properties to drm
  2014-12-04 19:03       ` [PATCH v2 2/2] drm: Add Content Protection properties " Sean Paul
@ 2016-12-20 18:36         ` Daniel Vetter
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2016-12-20 18:36 UTC (permalink / raw)
  To: Sean Paul; +Cc: dri-devel

On Thu, Dec 4, 2014 at 8:03 PM, Sean Paul <seanpaul@chromium.org> wrote:
> Add new standard connector properties to track whether content protection
> (ex: hdcp) is desired by userspace. There are two properties involved,
> "Content Protection" and "Content Protection KSV".
>
> The "Content Protection" property allows userspace to request protection
> on a connector. Set "Desired" to enable, "Undesired" to disable.
>
> The "Content Protection KSV" property reflects the current state of
> protection. If the KSV is 0, the connection is not protected. Once the
> driver has enabled protection, it will update the the value with the KSV
> (or similarly unique identifier, if not using HDCP) of the first-hop
> device (sink or repeater).
>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>
> Changes in v2:
>         - Split property into 2
>                 - one for desired/undesired
>                 - one for disabled/ksv


So this came up again, and I have a slightly less abritrary opinion on
the split vs. non-split property topic. My assumption was that we want
to tell userspace the ksv so that it can do the blacklisting. But it
sounds like at least all the designs with some kind of secure
processor (maybe that's a hdcp2.x thing only) will do the blacklisting
in that special processor and fail to set up encryption if the sink is
blacklisted. So for those cases I think just the tri-state property +
maybe some way to update the SRM (system renewability message iirc,
aka The Blacklist) would be the better interface.

We might still need the split approach that exposes the the ksv in a
separate property. And for that probably still need a tri-state to
lock down the ksv to a specific one, to allow userspace to blacklist
it. But I think we should only add that once we have hw that needs it
(doesn't seem the case for now after a quick irc chat).

tldr; I'm leaning back to v1 ;-)

Patch itself needs updating since properties are a bit more formal
nowadays - we haz real docs, and we expect some core support for
standardized props - something along the lines of the recently floated
"link status" stuff is imo the new gold standard. Wrt naming bikeshed:
I think we can just go with this since it's shipping in cros, makes
the entire userspace thing much easier ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-12-20 18:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-03 19:57 [PATCH 1/2] drm/Documentation: Fix rowspan value in drm-kms-properties Sean Paul
2014-12-03 19:57 ` [PATCH 2/2] drm: Add Content Protection Desired property to drm Sean Paul
2014-12-03 21:31   ` Ville Syrjälä
2014-12-04 10:03     ` Daniel Vetter
2014-12-04 15:47       ` Rob Clark
2014-12-04 19:03       ` [PATCH v2 2/2] drm: Add Content Protection properties " Sean Paul
2016-12-20 18:36         ` Daniel Vetter
2014-12-04 10:03 ` [PATCH 1/2] drm/Documentation: Fix rowspan value in drm-kms-properties Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.