drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.c- Extension
.c- Size
- 27307 bytes
- Lines
- 797
- 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_core_utils.h
Detected Declarations
function dml2_core_utils_div_remfunction dml2_core_utils_is_420function dml2_core_utils_is_422_planarfunction dml2_core_utils_is_422_packedfunction dml2_core_utils_print_mode_support_infofunction dml2_core_utils_get_stream_output_bppfunction dml2_core_utils_round_to_multiplefunction dml2_core_util_get_num_active_pipesfunction dml2_core_utils_pipe_plane_mappingfunction dml2_core_utils_is_phantom_pipefunction dml2_core_utils_get_tile_block_size_bytesfunction dml2_core_utils_get_segment_horizontal_contiguousfunction dml2_core_utils_is_linearfunction dml2_core_utils_is_vertical_rotationfunction dml2_core_utils_get_gfx_versionfunction dml2_core_utils_get_qos_param_indexfunction dml2_core_utils_get_active_min_uclk_dpm_indexfunction dml2_core_utils_is_dual_planefunction dml2_core_utils_log_and_substract_if_non_zerofunction create_phantom_stream_from_main_streamfunction create_phantom_plane_from_main_planefunction dml2_core_utils_expand_implict_subvpfunction dml2_core_utils_is_stream_encoder_requiredfunction dml2_core_utils_is_encoder_dsc_capablefunction dml2_core_utils_is_dio_dp_encoderfunction dml2_core_utils_is_hpo_dp_encoderfunction dml2_core_utils_is_dp_encoderfunction dml2_core_utils_is_dp_8b_10b_link_ratefunction dml2_core_utils_is_dp_128b_132b_link_ratefunction dml2_core_utils_is_odm_splitfunction dml2_core_utils_get_frame_time_us
Annotated Snippet
if (display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.dsc.enable == dml2_dsc_disable) {
switch (display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].output.output_format) {
case dml2_444:
out_bpp[k] = bpc * 3;
break;
case dml2_s422:
out_bpp[k] = bpc * 2;
break;
case dml2_n422:
out_bpp[k] = bpc * 2;
break;
case dml2_420:
default:
out_bpp[k] = bpc * 1.5;
break;
}
} else if (display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.dsc.enable == dml2_dsc_enable) {
out_bpp[k] = (double)display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.dsc.dsc_compressed_bpp_x16 / 16;
} else {
out_bpp[k] = 0;
}
#ifdef __DML_VBA_DEBUG__
DML_LOG_VERBOSE("DML::%s: k=%d bpc=%f\n", __func__, k, bpc);
DML_LOG_VERBOSE("DML::%s: k=%d dsc.enable=%d\n", __func__, k, display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].timing.dsc.enable);
DML_LOG_VERBOSE("DML::%s: k=%d out_bpp=%f\n", __func__, k, out_bpp[k]);
#endif
}
}
unsigned int dml2_core_utils_round_to_multiple(unsigned int num, unsigned int multiple, bool up)
{
unsigned int remainder;
if (multiple == 0)
return num;
remainder = num % multiple;
if (remainder == 0)
return num;
if (up)
return (num + multiple - remainder);
else
return (num - remainder);
}
unsigned int dml2_core_util_get_num_active_pipes(int unsigned num_planes, const struct core_display_cfg_support_info *cfg_support_info)
{
unsigned int num_active_pipes = 0;
for (unsigned int k = 0; k < num_planes; k++) {
num_active_pipes = num_active_pipes + (unsigned int)cfg_support_info->plane_support_info[k].dpps_used;
}
#ifdef __DML_VBA_DEBUG__
DML_LOG_VERBOSE("DML::%s: num_active_pipes = %d\n", __func__, num_active_pipes);
#endif
return num_active_pipes;
}
void dml2_core_utils_pipe_plane_mapping(const struct core_display_cfg_support_info *cfg_support_info, unsigned int *pipe_plane)
{
unsigned int pipe_idx = 0;
for (unsigned int k = 0; k < DML2_MAX_PLANES; ++k) {
pipe_plane[k] = __DML2_CALCS_PIPE_NO_PLANE__;
}
for (unsigned int plane_idx = 0; plane_idx < DML2_MAX_PLANES; plane_idx++) {
for (int i = 0; i < cfg_support_info->plane_support_info[plane_idx].dpps_used; i++) {
pipe_plane[pipe_idx] = plane_idx;
pipe_idx++;
}
}
}
bool dml2_core_utils_is_phantom_pipe(const struct dml2_plane_parameters *plane_cfg)
{
bool is_phantom = false;
if (plane_cfg->overrides.legacy_svp_config == dml2_svp_mode_override_phantom_pipe ||
plane_cfg->overrides.legacy_svp_config == dml2_svp_mode_override_phantom_pipe_no_data_return) {
is_phantom = true;
}
return is_phantom;
}
unsigned int dml2_core_utils_get_tile_block_size_bytes(enum dml2_swizzle_mode sw_mode, unsigned int byte_per_pixel)
{
Annotation
- Immediate include surface: `dml2_core_utils.h`.
- Detected declarations: `function dml2_core_utils_div_rem`, `function dml2_core_utils_is_420`, `function dml2_core_utils_is_422_planar`, `function dml2_core_utils_is_422_packed`, `function dml2_core_utils_print_mode_support_info`, `function dml2_core_utils_get_stream_output_bpp`, `function dml2_core_utils_round_to_multiple`, `function dml2_core_util_get_num_active_pipes`, `function dml2_core_utils_pipe_plane_mapping`, `function dml2_core_utils_is_phantom_pipe`.
- 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.