drivers/gpu/drm/i915/display/intel_bw.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_bw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_bw.c- Extension
.c- Size
- 41696 bytes
- Lines
- 1521
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/drm_atomic_state_helper.hdrm/drm_print.hdrm/intel/intel_pcode_regs.hintel_bw.hintel_crtc.hintel_de.hintel_display_core.hintel_display_regs.hintel_display_types.hintel_display_utils.hintel_dram.hintel_mchbar.hintel_parent.hskl_watermark.h
Detected Declarations
struct intel_bw_statestruct intel_qgv_pointstruct intel_psf_gv_pointstruct intel_qgv_infostruct intel_soc_bw_paramsstruct intel_display_bw_paramsfunction dclk_freq_mhzfunction dg1_mchbar_read_qgv_point_infofunction icl_pcode_read_qgv_point_infofunction adls_pcode_read_psf_gv_point_infofunction icl_qgv_points_maskfunction is_sagv_enabledfunction icl_pcode_restrict_qgv_pointsfunction mtl_read_qgv_point_infofunction intel_read_qgv_point_infofunction is_y_tilefunction icl_get_qgv_pointsfunction adl_calc_psf_bwfunction icl_sagv_max_dclkfunction icl_get_bw_infofunction tgl_peakbwfunction tgl_get_bw_infofunction dg2_get_bw_infofunction xe2_hpd_get_bw_infofunction icl_max_bw_indexfunction tgl_max_bw_indexfunction adl_psf_bwfunction icl_qgv_bwfunction intel_bw_init_hwfunction intel_bw_num_active_planesfunction intel_bw_data_ratefunction intel_atomic_get_old_bw_statefunction intel_atomic_get_new_bw_statefunction intel_atomic_get_bw_statefunction icl_max_bw_qgv_point_maskfunction icl_prepare_qgv_points_maskfunction icl_max_bw_psf_gv_point_maskfunction icl_force_disable_sagvfunction icl_sagv_pre_plane_updatefunction icl_sagv_post_plane_updatefunction mtl_find_qgv_pointsfunction icl_find_qgv_pointsfunction serializedfunction intel_bw_check_qgv_pointsfunction intel_bw_check_data_ratefunction for_each_oldnew_intel_crtc_in_statefunction intel_bw_check_sagv_maskfunction for_each_oldnew_intel_crtc_in_state
Annotated Snippet
struct intel_bw_state {
struct intel_global_state base;
/*
* Contains a bit mask, used to determine, whether correspondent
* pipe allows SAGV or not.
*/
u8 pipe_sagv_reject;
/*
* From MTL onwards, to lock a QGV point, punit expects the peak BW of
* the selected QGV point as the parameter in multiples of 100MB/s
*/
u16 qgv_point_peakbw;
/*
* Current QGV points mask, which restricts
* some particular SAGV states, not to confuse
* with pipe_sagv_mask.
*/
u16 qgv_points_mask;
unsigned int data_rate[I915_MAX_PIPES];
u8 num_active_planes[I915_MAX_PIPES];
};
/* Parameters for Qclk Geyserville (QGV) */
struct intel_qgv_point {
u16 dclk, t_rp, t_rdpre, t_rc, t_ras, t_rcd;
};
#define DEPROGBWPCLIMIT 60
struct intel_psf_gv_point {
u8 clk; /* clock in multiples of 16.6666 MHz */
};
struct intel_qgv_info {
struct intel_qgv_point points[I915_NUM_QGV_POINTS];
struct intel_psf_gv_point psf_points[I915_NUM_PSF_GV_POINTS];
u8 num_points;
u8 num_psf_points;
u8 t_bl;
u8 max_numchannels;
u8 channel_width;
u8 deinterleave;
};
static int dclk_freq_mhz(int ratio)
{
/* multiple of 16.666 MHz (100/6) */
return DIV_ROUND_CLOSEST(ratio * 100, 6);
}
static int dg1_mchbar_read_qgv_point_info(struct intel_display *display,
struct intel_qgv_point *sp,
int point)
{
u32 dclk_ratio;
u32 val;
val = intel_mchbar_read(display, SA_PERF_STATUS_0_0_0_MCHBAR_PC);
dclk_ratio = REG_FIELD_GET(DG1_QCLK_RATIO_MASK, val);
if (val & DG1_QCLK_REFERENCE)
dclk_ratio *= 6; /* 6 * 16.666 MHz = 100 MHz */
else
dclk_ratio *= 8; /* 8 * 16.666 MHz = 133 MHz */
val = intel_mchbar_read(display, SKL_MC_BIOS_DATA_0_0_0_MCHBAR_PCU);
if (val & DG1_GEAR_TYPE)
dclk_ratio *= 2;
sp->dclk = dclk_freq_mhz(dclk_ratio);
if (sp->dclk == 0)
return -EINVAL;
val = intel_mchbar_read(display, MCHBAR_CH0_CR_TC_PRE_0_0_0_MCHBAR);
sp->t_rp = REG_FIELD_GET(DG1_DRAM_T_RP_MASK, val);
sp->t_rdpre = REG_FIELD_GET(DG1_DRAM_T_RDPRE_MASK, val);
val = intel_mchbar_read(display, MCHBAR_CH0_CR_TC_PRE_0_0_0_MCHBAR_HIGH);
sp->t_rcd = REG_FIELD_GET(DG1_DRAM_T_RCD_MASK, val);
sp->t_ras = REG_FIELD_GET(DG1_DRAM_T_RAS_MASK, val);
sp->t_rc = sp->t_rp + sp->t_ras;
return 0;
}
static int icl_pcode_read_qgv_point_info(struct intel_display *display,
Annotation
- Immediate include surface: `drm/drm_atomic_state_helper.h`, `drm/drm_print.h`, `drm/intel/intel_pcode_regs.h`, `intel_bw.h`, `intel_crtc.h`, `intel_de.h`, `intel_display_core.h`, `intel_display_regs.h`.
- Detected declarations: `struct intel_bw_state`, `struct intel_qgv_point`, `struct intel_psf_gv_point`, `struct intel_qgv_info`, `struct intel_soc_bw_params`, `struct intel_display_bw_params`, `function dclk_freq_mhz`, `function dg1_mchbar_read_qgv_point_info`, `function icl_pcode_read_qgv_point_info`, `function adls_pcode_read_psf_gv_point_info`.
- 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.