drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c- Extension
.c- Size
- 24777 bytes
- Lines
- 792
- 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
dpu_encoder_phys.hdpu_hw_interrupts.hdpu_hw_merge3d.hdpu_core_irq.hdpu_formats.hdpu_trace.hdisp/msm_disp_snapshot.hmsm_dsc_helper.hdrm/display/drm_dsc_helper.hdrm/drm_managed.h
Detected Declarations
function dpu_encoder_phys_vid_is_masterfunction drm_mode_to_intf_timing_paramsfunction get_horizontal_totalfunction get_vertical_totalfunction timefunction programmable_fetch_configfunction dpu_encoder_phys_vid_setup_timing_enginefunction dpu_encoder_phys_vid_vblank_irqfunction dpu_encoder_phys_vid_underrun_irqfunction dpu_encoder_phys_vid_needs_single_flushfunction dpu_encoder_phys_vid_atomic_mode_setfunction dpu_encoder_phys_vid_control_vblank_irqfunction dpu_encoder_phys_vid_enablefunction dpu_encoder_phys_vid_wait_for_tx_completefunction dpu_encoder_phys_vid_wait_for_commit_donefunction dpu_encoder_phys_vid_prepare_for_kickofffunction dpu_encoder_phys_vid_disablefunction thefunction dpu_encoder_phys_vid_handle_post_kickofffunction dpu_encoder_phys_vid_irq_enablefunction dpu_encoder_phys_vid_irq_disablefunction dpu_encoder_phys_vid_get_line_countfunction dpu_encoder_phys_vid_get_frame_countfunction dpu_encoder_phys_vid_init_ops
Annotated Snippet
if (ret) {
atomic_set(&phys_enc->pending_kickoff_cnt, 0);
DRM_ERROR("wait disable failed: id:%u intf:%d ret:%d\n",
DRMID(phys_enc->parent),
phys_enc->hw_intf->idx - INTF_0, ret);
}
}
if (phys_enc->hw_intf && phys_enc->hw_intf->ops.get_status)
phys_enc->hw_intf->ops.get_status(phys_enc->hw_intf, &intf_status);
/*
* Wait for a vsync if timing en status is on after timing engine
* is disabled.
*/
if (intf_status.is_en && dpu_encoder_phys_vid_is_master(phys_enc)) {
spin_lock_irqsave(phys_enc->enc_spinlock, lock_flags);
dpu_encoder_phys_inc_pending(phys_enc);
spin_unlock_irqrestore(phys_enc->enc_spinlock, lock_flags);
ret = dpu_encoder_phys_vid_wait_for_tx_complete(phys_enc);
if (ret) {
atomic_set(&phys_enc->pending_kickoff_cnt, 0);
DRM_ERROR("wait disable failed: id:%u intf:%d ret:%d\n",
DRMID(phys_enc->parent),
phys_enc->hw_intf->idx - INTF_0, ret);
}
}
dpu_encoder_helper_phys_cleanup(phys_enc);
phys_enc->enable_state = DPU_ENC_DISABLED;
}
static void dpu_encoder_phys_vid_handle_post_kickoff(
struct dpu_encoder_phys *phys_enc)
{
unsigned long lock_flags;
/*
* Video mode must flush CTL before enabling timing engine
* Video encoders need to turn on their interfaces now
*/
if (phys_enc->enable_state == DPU_ENC_ENABLING) {
trace_dpu_enc_phys_vid_post_kickoff(DRMID(phys_enc->parent),
phys_enc->hw_intf->idx - INTF_0);
spin_lock_irqsave(phys_enc->enc_spinlock, lock_flags);
phys_enc->hw_intf->ops.enable_timing(phys_enc->hw_intf, 1);
spin_unlock_irqrestore(phys_enc->enc_spinlock, lock_flags);
phys_enc->enable_state = DPU_ENC_ENABLED;
}
}
static void dpu_encoder_phys_vid_irq_enable(struct dpu_encoder_phys *phys_enc)
{
int ret;
trace_dpu_enc_phys_vid_irq_enable(DRMID(phys_enc->parent),
phys_enc->hw_intf->idx - INTF_0,
phys_enc->vblank_refcount);
ret = dpu_encoder_phys_vid_control_vblank_irq(phys_enc, true);
if (WARN_ON(ret))
return;
dpu_core_irq_register_callback(phys_enc->dpu_kms,
phys_enc->irq[INTR_IDX_UNDERRUN],
dpu_encoder_phys_vid_underrun_irq,
phys_enc);
}
static void dpu_encoder_phys_vid_irq_disable(struct dpu_encoder_phys *phys_enc)
{
trace_dpu_enc_phys_vid_irq_disable(DRMID(phys_enc->parent),
phys_enc->hw_intf->idx - INTF_0,
phys_enc->vblank_refcount);
dpu_encoder_phys_vid_control_vblank_irq(phys_enc, false);
dpu_core_irq_unregister_callback(phys_enc->dpu_kms,
phys_enc->irq[INTR_IDX_UNDERRUN]);
}
static int dpu_encoder_phys_vid_get_line_count(
struct dpu_encoder_phys *phys_enc)
{
if (!dpu_encoder_phys_vid_is_master(phys_enc))
return -EINVAL;
if (!phys_enc->hw_intf || !phys_enc->hw_intf->ops.get_line_count)
return -EINVAL;
return phys_enc->hw_intf->ops.get_line_count(phys_enc->hw_intf);
Annotation
- Immediate include surface: `dpu_encoder_phys.h`, `dpu_hw_interrupts.h`, `dpu_hw_merge3d.h`, `dpu_core_irq.h`, `dpu_formats.h`, `dpu_trace.h`, `disp/msm_disp_snapshot.h`, `msm_dsc_helper.h`.
- Detected declarations: `function dpu_encoder_phys_vid_is_master`, `function drm_mode_to_intf_timing_params`, `function get_horizontal_total`, `function get_vertical_total`, `function time`, `function programmable_fetch_config`, `function dpu_encoder_phys_vid_setup_timing_engine`, `function dpu_encoder_phys_vid_vblank_irq`, `function dpu_encoder_phys_vid_underrun_irq`, `function dpu_encoder_phys_vid_needs_single_flush`.
- 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.