drivers/gpu/drm/drm_atomic.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_atomic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_atomic.c- Extension
.c- Size
- 68376 bytes
- Lines
- 2144
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/export.hlinux/sync_file.hdrm/drm_atomic.hdrm/drm_atomic_uapi.hdrm/drm_blend.hdrm/drm_bridge.hdrm/drm_debugfs.hdrm/drm_device.hdrm/drm_drv.hdrm/drm_file.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_mode.hdrm/drm_print.hdrm/drm_writeback.hdrm/drm_colorop.hdrm_crtc_internal.hdrm_internal.h
Detected Declarations
function Copyrightfunction drm_crtc_commit_waitfunction drm_atomic_commit_default_releasefunction drm_atomic_commit_initfunction drm_atomic_commit_allocfunction drm_atomic_commit_default_clearfunction drm_atomic_commit_clearfunction __drm_atomic_commit_freefunction drm_atomic_get_crtc_statefunction drm_atomic_crtc_checkfunction allowfunction WARN_ONfunction drm_atomic_crtc_print_statefunction drm_atomic_connector_checkfunction drm_atomic_get_plane_statefunction drm_atomic_get_colorop_statefunction drm_atomic_get_old_colorop_statefunction drm_atomic_get_new_colorop_statefunction plane_switching_crtcfunction drm_atomic_plane_checkfunction drm_atomic_colorop_print_statefunction drm_atomic_plane_print_statefunction privatefunction drm_atomic_private_obj_finifunction drm_atomic_get_private_obj_statefunction drm_atomic_get_old_private_obj_statefunction drm_atomic_get_new_private_obj_statefunction drm_atomic_get_connector_for_encoderfunction for_each_old_connector_in_statefunction drm_atomic_get_connector_for_encoderfunction for_each_new_connector_in_statefunction drm_atomic_get_old_connector_for_encoderfunction drm_atomic_get_old_crtc_for_encoderfunction drm_atomic_get_new_crtc_for_encoderfunction drm_atomic_get_connector_statefunction drm_atomic_connector_print_statefunction drm_atomic_get_bridge_statefunction drm_atomic_get_old_bridge_statefunction drm_atomic_get_new_bridge_statefunction drm_atomic_add_encoder_bridgesfunction drm_for_each_bridge_in_chain_scopedfunction neededfunction planefunction drm_for_each_plane_maskfunction coloropfunction drm_for_each_coloropfunction drm_atomic_check_onlyfunction for_each_new_crtc_in_state
Annotated Snippet
if (drm_atomic_commit_init(dev, state) < 0) {
kfree(state);
return NULL;
}
return state;
}
return config->funcs->atomic_state_alloc(dev);
}
EXPORT_SYMBOL(drm_atomic_commit_alloc);
/**
* drm_atomic_commit_default_clear - clear base atomic state
* @state: atomic state
*
* Default implementation for clearing atomic state.
* This should only be used by drivers which are still subclassing
* &drm_atomic_commit and haven't switched to &drm_private_state yet.
*/
void drm_atomic_commit_default_clear(struct drm_atomic_commit *state)
{
struct drm_device *dev = state->dev;
struct drm_mode_config *config = &dev->mode_config;
int i;
drm_dbg_atomic(dev, "Clearing atomic state %p\n", state);
state->checked = false;
for (i = 0; i < state->num_connector; i++) {
struct drm_connector *connector = state->connectors[i].ptr;
if (!connector)
continue;
connector->funcs->atomic_destroy_state(connector,
state->connectors[i].state_to_destroy);
state->connectors[i].ptr = NULL;
state->connectors[i].state_to_destroy = NULL;
state->connectors[i].old_state = NULL;
state->connectors[i].new_state = NULL;
drm_connector_put(connector);
}
for (i = 0; i < config->num_crtc; i++) {
struct drm_crtc *crtc = state->crtcs[i].ptr;
if (!crtc)
continue;
crtc->funcs->atomic_destroy_state(crtc,
state->crtcs[i].state_to_destroy);
state->crtcs[i].ptr = NULL;
state->crtcs[i].state_to_destroy = NULL;
state->crtcs[i].old_state = NULL;
state->crtcs[i].new_state = NULL;
if (state->crtcs[i].commit) {
drm_crtc_commit_put(state->crtcs[i].commit);
state->crtcs[i].commit = NULL;
}
}
for (i = 0; i < config->num_total_plane; i++) {
struct drm_plane *plane = state->planes[i].ptr;
if (!plane)
continue;
plane->funcs->atomic_destroy_state(plane,
state->planes[i].state_to_destroy);
state->planes[i].ptr = NULL;
state->planes[i].state_to_destroy = NULL;
state->planes[i].old_state = NULL;
state->planes[i].new_state = NULL;
}
for (i = 0; i < config->num_colorop; i++) {
struct drm_colorop *colorop = state->colorops[i].ptr;
if (!colorop)
continue;
drm_colorop_atomic_destroy_state(colorop,
state->colorops[i].state);
state->colorops[i].ptr = NULL;
state->colorops[i].state = NULL;
state->colorops[i].old_state = NULL;
state->colorops[i].new_state = NULL;
Annotation
- Immediate include surface: `linux/export.h`, `linux/sync_file.h`, `drm/drm_atomic.h`, `drm/drm_atomic_uapi.h`, `drm/drm_blend.h`, `drm/drm_bridge.h`, `drm/drm_debugfs.h`, `drm/drm_device.h`.
- Detected declarations: `function Copyright`, `function drm_crtc_commit_wait`, `function drm_atomic_commit_default_release`, `function drm_atomic_commit_init`, `function drm_atomic_commit_alloc`, `function drm_atomic_commit_default_clear`, `function drm_atomic_commit_clear`, `function __drm_atomic_commit_free`, `function drm_atomic_get_crtc_state`, `function drm_atomic_crtc_check`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration 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.