Skip to content

Commit c219287

Browse files
Timur Kristófalexdeucher
authored andcommitted
drm/amd/display: Determine early if a link has supported encoders (v2)
Avoid initializing DDC, HPD, etc. when we know that the link is not going to be constructed because it has no supported encoders. This is mainly useful for old GPUs which may have encoders such as TRAVIS and NUTMEG that are not yet supported by DC. Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent e3ea56e commit c219287

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

drivers/gpu/drm/amd/display/dc/link/link_factory.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,14 @@ static enum channel_id get_ddc_line(struct dc_link *link)
451451
return channel;
452452
}
453453

454+
static bool transmitter_supported(const enum transmitter transmitter)
455+
{
456+
return transmitter != TRANSMITTER_UNKNOWN &&
457+
transmitter != TRANSMITTER_NUTMEG_CRT &&
458+
transmitter != TRANSMITTER_TRAVIS_CRT &&
459+
transmitter != TRANSMITTER_TRAVIS_LCD;
460+
}
461+
454462
static bool construct_phy(struct dc_link *link,
455463
const struct link_init_data *init_params)
456464
{
@@ -482,6 +490,17 @@ static bool construct_phy(struct dc_link *link,
482490
link->link_id =
483491
bios->funcs->get_connector_id(bios, init_params->connector_index);
484492

493+
/* Determine early if the link has any supported encoders,
494+
* so that we avoid initializing DDC and HPD, etc.
495+
*/
496+
bp_funcs->get_src_obj(bios, link->link_id, 0, &enc_init_data.encoder);
497+
enc_init_data.transmitter = translate_encoder_to_transmitter(enc_init_data.encoder);
498+
499+
if (!transmitter_supported(enc_init_data.transmitter)) {
500+
DC_LOG_WARNING("link_id %d has unsupported encoder\n", link->link_id.id);
501+
return false;
502+
}
503+
485504
link->ep_type = DISPLAY_ENDPOINT_PHY;
486505

487506
DC_LOG_DC("BIOS object table - link_id: %d", link->link_id.id);
@@ -611,16 +630,12 @@ static bool construct_phy(struct dc_link *link,
611630
dal_ddc_get_line(get_ddc_pin(link->ddc));
612631

613632
enc_init_data.ctx = dc_ctx;
614-
bp_funcs->get_src_obj(dc_ctx->dc_bios, link->link_id, 0,
615-
&enc_init_data.encoder);
616633
enc_init_data.connector = link->link_id;
617634
enc_init_data.channel = get_ddc_line(link);
618635
enc_init_data.hpd_source = get_hpd_line(link);
619636

620637
link->hpd_src = enc_init_data.hpd_source;
621638

622-
enc_init_data.transmitter =
623-
translate_encoder_to_transmitter(enc_init_data.encoder);
624639
link->link_enc =
625640
link->dc->res_pool->funcs->link_enc_create(dc_ctx, &enc_init_data);
626641

0 commit comments

Comments
 (0)