drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_dpmm/dml2_dpmm_dcn4.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_dpmm/dml2_dpmm_dcn4.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_dpmm/dml2_dpmm_dcn4.c- Extension
.c- Size
- 45800 bytes
- Lines
- 859
- 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_dpmm_dcn4.hdml2_internal_shared_types.hdml_top_types.hlib_float_math.h
Detected Declarations
enum dentist_divider_rangeenum DFS_base_divider_idfunction dram_bw_kbps_to_uclk_khzfunction get_minimum_clocks_for_latencyfunction dml_round_upfunction calculate_system_active_minimumsfunction calculate_svp_prefetch_minimumsfunction calculate_idle_minimumsfunction add_margin_and_round_to_dfs_grainularityfunction round_to_non_dfs_granularityfunction round_up_and_copy_to_next_dpmfunction DML_MAX_CLK_TABLE_SIZEfunction round_up_to_next_dpmfunction map_soc_min_clocks_to_dpm_fine_grainedfunction map_soc_min_clocks_to_dpm_coarse_grainedfunction map_min_clocks_to_dpmfunction are_timings_trivially_synchronizablefunction find_smallest_idle_time_in_vblank_usfunction determine_power_management_features_with_vblank_onlyfunction get_displays_without_vactive_margin_maskfunction get_displays_with_fams_maskfunction determine_power_management_features_with_vactive_and_vblankfunction determine_power_management_features_with_famsfunction clamp_uclk_to_maxfunction clamp_fclk_to_maxfunction map_mode_to_soc_dpmfunction dpmm_dcn3_map_mode_to_soc_dpmfunction dpmm_dcn4_map_mode_to_soc_dpmfunction dpmm_dcn4_map_watermarksfunction dpmm_dcn42_map_watermarks
Annotated Snippet
if (dram_bw_table->entries[i].pre_derate_dram_bw_kbps >= bandwidth_kbps) {
uclk_khz = dram_bw_table->entries[i].min_uclk_khz;
break;
}
}
return uclk_khz;
}
static void get_minimum_clocks_for_latency(struct dml2_dpmm_map_mode_to_soc_dpm_params_in_out *in_out,
double *uclk,
double *fclk,
double *dcfclk)
{
int min_clock_index_for_latency;
if (in_out->display_cfg->stage3.success)
min_clock_index_for_latency = in_out->display_cfg->stage3.min_clk_index_for_latency;
else
min_clock_index_for_latency = in_out->display_cfg->stage1.min_clk_index_for_latency;
*dcfclk = in_out->min_clk_table->dram_bw_table.entries[min_clock_index_for_latency].min_dcfclk_khz;
*fclk = in_out->min_clk_table->dram_bw_table.entries[min_clock_index_for_latency].min_fclk_khz;
*uclk = dram_bw_kbps_to_uclk_khz(in_out->min_clk_table->dram_bw_table.entries[min_clock_index_for_latency].pre_derate_dram_bw_kbps,
&in_out->soc_bb->clk_table.dram_config, &in_out->min_clk_table->dram_bw_table);
}
static unsigned long dml_round_up(double a)
{
if (a - (unsigned long)a > 0) {
return ((unsigned long)a) + 1;
}
return (unsigned long)a;
}
static void calculate_system_active_minimums(struct dml2_dpmm_map_mode_to_soc_dpm_params_in_out *in_out)
{
double min_uclk_avg, min_uclk_urgent, min_uclk_bw;
double min_fclk_avg, min_fclk_urgent, min_fclk_bw;
double min_dcfclk_avg, min_dcfclk_urgent, min_dcfclk_bw;
double min_uclk_latency, min_fclk_latency, min_dcfclk_latency;
const struct dml2_core_mode_support_result *mode_support_result = &in_out->display_cfg->mode_support_result;
min_uclk_avg = dram_bw_kbps_to_uclk_khz((unsigned long long)(mode_support_result->global.active.average_bw_dram_kbps
/ ((double)in_out->soc_bb->qos_parameters.derate_table.system_active_average.dram_derate_percent_pixel / 100)),
&in_out->soc_bb->clk_table.dram_config, &in_out->min_clk_table->dram_bw_table);
if (in_out->display_cfg->display_config.hostvm_enable)
min_uclk_urgent = dram_bw_kbps_to_uclk_khz((unsigned long long)(mode_support_result->global.active.urgent_bw_dram_kbps
/ ((double)in_out->soc_bb->qos_parameters.derate_table.system_active_urgent.dram_derate_percent_pixel_and_vm / 100)),
&in_out->soc_bb->clk_table.dram_config, &in_out->min_clk_table->dram_bw_table);
else
min_uclk_urgent = dram_bw_kbps_to_uclk_khz((unsigned long long)(mode_support_result->global.active.urgent_bw_dram_kbps
/ ((double)in_out->soc_bb->qos_parameters.derate_table.system_active_urgent.dram_derate_percent_pixel / 100)),
&in_out->soc_bb->clk_table.dram_config, &in_out->min_clk_table->dram_bw_table);
min_uclk_bw = min_uclk_urgent > min_uclk_avg ? min_uclk_urgent : min_uclk_avg;
min_fclk_avg = (double)mode_support_result->global.active.average_bw_sdp_kbps / in_out->soc_bb->fabric_datapath_to_dcn_data_return_bytes;
min_fclk_avg = (double)min_fclk_avg / ((double)in_out->soc_bb->qos_parameters.derate_table.system_active_average.fclk_derate_percent / 100);
min_fclk_urgent = (double)mode_support_result->global.active.urgent_bw_sdp_kbps / in_out->soc_bb->fabric_datapath_to_dcn_data_return_bytes;
min_fclk_urgent = (double)min_fclk_urgent / ((double)in_out->soc_bb->qos_parameters.derate_table.system_active_urgent.fclk_derate_percent / 100);
min_fclk_bw = min_fclk_urgent > min_fclk_avg ? min_fclk_urgent : min_fclk_avg;
min_dcfclk_avg = (double)mode_support_result->global.active.average_bw_sdp_kbps / in_out->soc_bb->return_bus_width_bytes;
min_dcfclk_avg = (double)min_dcfclk_avg / ((double)in_out->soc_bb->qos_parameters.derate_table.system_active_average.dcfclk_derate_percent / 100);
min_dcfclk_urgent = (double)mode_support_result->global.active.urgent_bw_sdp_kbps / in_out->soc_bb->return_bus_width_bytes;
min_dcfclk_urgent = (double)min_dcfclk_urgent / ((double)in_out->soc_bb->qos_parameters.derate_table.system_active_urgent.dcfclk_derate_percent / 100);
min_dcfclk_bw = min_dcfclk_urgent > min_dcfclk_avg ? min_dcfclk_urgent : min_dcfclk_avg;
get_minimum_clocks_for_latency(in_out, &min_uclk_latency, &min_fclk_latency, &min_dcfclk_latency);
in_out->programming->min_clocks.dcn4x.active.uclk_khz = dml_round_up(min_uclk_bw > min_uclk_latency ? min_uclk_bw : min_uclk_latency);
in_out->programming->min_clocks.dcn4x.active.fclk_khz = dml_round_up(min_fclk_bw > min_fclk_latency ? min_fclk_bw : min_fclk_latency);
in_out->programming->min_clocks.dcn4x.active.dcfclk_khz = dml_round_up(min_dcfclk_bw > min_dcfclk_latency ? min_dcfclk_bw : min_dcfclk_latency);
}
static void calculate_svp_prefetch_minimums(struct dml2_dpmm_map_mode_to_soc_dpm_params_in_out *in_out)
{
double min_uclk_avg, min_uclk_urgent, min_uclk_bw;
double min_fclk_avg, min_fclk_urgent, min_fclk_bw;
double min_dcfclk_avg, min_dcfclk_urgent, min_dcfclk_bw;
double min_fclk_latency, min_dcfclk_latency;
double min_uclk_latency;
const struct dml2_core_mode_support_result *mode_support_result = &in_out->display_cfg->mode_support_result;
Annotation
- Immediate include surface: `dml2_dpmm_dcn4.h`, `dml2_internal_shared_types.h`, `dml_top_types.h`, `lib_float_math.h`.
- Detected declarations: `enum dentist_divider_range`, `enum DFS_base_divider_id`, `function dram_bw_kbps_to_uclk_khz`, `function get_minimum_clocks_for_latency`, `function dml_round_up`, `function calculate_system_active_minimums`, `function calculate_svp_prefetch_minimums`, `function calculate_idle_minimums`, `function add_margin_and_round_to_dfs_grainularity`, `function round_to_non_dfs_granularity`.
- 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.