Skip to contentSkip to conversation

HDCP Misc series

PATCH Superseded Anshuman Gupta 4 participants 20 messages Jan 28, 2020 – Mar 5, 2020

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover HDCP Misc series

Test-with: <[email protected]>

This series have misc fixes for broken uapi and HDCP support for Port_E, also there are few patches for DEBUG verbosity.

Anshuman Gupta (4):
drm/i915/hdcp: Update CP as per the kernel internal state drm/i915: HDCP support on above PORT_E
drm/i915: debugfs info print "HDCP shim isn't available" drm/i915: Add HDCP2.2 capable debug print

 drivers/gpu/drm/i915/display/intel_display.c |  4 +++
 drivers/gpu/drm/i915/display/intel_dp.c      |  2 ++
 drivers/gpu/drm/i915/display/intel_hdcp.c    | 29 +++++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_hdcp.h    |  2 ++
 drivers/gpu/drm/i915/display/intel_hdmi.c    |  2 ++
 drivers/gpu/drm/i915/i915_debugfs.c          |  5 +++-
 6 files changed, 42 insertions(+), 2 deletions(-)
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/4 drm/i915/hdcp: Update CP as per the kernel internal state

Content Protection property should be updated as per the kernel internal state. Let's say if Content protection is disabled by userspace, CP property should be set to UNDESIRED so that reauthentication will not happen until userspace request it again, but when kernel disables the HDCP due to any DDI disabling sequences like modeset/DPMS operation, kernel should set the property to DESIRED, so that when opportunity arises, kernel will start the HDCP authentication on its own.

Somewhere in the line, state machine to set content protection to DESIRED from kernel was broken and IGT coverage was missing for it. This patch fixes it.
IGT patch to catch further regression on this features is being worked upon.

---
 drivers/gpu/drm/i915/display/intel_display.c |  4 +++
 drivers/gpu/drm/i915/display/intel_hdcp.c    | 26 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp.h    |  2 ++
 3 files changed, 32 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +4 -0
index da5266e76738..934cdf1f1858 100644
@@ -14595,6 +14595,10 @@ static int intel_atomic_check(struct drm_device *dev,
 		goto fail;
 
 	if (any_ms) {
+		/*
+		 * When there is modeset fix the hdcp uapi CP state.
+		 */
+		intel_hdcp_post_need_modeset_check(state);
 		ret = intel_modeset_checks(state);
 		if (ret)
 			goto fail;
drivers/gpu/drm/i915/display/intel_hdcp.c +26 -0
index 0fdbd39f6641..be083136eee2 100644
@@ -2074,6 +2074,32 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
 	crtc_state->mode_changed = true;
 }
 
+/**
+ * intel_hdcp_post_need_modeset_check.
+ * @state: intel atomic state.
+ *
+ * This function fix the HDCP uapi state when hdcp disabling initiated from
+ * modeset DDI disabling sequence. It updates uapi CP state from ENABLED to
+ * DESIRED so that HDCP uapi state can be restored as per HDCP Auth state.
+ * This function should be called only in case of in case of modeset.
+ * FIXME: As per HDCP content protection property uapi doc, an uevent()
+ * need to be sent if there is transition from ENABLED->DESIRED.
+ */
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state)
+{
+	struct drm_connector *connector;
+	struct drm_connector_state *old_state;
+	struct drm_connector_state *new_state;
+	int i;
+
+	for_each_oldnew_connector_in_state(&state->base, connector, old_state,
+					   new_state, i) {
+		if (old_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED &&
+		    new_state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
+			new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+	}
+}
+
 /* Handles the CP_IRQ raised from the DP HDCP sink */
 void intel_hdcp_handle_cp_irq(struct intel_connector *connector)
 {
drivers/gpu/drm/i915/display/intel_hdcp.h +2 -0
index f3c3272e712a..7bf46bc3c348 100644
@@ -13,6 +13,7 @@
 struct drm_connector;
 struct drm_connector_state;
 struct drm_i915_private;
+struct intel_atomic_state;
 struct intel_connector;
 struct intel_hdcp_shim;
 enum port;
@@ -21,6 +22,7 @@ enum transcoder;
 void intel_hdcp_atomic_check(struct drm_connector *connector,
 			     struct drm_connector_state *old_state,
 			     struct drm_connector_state *new_state);
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state);
 int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim);
 int intel_hdcp_enable(struct intel_connector *connector,
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#2 lore raw

Re: [Intel-gfx] [PATCH 1/4] drm/i915/hdcp: Update CP as per the kernel internal state

Quoted 62 lines · Anshuman Gupta

Content Protection property should be updated as per the kernel internal state. Let's say if Content protection is disabled by userspace, CP property should be set to UNDESIRED so that reauthentication will not happen until userspace request it again, but when kernel disables the HDCP due to any DDI disabling sequences like modeset/DPMS operation, kernel should set the property to DESIRED, so that when opportunity arises, kernel will start the HDCP authentication on its own.

Somewhere in the line, state machine to set content protection to DESIRED from kernel was broken and IGT coverage was missing for it. This patch fixes it.
IGT patch to catch further regression on this features is being worked upon.

---
 drivers/gpu/drm/i915/display/intel_display.c |  4 +++
 drivers/gpu/drm/i915/display/intel_hdcp.c    | 26 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp.h    |  2 ++
 3 files changed, 32 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +4 -0
index da5266e76738..934cdf1f1858 100644
@@ -14595,6 +14595,10 @@ static int intel_atomic_check(struct drm_device *dev,
 		goto fail;
 
 	if (any_ms) {
+		/*
+		 * When there is modeset fix the hdcp uapi CP state.
+		 */
+		intel_hdcp_post_need_modeset_check(state);
 		ret = intel_modeset_checks(state);
 		if (ret)
 			goto fail;
drivers/gpu/drm/i915/display/intel_hdcp.c +16 -0
index 0fdbd39f6641..be083136eee2 100644
@@ -2074,6 +2074,32 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
 	crtc_state->mode_changed = true;
 }
 
+/**
+ * intel_hdcp_post_need_modeset_check.
+ * @state: intel atomic state.
+ *
+ * This function fix the HDCP uapi state when hdcp disabling initiated from
+ * modeset DDI disabling sequence. It updates uapi CP state from ENABLED to
+ * DESIRED so that HDCP uapi state can be restored as per HDCP Auth state.
+ * This function should be called only in case of in case of modeset.
+ * FIXME: As per HDCP content protection property uapi doc, an uevent()
+ * need to be sent if there is transition from ENABLED->DESIRED.
+ */
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state)
+{
+	struct drm_connector *connector;
+	struct drm_connector_state *old_state;
+	struct drm_connector_state *new_state;

drivers/gpu/drm/i915/display/intel_hdcp.c void intel_hdcp_atomic_check(struct drm_connector *connector, · line 2102

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +10 -0
+	int i;
+
+	for_each_oldnew_connector_in_state(&state->base, connector, old_state,
+					   new_state, i) {
+		if (old_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED &&
+		    new_state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
+			new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+	}
+}
+

Why does this feel like duplication of what you already have in intel_hdcp_atomic_check()?

BR,
Jani.

Quoted 23 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 /* Handles the CP_IRQ raised from the DP HDCP sink */
 void intel_hdcp_handle_cp_irq(struct intel_connector *connector)
 {
drivers/gpu/drm/i915/display/intel_hdcp.h +2 -0
index f3c3272e712a..7bf46bc3c348 100644
@@ -13,6 +13,7 @@
 struct drm_connector;
 struct drm_connector_state;
 struct drm_i915_private;
+struct intel_atomic_state;
 struct intel_connector;
 struct intel_hdcp_shim;
 enum port;
@@ -21,6 +22,7 @@ enum transcoder;
 void intel_hdcp_atomic_check(struct drm_connector *connector,
 			     struct drm_connector_state *old_state,
 			     struct drm_connector_state *new_state);
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state);
 int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim);
 int intel_hdcp_enable(struct intel_connector *connector,
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [Intel-gfx] [PATCH 1/4] drm/i915/hdcp: Update CP as per the kernel internal state

Quoted 68 lines · Jani Nikula
Quoted 67 lines · Anshuman Gupta

Content Protection property should be updated as per the kernel internal state. Let's say if Content protection is disabled by userspace, CP property should be set to UNDESIRED so that reauthentication will not happen until userspace request it again, but when kernel disables the HDCP due to any DDI disabling sequences like modeset/DPMS operation, kernel should set the property to DESIRED, so that when opportunity arises, kernel will start the HDCP authentication on its own.

Somewhere in the line, state machine to set content protection to DESIRED from kernel was broken and IGT coverage was missing for it. This patch fixes it.
IGT patch to catch further regression on this features is being worked upon.

---
 drivers/gpu/drm/i915/display/intel_display.c |  4 +++
 drivers/gpu/drm/i915/display/intel_hdcp.c    | 26 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp.h    |  2 ++
 3 files changed, 32 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +4 -0
index da5266e76738..934cdf1f1858 100644
@@ -14595,6 +14595,10 @@ static int intel_atomic_check(struct drm_device *dev,
 		goto fail;
 
 	if (any_ms) {
+		/*
+		 * When there is modeset fix the hdcp uapi CP state.
+		 */
+		intel_hdcp_post_need_modeset_check(state);
 		ret = intel_modeset_checks(state);
 		if (ret)
 			goto fail;
drivers/gpu/drm/i915/display/intel_hdcp.c +21 -0
index 0fdbd39f6641..be083136eee2 100644
@@ -2074,6 +2074,32 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
 	crtc_state->mode_changed = true;
 }
 
+/**
+ * intel_hdcp_post_need_modeset_check.
+ * @state: intel atomic state.
+ *
+ * This function fix the HDCP uapi state when hdcp disabling initiated from
+ * modeset DDI disabling sequence. It updates uapi CP state from ENABLED to
+ * DESIRED so that HDCP uapi state can be restored as per HDCP Auth state.
+ * This function should be called only in case of in case of modeset.
+ * FIXME: As per HDCP content protection property uapi doc, an uevent()
+ * need to be sent if there is transition from ENABLED->DESIRED.
+ */
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state)
+{
+	struct drm_connector *connector;
+	struct drm_connector_state *old_state;
+	struct drm_connector_state *new_state;
+	int i;
+
+	for_each_oldnew_connector_in_state(&state->base, connector, old_state,
+					   new_state, i) {
+		if (old_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED &&
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_hdcp.c void intel_hdcp_atomic_check(struct drm_connector *connector, · line 2102

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +5 -0
+		    new_state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
+			new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+	}
+}
+

Why does this feel like duplication of what you already have in intel_hdcp_atomic_check()?

intel_hdcp_atomic_check() have checks that for disconnected connector and it doesn't look for old state, that is not sufficient to fix the hdcp CP uapi state, it need to be fix only in case of modeset, Later on a fastset check can disable the modeset and we would endup calling intel_hdcp_enable while hdcp is already enabled. That is the reason i think we would require a new API to fix the uapi state.
Thanks ,
Anshuman Gupta.

Quoted 20 lines

BR,
Jani.

Quoted 15 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 /* Handles the CP_IRQ raised from the DP HDCP sink */
 void intel_hdcp_handle_cp_irq(struct intel_connector *connector)
 {
drivers/gpu/drm/i915/display/intel_hdcp.h +1 -0
index f3c3272e712a..7bf46bc3c348 100644
@@ -13,6 +13,7 @@
 struct drm_connector;
 struct drm_connector_state;
 struct drm_i915_private;
+struct intel_atomic_state;
 struct intel_connector;
 struct intel_hdcp_shim;
 enum port;
Quoted 11 lines
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_hdcp.h +1 -0
@@ -21,6 +22,7 @@ enum transcoder;
 void intel_hdcp_atomic_check(struct drm_connector *connector,
 			     struct drm_connector_state *old_state,
 			     struct drm_connector_state *new_state);
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state);
 int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim);
 int intel_hdcp_enable(struct intel_connector *connector,
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [Intel-gfx] [PATCH 1/4] drm/i915/hdcp: Update CP as per the kernel internal state

Quoted 77 lines · Anshuman Gupta
Quoted 68 lines · Jani Nikula
Quoted 67 lines · Anshuman Gupta

Content Protection property should be updated as per the kernel internal state. Let's say if Content protection is disabled by userspace, CP property should be set to UNDESIRED so that reauthentication will not happen until userspace request it again, but when kernel disables the HDCP due to any DDI disabling sequences like modeset/DPMS operation, kernel should set the property to DESIRED, so that when opportunity arises, kernel will start the HDCP authentication on its own.

Somewhere in the line, state machine to set content protection to DESIRED from kernel was broken and IGT coverage was missing for it. This patch fixes it.
IGT patch to catch further regression on this features is being worked upon.

---
 drivers/gpu/drm/i915/display/intel_display.c |  4 +++
 drivers/gpu/drm/i915/display/intel_hdcp.c    | 26 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp.h    |  2 ++
 3 files changed, 32 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +4 -0
index da5266e76738..934cdf1f1858 100644
@@ -14595,6 +14595,10 @@ static int intel_atomic_check(struct drm_device *dev,
 		goto fail;
 
 	if (any_ms) {
+		/*
+		 * When there is modeset fix the hdcp uapi CP state.
+		 */
+		intel_hdcp_post_need_modeset_check(state);
 		ret = intel_modeset_checks(state);
 		if (ret)
 			goto fail;
drivers/gpu/drm/i915/display/intel_hdcp.c +21 -0
index 0fdbd39f6641..be083136eee2 100644
@@ -2074,6 +2074,32 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
 	crtc_state->mode_changed = true;
 }
 
+/**
+ * intel_hdcp_post_need_modeset_check.
+ * @state: intel atomic state.
+ *
+ * This function fix the HDCP uapi state when hdcp disabling initiated from
+ * modeset DDI disabling sequence. It updates uapi CP state from ENABLED to
+ * DESIRED so that HDCP uapi state can be restored as per HDCP Auth state.
+ * This function should be called only in case of in case of modeset.
+ * FIXME: As per HDCP content protection property uapi doc, an uevent()
+ * need to be sent if there is transition from ENABLED->DESIRED.
+ */
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state)
+{
+	struct drm_connector *connector;
+	struct drm_connector_state *old_state;
+	struct drm_connector_state *new_state;
+	int i;
+
+	for_each_oldnew_connector_in_state(&state->base, connector, old_state,
+					   new_state, i) {
+		if (old_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED &&
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_hdcp.c void intel_hdcp_atomic_check(struct drm_connector *connector, · line 2102

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +5 -0
+		    new_state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
+			new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+	}
+}
+

Why does this feel like duplication of what you already have in intel_hdcp_atomic_check()?

Quoted 1 line

intel_hdcp_atomic_check() have checks that for disconnected connector and it doesn't look for

typo here, "intel_hdcp_atomic_check() checks that for disconnected connector and it doesn't check for new state shouldn't be UNDESIRED"

Quoted 37 lines

old state, that is not sufficient to fix the hdcp CP uapi state, it need to be fix only in case of modeset, Later on a fastset check can disable the modeset and we would endup calling intel_hdcp_enable while hdcp is already enabled. That is the reason i think we would require a new API to fix the uapi state.
Thanks ,
Anshuman Gupta.

Quoted 31 lines

BR,
Jani.

Quoted 23 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 /* Handles the CP_IRQ raised from the DP HDCP sink */
 void intel_hdcp_handle_cp_irq(struct intel_connector *connector)
 {
drivers/gpu/drm/i915/display/intel_hdcp.h +2 -0
index f3c3272e712a..7bf46bc3c348 100644
@@ -13,6 +13,7 @@
 struct drm_connector;
 struct drm_connector_state;
 struct drm_i915_private;
+struct intel_atomic_state;
 struct intel_connector;
 struct intel_hdcp_shim;
 enum port;
@@ -21,6 +22,7 @@ enum transcoder;
 void intel_hdcp_atomic_check(struct drm_connector *connector,
 			     struct drm_connector_state *old_state,
 			     struct drm_connector_state *new_state);
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state);
 int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim);
 int intel_hdcp_enable(struct intel_connector *connector,
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [Intel-gfx] [PATCH 1/4] drm/i915/hdcp: Update CP as per the kernel internal state

On 2020-01-28 at 21:45:45 +0530, Anshuman Gupta wrote:
Hi Jani ,
As per my understanding intel_hdcp_atomic_check() is not sufficient to fix the broken hdcp uapi state, as the state fixup required in case of modeset.
If you do not have any concern, can we continue with the patch. Thanks,
Anshuman Gupta.

Quoted 78 lines · Anshuman Gupta
Quoted 77 lines · Jani Nikula
Quoted 76 lines · Anshuman Gupta
Quoted 62 lines

Content Protection property should be updated as per the kernel internal state. Let's say if Content protection is disabled by userspace, CP property should be set to UNDESIRED so that reauthentication will not happen until userspace request it again, but when kernel disables the HDCP due to any DDI disabling sequences like modeset/DPMS operation, kernel should set the property to DESIRED, so that when opportunity arises, kernel will start the HDCP authentication on its own.

Somewhere in the line, state machine to set content protection to DESIRED from kernel was broken and IGT coverage was missing for it. This patch fixes it.
IGT patch to catch further regression on this features is being worked upon.

---
 drivers/gpu/drm/i915/display/intel_display.c |  4 +++
 drivers/gpu/drm/i915/display/intel_hdcp.c    | 26 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp.h    |  2 ++
 3 files changed, 32 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +4 -0
index da5266e76738..934cdf1f1858 100644
@@ -14595,6 +14595,10 @@ static int intel_atomic_check(struct drm_device *dev,
 		goto fail;
 
 	if (any_ms) {
+		/*
+		 * When there is modeset fix the hdcp uapi CP state.
+		 */
+		intel_hdcp_post_need_modeset_check(state);
 		ret = intel_modeset_checks(state);
 		if (ret)
 			goto fail;
drivers/gpu/drm/i915/display/intel_hdcp.c +16 -0
index 0fdbd39f6641..be083136eee2 100644
@@ -2074,6 +2074,32 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
 	crtc_state->mode_changed = true;
 }
 
+/**
+ * intel_hdcp_post_need_modeset_check.
+ * @state: intel atomic state.
+ *
+ * This function fix the HDCP uapi state when hdcp disabling initiated from
+ * modeset DDI disabling sequence. It updates uapi CP state from ENABLED to
+ * DESIRED so that HDCP uapi state can be restored as per HDCP Auth state.
+ * This function should be called only in case of in case of modeset.
+ * FIXME: As per HDCP content protection property uapi doc, an uevent()
+ * need to be sent if there is transition from ENABLED->DESIRED.
+ */
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state)
+{
+	struct drm_connector *connector;
+	struct drm_connector_state *old_state;
+	struct drm_connector_state *new_state;

drivers/gpu/drm/i915/display/intel_hdcp.c void intel_hdcp_atomic_check(struct drm_connector *connector, · line 2102

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +10 -0
+	int i;
+
+	for_each_oldnew_connector_in_state(&state->base, connector, old_state,
+					   new_state, i) {
+		if (old_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED &&
+		    new_state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
+			new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+	}
+}
+

Why does this feel like duplication of what you already have in intel_hdcp_atomic_check()?

Quoted 39 lines
Quoted 1 line

intel_hdcp_atomic_check() have checks that for disconnected connector and it doesn't look for

typo here, "intel_hdcp_atomic_check() checks that for disconnected connector and it doesn't check for new state shouldn't be UNDESIRED"

Quoted 37 lines

old state, that is not sufficient to fix the hdcp CP uapi state, it need to be fix only in case of modeset, Later on a fastset check can disable the modeset and we would endup calling intel_hdcp_enable while hdcp is already enabled. That is the reason i think we would require a new API to fix the uapi state.
Thanks ,
Anshuman Gupta.

Quoted 31 lines

BR,
Jani.

Quoted 23 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 /* Handles the CP_IRQ raised from the DP HDCP sink */
 void intel_hdcp_handle_cp_irq(struct intel_connector *connector)
 {
drivers/gpu/drm/i915/display/intel_hdcp.h +2 -0
index f3c3272e712a..7bf46bc3c348 100644
@@ -13,6 +13,7 @@
 struct drm_connector;
 struct drm_connector_state;
 struct drm_i915_private;
+struct intel_atomic_state;
 struct intel_connector;
 struct intel_hdcp_shim;
 enum port;
@@ -21,6 +22,7 @@ enum transcoder;
 void intel_hdcp_atomic_check(struct drm_connector *connector,
 			     struct drm_connector_state *old_state,
 			     struct drm_connector_state *new_state);
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state);
 int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim);
 int intel_hdcp_enable(struct intel_connector *connector,
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Re: [Intel-gfx] [PATCH 1/4] drm/i915/hdcp: Update CP as per the kernel internal state

Op 05-02-2020 om 06:07 schreef Anshuman Gupta:

Quoted 8 lines · Anshuman Gupta

Hi Jani ,
As per my understanding intel_hdcp_atomic_check() is not sufficient to fix the broken hdcp uapi state, as the state fixup required in case of modeset.
If you do not have any concern, can we continue with the patch. Thanks,
Anshuman Gupta.

Hey,

In case of a modeset, don't we always call atomic_check() on the connector, either before or after?

Should be fine to fixup there then?

Quoted 114 lines
Quoted 77 lines · Anshuman Gupta
Quoted 76 lines · Jani Nikula
Quoted 75 lines · Anshuman Gupta
Quoted 62 lines

Content Protection property should be updated as per the kernel internal state. Let's say if Content protection is disabled by userspace, CP property should be set to UNDESIRED so that reauthentication will not happen until userspace request it again, but when kernel disables the HDCP due to any DDI disabling sequences like modeset/DPMS operation, kernel should set the property to DESIRED, so that when opportunity arises, kernel will start the HDCP authentication on its own.

Somewhere in the line, state machine to set content protection to DESIRED from kernel was broken and IGT coverage was missing for it. This patch fixes it.
IGT patch to catch further regression on this features is being worked upon.

---
 drivers/gpu/drm/i915/display/intel_display.c |  4 +++
 drivers/gpu/drm/i915/display/intel_hdcp.c    | 26 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp.h    |  2 ++
 3 files changed, 32 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +4 -0
index da5266e76738..934cdf1f1858 100644
@@ -14595,6 +14595,10 @@ static int intel_atomic_check(struct drm_device *dev,
 		goto fail;
 
 	if (any_ms) {
+		/*
+		 * When there is modeset fix the hdcp uapi CP state.
+		 */
+		intel_hdcp_post_need_modeset_check(state);
 		ret = intel_modeset_checks(state);
 		if (ret)
 			goto fail;
drivers/gpu/drm/i915/display/intel_hdcp.c +16 -0
index 0fdbd39f6641..be083136eee2 100644
@@ -2074,6 +2074,32 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
 	crtc_state->mode_changed = true;
 }
 
+/**
+ * intel_hdcp_post_need_modeset_check.
+ * @state: intel atomic state.
+ *
+ * This function fix the HDCP uapi state when hdcp disabling initiated from
+ * modeset DDI disabling sequence. It updates uapi CP state from ENABLED to
+ * DESIRED so that HDCP uapi state can be restored as per HDCP Auth state.
+ * This function should be called only in case of in case of modeset.
+ * FIXME: As per HDCP content protection property uapi doc, an uevent()
+ * need to be sent if there is transition from ENABLED->DESIRED.
+ */
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state)
+{
+	struct drm_connector *connector;
+	struct drm_connector_state *old_state;
+	struct drm_connector_state *new_state;

drivers/gpu/drm/i915/display/intel_hdcp.c void intel_hdcp_atomic_check(struct drm_connector *connector, · line 2102

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +10 -0
+	int i;
+
+	for_each_oldnew_connector_in_state(&state->base, connector, old_state,
+					   new_state, i) {
+		if (old_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED &&
+		    new_state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
+			new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+	}
+}
+

Why does this feel like duplication of what you already have in intel_hdcp_atomic_check()?

Quoted 37 lines
Quoted 1 line

intel_hdcp_atomic_check() have checks that for disconnected connector and it doesn't look for

typo here, "intel_hdcp_atomic_check() checks that for disconnected connector and it doesn't check for new state shouldn't be UNDESIRED"

Quoted 35 lines

old state, that is not sufficient to fix the hdcp CP uapi state, it need to be fix only in case of modeset, Later on a fastset check can disable the modeset and we would endup calling intel_hdcp_enable while hdcp is already enabled. That is the reason i think we would require a new API to fix the uapi state.
Thanks ,
Anshuman Gupta.

Quoted 29 lines

BR,
Jani.

Quoted 23 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 /* Handles the CP_IRQ raised from the DP HDCP sink */
 void intel_hdcp_handle_cp_irq(struct intel_connector *connector)
 {
drivers/gpu/drm/i915/display/intel_hdcp.h +2 -0
index f3c3272e712a..7bf46bc3c348 100644
@@ -13,6 +13,7 @@
 struct drm_connector;
 struct drm_connector_state;
 struct drm_i915_private;
+struct intel_atomic_state;
 struct intel_connector;
 struct intel_hdcp_shim;
 enum port;
@@ -21,6 +22,7 @@ enum transcoder;
 void intel_hdcp_atomic_check(struct drm_connector *connector,
 			     struct drm_connector_state *old_state,
 			     struct drm_connector_state *new_state);
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state);
 int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim);
 int intel_hdcp_enable(struct intel_connector *connector,
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Quoted 5 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Re: [Intel-gfx] [PATCH 1/4] drm/i915/hdcp: Update CP as per the kernel internal state

Quoted 10 lines · Maarten Lankhorst

Op 05-02-2020 om 06:07 schreef Anshuman Gupta:

Quoted 8 lines · Anshuman Gupta

Hi Jani ,
As per my understanding intel_hdcp_atomic_check() is not sufficient to fix the broken hdcp uapi state, as the state fixup required in case of modeset.
If you do not have any concern, can we continue with the patch. Thanks,
Anshuman Gupta.

Quoted 2 lines

Hey,

Thanks martin for review.
As full modeset DDI disable sequence (encoder->disable()->intel_hdcp_disable()) can cause HDCP to disable without user space knowledge i.e. when Content Protetion state is not UNDESIRED, in those cases we want to fix the HDCP Content Protection state.

Quoted 1 line

In case of a modeset, don't we always call atomic_check() on the connector, either before or after?

yes it calls drm_atomic_helper_check_modeset()->intel_digital_connector_atomic_check()->intel_hdcp_atomic_check(), but if we fix HDCP state in intel_hdcp_atomic_check(), there may be a case at later point that fastset check is true, which disable need_modeset and enable update_pipe due to which encoder->update_pipe()->intel_hdcp_update_pipe() may endup enabling HDCP again when HDCP is already enabled, which is wrong.

Quoted 2 lines

Should be fine to fixup there then?

Therefore we want to fixup the HDCP state only when full modeset is required, when it is going to disable DDI.

Thanks ,
Anshuman Gupta.

Quoted 115 lines
Quoted 115 lines
Quoted 115 lines · Anshuman Gupta
Quoted 76 lines · Jani Nikula
Quoted 67 lines · Anshuman Gupta
Quoted 66 lines

Content Protection property should be updated as per the kernel internal state. Let's say if Content protection is disabled by userspace, CP property should be set to UNDESIRED so that reauthentication will not happen until userspace request it again, but when kernel disables the HDCP due to any DDI disabling sequences like modeset/DPMS operation, kernel should set the property to DESIRED, so that when opportunity arises, kernel will start the HDCP authentication on its own.

Somewhere in the line, state machine to set content protection to DESIRED from kernel was broken and IGT coverage was missing for it. This patch fixes it.
IGT patch to catch further regression on this features is being worked upon.

---
 drivers/gpu/drm/i915/display/intel_display.c |  4 +++
 drivers/gpu/drm/i915/display/intel_hdcp.c    | 26 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp.h    |  2 ++
 3 files changed, 32 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +4 -0
index da5266e76738..934cdf1f1858 100644
@@ -14595,6 +14595,10 @@ static int intel_atomic_check(struct drm_device *dev,
 		goto fail;
 
 	if (any_ms) {
+		/*
+		 * When there is modeset fix the hdcp uapi CP state.
+		 */
+		intel_hdcp_post_need_modeset_check(state);
 		ret = intel_modeset_checks(state);
 		if (ret)
 			goto fail;
drivers/gpu/drm/i915/display/intel_hdcp.c +20 -0
index 0fdbd39f6641..be083136eee2 100644
@@ -2074,6 +2074,32 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
 	crtc_state->mode_changed = true;
 }
 
+/**
+ * intel_hdcp_post_need_modeset_check.
+ * @state: intel atomic state.
+ *
+ * This function fix the HDCP uapi state when hdcp disabling initiated from
+ * modeset DDI disabling sequence. It updates uapi CP state from ENABLED to
+ * DESIRED so that HDCP uapi state can be restored as per HDCP Auth state.
+ * This function should be called only in case of in case of modeset.
+ * FIXME: As per HDCP content protection property uapi doc, an uevent()
+ * need to be sent if there is transition from ENABLED->DESIRED.
+ */
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state)
+{
+	struct drm_connector *connector;
+	struct drm_connector_state *old_state;
+	struct drm_connector_state *new_state;
+	int i;
+
+	for_each_oldnew_connector_in_state(&state->base, connector, old_state,
+					   new_state, i) {
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_hdcp.c void intel_hdcp_atomic_check(struct drm_connector *connector, · line 2102

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +6 -0
+		if (old_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED &&
+		    new_state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
+			new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+	}
+}
+

Why does this feel like duplication of what you already have in intel_hdcp_atomic_check()?

Quoted 1 line

intel_hdcp_atomic_check() have checks that for disconnected connector and it doesn't look for

typo here, "intel_hdcp_atomic_check() checks that for disconnected connector and it doesn't check for new state shouldn't be UNDESIRED"

Quoted 35 lines

old state, that is not sufficient to fix the hdcp CP uapi state, it need to be fix only in case of modeset, Later on a fastset check can disable the modeset and we would endup calling intel_hdcp_enable while hdcp is already enabled. That is the reason i think we would require a new API to fix the uapi state.
Thanks ,
Anshuman Gupta.

Quoted 29 lines

BR,
Jani.

Quoted 23 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 /* Handles the CP_IRQ raised from the DP HDCP sink */
 void intel_hdcp_handle_cp_irq(struct intel_connector *connector)
 {
drivers/gpu/drm/i915/display/intel_hdcp.h +2 -0
index f3c3272e712a..7bf46bc3c348 100644
@@ -13,6 +13,7 @@
 struct drm_connector;
 struct drm_connector_state;
 struct drm_i915_private;
+struct intel_atomic_state;
 struct intel_connector;
 struct intel_hdcp_shim;
 enum port;
@@ -21,6 +22,7 @@ enum transcoder;
 void intel_hdcp_atomic_check(struct drm_connector *connector,
 			     struct drm_connector_state *old_state,
 			     struct drm_connector_state *new_state);
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state);
 int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim);
 int intel_hdcp_enable(struct intel_connector *connector,
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Quoted 6 lines
Quoted 5 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

Re: [Intel-gfx] [PATCH 1/4] drm/i915/hdcp: Update CP as per the kernel internal state

Op 03-03-2020 om 17:35 schreef Anshuman Gupta:

Quoted 10 lines · Maarten Lankhorst
Quoted 9 lines

Op 05-02-2020 om 06:07 schreef Anshuman Gupta:

Quoted 8 lines · Anshuman Gupta

Hi Jani ,
As per my understanding intel_hdcp_atomic_check() is not sufficient to fix the broken hdcp uapi state, as the state fixup required in case of modeset.
If you do not have any concern, can we continue with the patch. Thanks,
Anshuman Gupta.

Quoted 6 lines
Quoted 2 lines

Hey,

Thanks martin for review.
As full modeset DDI disable sequence (encoder->disable()->intel_hdcp_disable()) can cause HDCP to disable without user space knowledge i.e. when Content Protetion state is not UNDESIRED, in those cases we want to fix the HDCP Content Protection state.

You can get to crtc_state from the connector_state->crtc, should be easy to fix up this case.

Quoted 5 lines
Quoted 1 line

In case of a modeset, don't we always call atomic_check() on the connector, either before or after?

yes it calls drm_atomic_helper_check_modeset()->intel_digital_connector_atomic_check()->intel_hdcp_atomic_check(), but if we fix HDCP state in intel_hdcp_atomic_check(), there may be a case at later point that fastset check is true, which disable need_modeset and enable update_pipe due to which encoder->update_pipe()->intel_hdcp_update_pipe() may endup enabling HDCP again when HDCP is already enabled, which is wrong.

Seems that if you look at the crtc_state carefully, you can prevent that. :)

~Maarten

Quoted 125 lines
Quoted 1 line

Should be fine to fixup there then?

Therefore we want to fixup the HDCP state only when full modeset is required, when it is going to disable DDI.

Thanks ,
Anshuman Gupta.

Quoted 119 lines
Quoted 119 lines
Quoted 77 lines · Anshuman Gupta
Quoted 76 lines · Jani Nikula
Quoted 75 lines · Anshuman Gupta
Quoted 62 lines

Content Protection property should be updated as per the kernel internal state. Let's say if Content protection is disabled by userspace, CP property should be set to UNDESIRED so that reauthentication will not happen until userspace request it again, but when kernel disables the HDCP due to any DDI disabling sequences like modeset/DPMS operation, kernel should set the property to DESIRED, so that when opportunity arises, kernel will start the HDCP authentication on its own.

Somewhere in the line, state machine to set content protection to DESIRED from kernel was broken and IGT coverage was missing for it. This patch fixes it.
IGT patch to catch further regression on this features is being worked upon.

---
 drivers/gpu/drm/i915/display/intel_display.c |  4 +++
 drivers/gpu/drm/i915/display/intel_hdcp.c    | 26 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp.h    |  2 ++
 3 files changed, 32 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +4 -0
index da5266e76738..934cdf1f1858 100644
@@ -14595,6 +14595,10 @@ static int intel_atomic_check(struct drm_device *dev,
 		goto fail;
 
 	if (any_ms) {
+		/*
+		 * When there is modeset fix the hdcp uapi CP state.
+		 */
+		intel_hdcp_post_need_modeset_check(state);
 		ret = intel_modeset_checks(state);
 		if (ret)
 			goto fail;
drivers/gpu/drm/i915/display/intel_hdcp.c +16 -0
index 0fdbd39f6641..be083136eee2 100644
@@ -2074,6 +2074,32 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
 	crtc_state->mode_changed = true;
 }
 
+/**
+ * intel_hdcp_post_need_modeset_check.
+ * @state: intel atomic state.
+ *
+ * This function fix the HDCP uapi state when hdcp disabling initiated from
+ * modeset DDI disabling sequence. It updates uapi CP state from ENABLED to
+ * DESIRED so that HDCP uapi state can be restored as per HDCP Auth state.
+ * This function should be called only in case of in case of modeset.
+ * FIXME: As per HDCP content protection property uapi doc, an uevent()
+ * need to be sent if there is transition from ENABLED->DESIRED.
+ */
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state)
+{
+	struct drm_connector *connector;
+	struct drm_connector_state *old_state;
+	struct drm_connector_state *new_state;

drivers/gpu/drm/i915/display/intel_hdcp.c void intel_hdcp_atomic_check(struct drm_connector *connector, · line 2102

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +10 -0
+	int i;
+
+	for_each_oldnew_connector_in_state(&state->base, connector, old_state,
+					   new_state, i) {
+		if (old_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED &&
+		    new_state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
+			new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+	}
+}
+

Why does this feel like duplication of what you already have in intel_hdcp_atomic_check()?

Quoted 37 lines
Quoted 1 line

intel_hdcp_atomic_check() have checks that for disconnected connector and it doesn't look for

typo here, "intel_hdcp_atomic_check() checks that for disconnected connector and it doesn't check for new state shouldn't be UNDESIRED"

Quoted 35 lines

old state, that is not sufficient to fix the hdcp CP uapi state, it need to be fix only in case of modeset, Later on a fastset check can disable the modeset and we would endup calling intel_hdcp_enable while hdcp is already enabled. That is the reason i think we would require a new API to fix the uapi state.
Thanks ,
Anshuman Gupta.

Quoted 29 lines

BR,
Jani.

Quoted 23 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 /* Handles the CP_IRQ raised from the DP HDCP sink */
 void intel_hdcp_handle_cp_irq(struct intel_connector *connector)
 {
drivers/gpu/drm/i915/display/intel_hdcp.h +2 -0
index f3c3272e712a..7bf46bc3c348 100644
@@ -13,6 +13,7 @@
 struct drm_connector;
 struct drm_connector_state;
 struct drm_i915_private;
+struct intel_atomic_state;
 struct intel_connector;
 struct intel_hdcp_shim;
 enum port;
@@ -21,6 +22,7 @@ enum transcoder;
 void intel_hdcp_atomic_check(struct drm_connector *connector,
 			     struct drm_connector_state *old_state,
 			     struct drm_connector_state *new_state);
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state);
 int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim);
 int intel_hdcp_enable(struct intel_connector *connector,
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [Intel-gfx] [PATCH 1/4] drm/i915/hdcp: Update CP as per the kernel internal state

Quoted 13 lines · Maarten Lankhorst

Op 03-03-2020 om 17:35 schreef Anshuman Gupta:

Quoted 12 lines · Maarten Lankhorst
Quoted 11 lines

Op 05-02-2020 om 06:07 schreef Anshuman Gupta:

Quoted 8 lines · Anshuman Gupta

Hi Jani ,
As per my understanding intel_hdcp_atomic_check() is not sufficient to fix the broken hdcp uapi state, as the state fixup required in case of modeset.
If you do not have any concern, can we continue with the patch. Thanks,
Anshuman Gupta.

Hey,

Hi Maarten,

Quoted 1 line
Quoted 1 line

Thanks martin for review.

My apology for typo here.

Quoted 11 lines
Quoted 3 lines

As full modeset DDI disable sequence (encoder->disable()->intel_hdcp_disable()) can cause HDCP to disable without user space knowledge i.e. when Content Protetion state is not UNDESIRED, in those cases we want to fix the HDCP Content Protection state.

You can get to crtc_state from the connector_state->crtc, should be easy to fix up this case.

Quoted 5 lines
Quoted 1 line

In case of a modeset, don't we always call atomic_check() on the connector, either before or after?

yes it calls drm_atomic_helper_check_modeset()->intel_digital_connector_atomic_check()->intel_hdcp_atomic_check(), but if we fix HDCP state in intel_hdcp_atomic_check(), there may be a case at later point that fastset check is true, which disable need_modeset and enable update_pipe due to which encoder->update_pipe()->intel_hdcp_update_pipe() may endup enabling HDCP again when HDCP is already enabled, which is wrong.

Seems that if you look at the crtc_state carefully, you can prevent that. :)

If i understand correctly your suggestion to use crtc_state->active state here, or it is some other crtc state parameter to refer.
AFAIU crtc_state->active state can also be true for any modeset request, Please correct me if i am wrong here.
Thanks,
Anshuman.

Quoted 130 lines

~Maarten

Quoted 125 lines
Quoted 1 line

Should be fine to fixup there then?

Therefore we want to fixup the HDCP state only when full modeset is required, when it is going to disable DDI.

Thanks ,
Anshuman Gupta.

Quoted 119 lines
Quoted 119 lines
Quoted 77 lines · Anshuman Gupta
Quoted 76 lines · Jani Nikula
Quoted 75 lines · Anshuman Gupta
Quoted 62 lines

Content Protection property should be updated as per the kernel internal state. Let's say if Content protection is disabled by userspace, CP property should be set to UNDESIRED so that reauthentication will not happen until userspace request it again, but when kernel disables the HDCP due to any DDI disabling sequences like modeset/DPMS operation, kernel should set the property to DESIRED, so that when opportunity arises, kernel will start the HDCP authentication on its own.

Somewhere in the line, state machine to set content protection to DESIRED from kernel was broken and IGT coverage was missing for it. This patch fixes it.
IGT patch to catch further regression on this features is being worked upon.

---
 drivers/gpu/drm/i915/display/intel_display.c |  4 +++
 drivers/gpu/drm/i915/display/intel_hdcp.c    | 26 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp.h    |  2 ++
 3 files changed, 32 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +4 -0
index da5266e76738..934cdf1f1858 100644
@@ -14595,6 +14595,10 @@ static int intel_atomic_check(struct drm_device *dev,
 		goto fail;
 
 	if (any_ms) {
+		/*
+		 * When there is modeset fix the hdcp uapi CP state.
+		 */
+		intel_hdcp_post_need_modeset_check(state);
 		ret = intel_modeset_checks(state);
 		if (ret)
 			goto fail;
drivers/gpu/drm/i915/display/intel_hdcp.c +16 -0
index 0fdbd39f6641..be083136eee2 100644
@@ -2074,6 +2074,32 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
 	crtc_state->mode_changed = true;
 }
 
+/**
+ * intel_hdcp_post_need_modeset_check.
+ * @state: intel atomic state.
+ *
+ * This function fix the HDCP uapi state when hdcp disabling initiated from
+ * modeset DDI disabling sequence. It updates uapi CP state from ENABLED to
+ * DESIRED so that HDCP uapi state can be restored as per HDCP Auth state.
+ * This function should be called only in case of in case of modeset.
+ * FIXME: As per HDCP content protection property uapi doc, an uevent()
+ * need to be sent if there is transition from ENABLED->DESIRED.
+ */
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state)
+{
+	struct drm_connector *connector;
+	struct drm_connector_state *old_state;
+	struct drm_connector_state *new_state;

drivers/gpu/drm/i915/display/intel_hdcp.c void intel_hdcp_atomic_check(struct drm_connector *connector, · line 2102

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +10 -0
+	int i;
+
+	for_each_oldnew_connector_in_state(&state->base, connector, old_state,
+					   new_state, i) {
+		if (old_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED &&
+		    new_state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
+			new_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+	}
+}
+

Why does this feel like duplication of what you already have in intel_hdcp_atomic_check()?

Quoted 37 lines
Quoted 1 line

intel_hdcp_atomic_check() have checks that for disconnected connector and it doesn't look for

typo here, "intel_hdcp_atomic_check() checks that for disconnected connector and it doesn't check for new state shouldn't be UNDESIRED"

Quoted 35 lines

old state, that is not sufficient to fix the hdcp CP uapi state, it need to be fix only in case of modeset, Later on a fastset check can disable the modeset and we would endup calling intel_hdcp_enable while hdcp is already enabled. That is the reason i think we would require a new API to fix the uapi state.
Thanks ,
Anshuman Gupta.

Quoted 29 lines

BR,
Jani.

Quoted 23 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 /* Handles the CP_IRQ raised from the DP HDCP sink */
 void intel_hdcp_handle_cp_irq(struct intel_connector *connector)
 {
drivers/gpu/drm/i915/display/intel_hdcp.h +2 -0
index f3c3272e712a..7bf46bc3c348 100644
@@ -13,6 +13,7 @@
 struct drm_connector;
 struct drm_connector_state;
 struct drm_i915_private;
+struct intel_atomic_state;
 struct intel_connector;
 struct intel_hdcp_shim;
 enum port;
@@ -21,6 +22,7 @@ enum transcoder;
 void intel_hdcp_atomic_check(struct drm_connector *connector,
 			     struct drm_connector_state *old_state,
 			     struct drm_connector_state *new_state);
+void intel_hdcp_post_need_modeset_check(struct intel_atomic_state *state);
 int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim);
 int intel_hdcp_enable(struct intel_connector *connector,
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

PATCH 2/4 drm/i915: HDCP support on above PORT_E

In reply to Anshuman Gupta

As Gen12 onwards there are HDCP instances for each transcoder instead of port, remove the (port >=PORT_E) hdcp support limitation.

---
 drivers/gpu/drm/i915/display/intel_hdcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +2 -1
index be083136eee2..d3a1dd791ff9 100644
@@ -922,7 +922,8 @@ static void intel_hdcp_prop_work(struct work_struct *work)
 bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port)
 {
 	/* PORT E doesn't have HDCP, and PORT F is disabled */
-	return INTEL_INFO(dev_priv)->display.has_hdcp && port < PORT_E;
+	return INTEL_INFO(dev_priv)->display.has_hdcp &&
+		((INTEL_GEN(dev_priv) >= 12) || port < PORT_E);
 }
 
 static int
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#11 lore raw

Re: [Intel-gfx] [PATCH 2/4] drm/i915: HDCP support on above PORT_E

Quoted 15 lines · Anshuman Gupta

As Gen12 onwards there are HDCP instances for each transcoder instead of port, remove the (port >=PORT_E) hdcp support limitation.

---
 drivers/gpu/drm/i915/display/intel_hdcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
index be083136eee2..d3a1dd791ff9 100644

drivers/gpu/drm/i915/display/intel_hdcp.c static void intel_hdcp_prop_work(struct work_struct *work) · line 926

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +2 -1
@@ -922,7 +922,8 @@ static void intel_hdcp_prop_work(struct work_struct *work)
 bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port)
 {
 	/* PORT E doesn't have HDCP, and PORT F is disabled */
-	return INTEL_INFO(dev_priv)->display.has_hdcp && port < PORT_E;
+	return INTEL_INFO(dev_priv)->display.has_hdcp &&
+		((INTEL_GEN(dev_priv) >= 12) || port < PORT_E);

Superfluous braces around (INTEL_GEN(dev_priv) >= 12).

BR,
Jani.

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 }
 
 static int
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#12 lore raw

Re: [Intel-gfx] [PATCH 2/4] drm/i915: HDCP support on above PORT_E

Quoted 11 lines · Jani Nikula
Quoted 10 lines · Anshuman Gupta

As Gen12 onwards there are HDCP instances for each transcoder instead of port, remove the (port >=PORT_E) hdcp support limitation.

---
 drivers/gpu/drm/i915/display/intel_hdcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_hdcp.c static void intel_hdcp_prop_work(struct work_struct *work) · line 924

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
index be083136eee2..d3a1dd791ff9 100644
@@ -922,7 +922,8 @@ static void intel_hdcp_prop_work(struct work_struct *work)
 bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port)
 {
 	/* PORT E doesn't have HDCP, and PORT F is disabled */

PS. It's probably best to nuke the comment.

Quoted 12 lines

drivers/gpu/drm/i915/display/intel_hdcp.c static void intel_hdcp_prop_work(struct work_struct *work) · line 926

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +2 -1
-	return INTEL_INFO(dev_priv)->display.has_hdcp && port < PORT_E;
+	return INTEL_INFO(dev_priv)->display.has_hdcp &&
+		((INTEL_GEN(dev_priv) >= 12) || port < PORT_E);

Superfluous braces around (INTEL_GEN(dev_priv) >= 12).

BR,
Jani.

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 }
 
 static int
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

PATCH v2 2/4 drm/i915: HDCP support on above PORT_E

In reply to Anshuman Gupta

As Gen12 onwards there are HDCP instances for each transcoder instead of port, remove the (port < PORT_E) hdcp support limitation for platform >= Gen12.

v2:
- Nuke the comment and cosmetic changes. [Jani]

Cc Jani Nikula <[email protected]>
Cc Ramalingam C <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_hdcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +2 -2
index be083136eee2..231b9c12c0b6 100644
@@ -921,8 +921,8 @@ static void intel_hdcp_prop_work(struct work_struct *work)
 
 bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port)
 {
-	/* PORT E doesn't have HDCP, and PORT F is disabled */
-	return INTEL_INFO(dev_priv)->display.has_hdcp && port < PORT_E;
+	return INTEL_INFO(dev_priv)->display.has_hdcp &&
+			(INTEL_GEN(dev_priv) >= 12 || port < PORT_E);
 }
 
 static int
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 2/4
#14 lore raw

Re: [Intel-gfx] [PATCH v2 2/4] drm/i915: HDCP support on above PORT_E

Quoted 19 lines · Anshuman Gupta

As Gen12 onwards there are HDCP instances for each transcoder instead of port, remove the (port < PORT_E) hdcp support limitation for platform >= Gen12.

v2:
- Nuke the comment and cosmetic changes. [Jani]

Cc Jani Nikula <[email protected]>
Cc Ramalingam C <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_hdcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
index be083136eee2..231b9c12c0b6 100644

drivers/gpu/drm/i915/display/intel_hdcp.c static void intel_hdcp_prop_work(struct work_struct *work) · line 925

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +2 -2
@@ -921,8 +921,8 @@ static void intel_hdcp_prop_work(struct work_struct *work)
 
 bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port)
 {
-	/* PORT E doesn't have HDCP, and PORT F is disabled */
-	return INTEL_INFO(dev_priv)->display.has_hdcp && port < PORT_E;
+	return INTEL_INFO(dev_priv)->display.has_hdcp &&
+			(INTEL_GEN(dev_priv) >= 12 || port < PORT_E);

As we discussed offline, this <PORT_E check for even <gen12 doesn't make sense as per Bspec. I would suggest we test HDCP1.4 and 2.2 on existing setup of <gen12 too.

Or as we could remove this limitation and address the failure cases(not expected any as per HW spec).

For >=gen12 transcoder based hdcp instances, this check dont make any sense.

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
 }
 
 static int
Signature · 1 line
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#15 lore raw

PATCH 3/4 drm/i915: debugfs info print "HDCP shim isn't available"

In reply to Anshuman Gupta

If HDCP shim is not initialized, i915_display_info connector info returns EINVAL without providing any debug information. Adding a print for that will be useful for debugging.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +4 -1
index 0ac98e39eb75..6d913a71cbdb 100644
@@ -2405,7 +2405,8 @@ static void intel_dp_info(struct seq_file *m,
 	if (intel_connector->hdcp.shim) {
 		seq_puts(m, "\tHDCP version: ");
 		intel_hdcp_info(m, intel_connector);
-	}
+	} else if (!intel_dp_is_edp(intel_dp))
+		seq_puts(m, "\tHDCP shim isn't available\n");
 }
 
 static void intel_dp_mst_info(struct seq_file *m,
@@ -2432,6 +2433,8 @@ static void intel_hdmi_info(struct seq_file *m,
 	if (intel_connector->hdcp.shim) {
 		seq_puts(m, "\tHDCP version: ");
 		intel_hdcp_info(m, intel_connector);
+	} else {
+		seq_puts(m, "\tHDCP shim isn't available\n");
 	}
 }
 
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

Re: [Intel-gfx] [PATCH 3/4] drm/i915: debugfs info print "HDCP shim isn't available"

Quoted 15 lines · Anshuman Gupta

If HDCP shim is not initialized, i915_display_info connector info returns EINVAL without providing any debug information. Adding a print for that will be useful for debugging.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
index 0ac98e39eb75..6d913a71cbdb 100644

drivers/gpu/drm/i915/i915_debugfs.c static void intel_dp_info(struct seq_file *m, · line 2409

Quoted 6 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
@@ -2405,7 +2405,8 @@ static void intel_dp_info(struct seq_file *m,
 	if (intel_connector->hdcp.shim) {
 		seq_puts(m, "\tHDCP version: ");
 		intel_hdcp_info(m, intel_connector);
-	}
+	} else if (!intel_dp_is_edp(intel_dp))
+		seq_puts(m, "\tHDCP shim isn't available\n");

I would prefer "HDCP shim is not initialized" for this purpose.

But when this can happen on DP/HDCP connector? Either has_hdcp is false or when port is >= E. Those info might help better for debugging.

Infact as we discussed in other patch, we need to check whether we need\
port limitation for <gen12.

-Ram

Quoted 15 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -0
 }
 
 static void intel_dp_mst_info(struct seq_file *m,
@@ -2432,6 +2433,8 @@ static void intel_hdmi_info(struct seq_file *m,
 	if (intel_connector->hdcp.shim) {
 		seq_puts(m, "\tHDCP version: ");
 		intel_hdcp_info(m, intel_connector);
+	} else {
+		seq_puts(m, "\tHDCP shim isn't available\n");
 	}
 }
 
Signature · 1 line
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw

PATCH 4/4 drm/i915: Add HDCP2.2 capable debug print

In reply to Anshuman Gupta

Few CI panel claims to support HDCP 2.2 but at CI HDCP IGT test execution these panels are not detecting as HDCP 2.2 supported panels. Adding HDCP 2.2 version print will be useful in such cases.

---
 drivers/gpu/drm/i915/display/intel_dp.c   | 2 ++
 drivers/gpu/drm/i915/display/intel_hdmi.c | 2 ++
 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/display/intel_dp.c +2 -0
index 991f343579ef..22a3c3e9ade2 100644
@@ -6449,6 +6449,8 @@ int intel_dp_hdcp2_capable(struct intel_digital_port *intel_dig_port,
 	if (ret != HDCP_2_2_RXCAPS_LEN)
 		return ret >= 0 ? -EIO : ret;
 
+	DRM_DEBUG_KMS("HDCP 2.2 RxCaps VERSION 0x%x\n", rx_caps[0]);
+
 	if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL &&
 	    HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2]))
 		*capable = true;
drivers/gpu/drm/i915/display/intel_hdmi.c +2 -0
index 685589064d10..a7af0be83397 100644
@@ -1701,6 +1701,8 @@ int intel_hdmi_hdcp2_capable(struct intel_digital_port *intel_dig_port,
 	*capable = false;
 	ret = intel_hdmi_hdcp_read(intel_dig_port, HDCP_2_2_HDMI_REG_VER_OFFSET,
 				   &hdcp2_version, sizeof(hdcp2_version));
+	DRM_DEBUG_KMS("HDCP2Version 0%x\n", hdcp2_version);
+
 	if (!ret && hdcp2_version & HDCP_2_2_HDMI_SUPPORT_MASK)
 		*capable = true;
 
Signature · 6 lines
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#18 lore raw

Re: [Intel-gfx] [PATCH 4/4] drm/i915: Add HDCP2.2 capable debug print

Quoted 17 lines · Anshuman Gupta

Few CI panel claims to support HDCP 2.2 but at CI HDCP IGT test execution these panels are not detecting as HDCP 2.2 supported panels. Adding HDCP 2.2 version print will be useful in such cases.

---
 drivers/gpu/drm/i915/display/intel_dp.c   | 2 ++
 drivers/gpu/drm/i915/display/intel_hdmi.c | 2 ++
 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/display/intel_dp.c +0 -0
index 991f343579ef..22a3c3e9ade2 100644

drivers/gpu/drm/i915/display/intel_dp.c int intel_dp_hdcp2_capable(struct intel_digital_port *intel_dig_port, · line 6452

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
@@ -6449,6 +6449,8 @@ int intel_dp_hdcp2_capable(struct intel_digital_port *intel_dig_port,
 	if (ret != HDCP_2_2_RXCAPS_LEN)
 		return ret >= 0 ? -EIO : ret;
 
+	DRM_DEBUG_KMS("HDCP 2.2 RxCaps VERSION 0x%x\n", rx_caps[0]);

Please use drm_dbg_kms().

drivers/gpu/drm/i915/display/intel_hdmi.c int intel_hdmi_hdcp2_capable(struct intel_digital_port *intel_dig_port, · line 1704

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
+
 	if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL &&
 	    HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2]))
 		*capable = true;
drivers/gpu/drm/i915/display/intel_hdmi.c +1 -0
index 685589064d10..a7af0be83397 100644
@@ -1701,6 +1701,8 @@ int intel_hdmi_hdcp2_capable(struct intel_digital_port *intel_dig_port,
 	*capable = false;
 	ret = intel_hdmi_hdcp_read(intel_dig_port, HDCP_2_2_HDMI_REG_VER_OFFSET,
 				   &hdcp2_version, sizeof(hdcp2_version));
+	DRM_DEBUG_KMS("HDCP2Version 0%x\n", hdcp2_version);

Please use drm_dbg_kms(). Why is the previous debug "HDCP 2.2" and this one "HDCP2Version"? You're probably missing an x in 0%x.

BR,
Jani.

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_hdmi.c +1 -0
+
 	if (!ret && hdcp2_version & HDCP_2_2_HDMI_SUPPORT_MASK)
 		*capable = true;
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

Re: [Intel-gfx] [PATCH 4/4] drm/i915: Add HDCP2.2 capable debug print

In reply to Anshuman Gupta
Quoted 17 lines · Anshuman Gupta

Few CI panel claims to support HDCP 2.2 but at CI HDCP IGT test execution these panels are not detecting as HDCP 2.2 supported panels. Adding HDCP 2.2 version print will be useful in such cases.

---
 drivers/gpu/drm/i915/display/intel_dp.c   | 2 ++
 drivers/gpu/drm/i915/display/intel_hdmi.c | 2 ++
 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/display/intel_dp.c +0 -0
index 991f343579ef..22a3c3e9ade2 100644

drivers/gpu/drm/i915/display/intel_dp.c int intel_dp_hdcp2_capable(struct intel_digital_port *intel_dig_port, · line 6452

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
@@ -6449,6 +6449,8 @@ int intel_dp_hdcp2_capable(struct intel_digital_port *intel_dig_port,
 	if (ret != HDCP_2_2_RXCAPS_LEN)
 		return ret >= 0 ? -EIO : ret;
 
+	DRM_DEBUG_KMS("HDCP 2.2 RxCaps VERSION 0x%x\n", rx_caps[0]);

I am not able to convince myself this is needed. After getting this value we will manually do the operations implemented in the next lines. So this is not adding any value.

drivers/gpu/drm/i915/display/intel_hdmi.c int intel_hdmi_hdcp2_capable(struct intel_digital_port *intel_dig_port, · line 1704

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
+
 	if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL &&
 	    HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2]))
 		*capable = true;
drivers/gpu/drm/i915/display/intel_hdmi.c +1 -0
index 685589064d10..a7af0be83397 100644
@@ -1701,6 +1701,8 @@ int intel_hdmi_hdcp2_capable(struct intel_digital_port *intel_dig_port,
 	*capable = false;
 	ret = intel_hdmi_hdcp_read(intel_dig_port, HDCP_2_2_HDMI_REG_VER_OFFSET,
 				   &hdcp2_version, sizeof(hdcp2_version));
+	DRM_DEBUG_KMS("HDCP2Version 0%x\n", hdcp2_version);

Same here too.

Ram.

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_hdmi.c +1 -0
+
 	if (!ret && hdcp2_version & HDCP_2_2_HDMI_SUPPORT_MASK)
 		*capable = true;
 
Signature · 1 line
2.24.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx