drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c- Extension
.c- Size
- 54532 bytes
- Lines
- 1942
- 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
linux/sort.hlinux/debugfs.hlinux/ktime.hlinux/bits.hdrm/drm_atomic.hdrm/drm_blend.hdrm/drm_crtc.hdrm/drm_flip_work.hdrm/drm_framebuffer.hdrm/drm_mode.hdrm/drm_probe_helper.hdrm/drm_rect.hdrm/drm_vblank.hdrm/drm_self_refresh_helper.hdpu_kms.hdpu_hw_lm.hdpu_hw_ctl.hdpu_hw_dspp.hdpu_crtc.hdpu_plane.hdpu_encoder.hdpu_vbif.hdpu_core_perf.hdpu_trace.h
Detected Declarations
function Copyrightfunction dpu_crtc_parse_crc_sourcefunction dpu_crtc_verify_crc_sourcefunction dpu_crtc_setup_lm_misrfunction dpu_crtc_setup_encoder_misrfunction dpu_crtc_set_crc_sourcefunction dpu_crtc_get_vblank_counterfunction dpu_crtc_get_lm_crcfunction dpu_crtc_get_encoder_crcfunction drm_for_each_encoder_maskfunction dpu_crtc_get_crcfunction dpu_crtc_get_scanout_positionfunction _dpu_crtc_setup_blend_cfgfunction _dpu_crtc_program_lm_output_roifunction _dpu_crtc_blend_setup_pipefunction _dpu_crtc_blend_setup_mixerfunction _dpu_crtc_blend_setupfunction _dpu_crtc_complete_flipfunction dpu_crtc_get_intf_modefunction dpu_crtc_vblank_callbackfunction dpu_crtc_frame_event_workfunction dpu_crtc_frame_event_cbfunction dpu_crtc_complete_commitfunction _dpu_crtc_check_and_setup_lm_boundsfunction _dpu_crtc_get_pcc_coefffunction _dpu_crtc_get_gc_lutfunction _dpu_crtc_setup_cp_blocksfunction dpu_crtc_atomic_beginfunction dpu_crtc_atomic_flushfunction dpu_crtc_destroy_statefunction _dpu_crtc_wait_for_frame_donefunction dpu_crtc_kickoff_clone_modefunction dpu_crtc_commit_kickofffunction drm_for_each_encoder_maskfunction drm_for_each_encoder_maskfunction dpu_crtc_resetfunction dpu_crtc_atomic_print_statefunction dpu_crtc_disablefunction drm_for_each_encoder_maskfunction drm_for_each_encoder_maskfunction dpu_crtc_enablefunction drm_for_each_encoder_maskfunction dpu_crtc_needs_dirtyfbfunction drm_for_each_encoder_maskfunction dpu_crtc_assign_planesfunction drm_atomic_crtc_state_for_each_planefunction dpu_crtc_reassign_planesfunction dpu_crtc_get_topology
Annotated Snippet
if (rc) {
if (rc != -ENODATA)
DRM_DEBUG_DRIVER("MISR read failed\n");
return rc;
}
}
return drm_crtc_add_crc_entry(crtc, true,
drm_crtc_accurate_vblank_count(crtc), crcs);
}
static int dpu_crtc_get_encoder_crc(struct drm_crtc *crtc)
{
struct drm_encoder *drm_enc;
int rc, pos = 0;
u32 crcs[INTF_MAX];
drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc->state->encoder_mask) {
rc = dpu_encoder_get_crc(drm_enc, crcs, pos);
if (rc < 0) {
if (rc != -ENODATA)
DRM_DEBUG_DRIVER("MISR read failed\n");
return rc;
}
pos += rc;
}
return drm_crtc_add_crc_entry(crtc, true,
drm_crtc_accurate_vblank_count(crtc), crcs);
}
static int dpu_crtc_get_crc(struct drm_crtc *crtc)
{
struct dpu_crtc_state *crtc_state = to_dpu_crtc_state(crtc->state);
/* Skip first 2 frames in case of "uncooked" CRCs */
if (crtc_state->crc_frame_skip_count < 2) {
crtc_state->crc_frame_skip_count++;
return 0;
}
if (crtc_state->crc_source == DPU_CRTC_CRC_SOURCE_LAYER_MIXER)
return dpu_crtc_get_lm_crc(crtc, crtc_state);
else if (crtc_state->crc_source == DPU_CRTC_CRC_SOURCE_ENCODER)
return dpu_crtc_get_encoder_crc(crtc);
return -EINVAL;
}
static bool dpu_crtc_get_scanout_position(struct drm_crtc *crtc,
bool in_vblank_irq,
int *vpos, int *hpos,
ktime_t *stime, ktime_t *etime,
const struct drm_display_mode *mode)
{
unsigned int pipe = crtc->index;
struct drm_encoder *encoder;
int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
encoder = get_encoder_from_crtc(crtc);
if (!encoder) {
DRM_ERROR("no encoder found for crtc %d\n", pipe);
return false;
}
vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
/*
* the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
* the end of VFP. Translate the porch values relative to the line
* counter positions.
*/
vactive_start = vsw + vbp + 1;
vactive_end = vactive_start + mode->crtc_vdisplay;
/* last scan line before VSYNC */
vfp_end = mode->crtc_vtotal;
if (stime)
*stime = ktime_get();
line = dpu_encoder_get_linecount(encoder);
if (line < vactive_start)
line -= vactive_start;
else if (line > vactive_end)
Annotation
- Immediate include surface: `linux/sort.h`, `linux/debugfs.h`, `linux/ktime.h`, `linux/bits.h`, `drm/drm_atomic.h`, `drm/drm_blend.h`, `drm/drm_crtc.h`, `drm/drm_flip_work.h`.
- Detected declarations: `function Copyright`, `function dpu_crtc_parse_crc_source`, `function dpu_crtc_verify_crc_source`, `function dpu_crtc_setup_lm_misr`, `function dpu_crtc_setup_encoder_misr`, `function dpu_crtc_set_crc_source`, `function dpu_crtc_get_vblank_counter`, `function dpu_crtc_get_lm_crc`, `function dpu_crtc_get_encoder_crc`, `function drm_for_each_encoder_mask`.
- 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.