drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c- Extension
.c- Size
- 38639 bytes
- Lines
- 1360
- 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.hdrm/drm_atomic.hdrm/drm_blend.hdrm/drm_mode.hdrm/drm_crtc.hdrm/drm_flip_work.hdrm/drm_fourcc.hdrm/drm_managed.hdrm/drm_probe_helper.hdrm/drm_vblank.hmdp5_kms.hmsm_gem.h
Detected Declarations
struct mdp5_crtcstruct plane_statefunction request_pendingfunction request_pp_done_pendingfunction crtc_flushfunction fbfunction drm_atomic_crtc_for_each_planefunction complete_flipfunction unref_cursor_workerfunction mdp5_crtc_flip_cleanupfunction mdp5_lm_use_fg_alpha_maskfunction blend_setupfunction mdp5_crtc_mode_set_nofbfunction mdp5_crtc_get_scanout_positionfunction mdp5_crtc_get_vblank_counterfunction mdp5_crtc_atomic_disablefunction mdp5_crtc_vblank_onfunction mdp5_crtc_atomic_enablefunction mdp5_crtc_setup_pipelinefunction pstate_cmpfunction is_fullscreenfunction get_start_stagefunction mdp5_crtc_atomic_checkfunction drm_atomic_crtc_state_for_each_plane_statefunction mdp5_crtc_atomic_beginfunction mdp5_crtc_atomic_flushfunction get_roifunction mdp5_crtc_restore_cursorfunction mdp5_crtc_cursor_setfunction mdp5_crtc_cursor_movefunction mdp5_crtc_atomic_print_statefunction mdp5_crtc_duplicate_statefunction mdp5_crtc_destroy_statefunction mdp5_crtc_resetfunction mdp5_crtc_vblank_irqfunction mdp5_crtc_err_irqfunction mdp5_crtc_pp_done_irqfunction mdp5_crtc_wait_for_pp_donefunction mdp5_crtc_wait_for_flush_donefunction mdp5_crtc_vblankfunction mdp5_crtc_set_pipelinefunction mdp5_crtc_wait_for_commit_done
Annotated Snippet
struct mdp5_crtc {
struct drm_crtc base;
int id;
bool enabled;
spinlock_t lm_lock; /* protect REG_MDP5_LM_* registers */
/* if there is a pending flip, these will be non-null: */
struct drm_pending_vblank_event *event;
/* Bits have been flushed at the last commit,
* used to decide if a vsync has happened since last commit.
*/
u32 flushed_mask;
#define PENDING_CURSOR 0x1
#define PENDING_FLIP 0x2
atomic_t pending;
/* for unref'ing cursor bo's after scanout completes: */
struct drm_flip_work unref_cursor_work;
struct mdp_irq vblank;
struct mdp_irq err;
struct mdp_irq pp_done;
struct completion pp_completion;
bool lm_cursor_enabled;
struct {
/* protect REG_MDP5_LM_CURSOR* registers and cursor scanout_bo*/
spinlock_t lock;
/* current cursor being scanned out: */
struct drm_gem_object *scanout_bo;
uint64_t iova;
uint32_t width, height;
int x, y;
} cursor;
};
#define to_mdp5_crtc(x) container_of(x, struct mdp5_crtc, base)
static void mdp5_crtc_restore_cursor(struct drm_crtc *crtc);
static struct mdp5_kms *get_kms(struct drm_crtc *crtc)
{
struct msm_drm_private *priv = crtc->dev->dev_private;
return to_mdp5_kms(to_mdp_kms(priv->kms));
}
static void request_pending(struct drm_crtc *crtc, uint32_t pending)
{
struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc);
atomic_or(pending, &mdp5_crtc->pending);
mdp_irq_register(&get_kms(crtc)->base, &mdp5_crtc->vblank);
}
static void request_pp_done_pending(struct drm_crtc *crtc)
{
struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc);
reinit_completion(&mdp5_crtc->pp_completion);
}
static u32 crtc_flush(struct drm_crtc *crtc, u32 flush_mask)
{
struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
struct mdp5_ctl *ctl = mdp5_cstate->ctl;
struct mdp5_pipeline *pipeline = &mdp5_cstate->pipeline;
bool start = !mdp5_cstate->defer_start;
mdp5_cstate->defer_start = false;
DBG("%s: flush=%08x", crtc->name, flush_mask);
return mdp5_ctl_commit(ctl, pipeline, flush_mask, start);
}
/*
* flush updates, to make sure hw is updated to new scanout fb,
* so that we can safely queue unref to current fb (ie. next
* vblank we know hw is done w/ previous scanout_fb).
*/
static u32 crtc_flush_all(struct drm_crtc *crtc)
{
struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state);
struct mdp5_hw_mixer *mixer, *r_mixer;
struct drm_plane *plane;
uint32_t flush_mask = 0;
Annotation
- Immediate include surface: `linux/sort.h`, `drm/drm_atomic.h`, `drm/drm_blend.h`, `drm/drm_mode.h`, `drm/drm_crtc.h`, `drm/drm_flip_work.h`, `drm/drm_fourcc.h`, `drm/drm_managed.h`.
- Detected declarations: `struct mdp5_crtc`, `struct plane_state`, `function request_pending`, `function request_pp_done_pending`, `function crtc_flush`, `function fb`, `function drm_atomic_crtc_for_each_plane`, `function complete_flip`, `function unref_cursor_worker`, `function mdp5_crtc_flip_cleanup`.
- 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.