drm/bridge:anx7625: Update HDCP status at atomic_enable()
Subsystems (3)
PATCH v3 1/1 drm/bridge:anx7625: Update HDCP status at atomic_enable()
When user enabled HDCP feature, userspace will set HDCP content to DRM_MODE_CONTENT_PROTECTION_DESIRED. Next, anx7625 will update HDCP content to DRM_MODE_CONTENT_PROTECTION_ENABLED if down stream support HDCP feature.
However once HDCP content turn to DRM_MODE_CONTENT_PROTECTION_ENABLED userspace will not update the HDCP content to DRM_MODE_CONTENT_PROTECTION_UNDESIRED until monitor disconnect.
So, anx7625 driver move hdcp content value checking from bridge interface .atomic_check() to .atomic_enable(), then update hdcp content according from currently HDCP status. And also disabled HDCP in bridge interface .atomic_disable().
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +46 -28
@@ -861,6 +861,22 @@ static int anx7625_hdcp_disable(struct anx7625_data *ctx) TX_HDCP_CTRL0, ~HARD_AUTH_EN & 0xFF); } +static void anx7625_hdcp_disable_and_update_cp (struct anx7625_data *ctx) +{ +struct device *dev = ctx->dev; + +if (!ctx->connector) +return ; + +anx7625_hdcp_disable (ctx); + + ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; +drm_hdcp_update_content_protection (ctx->connector, + ctx->hdcp_cp); + +dev_dbg (dev,"update CP to UNDESIRE\n" ); +} +static int anx7625_hdcp_enable (struct anx7625_data *ctx) {u8 bcap;
@@ -2149,34 +2165,6 @@ static int anx7625_connector_atomic_check(struct anx7625_data *ctx,if (cp == ctx->hdcp_cp)return 0 ; -if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { -if (ctx->dp_en) { -dev_dbg (dev,"enable HDCP\n" ); -anx7625_hdcp_enable (ctx); - -queue_delayed_work (ctx->hdcp_workqueue, - &ctx->hdcp_work, -msecs_to_jiffies (2000 )); - } - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { -if (ctx->hdcp_cp !=DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"current CP is not ENABLED\n" ); -return -EINVAL ; - } -anx7625_hdcp_disable (ctx); - ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; -drm_hdcp_update_content_protection (ctx->connector, - ctx->hdcp_cp); -dev_dbg (dev,"update CP to UNDESIRE\n" ); - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"Userspace illegal set to PROTECTION ENABLE\n" ); -return -EINVAL ; - } -return 0 ; }
@@ -2425,6 +2413,8 @@ static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,struct anx7625_data *ctx =bridge_to_anx7625 (bridge);struct device *dev = ctx->dev;struct drm_connector *connector; +struct drm_connector_state *conn_state; +int cp;dev_dbg (dev,"drm atomic enable\n" );
@@ -2439,6 +2429,32 @@ static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,_anx7625_hpd_polling (ctx,5000 *100 );anx7625_dp_start (ctx); + + conn_state =drm_atomic_get_new_connector_state (state->base.state, connector); + +if (WARN_ON (!conn_state)) +return ; + + cp = conn_state->content_protection; +if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { +if (ctx->dp_en) { +dev_dbg (dev,"enable HDCP\n" ); +anx7625_hdcp_enable (ctx); + +queue_delayed_work (ctx->hdcp_workqueue, + &ctx->hdcp_work, +msecs_to_jiffies (2000 )); + } + } + +if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { +if (ctx->hdcp_cp !=DRM_MODE_CONTENT_PROTECTION_ENABLED ) { +dev_err (dev,"current CP is not ENABLED\n" ); +return ; + } + +anx7625_hdcp_disable_and_update_cp (ctx); + } } static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,
@@ -2449,6 +2465,8 @@ static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,dev_dbg (dev,"drm atomic disable\n" ); +anx7625_hdcp_disable_and_update_cp (ctx); + ctx->connector =NULL ;anx7625_dp_stop (ctx);
Signature · 1 line
2.25.1
Quoted 10 lines · Xin Ji
When user enabled HDCP feature, userspace will set HDCP content to
DRM_MODE_CONTENT_PROTECTION_DESIRED. Next, anx7625 will update HDCP content toDRM_MODE_CONTENT_PROTECTION_ENABLEDif down stream support HDCP feature.However once HDCP content turn to
DRM_MODE_CONTENT_PROTECTION_ENABLEDuserspace will not update the HDCP content toDRM_MODE_CONTENT_PROTECTION_UNDESIREDuntil monitor disconnect.
Quoted 7 lines
So, anx7625 driver move hdcp content value checking from bridge interface .atomic_check() to .atomic_enable(), then update hdcp content according from currently HDCP status. And also disabled HDCP in bridge interface .atomic_disable().
Signed-off-by Xin Ji <[email protected]>---
No need to resend, but please provide a changelog under the "---" line so reviewers know what you changed in this new version.
Quoted 119 lines
drivers/gpu/drm/bridge/analogix/anx7625.c | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/anx7625.c +46
-29@@ -861,6 +861,22 @@ static int anx7625_hdcp_disable(struct anx7625_data *ctx) TX_HDCP_CTRL0, ~HARD_AUTH_EN & 0xFF); } +static void anx7625_hdcp_disable_and_update_cp (struct anx7625_data *ctx) +{ +struct device *dev = ctx->dev; + +if (!ctx->connector) +return ; + +anx7625_hdcp_disable (ctx); + + ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; +drm_hdcp_update_content_protection (ctx->connector, + ctx->hdcp_cp); + +dev_dbg (dev,"update CP to UNDESIRE\n" ); +} +static int anx7625_hdcp_enable (struct anx7625_data *ctx) {u8 bcap;@@ -2149,34 +2165,6 @@ static int anx7625_connector_atomic_check(struct anx7625_data *ctx,if (cp == ctx->hdcp_cp)return 0 ; -if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { -if (ctx->dp_en) { -dev_dbg (dev,"enable HDCP\n" ); -anx7625_hdcp_enable (ctx); - -queue_delayed_work (ctx->hdcp_workqueue, - &ctx->hdcp_work, -msecs_to_jiffies (2000 )); - } - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { -if (ctx->hdcp_cp !=DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"current CP is not ENABLED\n" ); -return -EINVAL ; - } -anx7625_hdcp_disable (ctx); - ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; -drm_hdcp_update_content_protection (ctx->connector, - ctx->hdcp_cp); -dev_dbg (dev,"update CP to UNDESIRE\n" ); - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"Userspace illegal set to PROTECTION ENABLE\n" ); -return -EINVAL ; - } -return 0 ; }@@ -2425,6 +2413,8 @@ static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,struct anx7625_data *ctx =bridge_to_anx7625 (bridge);struct device *dev = ctx->dev;struct drm_connector *connector; +struct drm_connector_state *conn_state; +int cp;dev_dbg (dev,"drm atomic enable\n" );@@ -2439,6 +2429,32 @@ static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,_anx7625_hpd_polling (ctx,5000 *100 );anx7625_dp_start (ctx); + + conn_state =drm_atomic_get_new_connector_state (state->base.state, connector); + +if (WARN_ON (!conn_state)) +return ; + + cp = conn_state->content_protection; +if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { +if (ctx->dp_en) { +dev_dbg (dev,"enable HDCP\n" ); +anx7625_hdcp_enable (ctx); + +queue_delayed_work (ctx->hdcp_workqueue, + &ctx->hdcp_work, +msecs_to_jiffies (2000 )); + } + } + +if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { +if (ctx->hdcp_cp !=DRM_MODE_CONTENT_PROTECTION_ENABLED ) { +dev_err (dev,"current CP is not ENABLED\n" ); +return ; + } + +anx7625_hdcp_disable_and_update_cp (ctx); + } } static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,@@ -2449,6 +2465,8 @@ static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,dev_dbg (dev,"drm atomic disable\n" ); +anx7625_hdcp_disable_and_update_cp (ctx); + ctx->connector =NULL ;anx7625_dp_stop (ctx); --2.25.1
Quoted 8 lines · Xin Ji
When user enabled HDCP feature, userspace will set HDCP content to
DRM_MODE_CONTENT_PROTECTION_DESIRED. Next, anx7625 will update HDCP content toDRM_MODE_CONTENT_PROTECTION_ENABLEDif down stream support HDCP feature.However once HDCP content turn to
DRM_MODE_CONTENT_PROTECTION_ENABLEDuserspace will not update the HDCP content toDRM_MODE_CONTENT_PROTECTION_UNDESIREDuntil monitor disconnect.
It seems you've ingored a part of the previous review comment. It's the userspace who triggers the ENABLED -> UNDESIRED transition, not the kernel side. The change to move HDCP handling to atomic_enable() looks fine, the change to disable HDCP is not (unless I misunderstand something).
Quoted 127 lines
So, anx7625 driver move hdcp content value checking from bridge interface .atomic_check() to .atomic_enable(), then update hdcp content according from currently HDCP status. And also disabled HDCP in bridge interface .atomic_disable().
Signed-off-by Xin Ji <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/anx7625.c +46
-28@@ -861,6 +861,22 @@ static int anx7625_hdcp_disable(struct anx7625_data *ctx) TX_HDCP_CTRL0, ~HARD_AUTH_EN & 0xFF); } +static void anx7625_hdcp_disable_and_update_cp (struct anx7625_data *ctx) +{ +struct device *dev = ctx->dev; + +if (!ctx->connector) +return ; + +anx7625_hdcp_disable (ctx); + + ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; +drm_hdcp_update_content_protection (ctx->connector, + ctx->hdcp_cp); + +dev_dbg (dev,"update CP to UNDESIRE\n" ); +} +static int anx7625_hdcp_enable (struct anx7625_data *ctx) {u8 bcap;@@ -2149,34 +2165,6 @@ static int anx7625_connector_atomic_check(struct anx7625_data *ctx,if (cp == ctx->hdcp_cp)return 0 ; -if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { -if (ctx->dp_en) { -dev_dbg (dev,"enable HDCP\n" ); -anx7625_hdcp_enable (ctx); - -queue_delayed_work (ctx->hdcp_workqueue, - &ctx->hdcp_work, -msecs_to_jiffies (2000 )); - } - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { -if (ctx->hdcp_cp !=DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"current CP is not ENABLED\n" ); -return -EINVAL ; - } -anx7625_hdcp_disable (ctx); - ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; -drm_hdcp_update_content_protection (ctx->connector, - ctx->hdcp_cp); -dev_dbg (dev,"update CP to UNDESIRE\n" ); - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"Userspace illegal set to PROTECTION ENABLE\n" ); -return -EINVAL ; - } -return 0 ; }@@ -2425,6 +2413,8 @@ static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,struct anx7625_data *ctx =bridge_to_anx7625 (bridge);struct device *dev = ctx->dev;struct drm_connector *connector; +struct drm_connector_state *conn_state; +int cp;dev_dbg (dev,"drm atomic enable\n" );@@ -2439,6 +2429,32 @@ static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,_anx7625_hpd_polling (ctx,5000 *100 );anx7625_dp_start (ctx); + + conn_state =drm_atomic_get_new_connector_state (state->base.state, connector); + +if (WARN_ON (!conn_state)) +return ; + + cp = conn_state->content_protection; +if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { +if (ctx->dp_en) { +dev_dbg (dev,"enable HDCP\n" ); +anx7625_hdcp_enable (ctx); + +queue_delayed_work (ctx->hdcp_workqueue, + &ctx->hdcp_work, +msecs_to_jiffies (2000 )); + } + } + +if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { +if (ctx->hdcp_cp !=DRM_MODE_CONTENT_PROTECTION_ENABLED ) { +dev_err (dev,"current CP is not ENABLED\n" ); +return ; + } + +anx7625_hdcp_disable_and_update_cp (ctx); + } } static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,@@ -2449,6 +2465,8 @@ static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,dev_dbg (dev,"drm atomic disable\n" ); +anx7625_hdcp_disable_and_update_cp (ctx); + ctx->connector =NULL ;anx7625_dp_stop (ctx);Signature · 1 line
2.25.1
Signature · 2 lines
With best wishes Dmitry
Hi Dmitry, thanks for the review, I made some changes which change ENABLE to DESIRE in .atomic_disable(), I'll upstream it after testing. Thanks!
Quoted 177 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Thursday, December 12, 2024 5:18 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
When user enabled HDCP feature, userspace will set HDCP content to
DRM_MODE_CONTENT_PROTECTION_DESIRED. Next, anx7625 will updateHDCP
Quoted 1 line
content to
DRM_MODE_CONTENT_PROTECTION_ENABLEDif down streamsupport
Quoted 3 lines
HDCP feature.
However once HDCP content turn to
DRM_MODE_CONTENT_PROTECTION_ENABLEDQuoted 2 lines
userspace will not update the HDCP content to
DRM_MODE_CONTENT_PROTECTION_UNDESIREDuntil monitor disconnect.It seems you've ingored a part of the previous review comment. It's the userspace who triggers the ENABLED -> UNDESIRED transition, not the kernel side. The change to move HDCP handling to
atomic_enable()looks fine, the change to disable HDCP is not (unless I misunderstand something).drivers/gpu/drm/bridge/analogix/anx7625.c static int anx7625_hdcp_disable(struct anx7625_data
Quoted 18 lines
So, anx7625 driver move hdcp content value checking from bridge interface .atomic_check() to .atomic_enable(), then update hdcp content according from currently HDCP status. And also disabled HDCP in bridge interface .atomic_disable().
Signed-off-by Xin Ji <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/anx7625.c +0
-0@@ -861,6 +861,22 @@ static int anx7625_hdcp_disable(struct anx7625_data*ctx)
drivers/gpu/drm/bridge/analogix/anx7625.c static int anx7625_connector_atomic_check(struct
Quoted 21 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +15
-0TX_HDCP_CTRL0, ~HARD_AUTH_EN & 0xFF); } +static void anx7625_hdcp_disable_and_update_cp (struct anx7625_data +*ctx) { +struct device *dev = ctx->dev; + +if (!ctx->connector) +return ; + +anx7625_hdcp_disable (ctx); + + ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; +drm_hdcp_update_content_protection (ctx->connector, + ctx->hdcp_cp); + +dev_dbg (dev,"update CP to UNDESIRE\n" ); } +static int anx7625_hdcp_enable (struct anx7625_data *ctx) {u8 bcap;@@ -2149,34 +2165,6 @@ static int anx7625_connector_atomic_check(struct
anx7625_data*ctx,drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_bridge_atomic_enable(struct
Quoted 35 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-28if (cp == ctx->hdcp_cp)return 0 ; -if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { -if (ctx->dp_en) { -dev_dbg (dev,"enable HDCP\n" ); -anx7625_hdcp_enable (ctx); - -queue_delayed_work (ctx->hdcp_workqueue, - &ctx->hdcp_work, -msecs_to_jiffies (2000 )); - } - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { -if (ctx->hdcp_cp !=DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"current CP is not ENABLED\n" ); -return -EINVAL ; - } -anx7625_hdcp_disable (ctx); - ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; -drm_hdcp_update_content_protection (ctx->connector, - ctx->hdcp_cp); -dev_dbg (dev,"update CP to UNDESIRE\n" ); - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"Userspace illegal set to PROTECTION ENABLE\n" ); -return -EINVAL ; - } -return 0 ; }@@ -2425,6 +2413,8 @@ static void anx7625_bridge_atomic_enable(struct
drm_bridge*bridge,drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_bridge_atomic_enable(struct
Quoted 9 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0struct anx7625_data *ctx =bridge_to_anx7625 (bridge);struct device *dev = ctx->dev;struct drm_connector *connector; +struct drm_connector_state *conn_state; +int cp;dev_dbg (dev,"drm atomic enable\n" );@@ -2439,6 +2429,32 @@ static void anx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 44 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +29
-1_anx7625_hpd_polling (ctx,5000 *100 );anx7625_dp_start (ctx); + + conn_state = +drm_atomic_get_new_connector_state (state->base.state, connector); + +if (WARN_ON (!conn_state)) +return ; + + cp = conn_state->content_protection; +if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { +if (ctx->dp_en) { +dev_dbg (dev,"enable HDCP\n" ); +anx7625_hdcp_enable (ctx); + +queue_delayed_work (ctx->hdcp_workqueue, + &ctx->hdcp_work, +msecs_to_jiffies (2000 )); + } + } + +if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { +if (ctx->hdcp_cp !=DRM_MODE_CONTENT_PROTECTION_ENABLED ) { +dev_err (dev,"current CP is not ENABLED\n" ); +return ; + } + +anx7625_hdcp_disable_and_update_cp (ctx); + } } static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,@@ -2449,6 +2465,8 @@ static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,dev_dbg (dev,"drm atomic disable\n" ); +anx7625_hdcp_disable_and_update_cp (ctx); + ctx->connector =NULL ;anx7625_dp_stop (ctx); --Quoted 2 lines
2.25.1
--
With best wishes
Dmitry
Quoted 2 lines · Xin Ji
Hi Dmitry, thanks for the review, I made some changes which change ENABLE to DESIRE in .atomic_disable(), I'll upstream it after testing. Thanks!
- Please don't top-post.
- You still didn't explain, why do you want to do this change of HDCP status. Could you please provide an explanation before sending the next iteration?
Quoted 178 lines
Quoted 178 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Thursday, December 12, 2024 5:18 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
When user enabled HDCP feature, userspace will set HDCP content to
DRM_MODE_CONTENT_PROTECTION_DESIRED. Next, anx7625 will updateHDCP
Quoted 1 line
content to
DRM_MODE_CONTENT_PROTECTION_ENABLEDif down streamsupport
Quoted 3 lines
HDCP feature.
However once HDCP content turn to
DRM_MODE_CONTENT_PROTECTION_ENABLEDQuoted 2 lines
userspace will not update the HDCP content to
DRM_MODE_CONTENT_PROTECTION_UNDESIREDuntil monitor disconnect.It seems you've ingored a part of the previous review comment. It's the userspace who triggers the ENABLED -> UNDESIRED transition, not the kernel side. The change to move HDCP handling to
atomic_enable()looks fine, the change to disable HDCP is not (unless I misunderstand something).drivers/gpu/drm/bridge/analogix/anx7625.c static int anx7625_hdcp_disable(struct anx7625_data
Quoted 18 lines
So, anx7625 driver move hdcp content value checking from bridge interface .atomic_check() to .atomic_enable(), then update hdcp content according from currently HDCP status. And also disabled HDCP in bridge interface .atomic_disable().
Signed-off-by Xin Ji <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/anx7625.c +0
-0@@ -861,6 +861,22 @@ static int anx7625_hdcp_disable(struct anx7625_data*ctx)
drivers/gpu/drm/bridge/analogix/anx7625.c static int anx7625_connector_atomic_check(struct
Quoted 21 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +15
-0TX_HDCP_CTRL0, ~HARD_AUTH_EN & 0xFF); } +static void anx7625_hdcp_disable_and_update_cp (struct anx7625_data +*ctx) { +struct device *dev = ctx->dev; + +if (!ctx->connector) +return ; + +anx7625_hdcp_disable (ctx); + + ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; +drm_hdcp_update_content_protection (ctx->connector, + ctx->hdcp_cp); + +dev_dbg (dev,"update CP to UNDESIRE\n" ); } +static int anx7625_hdcp_enable (struct anx7625_data *ctx) {u8 bcap;@@ -2149,34 +2165,6 @@ static int anx7625_connector_atomic_check(struct
anx7625_data*ctx,drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_bridge_atomic_enable(struct
Quoted 35 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-28if (cp == ctx->hdcp_cp)return 0 ; -if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { -if (ctx->dp_en) { -dev_dbg (dev,"enable HDCP\n" ); -anx7625_hdcp_enable (ctx); - -queue_delayed_work (ctx->hdcp_workqueue, - &ctx->hdcp_work, -msecs_to_jiffies (2000 )); - } - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { -if (ctx->hdcp_cp !=DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"current CP is not ENABLED\n" ); -return -EINVAL ; - } -anx7625_hdcp_disable (ctx); - ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; -drm_hdcp_update_content_protection (ctx->connector, - ctx->hdcp_cp); -dev_dbg (dev,"update CP to UNDESIRE\n" ); - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"Userspace illegal set to PROTECTION ENABLE\n" ); -return -EINVAL ; - } -return 0 ; }@@ -2425,6 +2413,8 @@ static void anx7625_bridge_atomic_enable(struct
drm_bridge*bridge,drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_bridge_atomic_enable(struct
Quoted 9 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0struct anx7625_data *ctx =bridge_to_anx7625 (bridge);struct device *dev = ctx->dev;struct drm_connector *connector; +struct drm_connector_state *conn_state; +int cp;dev_dbg (dev,"drm atomic enable\n" );@@ -2439,6 +2429,32 @@ static void anx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 44 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +29
-1_anx7625_hpd_polling (ctx,5000 *100 );anx7625_dp_start (ctx); + + conn_state = +drm_atomic_get_new_connector_state (state->base.state, connector); + +if (WARN_ON (!conn_state)) +return ; + + cp = conn_state->content_protection; +if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { +if (ctx->dp_en) { +dev_dbg (dev,"enable HDCP\n" ); +anx7625_hdcp_enable (ctx); + +queue_delayed_work (ctx->hdcp_workqueue, + &ctx->hdcp_work, +msecs_to_jiffies (2000 )); + } + } + +if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { +if (ctx->hdcp_cp !=DRM_MODE_CONTENT_PROTECTION_ENABLED ) { +dev_err (dev,"current CP is not ENABLED\n" ); +return ; + } + +anx7625_hdcp_disable_and_update_cp (ctx); + } } static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,@@ -2449,6 +2465,8 @@ static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge,dev_dbg (dev,"drm atomic disable\n" ); +anx7625_hdcp_disable_and_update_cp (ctx); + ctx->connector =NULL ;anx7625_dp_stop (ctx); --Quoted 2 lines
2.25.1
--
With best wishes
Dmitry
Signature · 2 lines
With best wishes Dmitry
Hi Dmitry, sorry, I didn't clear describe the reason.
Anx7625 implement DSI to DP convert behind USB Type-C port, when user plug into USB Type-C Dongle with DP monitor, the user space will enable HDCP feature, then kernel do HDCP and output display and set HDCP content to ENABLE, but the issue happened if user manually change the monitor's resolution later.
Each time user change the resolution, kernel will call bridge interface .atomic_disable() and .atomic_enable(), the old driver will keep HDCP state to ENABLE, this is a BUG, when user change the resolution, kernel must change HDCP content too (mustn't keep to ENABLE), as DRM doc said, kernel cannot change from ENABLE to UNDESIRE, so next patch, I'll change it to DESIRE in .atomic_disable().
Thanks!
Xin
Quoted 228 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 6:47 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
Hi Dmitry, thanks for the review, I made some changes which change ENABLE to DESIRE in .atomic_disable(), I'll upstream it after testing. Thanks!
- Please don't top-post.
- You still didn't explain, why do you want to do this change of HDCP status. Could you please provide an explanation before sending the next iteration?
Quoted 11 lines
Quoted 11 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Thursday, December 12, 2024 5:18 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 7 lines
Quoted 7 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Quoted 8 lines
Quoted 8 lines
CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
When user enabled HDCP feature, userspace will set HDCP content to
DRM_MODE_CONTENT_PROTECTION_DESIRED. Next, anx7625 willupdate
Quoted 2 lines
Quoted 2 lines
HDCP
Quoted 1 line
content to
DRM_MODE_CONTENT_PROTECTION_ENABLEDif downstream
Quoted 7 lines
Quoted 7 lines
support
Quoted 3 lines
HDCP feature.
However once HDCP content turn to
DRM_MODE_CONTENT_PROTECTION_ENABLEDQuoted 2 lines
userspace will not update the HDCP content to
DRM_MODE_CONTENT_PROTECTION_UNDESIREDuntil monitordisconnect.
Quoted 5 lines
Quoted 5 lines
It seems you've ingored a part of the previous review comment. It's the userspace who triggers the ENABLED -> UNDESIRED transition, not the kernel side. The change to move HDCP handling to
atomic_enable()looks fine, the change to disable HDCP is not (unless I misunderstandsomething).
Quoted 48 lines
Quoted 48 lines
Quoted 19 lines
So, anx7625 driver move hdcp content value checking from bridge interface .atomic_check() to .atomic_enable(), then update hdcp content according from currently HDCP status. And also disabled HDCP in bridge interface .atomic_disable().
Signed-off-by Xin Ji <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/anx7625.c +0
-0@@ -861,6 +861,22 @@ static int anx7625_hdcp_disable(structQuoted 1 line
anx7625_data*ctx)
Quoted 22 lines
TX_HDCP_CTRL0, ~HARD_AUTH_EN &
0xFF); }drivers/gpu/drm/bridge/analogix/anx7625.c +16
-0+static void anx7625_hdcp_disable_and_update_cp (struct +anx7625_data +*ctx) { +struct device *dev = ctx->dev; + +if (!ctx->connector) +return ; + +anx7625_hdcp_disable (ctx); + + ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; +drm_hdcp_update_content_protection (ctx->connector, + ctx->hdcp_cp); + +dev_dbg (dev,"update CP to UNDESIRE\n" ); } +static int anx7625_hdcp_enable (struct anx7625_data *ctx) {u8 bcap;@@ -2149,34 +2165,6 @@ static intQuoted 1 line
anx7625_connector_atomic_check(struct
anx7625_data*ctx,Quoted 3 lines
if (cp == ctx->hdcp_cp) return 0;Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-5-if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { -if (ctx->dp_en) { -dev_dbg (dev,"enable HDCP\n" ); -anx7625_hdcp_enable (ctx); -Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c static int anx7625_connector_atomic_check(struct anx7625_data *ctx,
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-8-queue_delayed_work (ctx->hdcp_workqueue, - &ctx->hdcp_work, -msecs_to_jiffies (2000 )); - } - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { - if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 49 lines
Quoted 49 lines
Quoted 19 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-15-dev_err (dev,"current CP is not ENABLED\n" ); -return -EINVAL ; - } -anx7625_hdcp_disable (ctx); - ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; -drm_hdcp_update_content_protection (ctx->connector, - ctx->hdcp_cp); -dev_dbg (dev,"update CP to UNDESIRE\n" ); - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"Userspace illegal set to PROTECTION ENABLE\n" ); -return -EINVAL ; - } -return 0 ; }@@ -2425,6 +2413,8 @@ static voidQuoted 1 line
anx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 10 lines
struct anx7625_data *ctx = bridge_to_anx7625(bridge); struct device *dev = ctx->dev; struct drm_connector *connector;drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0+struct drm_connector_state *conn_state; +int cp;dev_dbg (dev,"drm atomic enable\n" );@@ -2439,6 +2429,32 @@ static voidanx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 17 lines
_anx7625_hpd_polling(ctx, 5000 * 100); anx7625_dp_start(ctx);drivers/gpu/drm/bridge/analogix/anx7625.c +14
-0+ + conn_state = +drm_atomic_get_new_connector_state (state->base.state, + connector); + +if (WARN_ON (!conn_state)) +return ; + + cp = conn_state->content_protection; +if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { +if (ctx->dp_en) { +dev_dbg (dev,"enable HDCP\n" ); +anx7625_hdcp_enable (ctx); +Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +8
-0+queue_delayed_work (ctx->hdcp_workqueue, + &ctx->hdcp_work, +msecs_to_jiffies (2000 )); + } + } + +if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { + if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +6
-0+dev_err (dev,"current CP is not ENABLED\n" ); +return ; + } + +anx7625_hdcp_disable_and_update_cp (ctx); + } } static void anx7625_bridge_atomic_disable(struct drm_bridge*bridge, @@ -2449,6 +2465,8 @@ static void
anx7625_bridge_atomic_disable(structdrm_bridge*bridge,dev_dbg(dev, "drm atomic disable\n");drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0+anx7625_hdcp_disable_and_update_cp (ctx); + ctx->connector =NULL ;anx7625_dp_stop (ctx);Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
--
2.25.1--
With best wishes
Dmitry--
With best wishes
Dmitry
Quoted 2 lines · Xin Ji
Hi Dmitry, sorry, I didn't clear describe the reason.
Please. Do not top-post. Please paste your answer under the question, not somewhere at the top of the email. This allows us to have a more constructive dialog. Additional bonus if you can fix your email client to insert sensible quoting information instead of dumping the headers of the original email.
Quoted 9 lines
Anx7625 implement DSI to DP convert behind USB Type-C port, when user plug into USB Type-C Dongle with DP monitor, the user space will enable HDCP feature, then kernel do HDCP and output display and set HDCP content to ENABLE, but the issue happened if user manually change the monitor's resolution later.
Each time user change the resolution, kernel will call bridge interface .atomic_disable() and .atomic_enable(), the old driver will keep HDCP state to ENABLE, this is a BUG, when user change the resolution, kernel must change HDCP content too (mustn't keep to ENABLE),
Why? Could you please point me to the corresponding documentation or a code path in the other driver? Preferably i915, AMD or Nouveau.
Quoted 234 lines
as DRM doc said, kernel cannot change from ENABLE to UNDESIRE, so next patch, I'll change it to DESIRE in .atomic_disable().
Thanks!
XinQuoted 228 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 6:47 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
Hi Dmitry, thanks for the review, I made some changes which change ENABLE to DESIRE in .atomic_disable(), I'll upstream it after testing. Thanks!
- Please don't top-post.
- You still didn't explain, why do you want to do this change of HDCP status. Could you please provide an explanation before sending the next iteration?
Quoted 11 lines
Quoted 11 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Thursday, December 12, 2024 5:18 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 7 lines
Quoted 7 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Quoted 8 lines
Quoted 8 lines
CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
When user enabled HDCP feature, userspace will set HDCP content to
DRM_MODE_CONTENT_PROTECTION_DESIRED. Next, anx7625 willupdate
Quoted 2 lines
Quoted 2 lines
HDCP
Quoted 1 line
content to
DRM_MODE_CONTENT_PROTECTION_ENABLEDif downstream
Quoted 7 lines
Quoted 7 lines
support
Quoted 3 lines
HDCP feature.
However once HDCP content turn to
DRM_MODE_CONTENT_PROTECTION_ENABLEDQuoted 2 lines
userspace will not update the HDCP content to
DRM_MODE_CONTENT_PROTECTION_UNDESIREDuntil monitordisconnect.
Quoted 5 lines
Quoted 5 lines
It seems you've ingored a part of the previous review comment. It's the userspace who triggers the ENABLED -> UNDESIRED transition, not the kernel side. The change to move HDCP handling to
atomic_enable()looks fine, the change to disable HDCP is not (unless I misunderstandsomething).
Quoted 48 lines
Quoted 48 lines
Quoted 19 lines
So, anx7625 driver move hdcp content value checking from bridge interface .atomic_check() to .atomic_enable(), then update hdcp content according from currently HDCP status. And also disabled HDCP in bridge interface .atomic_disable().
Signed-off-by Xin Ji <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/anx7625.c +0
-0@@ -861,6 +861,22 @@ static int anx7625_hdcp_disable(structQuoted 1 line
anx7625_data*ctx)
Quoted 22 lines
TX_HDCP_CTRL0, ~HARD_AUTH_EN &
0xFF); }drivers/gpu/drm/bridge/analogix/anx7625.c +16
-0+static void anx7625_hdcp_disable_and_update_cp (struct +anx7625_data +*ctx) { +struct device *dev = ctx->dev; + +if (!ctx->connector) +return ; + +anx7625_hdcp_disable (ctx); + + ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; +drm_hdcp_update_content_protection (ctx->connector, + ctx->hdcp_cp); + +dev_dbg (dev,"update CP to UNDESIRE\n" ); } +static int anx7625_hdcp_enable (struct anx7625_data *ctx) {u8 bcap;@@ -2149,34 +2165,6 @@ static intQuoted 1 line
anx7625_connector_atomic_check(struct
anx7625_data*ctx,Quoted 3 lines
if (cp == ctx->hdcp_cp) return 0;Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-5-if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { -if (ctx->dp_en) { -dev_dbg (dev,"enable HDCP\n" ); -anx7625_hdcp_enable (ctx); -Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c static int anx7625_connector_atomic_check(struct anx7625_data *ctx,
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-8-queue_delayed_work (ctx->hdcp_workqueue, - &ctx->hdcp_work, -msecs_to_jiffies (2000 )); - } - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { - if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 49 lines
Quoted 49 lines
Quoted 19 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-15-dev_err (dev,"current CP is not ENABLED\n" ); -return -EINVAL ; - } -anx7625_hdcp_disable (ctx); - ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; -drm_hdcp_update_content_protection (ctx->connector, - ctx->hdcp_cp); -dev_dbg (dev,"update CP to UNDESIRE\n" ); - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"Userspace illegal set to PROTECTION ENABLE\n" ); -return -EINVAL ; - } -return 0 ; }@@ -2425,6 +2413,8 @@ static voidQuoted 1 line
anx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 10 lines
struct anx7625_data *ctx = bridge_to_anx7625(bridge); struct device *dev = ctx->dev; struct drm_connector *connector;drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0+struct drm_connector_state *conn_state; +int cp;dev_dbg (dev,"drm atomic enable\n" );@@ -2439,6 +2429,32 @@ static voidanx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 17 lines
_anx7625_hpd_polling(ctx, 5000 * 100); anx7625_dp_start(ctx);drivers/gpu/drm/bridge/analogix/anx7625.c +14
-0+ + conn_state = +drm_atomic_get_new_connector_state (state->base.state, + connector); + +if (WARN_ON (!conn_state)) +return ; + + cp = conn_state->content_protection; +if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { +if (ctx->dp_en) { +dev_dbg (dev,"enable HDCP\n" ); +anx7625_hdcp_enable (ctx); +Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +8
-0+queue_delayed_work (ctx->hdcp_workqueue, + &ctx->hdcp_work, +msecs_to_jiffies (2000 )); + } + } + +if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { + if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +6
-0+dev_err (dev,"current CP is not ENABLED\n" ); +return ; + } + +anx7625_hdcp_disable_and_update_cp (ctx); + } } static void anx7625_bridge_atomic_disable(struct drm_bridge*bridge, @@ -2449,6 +2465,8 @@ static void
anx7625_bridge_atomic_disable(structdrm_bridge*bridge,dev_dbg(dev, "drm atomic disable\n");drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0+anx7625_hdcp_disable_and_update_cp (ctx); + ctx->connector =NULL ;anx7625_dp_stop (ctx);Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
--
2.25.1--
With best wishes
Dmitry--
With best wishes
Dmitry
Signature · 2 lines
With best wishes Dmitry
Quoted 22 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 9:17 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 8 lines
Quoted 2 lines · Xin Ji
Hi Dmitry, sorry, I didn't clear describe the reason.
Please. Do not top-post. Please paste your answer under the question, not somewhere at the top of the email. This allows us to have a more constructive dialog. Additional bonus if you can fix your email client to insert sensible quoting information instead of dumping the headers of the original email.
Hi Dmitry, OK, sorry about it. Currently, we have problem to fetch email from Microsoft on Ubuntu. I'll try to fix it later.
Quoted 8 lines
Quoted 6 lines
Anx7625 implement DSI to DP convert behind USB Type-C port, when user plug into USB Type-C Dongle with DP monitor, the user space will enable HDCP feature, then kernel do HDCP and output display and set HDCP content to ENABLE, but the issue happened if user manually change the
monitor's resolution later.
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Each time user change the resolution, kernel will call bridge interface .atomic_disable() and .atomic_enable(), the old driver will keep HDCP state to ENABLE, this is a BUG, when user change the resolution, kernel must change HDCP content too (mustn't keep to ENABLE),
Why? Could you please point me to the corresponding documentation or a code path in the other driver? Preferably i915, AMD or Nouveau.
As https://elixir.bootlin.com/linux/v6.12.5/source/drivers/gpu/drm/drm_connector.c#L1423:
- ENABLED -> DESIRED (termination of authentication)
As there is no other interface to tell anx7625 bridge driver, so the I think best place to handle ENABLE -> DESIRED in .atomic_disable().
Quoted 248 lines
Quoted 17 lines
as DRM doc said, kernel cannot change from ENABLE to UNDESIRE, so next patch, I'll change it to DESIRE in .atomic_disable().
Thanks!
XinQuoted 10 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 6:47 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 43 lines
Quoted 43 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
Hi Dmitry, thanks for the review, I made some changes which change ENABLE to DESIRE in .atomic_disable(), I'll upstream it after testing. Thanks!
- Please don't top-post.
- You still didn't explain, why do you want to do this change of HDCP status. Could you please provide an explanation before sending the next iteration?
Quoted 12 lines
Quoted 12 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Thursday, December 12, 2024 5:18 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 8 lines
Quoted 8 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
When user enabled HDCP feature, userspace will set HDCP content to
DRM_MODE_CONTENT_PROTECTION_DESIRED. Next,anx7625
Quoted 82 lines
Quoted 82 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
will
update
Quoted 2 lines
Quoted 2 lines
HDCP
Quoted 1 line
content to
DRM_MODE_CONTENT_PROTECTION_ENABLEDif downstream
Quoted 7 lines
Quoted 7 lines
support
Quoted 3 lines
HDCP feature.
However once HDCP content turn to
DRM_MODE_CONTENT_PROTECTION_ENABLEDQuoted 2 lines
userspace will not update the HDCP content to
DRM_MODE_CONTENT_PROTECTION_UNDESIREDuntil monitordisconnect.
Quoted 6 lines
Quoted 6 lines
It seems you've ingored a part of the previous review comment. It's the userspace who triggers the ENABLED -> UNDESIRED transition, not the kernel side. The change to move HDCP handling to
atomic_enable()looks fine, the change to disable HDCP is not (unless I misunderstandsomething).
Quoted 48 lines
Quoted 48 lines
Quoted 19 lines
So, anx7625 driver move hdcp content value checking from bridge interface .atomic_check() to .atomic_enable(), then update hdcp content according from currently HDCP status. And also disabled HDCP in bridge interface .atomic_disable().
Signed-off-by Xin Ji <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/anx7625.c +0
-0@@ -861,6 +861,22 @@ static int anx7625_hdcp_disable(structQuoted 1 line
anx7625_data*ctx)
Quoted 22 lines
TX_HDCP_CTRL0, ~HARD_AUTH_EN &
0xFF); }drivers/gpu/drm/bridge/analogix/anx7625.c +16
-0+static void anx7625_hdcp_disable_and_update_cp (struct +anx7625_data +*ctx) { +struct device *dev = ctx->dev; + +if (!ctx->connector) +return ; + +anx7625_hdcp_disable (ctx); + + ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; +drm_hdcp_update_content_protection (ctx->connector, + ctx->hdcp_cp); + +dev_dbg (dev,"update CP to UNDESIRE\n" ); } +static int anx7625_hdcp_enable (struct anx7625_data *ctx) {u8 bcap;@@ -2149,34 +2165,6 @@ static intQuoted 1 line
anx7625_connector_atomic_check(struct
anx7625_data*ctx,Quoted 3 lines
if (cp == ctx->hdcp_cp) return 0;Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-5-if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { -if (ctx->dp_en) { -dev_dbg (dev,"enable HDCP\n" ); -anx7625_hdcp_enable (ctx); -Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c static int anx7625_connector_atomic_check(struct anx7625_data *ctx,
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-8-queue_delayed_work (ctx->hdcp_workqueue, - &ctx->hdcp_work, -msecs_to_jiffies (2000 )); - } - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { - if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c static int anx7625_connector_atomic_check(struct anx7625_data *ctx,
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-5-dev_err (dev,"current CP is not ENABLED\n" ); -return -EINVAL ; - } -anx7625_hdcp_disable (ctx); - ctx->hdcp_cp =
DRM_MODE_CONTENT_PROTECTION_UNDESIRED;Quoted 81 lines
Quoted 81 lines
Quoted 44 lines
Quoted 44 lines
Quoted 14 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-10-drm_hdcp_update_content_protection (ctx->connector, - ctx->hdcp_cp); -dev_dbg (dev,"update CP to UNDESIRE\n" ); - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"Userspace illegal set to PROTECTION ENABLE\n" ); -return -EINVAL ; - } -return 0 ; }@@ -2425,6 +2413,8 @@ static voidQuoted 1 line
anx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 10 lines
struct anx7625_data *ctx = bridge_to_anx7625(bridge); struct device *dev = ctx->dev; struct drm_connector *connector;drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0+struct drm_connector_state *conn_state; +int cp;dev_dbg (dev,"drm atomic enable\n" );@@ -2439,6 +2429,32 @@ static voidanx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 17 lines
_anx7625_hpd_polling(ctx, 5000 * 100); anx7625_dp_start(ctx);drivers/gpu/drm/bridge/analogix/anx7625.c +14
-0+ + conn_state = +drm_atomic_get_new_connector_state (state->base.state, + connector); + +if (WARN_ON (!conn_state)) +return ; + + cp = conn_state->content_protection; +if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { +if (ctx->dp_en) { +dev_dbg (dev,"enable HDCP\n" ); +anx7625_hdcp_enable (ctx); +Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +8
-0+queue_delayed_work (ctx->hdcp_workqueue, + &ctx->hdcp_work, +msecs_to_jiffies (2000 )); + } + } + +if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { + if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 27 lines
Quoted 27 lines
Quoted 21 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +6
-0+dev_err (dev,"current CP is not ENABLED\n" ); +return ; + } + +anx7625_hdcp_disable_and_update_cp (ctx); + } } static void anx7625_bridge_atomic_disable(struct drm_bridge*bridge, @@ -2449,6 +2465,8 @@ static void
anx7625_bridge_atomic_disable(structdrm_bridge*bridge,dev_dbg(dev, "drm atomic disable\n");drivers/gpu/drm/bridge/analogix/anx7625.c +2
-1+anx7625_hdcp_disable_and_update_cp (ctx); + ctx->connector =NULL ;anx7625_dp_stop (ctx); --Quoted 2 lines
2.25.1
--
With best wishes
DmitryQuoted 3 lines
Quoted 3 lines
--
With best wishes
Dmitry--
With best wishes
Dmitry
Quoted 46 lines · Xin Ji
Quoted 22 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 9:17 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 8 lines
Quoted 2 lines · Xin Ji
Hi Dmitry, sorry, I didn't clear describe the reason.
Please. Do not top-post. Please paste your answer under the question, not somewhere at the top of the email. This allows us to have a more constructive dialog. Additional bonus if you can fix your email client to insert sensible quoting information instead of dumping the headers of the original email.
Hi Dmitry, OK, sorry about it. Currently, we have problem to fetch email from Microsoft on Ubuntu. I'll try to fix it later.
Quoted 14 lines
Quoted 6 lines
Anx7625 implement DSI to DP convert behind USB Type-C port, when user plug into USB Type-C Dongle with DP monitor, the user space will enable HDCP feature, then kernel do HDCP and output display and set HDCP content to ENABLE, but the issue happened if user manually change the
monitor's resolution later.
Quoted 6 lines
Each time user change the resolution, kernel will call bridge interface .atomic_disable() and .atomic_enable(), the old driver will keep HDCP state to ENABLE, this is a BUG, when user change the resolution, kernel must change HDCP content too (mustn't keep to ENABLE),
Quoted 6 lines
Quoted 2 lines
Why? Could you please point me to the corresponding documentation or a code path in the other driver? Preferably i915, AMD or Nouveau.
As https://elixir.bootlin.com/linux/v6.12.5/source/drivers/gpu/drm/drm_connector.c#L1423:
- ENABLED -> DESIRED (termination of authentication)
As there is no other interface to tell anx7625 bridge driver, so the I think best place to handle ENABLE -> DESIRED in .atomic_disable().
I was looking for something like cdns_mhdp_connector_atomic_check(), which switches to UNDESIRED if there is no new CRTC. Likewise i915 driver performs this in intel_hdcp_atomic_check() if there is a need for modeset.
For the "termination of authentication" case see cdns_mhdp_hdcp_check_link(), which detects if the HDCP got disabled by HW and then updates the status accordingly.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
as DRM doc said, kernel cannot change from ENABLE to UNDESIRE, so next patch, I'll change it to DESIRE in .atomic_disable().
This e.g. will result in HDCP being restarted for all modesets. Is this an expected behaviour?
Quoted 245 lines
Quoted 245 lines
Quoted 14 lines
Thanks!
XinQuoted 10 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 6:47 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 43 lines
Quoted 43 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
Hi Dmitry, thanks for the review, I made some changes which change ENABLE to DESIRE in .atomic_disable(), I'll upstream it after testing. Thanks!
- Please don't top-post.
- You still didn't explain, why do you want to do this change of HDCP status. Could you please provide an explanation before sending the next iteration?
Quoted 12 lines
Quoted 12 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Thursday, December 12, 2024 5:18 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 8 lines
Quoted 8 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
When user enabled HDCP feature, userspace will set HDCP content to
DRM_MODE_CONTENT_PROTECTION_DESIRED. Next,anx7625
Quoted 82 lines
Quoted 82 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
will
update
Quoted 2 lines
Quoted 2 lines
HDCP
Quoted 1 line
content to
DRM_MODE_CONTENT_PROTECTION_ENABLEDif downstream
Quoted 7 lines
Quoted 7 lines
support
Quoted 3 lines
HDCP feature.
However once HDCP content turn to
DRM_MODE_CONTENT_PROTECTION_ENABLEDQuoted 2 lines
userspace will not update the HDCP content to
DRM_MODE_CONTENT_PROTECTION_UNDESIREDuntil monitordisconnect.
Quoted 6 lines
Quoted 6 lines
It seems you've ingored a part of the previous review comment. It's the userspace who triggers the ENABLED -> UNDESIRED transition, not the kernel side. The change to move HDCP handling to
atomic_enable()looks fine, the change to disable HDCP is not (unless I misunderstandsomething).
Quoted 48 lines
Quoted 48 lines
Quoted 19 lines
So, anx7625 driver move hdcp content value checking from bridge interface .atomic_check() to .atomic_enable(), then update hdcp content according from currently HDCP status. And also disabled HDCP in bridge interface .atomic_disable().
Signed-off-by Xin Ji <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/anx7625.c +0
-0@@ -861,6 +861,22 @@ static int anx7625_hdcp_disable(structQuoted 1 line
anx7625_data*ctx)
Quoted 22 lines
TX_HDCP_CTRL0, ~HARD_AUTH_EN &
0xFF); }drivers/gpu/drm/bridge/analogix/anx7625.c +16
-0+static void anx7625_hdcp_disable_and_update_cp (struct +anx7625_data +*ctx) { +struct device *dev = ctx->dev; + +if (!ctx->connector) +return ; + +anx7625_hdcp_disable (ctx); + + ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; +drm_hdcp_update_content_protection (ctx->connector, + ctx->hdcp_cp); + +dev_dbg (dev,"update CP to UNDESIRE\n" ); } +static int anx7625_hdcp_enable (struct anx7625_data *ctx) {u8 bcap;@@ -2149,34 +2165,6 @@ static intQuoted 1 line
anx7625_connector_atomic_check(struct
anx7625_data*ctx,Quoted 3 lines
if (cp == ctx->hdcp_cp) return 0;Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-5-if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { -if (ctx->dp_en) { -dev_dbg (dev,"enable HDCP\n" ); -anx7625_hdcp_enable (ctx); -Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-8-queue_delayed_work (ctx->hdcp_workqueue, - &ctx->hdcp_work, -msecs_to_jiffies (2000 )); - } - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { - if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-5-dev_err (dev,"current CP is not ENABLED\n" ); -return -EINVAL ; - } -anx7625_hdcp_disable (ctx); - ctx->hdcp_cp =
DRM_MODE_CONTENT_PROTECTION_UNDESIRED;Quoted 81 lines
Quoted 81 lines
Quoted 44 lines
Quoted 44 lines
Quoted 14 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-10-drm_hdcp_update_content_protection (ctx->connector, - ctx->hdcp_cp); -dev_dbg (dev,"update CP to UNDESIRE\n" ); - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"Userspace illegal set to PROTECTION ENABLE\n" ); -return -EINVAL ; - } -return 0 ; }@@ -2425,6 +2413,8 @@ static voidQuoted 1 line
anx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 10 lines
struct anx7625_data *ctx = bridge_to_anx7625(bridge); struct device *dev = ctx->dev; struct drm_connector *connector;drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0+struct drm_connector_state *conn_state; +int cp;dev_dbg (dev,"drm atomic enable\n" );@@ -2439,6 +2429,32 @@ static voidanx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 17 lines
_anx7625_hpd_polling(ctx, 5000 * 100); anx7625_dp_start(ctx);drivers/gpu/drm/bridge/analogix/anx7625.c +14
-0+ + conn_state = +drm_atomic_get_new_connector_state (state->base.state, + connector); + +if (WARN_ON (!conn_state)) +return ; + + cp = conn_state->content_protection; +if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { +if (ctx->dp_en) { +dev_dbg (dev,"enable HDCP\n" ); +anx7625_hdcp_enable (ctx); +Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +8
-0+queue_delayed_work (ctx->hdcp_workqueue, + &ctx->hdcp_work, +msecs_to_jiffies (2000 )); + } + } + +if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { + if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 27 lines
Quoted 27 lines
Quoted 21 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +6
-0+dev_err (dev,"current CP is not ENABLED\n" ); +return ; + } + +anx7625_hdcp_disable_and_update_cp (ctx); + } } static void anx7625_bridge_atomic_disable(struct drm_bridge*bridge, @@ -2449,6 +2465,8 @@ static void
anx7625_bridge_atomic_disable(structdrm_bridge*bridge,dev_dbg(dev, "drm atomic disable\n");drivers/gpu/drm/bridge/analogix/anx7625.c +2
-1+anx7625_hdcp_disable_and_update_cp (ctx); + ctx->connector =NULL ;anx7625_dp_stop (ctx); --Quoted 2 lines
2.25.1
--
With best wishes
DmitryQuoted 3 lines
Quoted 3 lines
--
With best wishes
Dmitry--
With best wishes
Dmitry
Signature · 2 lines
With best wishes Dmitry
Hi Dmitry,
Quoted 55 lines · Dmitry Baryshkov
Quoted 46 lines · Xin Ji
Quoted 22 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 9:17 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 8 lines
Quoted 2 lines · Xin Ji
Hi Dmitry, sorry, I didn't clear describe the reason.
Please. Do not top-post. Please paste your answer under the question, not somewhere at the top of the email. This allows us to have a more constructive dialog. Additional bonus if you can fix your email client to insert sensible quoting information instead of dumping the headers of the original email.
Hi Dmitry, OK, sorry about it. Currently, we have problem to fetch email from Microsoft on Ubuntu. I'll try to fix it later.
Quoted 14 lines
Quoted 6 lines
Anx7625 implement DSI to DP convert behind USB Type-C port, when user plug into USB Type-C Dongle with DP monitor, the user space will enable HDCP feature, then kernel do HDCP and output display and set HDCP content to ENABLE, but the issue happened if user manually change the
monitor's resolution later.
Quoted 6 lines
Each time user change the resolution, kernel will call bridge interface .atomic_disable() and .atomic_enable(), the old driver will keep HDCP state to ENABLE, this is a BUG, when user change the resolution, kernel must change HDCP content too (mustn't keep to ENABLE),
Quoted 6 lines
Quoted 2 lines
Why? Could you please point me to the corresponding documentation or a code path in the other driver? Preferably i915, AMD or Nouveau.
As https://elixir.bootlin.com/linux/v6.12.5/source/drivers/gpu/drm/drm_connector.c#L1423:
- ENABLED -> DESIRED (termination of authentication)
As there is no other interface to tell anx7625 bridge driver, so the I think best place to handle ENABLE -> DESIRED in .atomic_disable().
Quoted 4 lines
I was looking for something like
cdns_mhdp_connector_atomic_check(), which switches to UNDESIRED if there is no new CRTC. Likewise i915 driver performs this inintel_hdcp_atomic_check()if there is a need for modeset.
I believe you mean "DESIRED" here.
Quoted 7 lines
For the "termination of authentication" case see
cdns_mhdp_hdcp_check_link(), which detects if the HDCP got disabled by HW and then updates the status accordingly.Quoted 2 lines
Quoted 2 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
as DRM doc said, kernel cannot change from ENABLE to UNDESIRE, so next patch, I'll change it to DESIRE in .atomic_disable().
This e.g. will result in HDCP being restarted for all modesets. Is this an expected behaviour?
The bridge could be powered off between .atomic_disable() and .atomic_enable(), though I'm not sure if this would be a concern for anx7625. I'll let Xin to comment on this.
Quoted 243 lines
Quoted 243 lines
Quoted 243 lines
Quoted 15 lines
Thanks!
XinQuoted 10 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 6:47 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 43 lines
Quoted 43 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
Hi Dmitry, thanks for the review, I made some changes which change ENABLE to DESIRE in .atomic_disable(), I'll upstream it after testing. Thanks!
- Please don't top-post.
- You still didn't explain, why do you want to do this change of HDCP status. Could you please provide an explanation before sending the next iteration?
Quoted 12 lines
Quoted 12 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Thursday, December 12, 2024 5:18 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 8 lines
Quoted 8 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
When user enabled HDCP feature, userspace will set HDCP content to
DRM_MODE_CONTENT_PROTECTION_DESIRED. Next,anx7625
Quoted 82 lines
Quoted 82 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
will
update
Quoted 2 lines
Quoted 2 lines
HDCP
Quoted 1 line
content to
DRM_MODE_CONTENT_PROTECTION_ENABLEDif downstream
Quoted 7 lines
Quoted 7 lines
support
Quoted 3 lines
HDCP feature.
However once HDCP content turn to
DRM_MODE_CONTENT_PROTECTION_ENABLEDQuoted 2 lines
userspace will not update the HDCP content to
DRM_MODE_CONTENT_PROTECTION_UNDESIREDuntil monitordisconnect.
Quoted 6 lines
Quoted 6 lines
It seems you've ingored a part of the previous review comment. It's the userspace who triggers the ENABLED -> UNDESIRED transition, not the kernel side. The change to move HDCP handling to
atomic_enable()looks fine, the change to disable HDCP is not (unless I misunderstandsomething).
Quoted 48 lines
Quoted 48 lines
Quoted 19 lines
So, anx7625 driver move hdcp content value checking from bridge interface .atomic_check() to .atomic_enable(), then update hdcp content according from currently HDCP status. And also disabled HDCP in bridge interface .atomic_disable().
Signed-off-by Xin Ji <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/anx7625.c +0
-0@@ -861,6 +861,22 @@ static int anx7625_hdcp_disable(structQuoted 1 line
anx7625_data*ctx)
Quoted 22 lines
TX_HDCP_CTRL0, ~HARD_AUTH_EN &
0xFF); }drivers/gpu/drm/bridge/analogix/anx7625.c +16
-0+static void anx7625_hdcp_disable_and_update_cp (struct +anx7625_data +*ctx) { +struct device *dev = ctx->dev; + +if (!ctx->connector) +return ; + +anx7625_hdcp_disable (ctx); + + ctx->hdcp_cp =DRM_MODE_CONTENT_PROTECTION_UNDESIRED ; +drm_hdcp_update_content_protection (ctx->connector, + ctx->hdcp_cp); + +dev_dbg (dev,"update CP to UNDESIRE\n" ); } +static int anx7625_hdcp_enable (struct anx7625_data *ctx) {u8 bcap;@@ -2149,34 +2165,6 @@ static intQuoted 1 line
anx7625_connector_atomic_check(struct
anx7625_data*ctx,Quoted 3 lines
if (cp == ctx->hdcp_cp) return 0;Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-5-if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { -if (ctx->dp_en) { -dev_dbg (dev,"enable HDCP\n" ); -anx7625_hdcp_enable (ctx); -Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-8-queue_delayed_work (ctx->hdcp_workqueue, - &ctx->hdcp_work, -msecs_to_jiffies (2000 )); - } - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { - if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-5-dev_err (dev,"current CP is not ENABLED\n" ); -return -EINVAL ; - } -anx7625_hdcp_disable (ctx); - ctx->hdcp_cp =
DRM_MODE_CONTENT_PROTECTION_UNDESIRED;Quoted 84 lines
Quoted 84 lines
Quoted 44 lines
Quoted 44 lines
Quoted 14 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-10-drm_hdcp_update_content_protection (ctx->connector, - ctx->hdcp_cp); -dev_dbg (dev,"update CP to UNDESIRE\n" ); - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { -dev_err (dev,"Userspace illegal set to PROTECTION ENABLE\n" ); -return -EINVAL ; - } -return 0 ; }@@ -2425,6 +2413,8 @@ static voidQuoted 1 line
anx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 10 lines
struct anx7625_data *ctx = bridge_to_anx7625(bridge); struct device *dev = ctx->dev; struct drm_connector *connector;drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0+struct drm_connector_state *conn_state; +int cp;dev_dbg (dev,"drm atomic enable\n" );@@ -2439,6 +2429,32 @@ static voidanx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 17 lines
_anx7625_hpd_polling(ctx, 5000 * 100); anx7625_dp_start(ctx);drivers/gpu/drm/bridge/analogix/anx7625.c +14
-0+ + conn_state = +drm_atomic_get_new_connector_state (state->base.state, + connector); + +if (WARN_ON (!conn_state)) +return ; + + cp = conn_state->content_protection; +if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { +if (ctx->dp_en) { +dev_dbg (dev,"enable HDCP\n" ); +anx7625_hdcp_enable (ctx); +Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +8
-0+queue_delayed_work (ctx->hdcp_workqueue, + &ctx->hdcp_work, +msecs_to_jiffies (2000 )); + } + } + +if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { + if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +6
-0+dev_err (dev,"current CP is not ENABLED\n" ); +return ; + } + +anx7625_hdcp_disable_and_update_cp (ctx); + } } static void anx7625_bridge_atomic_disable(struct drm_bridge*bridge, @@ -2449,6 +2465,8 @@ static void
anx7625_bridge_atomic_disable(structdrm_bridge*bridge,dev_dbg(dev, "drm atomic disable\n");drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0+anx7625_hdcp_disable_and_update_cp (ctx); + ctx->connector =NULL ;anx7625_dp_stop (ctx);Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
--
2.25.1--
With best wishes
Dmitry--
With best wishes
Dmitry
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
--
With best wishes
Dmitry--
With best wishes
Dmitry
Regards,
Pin-yen
Quoted 73 lines
-----Original Message-----
From: Pin-yen Lin <[email protected]>
Sent: Monday, December 16, 2024 8:05 PM
To: Dmitry Baryshkov <[email protected]>
Cc: Xin Ji <[email protected]>; Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Hi Dmitry,
Quoted 25 lines · Dmitry Baryshkov
Quoted 23 lines · Xin Ji
Quoted 23 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 9:17 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Xin Ji
Quoted 2 lines
Hi Dmitry, sorry, I didn't clear describe the reason.
Please. Do not top-post. Please paste your answer under the question, not somewhere at the top of the email. This allows us to have a more constructive dialog. Additional bonus if you can fix your email client to insert sensible quoting information instead of dumping
the headers of the original email.
Quoted 17 lines
Quoted 17 lines
Hi Dmitry, OK, sorry about it. Currently, we have problem to fetch email from Microsoft on Ubuntu. I'll try to fix it later.
Quoted 15 lines
Quoted 7 lines
Anx7625 implement DSI to DP convert behind USB Type-C port, when user plug into USB Type-C Dongle with DP monitor, the user space will enable HDCP feature, then kernel do HDCP and output display and set HDCP content to ENABLE, but the issue happened if user manually change the
monitor's resolution later.
Quoted 6 lines
Each time user change the resolution, kernel will call bridge interface .atomic_disable() and .atomic_enable(), the old driver will keep HDCP state to ENABLE, this is a BUG, when user change the resolution, kernel must change HDCP content too (mustn't keep to ENABLE),
Quoted 13 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Why? Could you please point me to the corresponding documentation or a code path in the other driver? Preferably i915, AMD or Nouveau.
As
https://elixir.bootlin.com/linux/v6.12.5/source/drivers/gpu/drm/drm_connecto
r.c#L1423:Quoted 8 lines
Quoted 3 lines
- ENABLED -> DESIRED (termination of authentication) As
there is no other interface to tell anx7625 bridge driver, so the I think best place to handle ENABLE -> DESIRED in .atomic_disable().I was looking for something like
cdns_mhdp_connector_atomic_check(), which switches to UNDESIRED if there is no new CRTC. Likewise i915 driver performs this inintel_hdcp_atomic_check()if there is a need for modeset.
Hi Dmitry, the bridge driver is different with i915, anx7625 bridge driver only implement some passive callback interface. There is no HDCP status checking while do resolution switch.
Quoted 12 lines
I believe you mean "DESIRED" here.
Quoted 10 lines
For the "termination of authentication" case see
cdns_mhdp_hdcp_check_link(), which detects if the HDCP got disabled by HW and then updates the status accordingly.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
as DRM doc said, kernel cannot change from ENABLE to UNDESIRE, so next patch, I'll change it to DESIRE in .atomic_disable().
Quoted 6 lines
Quoted 2 lines
This e.g. will result in HDCP being restarted for all modesets. Is this an expected behaviour?
The bridge could be powered off between .atomic_disable() and .atomic_enable(), though I'm not sure if this would be a concern for anx7625. I'll let Xin to comment on this.
The flow of resolution switch is:
-> .atomic_disable().
-> .atomic_enable().
-> HDCP status check and enable.As resolution switch is triggered by user space, at this moment, the HDCP works fine(cannot get disabled event from HW). So, I think, .atomic_disable() is the best place to do termination of authentication (turn HDCP status to DESIRED). This is the only entrance which can do termination of authentication, I cannot find others.
Quoted 264 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Thanks!
XinQuoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 6:47 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas ZimmermannQuoted 9 lines
Quoted 9 lines
Quoted 9 lines
David
Quoted 8 lines
Quoted 8 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 2 lines · Xin Ji
Hi Dmitry, thanks for the review, I made some changes which change ENABLE to DESIRE in .atomic_disable(), I'll upstream it after
testing. Thanks!
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
- Please don't top-post.
- You still didn't explain, why do you want to do this change of HDCP status. Could you please provide an explanation before sending the next iteration?
Quoted 14 lines
Quoted 14 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Thursday, December 12, 2024 5:18 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 14 lines
Quoted 14 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Xin Ji
Quoted 2 lines
When user enabled HDCP feature, userspace will set HDCP content to
DRM_MODE_CONTENT_PROTECTION_DESIRED. Next,anx7625
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
will
update
Quoted 2 lines
Quoted 2 lines
HDCP
Quoted 1 line
content to
DRM_MODE_CONTENT_PROTECTION_ENABLEDifdown
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
stream
Quoted 7 lines
Quoted 7 lines
support
Quoted 3 lines
HDCP feature.
However once HDCP content turn to
DRM_MODE_CONTENT_PROTECTION_ENABLEDQuoted 2 lines
userspace will not update the HDCP content to
DRM_MODE_CONTENT_PROTECTION_UNDESIREDuntil monitordisconnect.
Quoted 6 lines
Quoted 6 lines
It seems you've ingored a part of the previous review comment. It's the userspace who triggers the ENABLED -> UNDESIRED transition, not the kernel side. The change to move HDCP handling to
atomic_enable()looks fine, the change to disable HDCP is not (unless I misunderstandQuoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
something).
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
So, anx7625 driver move hdcp content value checking from bridge interface .atomic_check() to .atomic_enable(), then update hdcp content according from currently HDCP status. And also disabled HDCP in bridge
interface .atomic_disable().
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 13 lines
Signed-off-by Xin Ji <[email protected]>--- drivers/gpu/drm/bridge/analogix/anx7625.c | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/anx7625.c +0
-0@@ -861,6 +861,22 @@ static intQuoted 1 line
anx7625_hdcp_disable(struct
anx7625_data*ctx)
Quoted 3 lines
TX_HDCP_CTRL0,~HARD_AUTH_EN &
0xFF); }Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/bridge/analogix/anx7625.c
Quoted 11 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +11
-0+static void anx7625_hdcp_disable_and_update_cp (struct +anx7625_data +*ctx) { +struct device *dev = ctx->dev; + +if (!ctx->connector) +return ; + +anx7625_hdcp_disable (ctx); + + ctx->hdcp_cp =
DRM_MODE_CONTENT_PROTECTION_UNDESIRED;Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 13 lines
Quoted 13 lines
Quoted 9 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +5
-0+drm_hdcp_update_content_protection (ctx->connector, + ctx->hdcp_cp); + +dev_dbg (dev,"update CP to UNDESIRE\n" ); } +static int anx7625_hdcp_enable (struct anx7625_data *ctx) {u8 bcap;@@ -2149,34 +2165,6 @@ static intanx7625_connector_atomic_check(struct
anx7625_data*ctx,Quoted 3 lines
if (cp == ctx->hdcp_cp) return 0;Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-5-if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { -if (ctx->dp_en) { -dev_dbg (dev,"enable HDCP\n" ); -anx7625_hdcp_enable (ctx); -Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-8-queue_delayed_work (ctx->hdcp_workqueue, - &ctx->hdcp_work, -msecs_to_jiffies (2000 )); - } - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { - if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-5-dev_err (dev,"current CP is not ENABLED\n" ); -return -EINVAL ; - } -anx7625_hdcp_disable (ctx); - ctx->hdcp_cp =Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
DRM_MODE_CONTENT_PROTECTION_UNDESIRED;Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-7-drm_hdcp_update_content_protection (ctx->connector, - ctx->hdcp_cp); -dev_dbg (dev,"update CP to UNDESIRE\n" ); - } - -if (cp ==DRM_MODE_CONTENT_PROTECTION_ENABLED ) { - dev_err(dev, "Userspace illegal set to PROTECTIONENABLE\n");
Quoted 80 lines
Quoted 80 lines
Quoted 80 lines
Quoted 77 lines
Quoted 77 lines
Quoted 37 lines
Quoted 37 lines
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0
-3-return -EINVAL ; - } -return 0 ; }@@ -2425,6 +2413,8 @@ static voidanx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 10 lines
struct anx7625_data *ctx = bridge_to_anx7625(bridge); struct device *dev = ctx->dev; struct drm_connector *connector;drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0+struct drm_connector_state *conn_state; +int cp;dev_dbg (dev,"drm atomic enable\n" );@@ -2439,6 +2429,32 @@ static voidanx7625_bridge_atomic_enable(struct
drm_bridge*bridge,Quoted 17 lines
_anx7625_hpd_polling(ctx, 5000 * 100); anx7625_dp_start(ctx);drivers/gpu/drm/bridge/analogix/anx7625.c +14
-0+ + conn_state = +drm_atomic_get_new_connector_state (state->base.state, + connector); + +if (WARN_ON (!conn_state)) +return ; + + cp = conn_state->content_protection; +if (cp ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) { +if (ctx->dp_en) { +dev_dbg (dev,"enable HDCP\n" ); +anx7625_hdcp_enable (ctx); +Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c
Quoted 8 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +8
-0+queue_delayed_work (ctx->hdcp_workqueue, + &ctx->hdcp_work, +msecs_to_jiffies (2000 )); + } + } + +if (cp ==DRM_MODE_CONTENT_PROTECTION_UNDESIRED ) { + if (ctx->hdcp_cp !=
DRM_MODE_CONTENT_PROTECTION_ENABLED) {Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +6
-0+dev_err (dev,"current CP is not ENABLED\n" ); +return ; + } + +anx7625_hdcp_disable_and_update_cp (ctx); + } } static void anx7625_bridge_atomic_disable(struct
drm_bridge*bridge, @@ -2449,6 +2465,8 @@ static void anx7625_bridge_atomic_disable(structdrm_bridge*bridge,dev_dbg(dev, "drm atomic disable\n");drivers/gpu/drm/bridge/analogix/anx7625.c +2
-0+anx7625_hdcp_disable_and_update_cp (ctx); + ctx->connector =NULL ;anx7625_dp_stop (ctx);Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
--
2.25.1--
With best wishes
Dmitry--
With best wishes
DmitryQuoted 7 lines
Quoted 3 lines
Quoted 3 lines
--
With best wishes
Dmitry--
With best wishes
DmitryRegards,
Pin-yen
Quoted 82 lines · Xin Ji
Quoted 82 lines
-----Original Message-----
From: Pin-yen Lin <[email protected]>
Sent: Monday, December 16, 2024 8:05 PM
To: Dmitry Baryshkov <[email protected]>
Cc: Xin Ji <[email protected]>; Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Hi Dmitry,
Quoted 25 lines · Dmitry Baryshkov
Quoted 23 lines · Xin Ji
Quoted 23 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 9:17 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Xin Ji
Quoted 2 lines
Hi Dmitry, sorry, I didn't clear describe the reason.
Please. Do not top-post. Please paste your answer under the question, not somewhere at the top of the email. This allows us to have a more constructive dialog. Additional bonus if you can fix your email client to insert sensible quoting information instead of dumping
the headers of the original email.
Quoted 17 lines
Quoted 17 lines
Hi Dmitry, OK, sorry about it. Currently, we have problem to fetch email from Microsoft on Ubuntu. I'll try to fix it later.
Quoted 15 lines
Quoted 7 lines
Anx7625 implement DSI to DP convert behind USB Type-C port, when user plug into USB Type-C Dongle with DP monitor, the user space will enable HDCP feature, then kernel do HDCP and output display and set HDCP content to ENABLE, but the issue happened if user manually change the
monitor's resolution later.
Quoted 6 lines
Each time user change the resolution, kernel will call bridge interface .atomic_disable() and .atomic_enable(), the old driver will keep HDCP state to ENABLE, this is a BUG, when user change the resolution, kernel must change HDCP content too (mustn't keep to ENABLE),
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Why? Could you please point me to the corresponding documentation or a code path in the other driver? Preferably i915, AMD or Nouveau.
As
https://elixir.bootlin.com/linux/v6.12.5/source/drivers/gpu/drm/drm_connecto
r.c#L1423:Quoted 4 lines
Quoted 3 lines
- ENABLED -> DESIRED (termination of authentication) As
there is no other interface to tell anx7625 bridge driver, so the I think best place to handle ENABLE -> DESIRED in .atomic_disable().
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
I was looking for something like
cdns_mhdp_connector_atomic_check(), which switches to UNDESIRED if there is no new CRTC. Likewise i915 driver performs this inintel_hdcp_atomic_check()if there is a need for modeset.Hi Dmitry, the bridge driver is different with i915, anx7625 bridge driver only implement some passive callback interface. There is no HDCP status checking while do resolution switch.
Does that mean that you _have_ to reestablish HDCP after mode switching in order for it to work?
Quoted 22 lines
Quoted 12 lines
I believe you mean "DESIRED" here.
Quoted 10 lines
For the "termination of authentication" case see
cdns_mhdp_hdcp_check_link(), which detects if the HDCP got disabled by HW and then updates the status accordingly.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
as DRM doc said, kernel cannot change from ENABLE to UNDESIRE, so next patch, I'll change it to DESIRE in .atomic_disable().
Quoted 6 lines
Quoted 2 lines
This e.g. will result in HDCP being restarted for all modesets. Is this an expected behaviour?
The bridge could be powered off between .atomic_disable() and .atomic_enable(), though I'm not sure if this would be a concern for anx7625. I'll let Xin to comment on this.
The flow of resolution switch is:
-> .atomic_disable(). -> .atomic_enable(). -> HDCP status check and enable.
Quoted 6 lines
As resolution switch is triggered by user space, at this moment, the HDCP works fine(cannot get disabled event from HW).
So, I think, .atomic_disable() is
the best place to do termination of authentication (turn HDCP status to DESIRED). This is the only entrance which can do termination of authentication, I cannot find others.
I'm probably still missing a reference to the standard (please excuse me, I don't know it by heart). Is it a standard requirement to reauthenticate on the mode switch?
BTW, while reading the anx7625 code, I noticed that there is a possible race between .atomic_enable() / .atomic_disable() which set ctx->connector and the hdcp_check_work_func() which reads ctx->connector without any protection.
Signature · 2 lines
With best wishes Dmitry
Quoted 114 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Tuesday, December 17, 2024 8:30 PM
To: Xin Ji <[email protected]>
Cc: Pin-yen Lin <[email protected]>; Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Quoted 11 lines · Xin Ji
Quoted 11 lines
-----Original Message-----
From: Pin-yen Lin <[email protected]>
Sent: Monday, December 16, 2024 8:05 PM
To: Dmitry Baryshkov <[email protected]>
Cc: Xin Ji <[email protected]>; Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 14 lines
Quoted 14 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Hi Dmitry,
Quoted 2 lines · Dmitry Baryshkov
On Mon, Dec 16, 2024 at 08:33:23AM +0000, Xin Ji wrote:
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 9:17 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas ZimmermannQuoted 34 lines
Quoted 34 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 1 line · Xin Ji
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Hi Dmitry, sorry, I didn't clear describe the reason.
Please. Do not top-post. Please paste your answer under the question, not somewhere at the top of the email. This allows us to have a more constructive dialog. Additional bonus if you can fix your email client to insert sensible quoting information instead of dumping
the headers of the original email.
Quoted 11 lines
Quoted 11 lines
Hi Dmitry, OK, sorry about it. Currently, we have problem to fetch email from Microsoft on Ubuntu. I'll try to fix it later.
Quoted 9 lines
Quoted 7 lines
Anx7625 implement DSI to DP convert behind USB Type-C port, when user plug into USB Type-C Dongle with DP monitor, the user space will enable HDCP feature, then kernel do HDCP and output display and set HDCP content to ENABLE, but the issue happened if user manually change the
monitor's resolution later.
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Each time user change the resolution, kernel will call bridge interface .atomic_disable() and .atomic_enable(), the old driver will keep HDCP state to ENABLE, this is a BUG, when user change the resolution, kernel must change HDCP content too (mustn't keep to ENABLE),
Why? Could you please point me to the corresponding documentation or a code path in the other driver? Preferably i915,
AMD or Nouveau.
Quoted 13 lines
Quoted 13 lines
Quoted 1 line
Quoted 1 line
As
https://elixir.bootlin.com/linux/v6.12.5/source/drivers/gpu/drm/drm_
connecto
r.c#L1423:Quoted 9 lines
Quoted 3 lines
- ENABLED -> DESIRED (termination of authentication) As
there is no other interface to tell anx7625 bridge driver, so the I think best place to handle ENABLE -> DESIRED in .atomic_disable().I was looking for something like
cdns_mhdp_connector_atomic_check(),
which switches to UNDESIRED if there is no new CRTC. Likewise i915 driver performs this inintel_hdcp_atomic_check()if there is a need for modeset.
Quoted 6 lines
Quoted 3 lines
Hi Dmitry, the bridge driver is different with i915, anx7625 bridge driver only implement some passive callback interface. There is no HDCP status checking while do resolution switch.
Does that mean that you _have_ to reestablish HDCP after mode switching in order for it to work?
Hi Dmitry, anx7625 bridge IC will be power down after call .atomic_disable(), and all HDCP status will be lost on chip. So, we should reestablish HDCP again in .atomic_enable().
Quoted 27 lines
Quoted 19 lines
Quoted 13 lines
I believe you mean "DESIRED" here.
Quoted 10 lines
For the "termination of authentication" case see
cdns_mhdp_hdcp_check_link(), which detects if the HDCP got disabled by HW and then updates the status accordingly.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
as DRM doc said, kernel cannot change from ENABLE to UNDESIRE, so next patch, I'll change it to DESIRE in .atomic_disable().
Quoted 6 lines
Quoted 2 lines
This e.g. will result in HDCP being restarted for all modesets. Is this an expected behaviour?
The bridge could be powered off between .atomic_disable() and .atomic_enable(), though I'm not sure if this would be a concern for anx7625. I'll let Xin to comment on this.
Quoted 8 lines
The flow of resolution switch is:
-> .atomic_disable(). -> .atomic_enable(). -> HDCP status check and enable.As resolution switch is triggered by user space, at this moment, the HDCP works fine(cannot get disabled event from HW).
So, I think, .atomic_disable() is
the best place to do termination of authentication (turn HDCP status to
Quoted 7 lines
DESIRED).
Quoted 2 lines
This is the only entrance which can do termination of authentication, I cannot find others.
I'm probably still missing a reference to the standard (please excuse me, I don't know it by heart). Is it a standard requirement to reauthenticate on the mode switch?
I'm not sure, but anx7625 have power cycle on the mode switch. All HDCP status Will be lost.
Quoted 5 lines
BTW, while reading the anx7625 code, I noticed that there is a possible race between .atomic_enable() / .atomic_disable() which set
ctx->connectorand thehdcp_check_work_func()which readsctx->connectorwithout any protection.
OK, I'll upstream another patch.
Quoted 4 lines
--
With best wishes
Dmitry
Quoted 119 lines · Xin Ji
Quoted 119 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Tuesday, December 17, 2024 8:30 PM
To: Xin Ji <[email protected]>
Cc: Pin-yen Lin <[email protected]>; Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Quoted 11 lines · Xin Ji
Quoted 11 lines
-----Original Message-----
From: Pin-yen Lin <[email protected]>
Sent: Monday, December 16, 2024 8:05 PM
To: Dmitry Baryshkov <[email protected]>
Cc: Xin Ji <[email protected]>; Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 14 lines
Quoted 14 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Hi Dmitry,
Quoted 2 lines · Dmitry Baryshkov
On Mon, Dec 16, 2024 at 08:33:23AM +0000, Xin Ji wrote:
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 9:17 PM
To: Xin Ji <[email protected]>
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas ZimmermannQuoted 34 lines
Quoted 34 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 1 line · Xin Ji
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Hi Dmitry, sorry, I didn't clear describe the reason.
Please. Do not top-post. Please paste your answer under the question, not somewhere at the top of the email. This allows us to have a more constructive dialog. Additional bonus if you can fix your email client to insert sensible quoting information instead of dumping
the headers of the original email.
Quoted 11 lines
Quoted 11 lines
Hi Dmitry, OK, sorry about it. Currently, we have problem to fetch email from Microsoft on Ubuntu. I'll try to fix it later.
Quoted 9 lines
Quoted 7 lines
Anx7625 implement DSI to DP convert behind USB Type-C port, when user plug into USB Type-C Dongle with DP monitor, the user space will enable HDCP feature, then kernel do HDCP and output display and set HDCP content to ENABLE, but the issue happened if user manually change the
monitor's resolution later.
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Each time user change the resolution, kernel will call bridge interface .atomic_disable() and .atomic_enable(), the old driver will keep HDCP state to ENABLE, this is a BUG, when user change the resolution, kernel must change HDCP content too (mustn't keep to ENABLE),
Why? Could you please point me to the corresponding documentation or a code path in the other driver? Preferably i915,
AMD or Nouveau.
Quoted 16 lines
Quoted 13 lines
Quoted 1 line
Quoted 1 line
As
https://elixir.bootlin.com/linux/v6.12.5/source/drivers/gpu/drm/drm_
connecto
r.c#L1423:Quoted 9 lines
Quoted 3 lines
- ENABLED -> DESIRED (termination of authentication) As
there is no other interface to tell anx7625 bridge driver, so the I think best place to handle ENABLE -> DESIRED in .atomic_disable().I was looking for something like
cdns_mhdp_connector_atomic_check(),
which switches to UNDESIRED if there is no new CRTC. Likewise i915 driver performs this inintel_hdcp_atomic_check()if there is a need for modeset.Hi Dmitry, the bridge driver is different with i915, anx7625 bridge driver only implement some passive callback interface. There is no HDCP status checking while do resolution switch.
Quoted 5 lines
Quoted 2 lines
Does that mean that you _have_ to reestablish HDCP after mode switching in order for it to work?
Hi Dmitry, anx7625 bridge IC will be power down after call .atomic_disable(), and all HDCP status will be lost on chip. So, we should reestablish HDCP again in .atomic_enable().
Finally! This phrase should be in the commit message.
Quoted 46 lines
Quoted 27 lines
Quoted 19 lines
Quoted 13 lines
I believe you mean "DESIRED" here.
Quoted 10 lines
For the "termination of authentication" case see
cdns_mhdp_hdcp_check_link(), which detects if the HDCP got disabled by HW and then updates the status accordingly.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
as DRM doc said, kernel cannot change from ENABLE to UNDESIRE, so next patch, I'll change it to DESIRE in .atomic_disable().
Quoted 6 lines
Quoted 2 lines
This e.g. will result in HDCP being restarted for all modesets. Is this an expected behaviour?
The bridge could be powered off between .atomic_disable() and .atomic_enable(), though I'm not sure if this would be a concern for anx7625. I'll let Xin to comment on this.
Quoted 8 lines
The flow of resolution switch is:
-> .atomic_disable(). -> .atomic_enable(). -> HDCP status check and enable.As resolution switch is triggered by user space, at this moment, the HDCP works fine(cannot get disabled event from HW).
So, I think, .atomic_disable() is
the best place to do termination of authentication (turn HDCP status toQuoted 7 lines
DESIRED).
Quoted 2 lines
This is the only entrance which can do termination of authentication, I cannot find others.
I'm probably still missing a reference to the standard (please excuse me, I don't know it by heart). Is it a standard requirement to reauthenticate on the mode switch?
I'm not sure, but anx7625 have power cycle on the mode switch. All HDCP status Will be lost.
Quoted 5 lines
BTW, while reading the anx7625 code, I noticed that there is a possible race between .atomic_enable() / .atomic_disable() which set
ctx->connectorand thehdcp_check_work_func()which readsctx->connectorwithout any protection.OK, I'll upstream another patch.
Quoted 4 lines
--
With best wishes
Dmitry
Signature · 2 lines
With best wishes Dmitry
Quoted 148 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Wednesday, December 18, 2024 6:32 PM
To: Xin Ji <[email protected]>
Cc: Pin-yen Lin <[email protected]>; Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>; David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Quoted 12 lines · Xin Ji
Quoted 12 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Tuesday, December 17, 2024 8:30 PM
To: Xin Ji <[email protected]>
Cc: Pin-yen Lin <[email protected]>; Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;David
Quoted 96 lines
Quoted 96 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Quoted 4 lines · Xin Ji
Quoted 4 lines
-----Original Message-----
From: Pin-yen Lin <[email protected]>
Sent: Monday, December 16, 2024 8:05 PM
To: Dmitry Baryshkov <[email protected]>Quoted 8 lines
Quoted 8 lines
Cc: Xin Ji <[email protected]>; Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann <[email protected]>;
David
Quoted 15 lines
Quoted 15 lines
Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()Hi Dmitry,
Quoted 2 lines · Dmitry Baryshkov
On Mon, Dec 16, 2024 at 08:33:23AM +0000, Xin Ji wrote:
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
-----Original Message-----
From: Dmitry Baryshkov <[email protected]>
Sent: Friday, December 13, 2024 9:17 PM
To: Xin Ji <[email protected]>Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Cc: Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; Maarten Lankhorst <[email protected]>; Maxime Ripard <[email protected]>; Thomas Zimmermann
Quoted 42 lines
Quoted 42 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
David Airlie <[email protected]>; Simona Vetter <[email protected]>; Bernie Liang <[email protected]>; Qilin Wen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3] drm/bridge:anx7625: Update HDCP status atatomic_enable()CAUTION: This email originated from outside of the organization. Please do not click links or open attachments unless you recognize the sender, and know the content is safe.
Quoted 1 line · Xin Ji
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Hi Dmitry, sorry, I didn't clear describe the reason.
Please. Do not top-post. Please paste your answer under the question, not somewhere at the top of the email. This allows us to have a more constructive dialog. Additional bonus if you can fix your email client to insert sensible quoting information instead of dumping
the headers of the original email.
Quoted 18 lines
Quoted 18 lines
Hi Dmitry, OK, sorry about it. Currently, we have problem to fetch email from Microsoft on Ubuntu. I'll try to fix it later.
Quoted 16 lines
Quoted 8 lines
Anx7625 implement DSI to DP convert behind USB Type-C port, when user plug into USB Type-C Dongle with DP monitor, the user space will enable HDCP feature, then kernel do HDCP and output display and set HDCP content to ENABLE, but the issue happened if user manually change the
monitor's resolution later.
Quoted 6 lines
Each time user change the resolution, kernel will call bridge interface .atomic_disable() and .atomic_enable(), the old driver will keep HDCP state to ENABLE, this is a BUG, when user change the resolution, kernel must change HDCP content too (mustn't keep to ENABLE),
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Why? Could you please point me to the corresponding documentation or a code path in the other driver? Preferably i915,
AMD or Nouveau.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
As
https://elixir.bootlin.com/linux/v6.12.5/source/drivers/gpu/drm/
drm_
connecto
r.c#L1423:Quoted 3 lines
Quoted 3 lines
- ENABLED -> DESIRED (termination of authentication)
As there is no other interface to tell anx7625 bridge driver, so the I think best place to handle ENABLE -> DESIREDin .atomic_disable().
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
I was looking for something like
cdns_mhdp_connector_atomic_check(),
which switches to UNDESIRED if there is no new CRTC. Likewise i915 driver performs this inintel_hdcp_atomic_check()if there is a need for modeset.Hi Dmitry, the bridge driver is different with i915, anx7625 bridge driver only implement some passive callback interface. There is no HDCP status checking while do resolution switch.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Does that mean that you _have_ to reestablish HDCP after mode switching in order for it to work?
Hi Dmitry, anx7625 bridge IC will be power down after call .atomic_disable(), and all HDCP status will be lost on chip. So, we should reestablish HDCP again in .atomic_enable().
Finally! This phrase should be in the commit message.
Hi Dmitry, OK, I'll add it in the commit message and send new patch. Thanks,
Xin
Quoted 56 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
I believe you mean "DESIRED" here.
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
For the "termination of authentication" case see
cdns_mhdp_hdcp_check_link(), which detects if the HDCP got disabled by HW and then updates the status accordingly.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
as DRM doc said, kernel cannot change from ENABLE to UNDESIRE, so next patch, I'll change it to DESIRE
in .atomic_disable().
Quoted 26 lines
Quoted 16 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
This e.g. will result in HDCP being restarted for all modesets. Is this an expected behaviour?
The bridge could be powered off between .atomic_disable() and .atomic_enable(), though I'm not sure if this would be a concern for anx7625. I'll let Xin to comment on this.
The flow of resolution switch is:
Quoted 8 lines
-> .atomic_disable(). -> .atomic_enable(). -> HDCP status check and enable.As resolution switch is triggered by user space, at this moment, the HDCP works fine(cannot get disabled event from HW). So, I think, .atomic_disable() is
the best place to do termination of authentication (turn HDCP status toQuoted 7 lines
DESIRED).
Quoted 2 lines
This is the only entrance which can do termination of authentication, I cannot find others.
I'm probably still missing a reference to the standard (please excuse me, I don't know it by heart). Is it a standard requirement to reauthenticate on the mode switch?
I'm not sure, but anx7625 have power cycle on the mode switch. All HDCP status Will be lost.
Quoted 1 line
Quoted 10 lines
Quoted 5 lines
BTW, while reading the anx7625 code, I noticed that there is a possible race between .atomic_enable() / .atomic_disable() which set
ctx->connectorand thehdcp_check_work_func()which readsctx->ctx->connector
without any protection.OK, I'll upstream another patch.
Quoted 4 lines
--
With best wishes
Dmitry--
With best wishes
Dmitry