drivers/gpu/drm/i915/display/intel_psr.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_psr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_psr.c- Extension
.c- Size
- 145394 bytes
- Lines
- 4712
- 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/debugfs.hdrm/drm_atomic_helper.hdrm/drm_damage_helper.hdrm/drm_debugfs.hdrm/drm_print.hdrm/drm_vblank.hdrm/intel/step.hintel_alpm.hintel_atomic.hintel_crtc.hintel_cursor_regs.hintel_ddi.hintel_de.hintel_display_irq.hintel_display_regs.hintel_display_rpm.hintel_display_types.hintel_display_utils.hintel_display_wa.hintel_dmc.hintel_dp.hintel_dpcd.hintel_dp_aux.hintel_dp_tunnel.hintel_dsb.hintel_frontbuffer.hintel_hdmi.hintel_psr.hintel_psr_regs.hintel_quirks.hintel_snps_phy.hintel_vblank.h
Detected Declarations
function filesfunction intel_psr_needs_aux_io_powerfunction psr_global_enabledfunction sel_update_global_enabledfunction panel_replay_global_enabledfunction psr_irq_psr_error_bit_getfunction psr_irq_post_exit_bit_getfunction psr_irq_pre_entry_bit_getfunction psr_irq_mask_getfunction psr_ctl_regfunction psr_debug_regfunction psr_perf_cnt_regfunction psr_status_regfunction psr_imr_regfunction psr_iir_regfunction psr_aux_ctl_regfunction psr_aux_data_regfunction psr_irq_controlfunction psr_event_printfunction intel_psr_irq_handlerfunction intel_dp_get_sink_sync_latencyfunction _psr_compute_su_granularityfunction compute_pr_dsc_supportfunction _panel_replay_compute_su_granularityfunction _panel_replay_init_dpcdfunction _psr_init_dpcdfunction intel_psr_init_dpcdfunction hsw_psr_setup_auxfunction psr2_su_region_et_validfunction _panel_replay_enable_sinkfunction _psr_enable_sinkfunction intel_psr_enable_sinkfunction intel_psr_panel_replay_enable_sinkfunction intel_psr1_get_tp_timefunction psr_compute_idle_framesfunction is_dc5_dc6_blockedfunction hsw_activate_psr1function intel_psr2_get_tp_timefunction psr2_block_count_linesfunction psr2_block_countfunction frames_before_su_entryfunction intel_psr_allow_pr_bw_optimizationfunction dg2_activate_panel_replayfunction hsw_activate_psr2function transcoder_has_psr2function intel_get_frame_time_usfunction psr2_program_idle_framesfunction tgl_psr2_enable_dc3co
Annotated Snippet
if (DISPLAY_VER(display) >= 9) {
u32 val;
val = intel_de_rmw(display,
PSR_EVENT(display, cpu_transcoder),
0, 0);
psr_event_print(display, val, intel_dp->psr.sel_update_enabled);
}
}
if (psr_iir & psr_irq_psr_error_bit_get(intel_dp)) {
drm_warn(display->drm, "[transcoder %s] PSR aux error\n",
transcoder_name(cpu_transcoder));
intel_dp->psr.irq_aux_error = true;
/*
* If this interruption is not masked it will keep
* interrupting so fast that it prevents the scheduled
* work to run.
* Also after a PSR error, we don't want to arm PSR
* again so we don't care about unmask the interruption
* or unset irq_aux_error.
*/
intel_de_rmw(display, psr_imr_reg(display, cpu_transcoder),
0, psr_irq_psr_error_bit_get(intel_dp));
queue_work(display->wq.unordered, &intel_dp->psr.work);
}
}
static u8 intel_dp_get_sink_sync_latency(struct intel_dp *intel_dp)
{
struct intel_display *display = to_intel_display(intel_dp);
u8 val = 8; /* assume the worst if we can't read the value */
if (drm_dp_dpcd_readb(&intel_dp->aux,
DP_SYNCHRONIZATION_LATENCY_IN_SINK, &val) == 1)
val &= DP_MAX_RESYNC_FRAME_COUNT_MASK;
else
drm_dbg_kms(display->drm,
"Unable to get sink synchronization latency, assuming 8 frames\n");
return val;
}
static void _psr_compute_su_granularity(struct intel_dp *intel_dp,
struct intel_connector *connector)
{
struct intel_display *display = to_intel_display(intel_dp);
ssize_t r;
__le16 w;
u8 y;
/*
* If sink don't have specific granularity requirements set legacy
* ones.
*/
if (!(connector->dp.psr_caps.dpcd[1] & DP_PSR2_SU_GRANULARITY_REQUIRED)) {
/* As PSR2 HW sends full lines, we do not care about x granularity */
w = cpu_to_le16(4);
y = 4;
goto exit;
}
r = drm_dp_dpcd_read(&intel_dp->aux, DP_PSR2_SU_X_GRANULARITY, &w, sizeof(w));
if (r != sizeof(w))
drm_dbg_kms(display->drm,
"Unable to read selective update x granularity\n");
/*
* Spec says that if the value read is 0 the default granularity should
* be used instead.
*/
if (r != sizeof(w) || w == 0)
w = cpu_to_le16(4);
r = drm_dp_dpcd_read(&intel_dp->aux, DP_PSR2_SU_Y_GRANULARITY, &y, 1);
if (r != 1) {
drm_dbg_kms(display->drm,
"Unable to read selective update y granularity\n");
y = 4;
}
if (y == 0)
y = 1;
exit:
connector->dp.psr_caps.su_w_granularity = le16_to_cpu(w);
connector->dp.psr_caps.su_y_granularity = y;
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `drm/drm_atomic_helper.h`, `drm/drm_damage_helper.h`, `drm/drm_debugfs.h`, `drm/drm_print.h`, `drm/drm_vblank.h`, `drm/intel/step.h`, `intel_alpm.h`.
- Detected declarations: `function files`, `function intel_psr_needs_aux_io_power`, `function psr_global_enabled`, `function sel_update_global_enabled`, `function panel_replay_global_enabled`, `function psr_irq_psr_error_bit_get`, `function psr_irq_post_exit_bit_get`, `function psr_irq_pre_entry_bit_get`, `function psr_irq_mask_get`, `function psr_ctl_reg`.
- 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.