drivers/gpu/drm/i915/i915_sw_fence_work.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/i915_sw_fence_work.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/i915_sw_fence_work.h- Extension
.h- Size
- 1716 bytes
- Lines
- 68
- 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
linux/dma-fence.hlinux/spinlock.hlinux/workqueue.hi915_sw_fence.h
Detected Declarations
struct dma_fence_workstruct dma_fence_work_opsstruct dma_fence_workfunction dma_fence_work_commitfunction callback
Annotated Snippet
struct dma_fence_work_ops {
const char *name;
void (*work)(struct dma_fence_work *f);
void (*release)(struct dma_fence_work *f);
};
struct dma_fence_work {
struct dma_fence dma;
spinlock_t lock;
struct i915_sw_fence chain;
struct i915_sw_dma_fence_cb cb;
struct work_struct work;
const struct dma_fence_work_ops *ops;
};
enum {
DMA_FENCE_WORK_IMM = DMA_FENCE_FLAG_USER_BITS,
};
void dma_fence_work_init(struct dma_fence_work *f,
const struct dma_fence_work_ops *ops);
int dma_fence_work_chain(struct dma_fence_work *f, struct dma_fence *signal);
static inline void dma_fence_work_commit(struct dma_fence_work *f)
{
i915_sw_fence_commit(&f->chain);
}
/**
* dma_fence_work_commit_imm: Commit the fence, and if possible execute locally.
* @f: the fenced worker
*
* Instead of always scheduling a worker to execute the callback (see
* dma_fence_work_commit()), we try to execute the callback immediately in
* the local context. It is required that the fence be committed before it
* is published, and that no other threads try to tamper with the number
* of asynchronous waits on the fence (or else the callback will be
* executed in the wrong context, i.e. not the callers).
*/
static inline void dma_fence_work_commit_imm(struct dma_fence_work *f)
{
if (atomic_read(&f->chain.pending) <= 1)
__set_bit(DMA_FENCE_WORK_IMM, &f->dma.flags);
dma_fence_work_commit(f);
}
#endif /* I915_SW_FENCE_WORK_H */
Annotation
- Immediate include surface: `linux/dma-fence.h`, `linux/spinlock.h`, `linux/workqueue.h`, `i915_sw_fence.h`.
- Detected declarations: `struct dma_fence_work`, `struct dma_fence_work_ops`, `struct dma_fence_work`, `function dma_fence_work_commit`, `function callback`.
- 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.