drivers/gpu/drm/drm_atomic_state_helper.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_atomic_state_helper.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_atomic_state_helper.c- Extension
.c- Size
- 27000 bytes
- Lines
- 855
- 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
drm/drm_atomic.hdrm/drm_atomic_state_helper.hdrm/drm_blend.hdrm/drm_bridge.hdrm/drm_connector.hdrm/drm_crtc.hdrm/drm_device.hdrm/drm_framebuffer.hdrm/drm_plane.hdrm/drm_print.hdrm/drm_vblank.hdrm/drm_writeback.hlinux/export.hlinux/slab.hlinux/dma-fence.h
Detected Declarations
function Copyrightfunction __drm_atomic_helper_crtc_resetfunction drm_atomic_helper_crtc_resetfunction __drm_atomic_helper_crtc_duplicate_statefunction drm_atomic_helper_crtc_duplicate_statefunction __drm_atomic_helper_crtc_destroy_statefunction drm_atomic_helper_crtc_destroy_statefunction __drm_atomic_helper_plane_state_resetfunction __drm_atomic_helper_plane_resetfunction drm_atomic_helper_plane_resetfunction __drm_atomic_helper_plane_duplicate_statefunction drm_atomic_helper_plane_duplicate_statefunction __drm_atomic_helper_plane_destroy_statefunction drm_atomic_helper_plane_destroy_statefunction __drm_atomic_helper_connector_state_resetfunction __drm_atomic_helper_connector_resetfunction drm_atomic_helper_connector_resetfunction drm_atomic_helper_connector_tv_margins_resetfunction drm_atomic_helper_connector_tv_resetfunction drm_atomic_helper_connector_tv_checkfunction __drm_atomic_helper_connector_duplicate_statefunction drm_atomic_helper_connector_duplicate_statefunction __drm_atomic_helper_connector_destroy_statefunction drm_atomic_helper_connector_destroy_statefunction __drm_atomic_helper_private_obj_create_statefunction __drm_atomic_helper_private_obj_duplicate_statefunction __drm_atomic_helper_bridge_duplicate_statefunction drm_atomic_helper_bridge_duplicate_statefunction drm_atomic_helper_bridge_destroy_statefunction __drm_atomic_helper_bridge_resetfunction drm_atomic_helper_bridge_resetexport __drm_atomic_helper_crtc_state_resetexport __drm_atomic_helper_crtc_resetexport drm_atomic_helper_crtc_resetexport __drm_atomic_helper_crtc_duplicate_stateexport drm_atomic_helper_crtc_duplicate_stateexport __drm_atomic_helper_crtc_destroy_stateexport drm_atomic_helper_crtc_destroy_stateexport __drm_atomic_helper_plane_state_resetexport __drm_atomic_helper_plane_resetexport drm_atomic_helper_plane_resetexport __drm_atomic_helper_plane_duplicate_stateexport drm_atomic_helper_plane_duplicate_stateexport __drm_atomic_helper_plane_destroy_stateexport drm_atomic_helper_plane_destroy_stateexport __drm_atomic_helper_connector_state_resetexport __drm_atomic_helper_connector_resetexport drm_atomic_helper_connector_reset
Annotated Snippet
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_blend.h>
#include <drm/drm_bridge.h>
#include <drm/drm_connector.h>
#include <drm/drm_crtc.h>
#include <drm/drm_device.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_plane.h>
#include <drm/drm_print.h>
#include <drm/drm_vblank.h>
#include <drm/drm_writeback.h>
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/dma-fence.h>
/**
* DOC: atomic state reset and initialization
*
* Both the drm core and the atomic helpers assume that there is always the full
* and correct atomic software state for all connectors, CRTCs and planes
* available. Which is a bit a problem on driver load and also after system
* suspend. One way to solve this is to have a hardware state read-out
* infrastructure which reconstructs the full software state (e.g. the i915
* driver).
*
* The simpler solution is to just reset the software state to everything off,
* which is easiest to do by calling drm_mode_config_reset(). To facilitate this
* the atomic helpers provide default reset implementations for all hooks.
*
* On the upside the precise state tracking of atomic simplifies system suspend
* and resume a lot. For drivers using drm_mode_config_reset() a complete recipe
* is implemented in drm_atomic_helper_suspend() and drm_atomic_helper_resume().
* For other drivers the building blocks are split out, see the documentation
* for these functions.
*/
/**
* __drm_atomic_helper_crtc_state_reset - reset the CRTC state
* @crtc_state: atomic CRTC state, must not be NULL
* @crtc: CRTC object, must not be NULL
*
* Initializes the newly allocated @crtc_state with default
* values. This is useful for drivers that subclass the CRTC state.
*/
void
__drm_atomic_helper_crtc_state_reset(struct drm_crtc_state *crtc_state,
struct drm_crtc *crtc)
{
crtc_state->crtc = crtc;
crtc_state->background_color = DRM_ARGB64_PREP(0xffff, 0, 0, 0);
}
EXPORT_SYMBOL(__drm_atomic_helper_crtc_state_reset);
/**
* __drm_atomic_helper_crtc_reset - reset state on CRTC
* @crtc: drm CRTC
* @crtc_state: CRTC state to assign
*
* Initializes the newly allocated @crtc_state and assigns it to
* the &drm_crtc->state pointer of @crtc, usually required when
* initializing the drivers or when called from the &drm_crtc_funcs.reset
* hook.
*
* This is useful for drivers that subclass the CRTC state.
*/
void
__drm_atomic_helper_crtc_reset(struct drm_crtc *crtc,
struct drm_crtc_state *crtc_state)
{
if (crtc_state)
__drm_atomic_helper_crtc_state_reset(crtc_state, crtc);
if (drm_dev_has_vblank(crtc->dev))
drm_crtc_vblank_reset(crtc);
crtc->state = crtc_state;
}
EXPORT_SYMBOL(__drm_atomic_helper_crtc_reset);
/**
* drm_atomic_helper_crtc_reset - default &drm_crtc_funcs.reset hook for CRTCs
* @crtc: drm CRTC
*
* Resets the atomic state for @crtc by freeing the state pointer (which might
* be NULL, e.g. at driver load time) and allocating a new empty state object.
*/
void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc)
{
Annotation
- Immediate include surface: `drm/drm_atomic.h`, `drm/drm_atomic_state_helper.h`, `drm/drm_blend.h`, `drm/drm_bridge.h`, `drm/drm_connector.h`, `drm/drm_crtc.h`, `drm/drm_device.h`, `drm/drm_framebuffer.h`.
- Detected declarations: `function Copyright`, `function __drm_atomic_helper_crtc_reset`, `function drm_atomic_helper_crtc_reset`, `function __drm_atomic_helper_crtc_duplicate_state`, `function drm_atomic_helper_crtc_duplicate_state`, `function __drm_atomic_helper_crtc_destroy_state`, `function drm_atomic_helper_crtc_destroy_state`, `function __drm_atomic_helper_plane_state_reset`, `function __drm_atomic_helper_plane_reset`, `function drm_atomic_helper_plane_reset`.
- 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.