drivers/gpu/drm/i915/display/intel_vrr.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_vrr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_vrr.c- Extension
.c- Size
- 39971 bytes
- Lines
- 1229
- 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
drm/drm_print.hintel_alpm.hintel_crtc.hintel_de.hintel_display_regs.hintel_display_types.hintel_dmc.hintel_dmc_regs.hintel_dp.hintel_psr.hintel_vrr.hintel_vrr_regs.hskl_prefill.hskl_watermark.h
Detected Declarations
function intel_vrr_is_capablefunction intel_vrr_is_in_rangefunction intel_vrr_possiblefunction intel_vrr_check_modesetfunction for_each_oldnew_intel_crtc_in_statefunction intel_vrr_extra_vblank_delayfunction intel_vrr_vmin_flipline_offsetfunction intel_vrr_guardband_to_pipeline_fullfunction intel_vrr_pipeline_full_to_guardbandfunction intel_vrr_vmin_vblank_startfunction intel_vrr_vmax_vtotalfunction intel_vrr_vmin_vblank_startfunction intel_vrr_vmax_vblank_startfunction is_cmrr_frac_requiredfunction cmrr_get_vtotalfunction intel_vrr_compute_cmrr_timingsfunction intel_vrr_compute_vrr_timingsfunction intel_vrr_compute_fixed_rr_timingsfunction intel_vrr_hw_valuefunction intel_vrr_vblank_startfunction intel_vrr_fixed_rr_hw_vtotalfunction intel_vrr_fixed_rr_hw_vmaxfunction intel_vrr_fixed_rr_hw_vminfunction intel_vrr_fixed_rr_hw_fliplinefunction intel_vrr_set_fixed_rr_timingsfunction intel_vrr_compute_vminfunction intel_vrr_compute_vmaxfunction intel_vrr_dc_balance_possiblefunction intel_vrr_dc_balance_compute_configfunction intel_vrr_compute_configfunction intel_vrr_max_hw_guardbandfunction intel_vrr_max_vblank_guardbandfunction intel_vrr_max_guardbandfunction intel_vrr_compute_optimized_guardbandfunction intel_vrr_use_optimized_guardbandfunction intel_vrr_compute_guardbandfunction trans_vrr_ctlfunction intel_vrr_set_transcoder_timingsfunction intel_vrr_dcb_increment_flip_countfunction intel_vrr_dcb_resetfunction trans_vrr_pushfunction intel_vrr_send_pushfunction intel_vrr_check_push_sentfunction intel_vrr_is_push_sentfunction intel_vrr_always_use_vrr_tgfunction intel_vrr_hw_vminfunction intel_vrr_hw_vmaxfunction intel_vrr_hw_flipline
Annotated Snippet
if (trans_vrr_ctl & VRR_CTL_PIPELINE_FULL_OVERRIDE) {
crtc_state->vrr.pipeline_full =
REG_FIELD_GET(VRR_CTL_PIPELINE_FULL_MASK, trans_vrr_ctl);
crtc_state->vrr.guardband =
intel_vrr_pipeline_full_to_guardband(crtc_state,
crtc_state->vrr.pipeline_full);
}
}
if (trans_vrr_ctl & VRR_CTL_FLIP_LINE_EN) {
crtc_state->vrr.flipline = intel_de_read(display,
TRANS_VRR_FLIPLINE(display, cpu_transcoder)) + 1;
crtc_state->vrr.vmax = intel_de_read(display,
TRANS_VRR_VMAX(display, cpu_transcoder)) + 1;
crtc_state->vrr.vmin = intel_de_read(display,
TRANS_VRR_VMIN(display, cpu_transcoder)) + 1;
if (DISPLAY_VER(display) < 13) {
/* undo what intel_vrr_hw_value() does when writing the values */
crtc_state->vrr.flipline += crtc_state->set_context_latency;
crtc_state->vrr.vmax += crtc_state->set_context_latency;
crtc_state->vrr.vmin += crtc_state->set_context_latency;
crtc_state->vrr.vmin += intel_vrr_vmin_flipline_offset(display);
}
/*
* For platforms that always use VRR Timing Generator, the VTOTAL.Vtotal
* bits are not filled. Since for these platforms TRAN_VMIN is always
* filled with crtc_vtotal, use TRAN_VRR_VMIN to get the vtotal for
* adjusted_mode.
*/
if (intel_vrr_always_use_vrr_tg(display))
crtc_state->hw.adjusted_mode.crtc_vtotal =
intel_vrr_vmin_vtotal(crtc_state);
if (HAS_AS_SDP(display)) {
trans_vrr_vsync =
intel_de_read(display,
TRANS_VRR_VSYNC(display, cpu_transcoder));
crtc_state->vrr.vsync_start =
REG_FIELD_GET(VRR_VSYNC_START_MASK, trans_vrr_vsync);
crtc_state->vrr.vsync_end =
REG_FIELD_GET(VRR_VSYNC_END_MASK, trans_vrr_vsync);
}
}
vrr_enable = trans_vrr_ctl & VRR_CTL_VRR_ENABLE;
if (intel_vrr_always_use_vrr_tg(display))
crtc_state->vrr.enable = vrr_enable && !intel_vrr_is_fixed_rr(crtc_state);
else
crtc_state->vrr.enable = vrr_enable;
intel_vrr_get_dc_balance_config(crtc_state);
/*
* #TODO: For Both VRR and CMRR the flag I915_MODE_FLAG_VRR is set for mode_flags.
* Since CMRR is currently disabled, set this flag for VRR for now.
* Need to keep this in mind while re-enabling CMRR.
*/
if (crtc_state->vrr.enable)
crtc_state->mode_flags |= I915_MODE_FLAG_VRR;
/*
* For platforms that always use the VRR timing generator, we overwrite
* crtc_vblank_start with vtotal - guardband to reflect the delayed
* vblank start. This works for both default and optimized guardband values.
* On other platforms, we keep the original value from
* intel_get_transcoder_timings() and apply adjustments only in VRR-specific
* paths as needed.
*/
if (intel_vrr_always_use_vrr_tg(display))
crtc_state->hw.adjusted_mode.crtc_vblank_start =
crtc_state->hw.adjusted_mode.crtc_vtotal -
crtc_state->vrr.guardband;
}
int intel_vrr_safe_window_start(const struct intel_crtc_state *crtc_state)
{
struct intel_display *display = to_intel_display(crtc_state);
if (DISPLAY_VER(display) >= 30)
return crtc_state->hw.adjusted_mode.crtc_vdisplay -
crtc_state->set_context_latency;
else
return crtc_state->hw.adjusted_mode.crtc_vdisplay;
}
Annotation
- Immediate include surface: `drm/drm_print.h`, `intel_alpm.h`, `intel_crtc.h`, `intel_de.h`, `intel_display_regs.h`, `intel_display_types.h`, `intel_dmc.h`, `intel_dmc_regs.h`.
- Detected declarations: `function intel_vrr_is_capable`, `function intel_vrr_is_in_range`, `function intel_vrr_possible`, `function intel_vrr_check_modeset`, `function for_each_oldnew_intel_crtc_in_state`, `function intel_vrr_extra_vblank_delay`, `function intel_vrr_vmin_flipline_offset`, `function intel_vrr_guardband_to_pipeline_full`, `function intel_vrr_pipeline_full_to_guardband`, `function intel_vrr_vmin_vblank_start`.
- 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.