drivers/gpu/drm/i915/i915_active.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/i915_active.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/i915_active.c- Extension
.c- Size
- 30456 bytes
- Lines
- 1193
- 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/debugobjects.hgt/intel_context.hgt/intel_engine_heartbeat.hgt/intel_engine_pm.hgt/intel_ring.hi915_drv.hi915_active.hselftests/i915_active.c
Detected Declarations
struct active_nodestruct wait_barrierstruct auto_activefunction node_from_activefunction is_barrierfunction __barrier_to_enginefunction barrier_to_enginefunction debug_active_initfunction debug_active_activatefunction debug_active_deactivatefunction debug_active_finifunction debug_active_assertfunction debug_active_initfunction active_workfunction active_retirefunction __active_fence_slotfunction active_fence_cbfunction node_retirefunction excl_retirefunction active_instancefunction __i915_active_initfunction ____active_del_barrierfunction __active_del_barrierfunction __active_del_barrierfunction replace_barrierfunction i915_active_add_requestfunction __i915_active_set_fencefunction i915_active_set_exclusivefunction i915_active_acquire_if_busyfunction __i915_active_activatefunction i915_active_acquirefunction i915_active_releasefunction enable_signalingfunction flush_barrierfunction flush_lazy_signalsfunction __i915_active_waitfunction __await_activefunction barrier_wakefunction __await_barrierfunction await_activefunction rbtree_postorder_for_each_entry_safefunction rq_await_fencefunction i915_request_await_activefunction sw_await_fencefunction i915_sw_fence_await_activefunction i915_active_finifunction is_idle_barrierfunction alive
Annotated Snippet
struct active_node {
struct rb_node node;
struct i915_active_fence base;
struct i915_active *ref;
u64 timeline;
};
#define fetch_node(x) rb_entry(READ_ONCE(x), typeof(struct active_node), node)
static inline struct active_node *
node_from_active(struct i915_active_fence *active)
{
return container_of(active, struct active_node, base);
}
#define take_preallocated_barriers(x) llist_del_all(&(x)->preallocated_barriers)
static inline bool is_barrier(const struct i915_active_fence *active)
{
return IS_ERR(rcu_access_pointer(active->fence));
}
static inline struct llist_node *barrier_to_ll(struct active_node *node)
{
GEM_BUG_ON(!is_barrier(&node->base));
return (struct llist_node *)&node->base.cb.node;
}
static inline struct intel_engine_cs *
__barrier_to_engine(struct active_node *node)
{
return (struct intel_engine_cs *)READ_ONCE(node->base.cb.node.prev);
}
static inline struct intel_engine_cs *
barrier_to_engine(struct active_node *node)
{
GEM_BUG_ON(!is_barrier(&node->base));
return __barrier_to_engine(node);
}
static inline struct active_node *barrier_from_ll(struct llist_node *x)
{
return container_of((struct list_head *)x,
struct active_node, base.cb.node);
}
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM) && IS_ENABLED(CONFIG_DEBUG_OBJECTS)
static void *active_debug_hint(void *addr)
{
struct i915_active *ref = addr;
return (void *)ref->active ?: (void *)ref->retire ?: (void *)ref;
}
static const struct debug_obj_descr active_debug_desc = {
.name = "i915_active",
.debug_hint = active_debug_hint,
};
static void debug_active_init(struct i915_active *ref)
{
debug_object_init(ref, &active_debug_desc);
}
static void debug_active_activate(struct i915_active *ref)
{
lockdep_assert_held(&ref->tree_lock);
debug_object_activate(ref, &active_debug_desc);
}
static void debug_active_deactivate(struct i915_active *ref)
{
lockdep_assert_held(&ref->tree_lock);
if (!atomic_read(&ref->count)) /* after the last dec */
debug_object_deactivate(ref, &active_debug_desc);
}
static void debug_active_fini(struct i915_active *ref)
{
debug_object_free(ref, &active_debug_desc);
}
static void debug_active_assert(struct i915_active *ref)
{
debug_object_assert_init(ref, &active_debug_desc);
}
#else
Annotation
- Immediate include surface: `linux/debugobjects.h`, `gt/intel_context.h`, `gt/intel_engine_heartbeat.h`, `gt/intel_engine_pm.h`, `gt/intel_ring.h`, `i915_drv.h`, `i915_active.h`, `selftests/i915_active.c`.
- Detected declarations: `struct active_node`, `struct wait_barrier`, `struct auto_active`, `function node_from_active`, `function is_barrier`, `function __barrier_to_engine`, `function barrier_to_engine`, `function debug_active_init`, `function debug_active_activate`, `function debug_active_deactivate`.
- 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.