drivers/gpu/drm/i915/i915_deps.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/i915_deps.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/i915_deps.c- Extension
.c- Size
- 6640 bytes
- Lines
- 238
- 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.
- 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/dma-fence.hlinux/slab.hdrm/ttm/ttm_bo.hi915_deps.h
Detected Declarations
function i915_deps_initfunction i915_deps_initfunction i915_deps_finifunction i915_deps_growfunction i915_deps_syncfunction i915_deps_add_dependencyfunction i915_deps_add_depencency
Annotated Snippet
if (ctx->no_wait_gpu && !dma_fence_is_signaled(*fences)) {
ret = -EBUSY;
break;
}
ret = dma_fence_wait(*fences, ctx->interruptible);
if (!ret)
ret = (*fences)->error;
if (ret)
break;
}
return ret;
}
/**
* i915_deps_add_dependency - Add a fence to the dependency collection
* @deps: Pointer to the i915_deps structure a fence is to be added to.
* @fence: The fence to add.
* @ctx: Pointer to a struct ttm_operation_ctx indicating how waits are to
* be performed if waiting.
*
* Adds a fence to the dependency collection, and takes a reference on it.
* If the fence context is not zero and there was a later fence from the
* same fence context already added, then the fence is not added to the
* dependency collection. If the fence context is not zero and there was
* an earlier fence already added, then the fence will replace the older
* fence from the same context and the reference on the earlier fence will
* be dropped.
* If there is a failure to allocate memory to accommodate the new fence to
* be added, the new fence will instead be waited for and an error may
* be returned; depending on the value of @ctx, or if there was a fence
* error. If an error was returned, the dependency collection will be
* finalized and all fence reference dropped.
*
* Return: 0 if success. Negative error code on error.
*/
int i915_deps_add_dependency(struct i915_deps *deps,
struct dma_fence *fence,
const struct ttm_operation_ctx *ctx)
{
unsigned int i;
int ret;
if (!fence)
return 0;
if (dma_fence_is_signaled(fence)) {
ret = fence->error;
if (ret)
i915_deps_fini(deps);
return ret;
}
for (i = 0; i < deps->num_deps; ++i) {
struct dma_fence *entry = deps->fences[i];
if (!entry->context || entry->context != fence->context)
continue;
if (dma_fence_is_later(fence, entry)) {
dma_fence_put(entry);
deps->fences[i] = dma_fence_get(fence);
}
return 0;
}
return i915_deps_grow(deps, fence, ctx);
}
/**
* i915_deps_add_resv - Add the fences of a reservation object to a dependency
* collection.
* @deps: Pointer to the i915_deps structure a fence is to be added to.
* @resv: The reservation object, then fences of which to add.
* @ctx: Pointer to a struct ttm_operation_ctx indicating how waits are to
* be performed if waiting.
*
* Calls i915_deps_add_depencency() on the indicated fences of @resv.
*
* Return: Zero on success. Negative error code on error.
*/
int i915_deps_add_resv(struct i915_deps *deps, struct dma_resv *resv,
const struct ttm_operation_ctx *ctx)
{
struct dma_resv_iter iter;
struct dma_fence *fence;
dma_resv_assert_held(resv);
Annotation
- Immediate include surface: `linux/dma-fence.h`, `linux/slab.h`, `drm/ttm/ttm_bo.h`, `i915_deps.h`.
- Detected declarations: `function i915_deps_init`, `function i915_deps_init`, `function i915_deps_fini`, `function i915_deps_grow`, `function i915_deps_sync`, `function i915_deps_add_dependency`, `function i915_deps_add_depencency`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.