mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
drm/amd/display: update link encoder assignment
[Why] Map a link encoder instance matching stream encoder instance if possible. [How] Get the stream encoder instance and assign the same link encoder instance if available. Reviewed-by: PeiChen Huang <peichen.huang@amd.com> Signed-off-by: Meenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com> Signed-off-by: Wayne Lin <wayne.lin@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
dbf58a9dad
commit
11cc0bdc5b
|
|
@ -2690,17 +2690,40 @@ static inline int find_fixed_dio_link_enc(const struct dc_link *link)
|
|||
}
|
||||
|
||||
static inline int find_free_dio_link_enc(const struct resource_context *res_ctx,
|
||||
const struct dc_link *link, const struct resource_pool *pool)
|
||||
const struct dc_link *link, const struct resource_pool *pool, struct dc_stream_state *stream)
|
||||
{
|
||||
int i;
|
||||
int i, j = -1;
|
||||
int stream_enc_inst = -1;
|
||||
int enc_count = pool->dig_link_enc_count;
|
||||
|
||||
/* for dpia, check preferred encoder first and then the next one */
|
||||
for (i = 0; i < enc_count; i++)
|
||||
if (res_ctx->dio_link_enc_ref_cnts[(link->dpia_preferred_eng_id + i) % enc_count] == 0)
|
||||
break;
|
||||
/* Find stream encoder instance for the stream */
|
||||
if (stream) {
|
||||
for (i = 0; i < pool->pipe_count; i++) {
|
||||
if ((res_ctx->pipe_ctx[i].stream == stream) &&
|
||||
(res_ctx->pipe_ctx[i].stream_res.stream_enc != NULL)) {
|
||||
stream_enc_inst = res_ctx->pipe_ctx[i].stream_res.stream_enc->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (i >= 0 && i < enc_count) ? (link->dpia_preferred_eng_id + i) % enc_count : -1;
|
||||
/* Assign dpia preferred > stream enc instance > available */
|
||||
for (i = 0; i < enc_count; i++) {
|
||||
if (res_ctx->dio_link_enc_ref_cnts[i] == 0) {
|
||||
if (j == -1)
|
||||
j = i;
|
||||
|
||||
if (link->dpia_preferred_eng_id == i) {
|
||||
j = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (stream_enc_inst == i) {
|
||||
j = stream_enc_inst;
|
||||
}
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
static inline void acquire_dio_link_enc(
|
||||
|
|
@ -2781,7 +2804,7 @@ static bool add_dio_link_enc_to_ctx(const struct dc *dc,
|
|||
retain_dio_link_enc(res_ctx, enc_index);
|
||||
} else {
|
||||
if (stream->link->is_dig_mapping_flexible)
|
||||
enc_index = find_free_dio_link_enc(res_ctx, stream->link, pool);
|
||||
enc_index = find_free_dio_link_enc(res_ctx, stream->link, pool, stream);
|
||||
else {
|
||||
int link_index = 0;
|
||||
|
||||
|
|
@ -2791,7 +2814,7 @@ static bool add_dio_link_enc_to_ctx(const struct dc *dc,
|
|||
* one into the acquiring link.
|
||||
*/
|
||||
if (enc_index >= 0 && is_dio_enc_acquired_by_other_link(stream->link, enc_index, &link_index)) {
|
||||
int new_enc_index = find_free_dio_link_enc(res_ctx, dc->links[link_index], pool);
|
||||
int new_enc_index = find_free_dio_link_enc(res_ctx, dc->links[link_index], pool, stream);
|
||||
|
||||
if (new_enc_index >= 0)
|
||||
swap_dio_link_enc_to_muxable_ctx(context, pool, new_enc_index, enc_index);
|
||||
|
|
@ -5201,7 +5224,7 @@ struct link_encoder *get_temp_dio_link_enc(
|
|||
enc_index = link->eng_id;
|
||||
|
||||
if (enc_index < 0)
|
||||
enc_index = find_free_dio_link_enc(res_ctx, link, pool);
|
||||
enc_index = find_free_dio_link_enc(res_ctx, link, pool, NULL);
|
||||
|
||||
if (enc_index >= 0)
|
||||
link_enc = pool->link_encoders[enc_index];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user