drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4.c- Extension
.c- Size
- 41038 bytes
- Lines
- 776
- 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_internal_shared_types.hdml2_core_shared_types.hdml2_core_dcn4.hdml2_core_dcn4_calcs.hdml2_debug.hlib_float_math.h
Detected Declarations
function patch_ip_caps_with_explicit_ip_paramsfunction patch_ip_params_with_ip_capsfunction core_dcn4_initializefunction core_dcn42_initializefunction create_phantom_stream_from_main_streamfunction create_phantom_plane_from_main_planefunction expand_implict_subvpfunction pack_mode_programming_params_with_implicit_subvpfunction core_dcn4_mode_supportfunction lookup_uclk_dpm_index_by_freqfunction core_dcn4_mode_programmingfunction core_dcn4_populate_informativefunction core_dcn4_calculate_mcache_allocation
Annotated Snippet
if (display_cfg->stage3.stream_svp_meta[stream_index].valid) {
// Create the phantom stream
create_phantom_stream_from_main_stream(&svp_expanded_display_cfg->stream_descriptors[svp_expanded_display_cfg->num_streams],
main_stream, &display_cfg->stage3.stream_svp_meta[stream_index]);
// Associate this phantom stream to the main stream
scratch->main_stream_index_from_svp_stream_index[svp_expanded_display_cfg->num_streams] = stream_index;
scratch->svp_stream_index_from_main_stream_index[stream_index] = svp_expanded_display_cfg->num_streams;
// Increment num streams
svp_expanded_display_cfg->num_streams++;
}
}
// Create the phantom planes
for (plane_index = 0; plane_index < display_cfg->display_config.num_planes; plane_index++) {
main_plane = &display_cfg->display_config.plane_descriptors[plane_index];
if (display_cfg->stage3.stream_svp_meta[main_plane->stream_index].valid) {
main_stream = &display_cfg->display_config.stream_descriptors[main_plane->stream_index];
phantom_stream = &svp_expanded_display_cfg->stream_descriptors[scratch->svp_stream_index_from_main_stream_index[main_plane->stream_index]];
create_phantom_plane_from_main_plane(&svp_expanded_display_cfg->plane_descriptors[svp_expanded_display_cfg->num_planes],
main_plane, phantom_stream, scratch->svp_stream_index_from_main_stream_index[main_plane->stream_index], main_stream);
// Associate this phantom plane to the main plane
scratch->phantom_plane_index_to_main_plane_index[svp_expanded_display_cfg->num_planes] = plane_index;
scratch->main_plane_index_to_phantom_plane_index[plane_index] = svp_expanded_display_cfg->num_planes;
// Increment num planes
svp_expanded_display_cfg->num_planes++;
// Adjust the main plane settings
svp_expanded_display_cfg->plane_descriptors[plane_index].overrides.legacy_svp_config = dml2_svp_mode_override_main_pipe;
}
}
}
static void pack_mode_programming_params_with_implicit_subvp(struct dml2_core_instance *core, const struct display_configuation_with_meta *display_cfg,
const struct dml2_display_cfg *svp_expanded_display_cfg, struct dml2_display_cfg_programming *programming, struct dml2_core_scratch *scratch)
{
unsigned int stream_index, plane_index, pipe_offset, stream_already_populated_mask, main_plane_index, mcache_index;
unsigned int total_main_mcaches_required = 0;
int total_pipe_regs_copied = 0;
int dml_internal_pipe_index = 0;
const struct dml2_plane_parameters *main_plane;
const struct dml2_plane_parameters *phantom_plane;
const struct dml2_stream_parameters *main_stream;
const struct dml2_stream_parameters *phantom_stream;
// Copy the unexpanded display config to output
memcpy(&programming->display_config, &display_cfg->display_config, sizeof(struct dml2_display_cfg));
// Set the global register values
dml2_core_calcs_get_arb_params(&display_cfg->display_config, &core->clean_me_up.mode_lib, &programming->global_regs.arb_regs);
// Get watermarks uses display config for ref clock override, so it doesn't matter whether we pass the pre or post expansion
// display config
dml2_core_calcs_get_watermarks(&display_cfg->display_config, &core->clean_me_up.mode_lib, &programming->global_regs.wm_regs[0]);
// Check if FAMS2 is required
if (display_cfg->stage3.performed && display_cfg->stage3.success) {
programming->fams2_required = display_cfg->stage3.fams2_required;
dml2_core_calcs_get_global_fams2_programming(&core->clean_me_up.mode_lib, display_cfg, &programming->fams2_global_config);
}
// Only loop over all the main streams (the implicit svp streams will be packed as part of the main stream)
for (stream_index = 0; stream_index < programming->display_config.num_streams; stream_index++) {
main_stream = &svp_expanded_display_cfg->stream_descriptors[stream_index];
phantom_stream = &svp_expanded_display_cfg->stream_descriptors[scratch->svp_stream_index_from_main_stream_index[stream_index]];
// Set the descriptor
programming->stream_programming[stream_index].stream_descriptor = &programming->display_config.stream_descriptors[stream_index];
// Set the odm combine factor
programming->stream_programming[stream_index].num_odms_required = display_cfg->mode_support_result.cfg_support_info.stream_support_info[stream_index].odms_used;
// Check if the stream has implicit SVP enabled
if (main_stream != phantom_stream) {
// If so, copy the phantom stream descriptor
programming->stream_programming[stream_index].phantom_stream.enabled = true;
memcpy(&programming->stream_programming[stream_index].phantom_stream.descriptor, phantom_stream, sizeof(struct dml2_stream_parameters));
} else {
programming->stream_programming[stream_index].phantom_stream.enabled = false;
}
// Due to the way DML indexes data internally, it's easier to populate the rest of the display
// stream programming in the next stage
}
dml_internal_pipe_index = 0;
Annotation
- Immediate include surface: `dml2_internal_shared_types.h`, `dml2_core_shared_types.h`, `dml2_core_dcn4.h`, `dml2_core_dcn4_calcs.h`, `dml2_debug.h`, `lib_float_math.h`.
- Detected declarations: `function patch_ip_caps_with_explicit_ip_params`, `function patch_ip_params_with_ip_caps`, `function core_dcn4_initialize`, `function core_dcn42_initialize`, `function create_phantom_stream_from_main_stream`, `function create_phantom_plane_from_main_plane`, `function expand_implict_subvp`, `function pack_mode_programming_params_with_implicit_subvp`, `function core_dcn4_mode_support`, `function lookup_uclk_dpm_index_by_freq`.
- 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.