drivers/gpu/drm/i915/display/intel_link_bw.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_link_bw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_link_bw.c- Extension
.c- Size
- 13158 bytes
- Lines
- 498
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ctype.hlinux/debugfs.hlinux/int_log.hlinux/math.hdrm/drm_fixed.hdrm/drm_print.hintel_atomic.hintel_crtc.hintel_display_core.hintel_display_types.hintel_dp.hintel_dp_mst.hintel_dp_tunnel.hintel_fdi.hintel_link_bw.hintel_vdsc.h
Detected Declarations
function get_forced_link_bpp_x16function for_each_new_intel_connector_in_statefunction intel_link_bw_init_limitsfunction __intel_link_bw_reduce_bppfunction for_each_intel_crtc_in_pipe_maskfunction intel_link_bw_reduce_bppfunction intel_link_bw_compute_pipe_bppfunction matchfunction check_all_link_configfunction assert_link_limit_change_validfunction for_each_pipefunction intel_link_bw_atomic_checkfunction force_link_bpp_showfunction str_to_fxp_q4_nonneg_intfunction str_to_fxp_q4_nonnegfunction user_str_to_fxp_q4_nonnegfunction connector_supports_dscfunction force_link_bpp_writefunction intel_link_bw_connector_debugfs_add
Annotated Snippet
if (state->base.duplicated && crtc_state) {
limits->max_bpp_x16[pipe] = crtc_state->max_link_bpp_x16;
if (intel_dsc_enabled_on_link(crtc_state))
limits->link_dsc_pipes |= BIT(pipe);
} else {
limits->max_bpp_x16[pipe] = INT_MAX;
}
if (forced_bpp_x16)
limits->max_bpp_x16[pipe] = min(limits->max_bpp_x16[pipe], forced_bpp_x16);
}
}
/**
* __intel_link_bw_reduce_bpp - reduce maximum link bpp for a selected pipe
* @state: atomic state
* @limits: link BW limits
* @pipe_mask: mask of pipes to select from
* @reason: explanation of why bpp reduction is needed
* @reduce_forced_bpp: allow reducing bpps below their forced link bpp
*
* Select the pipe from @pipe_mask with the biggest link bpp value and set the
* maximum of link bpp in @limits below this value. Modeset the selected pipe,
* so that its state will get recomputed.
*
* This function can be called to resolve a link's BW overallocation by reducing
* the link bpp of one pipe on the link and hence reducing the total link BW.
*
* Returns
* - 0 in case of success
* - %-ENOSPC if no pipe can further reduce its link bpp
* - Other negative error, if modesetting the selected pipe failed
*/
static int __intel_link_bw_reduce_bpp(struct intel_atomic_state *state,
struct intel_link_bw_limits *limits,
u8 pipe_mask,
const char *reason,
bool reduce_forced_bpp)
{
struct intel_display *display = to_intel_display(state);
enum pipe max_bpp_pipe = INVALID_PIPE;
struct intel_crtc *crtc;
int max_bpp_x16 = 0;
for_each_intel_crtc_in_pipe_mask(display, crtc, pipe_mask) {
struct intel_crtc_state *crtc_state;
int link_bpp_x16;
if (limits->bpp_limit_reached_pipes & BIT(crtc->pipe))
continue;
crtc_state = intel_atomic_get_crtc_state(&state->base,
crtc);
if (IS_ERR(crtc_state))
return PTR_ERR(crtc_state);
if (crtc_state->dsc.compression_enable)
link_bpp_x16 = crtc_state->dsc.compressed_bpp_x16;
else
/*
* TODO: for YUV420 the actual link bpp is only half
* of the pipe bpp value. The MST encoder's BW allocation
* is based on the pipe bpp value, set the actual link bpp
* limit here once the MST BW allocation is fixed.
*/
link_bpp_x16 = fxp_q4_from_int(crtc_state->pipe_bpp);
if (!reduce_forced_bpp &&
link_bpp_x16 <= get_forced_link_bpp_x16(state, crtc))
continue;
if (link_bpp_x16 > max_bpp_x16) {
max_bpp_x16 = link_bpp_x16;
max_bpp_pipe = crtc->pipe;
}
}
if (max_bpp_pipe == INVALID_PIPE)
return -ENOSPC;
limits->max_bpp_x16[max_bpp_pipe] = max_bpp_x16 - 1;
return intel_modeset_pipes_in_mask_early(state, reason,
BIT(max_bpp_pipe));
}
int intel_link_bw_reduce_bpp(struct intel_atomic_state *state,
struct intel_link_bw_limits *limits,
u8 pipe_mask,
const char *reason)
Annotation
- Immediate include surface: `linux/ctype.h`, `linux/debugfs.h`, `linux/int_log.h`, `linux/math.h`, `drm/drm_fixed.h`, `drm/drm_print.h`, `intel_atomic.h`, `intel_crtc.h`.
- Detected declarations: `function get_forced_link_bpp_x16`, `function for_each_new_intel_connector_in_state`, `function intel_link_bw_init_limits`, `function __intel_link_bw_reduce_bpp`, `function for_each_intel_crtc_in_pipe_mask`, `function intel_link_bw_reduce_bpp`, `function intel_link_bw_compute_pipe_bpp`, `function match`, `function check_all_link_config`, `function assert_link_limit_change_valid`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.