drivers/gpu/drm/vc4/vc4_kms.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vc4/vc4_kms.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vc4/vc4_kms.c- Extension
.c- Size
- 32547 bytes
- Lines
- 1195
- 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/clk.hlinux/sort.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_crtc.hdrm/drm_fourcc.hdrm/drm_gem_framebuffer_helper.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_vblank.hvc4_drv.hvc4_regs.h
Detected Declarations
struct vc4_ctm_statestruct vc4_load_tracker_statefunction vc4_ctm_duplicate_statefunction vc4_ctm_destroy_statefunction vc4_ctm_create_statefunction vc4_ctm_obj_finifunction vc4_ctm_obj_initfunction vc4_ctm_s31_32_to_s0_9function vc4_ctm_commitfunction vc4_hvs_get_new_global_statefunction vc4_hvs_get_old_global_statefunction vc4_hvs_get_global_statefunction vc4_hvs_pv_muxing_commitfunction for_each_new_crtc_in_statefunction vc5_hvs_pv_muxing_commitfunction for_each_new_crtc_in_statefunction vc6_hvs_pv_muxing_commitfunction for_each_new_crtc_in_statefunction vc4_atomic_commit_tailfunction for_each_new_crtc_in_statefunction vc4_atomic_commit_setupfunction for_each_new_crtc_in_statefunction vc4_set_tiling_ioctlfunction vc4_ctm_atomic_checkfunction for_each_oldnew_crtc_in_statefunction for_each_oldnew_crtc_in_statefunction vc4_load_tracker_atomic_checkfunction vc4_load_tracker_duplicate_statefunction vc4_load_tracker_destroy_statefunction vc4_load_tracker_create_statefunction vc4_load_tracker_obj_finifunction vc4_load_tracker_obj_initfunction vc4_hvs_channels_duplicate_statefunction vc4_hvs_channels_destroy_statefunction vc4_hvs_channels_print_statefunction vc4_hvs_channels_create_statefunction vc4_hvs_channels_obj_finifunction vc4_hvs_channels_obj_initfunction cmp_vc4_crtc_hvs_outputfunction TXPfunction vc4_core_clock_atomic_checkfunction for_each_oldnew_crtc_in_statefunction vc4_atomic_checkfunction vc4_kms_load
Annotated Snippet
struct vc4_ctm_state {
struct drm_private_state base;
struct drm_color_ctm *ctm;
int fifo;
};
#define to_vc4_ctm_state(_state) \
container_of_const(_state, struct vc4_ctm_state, base)
struct vc4_load_tracker_state {
struct drm_private_state base;
u64 hvs_load;
u64 membus_load;
};
#define to_vc4_load_tracker_state(_state) \
container_of_const(_state, struct vc4_load_tracker_state, base)
static struct vc4_ctm_state *vc4_get_ctm_state(struct drm_atomic_commit *state,
struct drm_private_obj *manager)
{
struct drm_device *dev = state->dev;
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct drm_private_state *priv_state;
int ret;
ret = drm_modeset_lock(&vc4->ctm_state_lock, state->acquire_ctx);
if (ret)
return ERR_PTR(ret);
priv_state = drm_atomic_get_private_obj_state(state, manager);
if (IS_ERR(priv_state))
return ERR_CAST(priv_state);
return to_vc4_ctm_state(priv_state);
}
static struct drm_private_state *
vc4_ctm_duplicate_state(struct drm_private_obj *obj)
{
struct vc4_ctm_state *state;
state = kmemdup(obj->state, sizeof(*state), GFP_KERNEL);
if (!state)
return NULL;
__drm_atomic_helper_private_obj_duplicate_state(obj, &state->base);
return &state->base;
}
static void vc4_ctm_destroy_state(struct drm_private_obj *obj,
struct drm_private_state *state)
{
struct vc4_ctm_state *ctm_state = to_vc4_ctm_state(state);
kfree(ctm_state);
}
static struct drm_private_state *
vc4_ctm_create_state(struct drm_private_obj *obj)
{
struct vc4_ctm_state *ctm_state;
ctm_state = kzalloc_obj(*ctm_state);
if (!ctm_state)
return ERR_PTR(-ENOMEM);
__drm_atomic_helper_private_obj_create_state(obj, &ctm_state->base);
return &ctm_state->base;
}
static const struct drm_private_state_funcs vc4_ctm_state_funcs = {
.atomic_create_state = vc4_ctm_create_state,
.atomic_duplicate_state = vc4_ctm_duplicate_state,
.atomic_destroy_state = vc4_ctm_destroy_state,
};
static void vc4_ctm_obj_fini(struct drm_device *dev, void *unused)
{
struct vc4_dev *vc4 = to_vc4_dev(dev);
drm_atomic_private_obj_fini(&vc4->ctm_manager);
}
static int vc4_ctm_obj_init(struct vc4_dev *vc4)
{
drm_modeset_lock_init(&vc4->ctm_state_lock);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/sort.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_crtc.h`, `drm/drm_fourcc.h`, `drm/drm_gem_framebuffer_helper.h`, `drm/drm_print.h`.
- Detected declarations: `struct vc4_ctm_state`, `struct vc4_load_tracker_state`, `function vc4_ctm_duplicate_state`, `function vc4_ctm_destroy_state`, `function vc4_ctm_create_state`, `function vc4_ctm_obj_fini`, `function vc4_ctm_obj_init`, `function vc4_ctm_s31_32_to_s0_9`, `function vc4_ctm_commit`, `function vc4_hvs_get_new_global_state`.
- 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.