drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c- Extension
.c- Size
- 22601 bytes
- Lines
- 750
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
link_enc_cfg.hresource.hlink_service.h
Detected Declarations
function filesfunction get_assignmentfunction remove_link_enc_assignmentfunction add_link_enc_assignmentfunction find_first_avail_link_encfunction is_avail_link_encfunction are_ep_ids_equalfunction clear_enc_assignmentsfunction link_enc_cfg_initfunction link_enc_cfg_copyfunction link_enc_cfg_link_encs_assignfunction link_enc_cfg_link_enc_unassignfunction link_enc_cfg_is_transmitter_mappablefunction link_enc_cfg_is_link_enc_availfunction link_enc_cfg_validatefunction link_enc_cfg_set_transient_mode
Annotated Snippet
if (link_enc && ((uint32_t)stream->link->connector_signal & link_enc->output_signals)) {
is_dig_stream = true;
/* If stream is HDMI FRL, then it is not a DIG stream. */
if (dc_is_hdmi_frl_signal(stream->signal))
is_dig_stream = false;
break;
}
}
}
return is_dig_stream;
}
static struct link_enc_assignment get_assignment(struct dc *dc, int i)
{
struct link_enc_assignment assignment;
if (dc->current_state->res_ctx.link_enc_cfg_ctx.mode == LINK_ENC_CFG_TRANSIENT)
assignment = dc->current_state->res_ctx.link_enc_cfg_ctx.transient_assignments[i];
else /* LINK_ENC_CFG_STEADY */
assignment = dc->current_state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i];
return assignment;
}
/* Return stream using DIG link encoder resource. NULL if unused. */
static struct dc_stream_state *get_stream_using_link_enc(
struct dc_state *state,
enum engine_id eng_id)
{
struct dc_stream_state *stream = NULL;
int i;
for (i = 0; i < state->stream_count; i++) {
struct link_enc_assignment assignment = state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i];
if ((assignment.valid == true) && (assignment.eng_id == eng_id)) {
stream = state->streams[i];
break;
}
}
return stream;
}
static void remove_link_enc_assignment(
struct dc_state *state,
struct dc_stream_state *stream,
enum engine_id eng_id)
{
int eng_idx;
int i;
if (eng_id != ENGINE_ID_UNKNOWN) {
eng_idx = eng_id - ENGINE_ID_DIGA;
/* stream ptr of stream in dc_state used to update correct entry in
* link_enc_assignments table.
*/
for (i = 0; i < MAX_PIPES; i++) {
struct link_enc_assignment assignment = state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i];
if (assignment.valid && assignment.stream == stream) {
state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].valid = false;
/* Only add link encoder back to availability pool if not being
* used by any other stream (i.e. removing SST stream or last MST stream).
*/
if (get_stream_using_link_enc(state, eng_id) == NULL)
state->res_ctx.link_enc_cfg_ctx.link_enc_avail[eng_idx] = eng_id;
stream->link_enc = NULL;
state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].eng_id = ENGINE_ID_UNKNOWN;
state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].stream = NULL;
dc_stream_release(stream);
break;
}
}
}
}
static void add_link_enc_assignment(
struct dc_state *state,
struct dc_stream_state *stream,
enum engine_id eng_id)
{
int eng_idx;
int i;
if (eng_id != ENGINE_ID_UNKNOWN) {
eng_idx = eng_id - ENGINE_ID_DIGA;
Annotation
- Immediate include surface: `link_enc_cfg.h`, `resource.h`, `link_service.h`.
- Detected declarations: `function files`, `function get_assignment`, `function remove_link_enc_assignment`, `function add_link_enc_assignment`, `function find_first_avail_link_enc`, `function is_avail_link_enc`, `function are_ep_ids_equal`, `function clear_enc_assignments`, `function link_enc_cfg_init`, `function link_enc_cfg_copy`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.