drivers/gpu/drm/i915/i915_sw_fence_work.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/i915_sw_fence_work.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/i915_sw_fence_work.c- Extension
.c- Size
- 2081 bytes
- Lines
- 100
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
i915_sw_fence_work.h
Detected Declarations
function fence_completefunction fence_workfunction fence_notifyfunction fence_releasefunction dma_fence_work_initfunction dma_fence_work_chain
Annotated Snippet
if (!f->dma.error) {
dma_fence_get(&f->dma);
if (test_bit(DMA_FENCE_WORK_IMM, &f->dma.flags))
fence_work(&f->work);
else
queue_work(system_dfl_wq, &f->work);
} else {
fence_complete(f);
}
break;
case FENCE_FREE:
dma_fence_put(&f->dma);
break;
}
return NOTIFY_DONE;
}
static const char *get_driver_name(struct dma_fence *fence)
{
return "dma-fence";
}
static const char *get_timeline_name(struct dma_fence *fence)
{
struct dma_fence_work *f = container_of(fence, typeof(*f), dma);
return f->ops->name ?: "work";
}
static void fence_release(struct dma_fence *fence)
{
struct dma_fence_work *f = container_of(fence, typeof(*f), dma);
i915_sw_fence_fini(&f->chain);
BUILD_BUG_ON(offsetof(typeof(*f), dma));
dma_fence_free(&f->dma);
}
static const struct dma_fence_ops fence_ops = {
.get_driver_name = get_driver_name,
.get_timeline_name = get_timeline_name,
.release = fence_release,
};
void dma_fence_work_init(struct dma_fence_work *f,
const struct dma_fence_work_ops *ops)
{
f->ops = ops;
spin_lock_init(&f->lock);
dma_fence_init(&f->dma, &fence_ops, &f->lock, 0, 0);
i915_sw_fence_init(&f->chain, fence_notify);
INIT_WORK(&f->work, fence_work);
}
int dma_fence_work_chain(struct dma_fence_work *f, struct dma_fence *signal)
{
if (!signal)
return 0;
return __i915_sw_fence_await_dma_fence(&f->chain, signal, &f->cb);
}
Annotation
- Immediate include surface: `i915_sw_fence_work.h`.
- Detected declarations: `function fence_complete`, `function fence_work`, `function fence_notify`, `function fence_release`, `function dma_fence_work_init`, `function dma_fence_work_chain`.
- 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.