drivers/gpu/drm/i915/selftests/i915_active.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/selftests/i915_active.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/selftests/i915_active.c- Extension
.c- Size
- 7433 bytes
- Lines
- 355
- 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/kref.hlinux/string_helpers.hdrm/drm_print.hgem/i915_gem_pm.hgt/intel_gt.hi915_selftest.higt_flush_test.hlib_sw_fence.h
Detected Declarations
struct live_activefunction __live_getfunction __live_freefunction __live_releasefunction __live_putfunction __live_activefunction __live_retirefunction __live_active_setupfunction for_each_uabi_enginefunction live_active_waitfunction live_active_retirefunction live_active_barrierfunction for_each_uabi_enginefunction i915_active_live_selftestsfunction i915_active_printfunction rbtree_postorder_for_each_entry_safefunction spin_unlock_waitfunction active_flushfunction i915_active_unlock_wait
Annotated Snippet
struct live_active {
struct i915_active base;
struct kref ref;
bool retired;
};
static void __live_get(struct live_active *active)
{
kref_get(&active->ref);
}
static void __live_free(struct live_active *active)
{
i915_active_fini(&active->base);
kfree(active);
}
static void __live_release(struct kref *ref)
{
struct live_active *active = container_of(ref, typeof(*active), ref);
__live_free(active);
}
static void __live_put(struct live_active *active)
{
kref_put(&active->ref, __live_release);
}
static int __live_active(struct i915_active *base)
{
struct live_active *active = container_of(base, typeof(*active), base);
__live_get(active);
return 0;
}
static void __live_retire(struct i915_active *base)
{
struct live_active *active = container_of(base, typeof(*active), base);
active->retired = true;
__live_put(active);
}
static struct live_active *__live_alloc(struct drm_i915_private *i915)
{
struct live_active *active;
active = kzalloc_obj(*active);
if (!active)
return NULL;
kref_init(&active->ref);
i915_active_init(&active->base, __live_active, __live_retire, 0);
return active;
}
static struct live_active *
__live_active_setup(struct drm_i915_private *i915)
{
struct intel_engine_cs *engine;
struct i915_sw_fence *submit;
struct live_active *active;
unsigned int count = 0;
int err = 0;
active = __live_alloc(i915);
if (!active)
return ERR_PTR(-ENOMEM);
submit = heap_fence_create(GFP_KERNEL);
if (!submit) {
kfree(active);
return ERR_PTR(-ENOMEM);
}
err = i915_active_acquire(&active->base);
if (err)
goto out;
for_each_uabi_engine(engine, i915) {
struct i915_request *rq;
rq = intel_engine_create_kernel_request(engine);
if (IS_ERR(rq)) {
err = PTR_ERR(rq);
break;
}
Annotation
- Immediate include surface: `linux/kref.h`, `linux/string_helpers.h`, `drm/drm_print.h`, `gem/i915_gem_pm.h`, `gt/intel_gt.h`, `i915_selftest.h`, `igt_flush_test.h`, `lib_sw_fence.h`.
- Detected declarations: `struct live_active`, `function __live_get`, `function __live_free`, `function __live_release`, `function __live_put`, `function __live_active`, `function __live_retire`, `function __live_active_setup`, `function for_each_uabi_engine`, `function live_active_wait`.
- 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.