drivers/gpu/drm/amd/display/dc/dml2_0/dml2_dc_resource_mgmt.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_dc_resource_mgmt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_dc_resource_mgmt.c- Extension
.c- Size
- 41338 bytes
- Lines
- 1190
- 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
dml2_mall_phantom.hdml2_dc_types.hdml2_internal_types.hdml2_utils.hdml2_dc_resource_mgmt.h
Detected Declarations
struct dc_plane_pipe_poolstruct dc_pipe_mapping_scratchfunction get_plane_idfunction find_disp_cfg_idx_by_plane_idfunction find_disp_cfg_idx_by_stream_idfunction find_pipes_assigned_to_planefunction validate_pipe_assignmentfunction is_plane_using_pipefunction is_pipe_freefunction find_preferred_pipe_candidatesfunction find_last_resort_pipe_candidatesfunction is_pipe_in_candidate_arrayfunction sort_pipes_for_splittingfunction calculate_odm_slicesfunction add_odm_slice_to_odm_treefunction find_pipes_assigned_to_streamfunction is_pipe_usedfunction free_pipefunction free_unused_pipes_for_planefunction remove_pipes_from_blend_treesfunction map_pipes_for_streamfunction map_pipes_for_planefunction get_target_mpc_factorfunction get_target_odm_factorfunction get_source_odm_factorfunction get_source_mpc_factorfunction populate_mpc_factors_for_streamfunction populate_odm_factorsfunction unmap_dc_pipes_for_streamfunction map_dc_pipes_for_streamfunction map_dc_pipes_with_callbacksfunction dml2_map_dc_pipes
Annotated Snippet
struct dc_plane_pipe_pool {
unsigned int pipes_assigned_to_plane[MAX_ODM_FACTOR][MAX_MPCC_FACTOR];
bool pipe_used[MAX_ODM_FACTOR][MAX_MPCC_FACTOR];
int num_pipes_assigned_to_plane_for_mpcc_combine;
int num_pipes_assigned_to_plane_for_odm_combine;
};
struct dc_pipe_mapping_scratch {
struct {
unsigned int odm_factor;
unsigned int odm_slice_end_x[MAX_PIPES];
struct pipe_ctx *next_higher_pipe_for_odm_slice[MAX_PIPES];
} odm_info;
struct {
unsigned int mpc_factor;
struct pipe_ctx *prev_odm_pipe;
} mpc_info;
struct dc_plane_pipe_pool pipe_pool;
};
static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *state, const struct dc_plane_state *plane,
unsigned int stream_id, unsigned int plane_index, unsigned int *plane_id)
{
int i, j;
bool is_plane_duplicate = dml2->v20.scratch.plane_duplicate_exists;
if (!plane_id)
return false;
for (i = 0; i < state->stream_count; i++) {
if (state->streams[i]->stream_id == stream_id) {
for (j = 0; j < state->stream_status[i].plane_count; j++) {
if (state->stream_status[i].plane_states[j] == plane &&
(!is_plane_duplicate || (j == plane_index))) {
*plane_id = (i << 16) | j;
return true;
}
}
}
}
return false;
}
static int find_disp_cfg_idx_by_plane_id(struct dml2_dml_to_dc_pipe_mapping *mapping, unsigned int plane_id)
{
int i;
for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
if (mapping->disp_cfg_to_plane_id_valid[i] && mapping->disp_cfg_to_plane_id[i] == plane_id)
return i;
}
ASSERT(false);
return __DML2_WRAPPER_MAX_STREAMS_PLANES__;
}
static int find_disp_cfg_idx_by_stream_id(struct dml2_dml_to_dc_pipe_mapping *mapping, unsigned int stream_id)
{
int i;
for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
if (mapping->disp_cfg_to_stream_id_valid[i] && mapping->disp_cfg_to_stream_id[i] == stream_id)
return i;
}
ASSERT(false);
return __DML2_WRAPPER_MAX_STREAMS_PLANES__;
}
// The master pipe of a stream is defined as the top pipe in odm slice 0
static struct pipe_ctx *find_master_pipe_of_stream(struct dml2_context *ctx, struct dc_state *state, unsigned int stream_id)
{
int i;
for (i = 0; i < ctx->config.dcn_pipe_count; i++) {
if (state->res_ctx.pipe_ctx[i].stream && state->res_ctx.pipe_ctx[i].stream->stream_id == stream_id) {
if (!state->res_ctx.pipe_ctx[i].prev_odm_pipe && !state->res_ctx.pipe_ctx[i].top_pipe)
return &state->res_ctx.pipe_ctx[i];
}
}
return NULL;
}
static struct pipe_ctx *find_master_pipe_of_plane(struct dml2_context *ctx,
struct dc_state *state, unsigned int plane_id)
{
int i;
Annotation
- Immediate include surface: `dml2_mall_phantom.h`, `dml2_dc_types.h`, `dml2_internal_types.h`, `dml2_utils.h`, `dml2_dc_resource_mgmt.h`.
- Detected declarations: `struct dc_plane_pipe_pool`, `struct dc_pipe_mapping_scratch`, `function get_plane_id`, `function find_disp_cfg_idx_by_plane_id`, `function find_disp_cfg_idx_by_stream_id`, `function find_pipes_assigned_to_plane`, `function validate_pipe_assignment`, `function is_plane_using_pipe`, `function is_pipe_free`, `function find_preferred_pipe_candidates`.
- 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.