drivers/gpu/drm/i915/i915_vma_resource.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/i915_vma_resource.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/i915/i915_vma_resource.h
Extension
.h
Size
8379 bytes
Lines
262
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct i915_page_sizes {
	/**
	 * The sg mask of the pages sg_table. i.e the mask of
	 * the lengths for each sg entry.
	 */
	unsigned int phys;

	/**
	 * The gtt page sizes we are allowed to use given the
	 * sg mask and the supported page sizes. This will
	 * express the smallest unit we can use for the whole
	 * object, as well as the larger sizes we may be able
	 * to use opportunistically.
	 */
	unsigned int sg;
};

/**
 * struct i915_vma_bindinfo - Information needed for async bind
 * only but that can be dropped after the bind has taken place.
 * Consider making this a separate argument to the bind_vma
 * op, coalescing with other arguments like vm, stash, cache_level
 * and flags
 * @pages: The pages sg-table.
 * @page_sizes: Page sizes of the pages.
 * @pages_rsgt: Refcounted sg-table when delayed object destruction
 * is supported. May be NULL.
 * @readonly: Whether the vma should be bound read-only.
 * @lmem: Whether the vma points to lmem.
 */
struct i915_vma_bindinfo {
	struct sg_table *pages;
	struct i915_page_sizes page_sizes;
	struct i915_refct_sgt *pages_rsgt;
	bool readonly:1;
	bool lmem:1;
};

/**
 * struct i915_vma_resource - Snapshotted unbind information.
 * @unbind_fence: Fence to mark unbinding complete. Note that this fence
 * is not considered published until unbind is scheduled, and as such it
 * is illegal to access this fence before scheduled unbind other than
 * for refcounting.
 * @lock: The @unbind_fence lock.
 * @hold_count: Number of holders blocking the fence from finishing.
 * The vma itself is keeping a hold, which is released when unbind
 * is scheduled.
 * @work: Work struct for deferred unbind work.
 * @chain: Pointer to struct i915_sw_fence used to await dependencies.
 * @rb: Rb node for the vm's pending unbind interval tree.
 * @__subtree_last: Interval tree private member.
 * @wakeref: wakeref.
 * @vm: non-refcounted pointer to the vm. This is for internal use only and
 * this member is cleared after vm_resource unbind.
 * @mr: The memory region of the object pointed to by the vma.
 * @ops: Pointer to the backend i915_vma_ops.
 * @private: Bind backend private info.
 * @start: Offset into the address space of bind range start. Note that
 * this is after any padding that might have been allocated.
 * @node_size: Size of the allocated range manager node with padding
 * subtracted.
 * @vma_size: Bind size.
 * @guard: The size of guard area preceding and trailing the bind.
 * @page_sizes_gtt: Resulting page sizes from the bind operation.
 * @bound_flags: Flags indicating binding status.
 * @allocated: Backend private data. TODO: Should move into @private.
 * @immediate_unbind: Unbind can be done immediately and doesn't need to be
 * deferred to a work item awaiting unsignaled fences. This is a hack.
 * (dma_fence_work uses a fence flag for this, but this seems slightly
 * cleaner).
 * @needs_wakeref: Whether a wakeref is needed during unbind. Since we can't
 * take a wakeref in the dma-fence signalling critical path, it needs to be
 * taken when the unbind is scheduled.
 * @skip_pte_rewrite: During ggtt suspend and vm takedown pte rewriting
 * needs to be skipped for unbind.
 * @tlb: pointer for obj->mm.tlb, if async unbind. Otherwise, NULL
 *
 * The lifetime of a struct i915_vma_resource is from a binding request to
 * the actual possible asynchronous unbind has completed.
 */
struct i915_vma_resource {
	struct dma_fence unbind_fence;
	/* See above for description of the lock. */
	spinlock_t lock;
	refcount_t hold_count;
	struct work_struct work;
	struct i915_sw_fence chain;
	struct rb_node rb;
	u64 __subtree_last;

Annotation

Implementation Notes