OSDN Git Service

drm/amd/display: Move link_enc init logic to DC
authorJude Shih <shenshih@amd.com>
Tue, 23 Nov 2021 05:53:00 +0000 (13:53 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 7 Dec 2021 18:11:14 +0000 (13:11 -0500)
[Why]

We shouldn't be accessing res_pool funcs from DM level,
therefore, we should create API and let the flow
be done in DC level.

[How]

We create new interface dp_get_link_enc to access and get the correct link_enc

Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Pavle Kotarac <Pavle.Kotarac@amd.com>
Signed-off-by: Jude Shih <shenshih@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h

index adaf370..3e935cf 100644 (file)
@@ -8330,15 +8330,8 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
                break;
        case DRM_MODE_CONNECTOR_DisplayPort:
                aconnector->base.polled = DRM_CONNECTOR_POLL_HPD;
-               if (link->is_dig_mapping_flexible &&
-                   link->dc->res_pool->funcs->link_encs_assign) {
-                       link->link_enc =
-                               link_enc_cfg_get_link_enc_used_by_link(link->ctx->dc, link);
-                       if (!link->link_enc)
-                               link->link_enc =
-                                       link_enc_cfg_get_next_avail_link_enc(link->ctx->dc);
-               }
-
+               link->link_enc = dp_get_link_enc(link);
+               ASSERT(link->link_enc);
                if (link->link_enc)
                        aconnector->base.ycbcr_420_allowed =
                        link->link_enc->features.dp_ycbcr420_supported ? true : false;
index ed94971..56b1aac 100644 (file)
@@ -6174,6 +6174,23 @@ void dp_set_fec_enable(struct dc_link *link, bool enable)
        }
 }
 
+struct link_encoder *dp_get_link_enc(struct dc_link *link)
+{
+       struct link_encoder *link_enc;
+
+       link_enc = link->link_enc;
+       if (link->is_dig_mapping_flexible &&
+           link->dc->res_pool->funcs->link_encs_assign) {
+               link_enc = link_enc_cfg_get_link_enc_used_by_link(link->ctx->dc,
+                                                                 link);
+               if (!link->link_enc)
+                       link_enc = link_enc_cfg_get_next_avail_link_enc(
+                               link->ctx->dc);
+       }
+
+       return link_enc;
+}
+
 void dpcd_set_source_specific_data(struct dc_link *link)
 {
        if (!link->dc->vendor_signature.is_valid) {
index 8f50b1b..52bdfea 100644 (file)
@@ -170,6 +170,7 @@ uint8_t dc_dp_initialize_scrambling_data_symbols(
 
 enum dc_status dp_set_fec_ready(struct dc_link *link, bool ready);
 void dp_set_fec_enable(struct dc_link *link, bool enable);
+struct link_encoder *dp_get_link_enc(struct dc_link *link);
 bool dp_set_dsc_enable(struct pipe_ctx *pipe_ctx, bool enable);
 bool dp_set_dsc_pps_sdp(struct pipe_ctx *pipe_ctx, bool enable, bool immediate_update);
 void dp_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable);