drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c- Extension
.c- Size
- 71587 bytes
- Lines
- 2166
- 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
drm/display/drm_dp_helper.hdrm/display/drm_dsc_helper.hdc_hw_types.hdsc.hdc.hrc_calc.hfixed31_32.hclk_mgr.hresource.h
Detected Declarations
function apply_128b_132b_stream_overheadfunction dc_bandwidth_in_kbps_from_timingfunction dsc_buff_block_size_from_dpcdfunction dsc_line_buff_depth_from_dpcdfunction dsc_throughput_from_dpcdfunction dsc_bpp_increment_div_from_dpcdfunction get_vic_preset_bppfunction hdmi_dsc_get_num_slicesfunction hdmi_dsc_get_bppfunction dc_dsc_parse_dsc_dpcdfunction dc_dsc_parse_dsc_edidfunction dc_dsc_compute_bandwidth_rangefunction dc_dsc_dump_encoder_capsfunction dc_dsc_dump_decoder_capsfunction build_dsc_enc_combined_slice_capsfunction build_dsc_enc_capsfunction dsc_div_by_10_round_upfunction get_min_dsc_slice_count_for_odmfunction get_dsc_enc_capsfunction intersect_dsc_capsfunction compute_bpp_x16_from_target_bandwidthfunction convert_bandwidth_to_frl_paramsfunction compute_bpp_x16_from_frl_paramsfunction decide_dsc_bandwidth_rangefunction decide_dsc_target_bpp_x16function get_available_dsc_slicesfunction get_max_dsc_slicesfunction inc_num_slicesfunction dec_num_slicesfunction fit_num_slices_upfunction setup_dsc_configfunction dc_dsc_compute_configfunction dc_dsc_stream_bandwidth_in_kbpsfunction dc_dsc_stream_bandwidth_overhead_in_kbpsfunction dc_dsc_get_policy_for_timingfunction dc_dsc_policy_set_max_target_bpp_limitfunction dc_dsc_policy_set_enable_dsc_when_not_neededfunction dc_dsc_policy_set_disable_dsc_stream_overheadfunction dc_set_disable_128b_132b_stream_overheadfunction dc_dsc_get_default_config_option
Annotated Snippet
if (prim_bpp_444[i].vic == vid_id) {
preset_found = true;
*preset_bpp = prim_bpp_444[i].target_bpp;
break;
}
}
} else if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR422) {
for (i = 0; i < table_size_422 ; i++) {
if (prim_bpp_422[i].vic == vid_id) {
preset_found = true;
*preset_bpp = prim_bpp_422[i].target_bpp;
break;
}
}
} else if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420) {
for (i = 0; i < table_size_420 ; i++) {
if (prim_bpp_420[i].vic == vid_id) {
preset_found = true;
*preset_bpp = prim_bpp_420[i].target_bpp;
break;
}
}
} else {
return false;
}
return preset_found;
}
static int hdmi_dsc_get_num_slices(const struct dc_crtc_timing *timing)
{
int k_slice_adjust = 1;
int adj_pix_clk_mhz;
int min_slices;
int slice_target;
int slice_width = timing->h_addressable;
int h_ratio_adj_pix_clk_mhz;
if (timing->pixel_encoding == PIXEL_ENCODING_RGB ||
timing->pixel_encoding == PIXEL_ENCODING_YCBCR444)
k_slice_adjust = 2;
adj_pix_clk_mhz = k_slice_adjust * timing->pix_clk_100hz / 10000 / 2;
h_ratio_adj_pix_clk_mhz = adj_pix_clk_mhz * timing->h_addressable / timing->h_total;
if (adj_pix_clk_mhz <= 2720) {
min_slices = adj_pix_clk_mhz / 340;
if (adj_pix_clk_mhz % 340 != 0)
min_slices++;
} else if (adj_pix_clk_mhz <= 4800) {
min_slices = adj_pix_clk_mhz / 400;
if (adj_pix_clk_mhz % 400 != 0)
min_slices++;
} else if (h_ratio_adj_pix_clk_mhz <= 4800) {
min_slices = h_ratio_adj_pix_clk_mhz / 600;
if (h_ratio_adj_pix_clk_mhz % 600 != 0)
min_slices++;
} else {
min_slices = h_ratio_adj_pix_clk_mhz / 900;
if (h_ratio_adj_pix_clk_mhz % 900 != 0)
min_slices++;
}
do {
if (min_slices <= 1)
slice_target = 1;
else if (min_slices <= 2)
slice_target = 2;
else if (min_slices <= 4)
slice_target = 4;
else if (min_slices <= 8)
slice_target = 8;
else if (min_slices <= 12)
slice_target = 12;
else if (min_slices <= 16)
slice_target = 16;
else
return 0;
slice_width = timing->h_addressable / slice_target;
min_slices++;
} while (slice_width > 2720);
return slice_target;
}
static int hdmi_dsc_get_bpp(const struct dc_crtc_timing *timing,
const struct dsc_enc_caps *dsc_common_caps)
{
int max_dsc_bpp, min_dsc_bpp;
int target_bytes;
Annotation
- Immediate include surface: `drm/display/drm_dp_helper.h`, `drm/display/drm_dsc_helper.h`, `dc_hw_types.h`, `dsc.h`, `dc.h`, `rc_calc.h`, `fixed31_32.h`, `clk_mgr.h`.
- Detected declarations: `function apply_128b_132b_stream_overhead`, `function dc_bandwidth_in_kbps_from_timing`, `function dsc_buff_block_size_from_dpcd`, `function dsc_line_buff_depth_from_dpcd`, `function dsc_throughput_from_dpcd`, `function dsc_bpp_increment_div_from_dpcd`, `function get_vic_preset_bpp`, `function hdmi_dsc_get_num_slices`, `function hdmi_dsc_get_bpp`, `function dc_dsc_parse_dsc_dpcd`.
- 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.