drivers/gpu/drm/i915/gt/intel_timeline.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/intel_timeline.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/gt/intel_timeline.c- Extension
.c- Size
- 12617 bytes
- Lines
- 495
- 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
drm/drm_cache.hdrm/drm_print.hgem/i915_gem_internal.hi915_active.hi915_drv.hi915_syncmap.hintel_gt.hintel_ring.hintel_timeline.hgt/selftests/mock_timeline.cgt/selftest_timeline.c
Detected Declarations
function __timeline_retirefunction __timeline_activefunction intel_timeline_pin_mapfunction intel_timeline_initfunction intel_gt_init_timelinesfunction intel_timeline_finifunction __intel_timeline_createfunction intel_timeline_create_from_enginefunction __intel_timeline_pinfunction intel_timeline_pinfunction intel_timeline_reset_seqnofunction intel_timeline_enterfunction intel_timeline_exitfunction timeline_advancefunction __intel_timeline_get_seqnofunction intel_timeline_get_seqnofunction intel_timeline_read_hwspfunction intel_timeline_unpinfunction __intel_timeline_freefunction intel_gt_fini_timelinesfunction intel_gt_show_timelinesfunction list_for_each_entry_safe
Annotated Snippet
if (!mutex_trylock(&tl->mutex)) {
drm_printf(m, "Timeline %llx: busy; skipping\n",
tl->fence_context);
continue;
}
intel_timeline_get(tl);
GEM_BUG_ON(!atomic_read(&tl->active_count));
atomic_inc(&tl->active_count); /* pin the list element */
spin_unlock(&timelines->lock);
count = 0;
ready = 0;
inflight = 0;
list_for_each_entry_safe(rq, rn, &tl->requests, link) {
if (i915_request_completed(rq))
continue;
count++;
if (i915_request_is_ready(rq))
ready++;
if (i915_request_is_active(rq))
inflight++;
}
drm_printf(m, "Timeline %llx: { ", tl->fence_context);
drm_printf(m, "count: %lu, ready: %lu, inflight: %lu",
count, ready, inflight);
drm_printf(m, ", seqno: { current: %d, last: %d }",
*tl->hwsp_seqno, tl->seqno);
fence = i915_active_fence_get(&tl->last_request);
if (fence) {
drm_printf(m, ", engine: %s",
to_request(fence)->engine->name);
dma_fence_put(fence);
}
drm_printf(m, " }\n");
if (show_request) {
list_for_each_entry_safe(rq, rn, &tl->requests, link)
show_request(m, rq, "", 2);
}
mutex_unlock(&tl->mutex);
spin_lock(&timelines->lock);
/* Resume list iteration after reacquiring spinlock */
list_safe_reset_next(tl, tn, link);
if (atomic_dec_and_test(&tl->active_count))
list_del(&tl->link);
/* Defer the final release to after the spinlock */
if (refcount_dec_and_test(&tl->kref.refcount)) {
GEM_BUG_ON(atomic_read(&tl->active_count));
list_add(&tl->link, &free);
}
}
spin_unlock(&timelines->lock);
list_for_each_entry_safe(tl, tn, &free, link)
__intel_timeline_free(&tl->kref);
}
#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
#include "gt/selftests/mock_timeline.c"
#include "gt/selftest_timeline.c"
#endif
Annotation
- Immediate include surface: `drm/drm_cache.h`, `drm/drm_print.h`, `gem/i915_gem_internal.h`, `i915_active.h`, `i915_drv.h`, `i915_syncmap.h`, `intel_gt.h`, `intel_ring.h`.
- Detected declarations: `function __timeline_retire`, `function __timeline_active`, `function intel_timeline_pin_map`, `function intel_timeline_init`, `function intel_gt_init_timelines`, `function intel_timeline_fini`, `function __intel_timeline_create`, `function intel_timeline_create_from_engine`, `function __intel_timeline_pin`, `function intel_timeline_pin`.
- 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.