<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div>This patch has been dropped</div>
<div><br>
</div>
<div>Regards,</div>
<div>Jasdeep</div>
<br>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> December 9, 2022 4:32 PM<br>
<b>To:</b> Dhillon, Jasdeep <Jasdeep.Dhillon@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Wang, Chao-kai (Stylon) <Stylon.Wang@amd.com>; Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; Wentland, Harry <Harry.Wentland@amd.com>; Zhuo, Qingqing (Lillian) <Qingqing.Zhuo@amd.com>; Siqueira,
 Rodrigo <Rodrigo.Siqueira@amd.com>; Li, Roman <Roman.Li@amd.com>; Chiu, Solomon <Solomon.Chiu@amd.com>; Pillai, Aurabindo <Aurabindo.Pillai@amd.com>; Wu, Hersen <hersenxs.wu@amd.com>; Lin, Wayne <Wayne.Lin@amd.com>; Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com>;
 Gutierrez, Agustin <Agustin.Gutierrez@amd.com>; Kotarac, Pavle <Pavle.Kotarac@amd.com><br>
<b>Subject:</b> Re: [PATCH 10/23] drm/amd/display: phase3 mst hdcp for multiple displays</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Fri, Dec 9, 2022 at 11:37 AM jdhillon <jdhillon@amd.com> wrote:<br>
><br>
> From: hersen wu <hersenxs.wu@amd.com><br>
><br>
> [Why]<br>
> multiple display hdcp are enabled within event_property_validate,<br>
> event_property_update by looping all displays on mst hub. when<br>
> one of display on mst hub in unplugged or disabled, hdcp are<br>
> disabled for all displays on mst hub within hdcp_reset_display<br>
> by looping all displays of mst link. for displays still active,<br>
> their encryption status are off. kernel driver will not run hdcp<br>
> authentication again. therefore, hdcp are not enabled automatically.<br>
><br>
> [How]<br>
> within is_content_protection_different, check drm_crtc_state changes<br>
> of all displays on mst hub, if need, triger hdcp_update_display to<br>
> re-run hdcp authentication.<br>
><br>
> Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com><br>
> Acked-by: Jasdeep Dhillon <jdhillon@amd.com><br>
> Signed-off-by: hersen wu <hersenxs.wu@amd.com><br>
> ---<br>
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 118 ++++++++++++------<br>
>  1 file changed, 81 insertions(+), 37 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
> index 7affe0899418..dc23801de071 100644<br>
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
> @@ -7374,27 +7374,55 @@ is_scaling_state_different(const struct dm_connector_state *dm_state,<br>
>  }<br>
><br>
>  #ifdef CONFIG_DRM_AMD_DC_HDCP<br>
> -static bool is_content_protection_different(struct drm_connector_state *state,<br>
> -                                           const struct drm_connector_state *old_state,<br>
> -                                           const struct drm_connector *connector, struct hdcp_workqueue *hdcp_w)<br>
> +static bool is_content_protection_different(struct drm_crtc_state *new_crtc_state,<br>
> +                                           struct drm_crtc_state *old_crtc_state,<br>
> +                                           struct drm_connector_state *new_conn_state,<br>
> +                                           struct drm_connector_state *old_conn_state,<br>
> +                                           const struct drm_connector *connector,<br>
> +                                           struct hdcp_workqueue *hdcp_w)<br>
>  {<br>
>         struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);<br>
>         struct dm_connector_state *dm_con_state = to_dm_connector_state(connector->state);<br>
><br>
> -       /* Handle: Type0/1 change */<br>
> -       if (old_state->hdcp_content_type != state->hdcp_content_type &&<br>
> -           state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {<br>
> -               state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;<br>
> +       pr_debug("[HDCP_DM] connector->index: %x connect_status: %x dpms: %x\n",<br>
> +               connector->index, connector->status, connector->dpms);<br>
> +       pr_debug("[HDCP_DM] state protection old: %x new: %x\n",<br>
> +               old_conn_state->content_protection, new_conn_state->content_protection);<br>
> +<br>
> +       if (old_crtc_state)<br>
> +               pr_debug("[HDCP_DM] old crtc en: %x a: %x m: %x a-chg: %x c-chg: %x\n",<br>
> +               old_crtc_state->enable,<br>
> +               old_crtc_state->active,<br>
> +               old_crtc_state->mode_changed,<br>
> +               old_crtc_state->active_changed,<br>
> +               old_crtc_state->connectors_changed);<br>
> +<br>
> +       if (new_crtc_state)<br>
> +               pr_debug("[HDCP_DM] NEW crtc en: %x a: %x m: %x a-chg: %x c-chg: %x\n",<br>
> +               new_crtc_state->enable,<br>
> +               new_crtc_state->active,<br>
> +               new_crtc_state->mode_changed,<br>
> +               new_crtc_state->active_changed,<br>
> +               new_crtc_state->connectors_changed);<br>
> +<br>
> +       /* hdcp content type change */<br>
> +       if (old_conn_state->hdcp_content_type != new_conn_state->hdcp_content_type &&<br>
> +           new_conn_state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {<br>
> +               new_conn_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;<br>
> +               pr_debug("[HDCP_DM] Type0/1 change %s :true\n", __func__);<br>
>                 return true;<br>
>         }<br>
><br>
> -       /* CP is being re enabled, ignore this<br>
> -        *<br>
> -        * Handles:     ENABLED -> DESIRED<br>
> -        */<br>
> -       if (old_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED &&<br>
> -           state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED) {<br>
> -               state->content_protection = DRM_MODE_CONTENT_PROTECTION_ENABLED;<br>
> +       /* CP is being re enabled, ignore this */<br>
> +       if (old_conn_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED &&<br>
> +           new_conn_state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED) {<br>
> +               if (new_crtc_state && new_crtc_state->mode_changed) {<br>
> +                       new_conn_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;<br>
> +                       pr_debug("[HDCP_DM] ENABLED->DESIRED & mode_changed %s :true\n", __func__);<br>
> +                       return true;<br>
> +               };<br>
> +               new_conn_state->content_protection = DRM_MODE_CONTENT_PROTECTION_ENABLED;<br>
> +               pr_debug("[HDCP_DM] ENABLED -> DESIRED %s :false\n", __func__);<br>
>                 return false;<br>
>         }<br>
><br>
> @@ -7402,9 +7430,9 @@ static bool is_content_protection_different(struct drm_connector_state *state,<br>
>          *<br>
>          * Handles:     UNDESIRED -> ENABLED<br>
>          */<br>
> -       if (old_state->content_protection == DRM_MODE_CONTENT_PROTECTION_UNDESIRED &&<br>
> -           state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED)<br>
> -               state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;<br>
> +       if (old_conn_state->content_protection == DRM_MODE_CONTENT_PROTECTION_UNDESIRED &&<br>
> +           new_conn_state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED)<br>
> +               new_conn_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;<br>
><br>
>         /* Stream removed and re-enabled<br>
>          *<br>
> @@ -7414,10 +7442,12 @@ static bool is_content_protection_different(struct drm_connector_state *state,<br>
>          *<br>
>          * Handles:     DESIRED -> DESIRED (Special case)<br>
>          */<br>
> -       if (!(old_state->crtc && old_state->crtc->enabled) &&<br>
> -               state->crtc && state->crtc->enabled &&<br>
> +       if (!(old_conn_state->crtc && old_conn_state->crtc->enabled) &&<br>
> +               new_conn_state->crtc && new_conn_state->crtc->enabled &&<br>
>                 connector->state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED) {<br>
>                 dm_con_state->update_hdcp = false;<br>
> +               pr_debug("[HDCP_DM] DESIRED->DESIRED (Stream removed and re-enabled) %s :true\n",<br>
> +                       __func__);<br>
>                 return true;<br>
>         }<br>
><br>
> @@ -7429,35 +7459,42 @@ static bool is_content_protection_different(struct drm_connector_state *state,<br>
>          *<br>
>          * Handles:     DESIRED -> DESIRED (Special case)<br>
>          */<br>
> -       if (dm_con_state->update_hdcp && state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED &&<br>
> -           connector->dpms == DRM_MODE_DPMS_ON && aconnector->dc_sink != NULL) {<br>
> +       if (dm_con_state->update_hdcp &&<br>
> +       new_conn_state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED &&<br>
> +       connector->dpms == DRM_MODE_DPMS_ON && aconnector->dc_sink != NULL) {<br>
>                 dm_con_state->update_hdcp = false;<br>
> +               pr_debug("[HDCP_DM] DESIRED->DESIRED (Hot-plug, headless s3, dpms) %s :true\n",<br>
> +                       __func__);<br>
>                 return true;<br>
>         }<br>
><br>
> -       /*<br>
> -        * Handles:     UNDESIRED -> UNDESIRED<br>
> -        *              DESIRED -> DESIRED<br>
> -        *              ENABLED -> ENABLED<br>
> -        */<br>
> -       if (old_state->content_protection == state->content_protection)<br>
> +       if (old_conn_state->content_protection == new_conn_state->content_protection) {<br>
> +               if (new_conn_state->content_protection >= DRM_MODE_CONTENT_PROTECTION_DESIRED) {<br>
> +                       if (new_crtc_state && new_crtc_state->mode_changed) {<br>
> +                               pr_debug("[HDCP_DM] DESIRED->DESIRED or ENABLE->ENABLE mode_change %s :true\n",<br>
> +                                       __func__);<br>
> +                               return true;<br>
> +                       };<br>
> +                       pr_debug("[HDCP_DM] DESIRED->DESIRED & ENABLE->ENABLE %s :false\n",<br>
> +                               __func__);<br>
> +                       return false;<br>
> +               };<br>
> +<br>
> +               pr_debug("[HDCP_DM] UNDESIRED->UNDESIRED %s :false\n", __func__);<br>
>                 return false;<br>
> +       }<br>
><br>
> -       /*<br>
> -        * Handles:     UNDESIRED -> DESIRED<br>
> -        *              DESIRED -> UNDESIRED<br>
> -        *              ENABLED -> UNDESIRED<br>
> -        */<br>
> -       if (state->content_protection != DRM_MODE_CONTENT_PROTECTION_ENABLED)<br>
> +       if (new_conn_state->content_protection != DRM_MODE_CONTENT_PROTECTION_ENABLED) {<br>
> +               pr_debug("[HDCP_DM] UNDESIRED->DESIRED or DESIRED->UNDESIRED or ENABLED->UNDESIRED %s :true\n",<br>
> +                       __func__);<br>
>                 return true;<br>
> +       }<br>
><br>
> -       /*<br>
> -        * Handles:     DESIRED -> ENABLED<br>
> -        */<br>
> +       pr_debug("[HDCP_DM] DESIRED->ENABLED %s :false\n", __func__);<br>
>         return false;<br>
>  }<br>
> -<br>
>  #endif<br>
> +<br>
>  static void remove_stream(struct amdgpu_device *adev,<br>
>                           struct amdgpu_crtc *acrtc,<br>
>                           struct dc_stream_state *stream)<br>
> @@ -8322,6 +8359,10 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)<br>
>                         new_crtc_state = drm_atomic_get_new_crtc_state(state, &acrtc->base);<br>
>                         old_crtc_state = drm_atomic_get_old_crtc_state(state, &acrtc->base);<br>
>                 }<br>
> +<<<<<<< HEAD<br>
> +=======<br>
> +<br>
> +>>>>>>> 667f52144b9a (drm/amd/display: phase3 mst hdcp for multiple displays)<br>
<br>
rebasing leftovers.<br>
<br>
>                 if (old_crtc_state)<br>
>                         pr_debug("old crtc en: %x a: %x m: %x a-chg: %x c-chg: %x\n",<br>
>                         old_crtc_state->enable,<br>
> @@ -8384,7 +8425,10 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)<br>
>                                 DRM_MODE_CONTENT_PROTECTION_DESIRED)<br>
>                                 enable_encryption = true;<br>
><br>
> +<<<<<<< HEAD<br>
><br>
> +=======<br>
> +>>>>>>> 667f52144b9a (drm/amd/display: phase3 mst hdcp for multiple displays)<br>
<br>
here too.<br>
<br>
>                         if (aconnector->dc_link && aconnector->dc_sink &&<br>
>                                 aconnector->dc_link->type == dc_connection_mst_branch) {<br>
>                                 struct hdcp_workqueue *hdcp_work = adev->dm.hdcp_workqueue;<br>
> --<br>
> 2.34.1<br>
><br>
</div>
</span></font></div>
</body>
</html>