drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c- Extension
.c- Size
- 18335 bytes
- Lines
- 666
- 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_crtc.hdrm/drm_flip_work.hdrm/drm_managed.hdrm/drm_mode.hdrm/drm_probe_helper.hdrm/drm_vblank.hmdp4_kms.hmsm_gem.h
Detected Declarations
struct mdp4_crtcfunction request_pendingfunction crtc_flushfunction drm_atomic_crtc_for_each_planefunction complete_flipfunction unref_cursor_workerfunction setup_mixerfunction list_for_each_entryfunction drm_atomic_crtc_for_each_planefunction blend_setupfunction drm_atomic_crtc_for_each_planefunction mdp4_crtc_mode_set_nofbfunction mdp4_crtc_atomic_disablefunction mdp4_crtc_atomic_enablefunction mdp4_crtc_atomic_checkfunction mdp4_crtc_atomic_beginfunction mdp4_crtc_atomic_flushfunction update_cursorfunction mdp4_crtc_cursor_setfunction mdp4_crtc_cursor_movefunction mdp4_crtc_vblank_irqfunction mdp4_crtc_err_irqfunction mdp4_crtc_wait_for_flush_donefunction mdp4_crtc_vblankfunction mdp4_crtc_set_configfunction mdp4_crtc_set_intffunction mdp4_crtc_wait_for_commit_donefunction mdp4_crtc_flip_cleanup
Annotated Snippet
struct mdp4_crtc {
struct drm_crtc base;
char name[8];
int ovlp;
enum mdp4_dma dma;
bool enabled;
/* which mixer/encoder we route output to: */
int mixer;
struct {
spinlock_t lock;
bool stale;
uint32_t width, height;
uint32_t x, y;
/* next cursor to scan-out: */
uint32_t next_iova;
struct drm_gem_object *next_bo;
/* current cursor being scanned out: */
struct drm_gem_object *scanout_bo;
} cursor;
/* 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;
};
#define to_mdp4_crtc(x) container_of(x, struct mdp4_crtc, base)
static struct mdp4_kms *get_kms(struct drm_crtc *crtc)
{
struct msm_drm_private *priv = crtc->dev->dev_private;
return to_mdp4_kms(to_mdp_kms(priv->kms));
}
static void request_pending(struct drm_crtc *crtc, uint32_t pending)
{
struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
atomic_or(pending, &mdp4_crtc->pending);
mdp_irq_register(&get_kms(crtc)->base, &mdp4_crtc->vblank);
}
static void crtc_flush(struct drm_crtc *crtc)
{
struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
struct mdp4_kms *mdp4_kms = get_kms(crtc);
struct drm_plane *plane;
uint32_t flush = 0;
drm_atomic_crtc_for_each_plane(plane, crtc) {
enum mdp4_pipe pipe_id = mdp4_plane_pipe(plane);
flush |= pipe2flush(pipe_id);
}
flush |= ovlp2flush(mdp4_crtc->ovlp);
DBG("%s: flush=%08x", mdp4_crtc->name, flush);
mdp4_crtc->flushed_mask = flush;
mdp4_write(mdp4_kms, REG_MDP4_OVERLAY_FLUSH, flush);
}
/* if file!=NULL, this is preclose potential cancel-flip path */
static void complete_flip(struct drm_crtc *crtc, struct drm_file *file)
{
struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc);
struct drm_device *dev = crtc->dev;
struct drm_pending_vblank_event *event;
unsigned long flags;
spin_lock_irqsave(&dev->event_lock, flags);
event = mdp4_crtc->event;
Annotation
- Immediate include surface: `drm/drm_crtc.h`, `drm/drm_flip_work.h`, `drm/drm_managed.h`, `drm/drm_mode.h`, `drm/drm_probe_helper.h`, `drm/drm_vblank.h`, `mdp4_kms.h`, `msm_gem.h`.
- Detected declarations: `struct mdp4_crtc`, `function request_pending`, `function crtc_flush`, `function drm_atomic_crtc_for_each_plane`, `function complete_flip`, `function unref_cursor_worker`, `function setup_mixer`, `function list_for_each_entry`, `function drm_atomic_crtc_for_each_plane`, `function blend_setup`.
- 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.