drm/amd/display: Take emulated dc_sink into account for HDCP
authorWayne Lin <Wayne.Lin@amd.com>
Tue, 31 May 2022 10:14:41 +0000 (18:14 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 21 Jun 2022 22:17:23 +0000 (18:17 -0400)
[Why]
While updating the config of hdcp, we use the sink_singal type of the
dc_sink to decide the HDCP operation mode. However, it doesn't consider
the case when the sink is a emulated one.

[How]
Take dc_em_sink into account while updating HDCP config.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Aurabindo Jayamohanan Pillai <Aurabindo.Pillai@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c

index a4191b2..d7c41c1 100644 (file)
@@ -448,6 +448,7 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
        struct mod_hdcp_display *display = &hdcp_work[link_index].display;
        struct mod_hdcp_link *link = &hdcp_work[link_index].link;
        struct drm_connector_state *conn_state;
+       struct dc_sink *sink = NULL;
        bool link_is_hdcp14 = false;
 
        if (config->dpms_off) {
@@ -461,8 +462,13 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
        display->index = aconnector->base.index;
        display->state = MOD_HDCP_DISPLAY_ACTIVE;
 
-       if (aconnector->dc_sink != NULL)
-               link->mode = mod_hdcp_signal_type_to_operation_mode(aconnector->dc_sink->sink_signal);
+       if (aconnector->dc_sink)
+               sink = aconnector->dc_sink;
+       else if (aconnector->dc_em_sink)
+               sink = aconnector->dc_em_sink;
+
+       if (sink != NULL)
+               link->mode = mod_hdcp_signal_type_to_operation_mode(sink->sink_signal);
 
        display->controller = CONTROLLER_ID_D0 + config->otg_inst;
        display->dig_fe = config->dig_fe;
@@ -473,8 +479,8 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
        link->dio_output_id = config->dio_output_idx;
        link->phy_idx = config->phy_idx;
 
-       link->hdcp_supported_informational = dc_link_is_hdcp14(aconnector->dc_link,
-                       aconnector->dc_sink->sink_signal) ? 1 : 0;
+       if (sink)
+               link_is_hdcp14 = dc_link_is_hdcp14(aconnector->dc_link, sink->sink_signal);
        link->hdcp_supported_informational = link_is_hdcp14;
        link->dp.rev = aconnector->dc_link->dpcd_caps.dpcd_rev.raw;
        link->dp.assr_enabled = config->assr_enabled;