drivers/gpu/drm/i915/i915_sw_fence.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/i915_sw_fence.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/i915_sw_fence.h- Extension
.h- Size
- 3142 bytes
- Lines
- 124
- 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/gfp.hlinux/kref.hlinux/notifier.hlinux/wait.h
Detected Declarations
struct completionstruct dma_resvstruct i915_sw_fencestruct i915_sw_fencestruct i915_sw_dma_fence_cbenum i915_sw_fence_notifyfunction i915_sw_fence_finifunction i915_sw_fence_signaledfunction i915_sw_fence_donefunction i915_sw_fence_waitfunction i915_sw_fence_set_error_once
Annotated Snippet
struct i915_sw_fence {
wait_queue_head_t wait;
i915_sw_fence_notify_t fn;
#ifdef CONFIG_DRM_I915_SW_FENCE_CHECK_DAG
unsigned long flags;
#endif
atomic_t pending;
int error;
};
#define I915_SW_FENCE_CHECKED_BIT 0 /* used internally for DAG checking */
void __i915_sw_fence_init(struct i915_sw_fence *fence,
i915_sw_fence_notify_t fn,
const char *name,
struct lock_class_key *key);
#ifdef CONFIG_LOCKDEP
#define i915_sw_fence_init(fence, fn) \
do { \
static struct lock_class_key __key; \
\
BUILD_BUG_ON((fn) == NULL); \
__i915_sw_fence_init((fence), (fn), #fence, &__key); \
} while (0)
#else
#define i915_sw_fence_init(fence, fn) \
do { \
BUILD_BUG_ON((fn) == NULL); \
__i915_sw_fence_init((fence), (fn), NULL, NULL); \
} while (0)
#endif
void i915_sw_fence_reinit(struct i915_sw_fence *fence);
#ifdef CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS
void i915_sw_fence_fini(struct i915_sw_fence *fence);
#else
static inline void i915_sw_fence_fini(struct i915_sw_fence *fence) {}
#endif
void i915_sw_fence_commit(struct i915_sw_fence *fence);
int i915_sw_fence_await_sw_fence(struct i915_sw_fence *fence,
struct i915_sw_fence *after,
wait_queue_entry_t *wq);
int i915_sw_fence_await_sw_fence_gfp(struct i915_sw_fence *fence,
struct i915_sw_fence *after,
gfp_t gfp);
struct i915_sw_dma_fence_cb {
struct dma_fence_cb base;
struct i915_sw_fence *fence;
};
int __i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
struct dma_fence *dma,
struct i915_sw_dma_fence_cb *cb);
int i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
struct dma_fence *dma,
unsigned long timeout,
gfp_t gfp);
int i915_sw_fence_await_reservation(struct i915_sw_fence *fence,
struct dma_resv *resv,
bool write,
unsigned long timeout,
gfp_t gfp);
bool i915_sw_fence_await(struct i915_sw_fence *fence);
void i915_sw_fence_complete(struct i915_sw_fence *fence);
static inline bool i915_sw_fence_signaled(const struct i915_sw_fence *fence)
{
return atomic_read(&fence->pending) <= 0;
}
static inline bool i915_sw_fence_done(const struct i915_sw_fence *fence)
{
return atomic_read(&fence->pending) < 0;
}
static inline void i915_sw_fence_wait(struct i915_sw_fence *fence)
{
wait_event(fence->wait, i915_sw_fence_done(fence));
}
static inline void
i915_sw_fence_set_error_once(struct i915_sw_fence *fence, int error)
{
if (unlikely(error))
Annotation
- Immediate include surface: `linux/dma-fence.h`, `linux/gfp.h`, `linux/kref.h`, `linux/notifier.h`, `linux/wait.h`.
- Detected declarations: `struct completion`, `struct dma_resv`, `struct i915_sw_fence`, `struct i915_sw_fence`, `struct i915_sw_dma_fence_cb`, `enum i915_sw_fence_notify`, `function i915_sw_fence_fini`, `function i915_sw_fence_signaled`, `function i915_sw_fence_done`, `function i915_sw_fence_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.