Commit 66d58bf7 authored by Martin Tsai's avatar Martin Tsai Committed by Alex Deucher

drm/amd/display: handle null link encoder

[Why]
The link encoder mapping could return a null one and causes system crash.

[How]
Let the mapping can get an available link encoder without endpoint
identification check.
Reviewed-by: default avatarWenjing Liu <Wenjing.Liu@amd.com>
Acked-by: default avatarJasdeep Dhillon <jdhillon@amd.com>
Signed-off-by: default avatarMartin Tsai <martin.tsai@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ed3a56f9
...@@ -3530,11 +3530,7 @@ enum dc_status dc_link_allocate_mst_payload(struct pipe_ctx *pipe_ctx) ...@@ -3530,11 +3530,7 @@ enum dc_status dc_link_allocate_mst_payload(struct pipe_ctx *pipe_ctx)
const struct link_hwss *link_hwss = get_link_hwss(link, &pipe_ctx->link_res); const struct link_hwss *link_hwss = get_link_hwss(link, &pipe_ctx->link_res);
DC_LOGGER_INIT(link->ctx->logger); DC_LOGGER_INIT(link->ctx->logger);
/* Link encoder may have been dynamically assigned to non-physical display endpoint. */ link_encoder = link_enc_cfg_get_link_enc(link);
if (link->ep_type == DISPLAY_ENDPOINT_PHY)
link_encoder = link->link_enc;
else if (link->dc->res_pool->funcs->link_encs_assign)
link_encoder = link_enc_cfg_get_link_enc_used_by_stream(pipe_ctx->stream->ctx->dc, stream);
ASSERT(link_encoder); ASSERT(link_encoder);
/* enable_link_dp_mst already check link->enabled_stream_count /* enable_link_dp_mst already check link->enabled_stream_count
...@@ -3823,11 +3819,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) ...@@ -3823,11 +3819,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx)
const struct dc_link_settings empty_link_settings = {0}; const struct dc_link_settings empty_link_settings = {0};
DC_LOGGER_INIT(link->ctx->logger); DC_LOGGER_INIT(link->ctx->logger);
/* Link encoder may have been dynamically assigned to non-physical display endpoint. */ link_encoder = link_enc_cfg_get_link_enc(link);
if (link->ep_type == DISPLAY_ENDPOINT_PHY)
link_encoder = link->link_enc;
else if (link->dc->res_pool->funcs->link_encs_assign)
link_encoder = link_enc_cfg_get_link_enc_used_by_stream(pipe_ctx->stream->ctx->dc, stream);
ASSERT(link_encoder); ASSERT(link_encoder);
/* deallocate_mst_payload is called before disable link. When mode or /* deallocate_mst_payload is called before disable link. When mode or
...@@ -3944,13 +3936,7 @@ static void update_psp_stream_config(struct pipe_ctx *pipe_ctx, bool dpms_off) ...@@ -3944,13 +3936,7 @@ static void update_psp_stream_config(struct pipe_ctx *pipe_ctx, bool dpms_off)
if (cp_psp == NULL || cp_psp->funcs.update_stream_config == NULL) if (cp_psp == NULL || cp_psp->funcs.update_stream_config == NULL)
return; return;
if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_PHY) link_enc = link_enc_cfg_get_link_enc(pipe_ctx->stream->link);
link_enc = pipe_ctx->stream->link->link_enc;
else if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA &&
pipe_ctx->stream->link->dc->res_pool->funcs->link_encs_assign)
link_enc = link_enc_cfg_get_link_enc_used_by_stream(
pipe_ctx->stream->ctx->dc,
pipe_ctx->stream);
ASSERT(link_enc); ASSERT(link_enc);
if (link_enc == NULL) if (link_enc == NULL)
return; return;
...@@ -4100,10 +4086,7 @@ void core_link_enable_stream( ...@@ -4100,10 +4086,7 @@ void core_link_enable_stream(
dc_is_virtual_signal(pipe_ctx->stream->signal)) dc_is_virtual_signal(pipe_ctx->stream->signal))
return; return;
if (dc->res_pool->funcs->link_encs_assign && stream->link->ep_type != DISPLAY_ENDPOINT_PHY) link_enc = link_enc_cfg_get_link_enc(link);
link_enc = link_enc_cfg_get_link_enc_used_by_stream(dc, stream);
else
link_enc = stream->link->link_enc;
ASSERT(link_enc); ASSERT(link_enc);
if (!dc_is_virtual_signal(pipe_ctx->stream->signal) if (!dc_is_virtual_signal(pipe_ctx->stream->signal)
......
...@@ -1605,16 +1605,7 @@ static void get_pixel_clock_parameters( ...@@ -1605,16 +1605,7 @@ static void get_pixel_clock_parameters(
pixel_clk_params->requested_pix_clk_100hz = stream->timing.pix_clk_100hz; pixel_clk_params->requested_pix_clk_100hz = stream->timing.pix_clk_100hz;
/* Links supporting dynamically assigned link encoder will be assigned next link_enc = link_enc_cfg_get_link_enc(link);
* available encoder if one not already assigned.
*/
if (link->is_dig_mapping_flexible &&
link->dc->res_pool->funcs->link_encs_assign) {
link_enc = link_enc_cfg_get_link_enc_used_by_stream(stream->ctx->dc, stream);
if (link_enc == NULL)
link_enc = link_enc_cfg_get_next_avail_link_enc(stream->ctx->dc);
} else
link_enc = stream->link->link_enc;
ASSERT(link_enc); ASSERT(link_enc);
if (link_enc) if (link_enc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment